Patch Detail
Show a patch.
GET /api/1.1/patches/17063/?format=api
{ "id": 17063, "url": "https://patchwork.libcamera.org/api/1.1/patches/17063/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17063/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220810002906.5406-3-laurent.pinchart@ideasonboard.com>", "date": "2022-08-10T00:29:04", "name": "[libcamera-devel,2/4] utils: gen-controls: Improve YAML notation for variable-size array controls", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b452c92d803dd4c61ee8634b23d706772c46d72d", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17063/mbox/", "series": [ { "id": 3401, "url": "https://patchwork.libcamera.org/api/1.1/series/3401/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3401", "date": "2022-08-10T00:29:02", "name": "libcamera: Improve handling of fixed-size array controls", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3401/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17063/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17063/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4CF5BC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Aug 2022 00:29:24 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BAB3F63330;\n\tWed, 10 Aug 2022 02:29:23 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A33663326\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Aug 2022 02:29:21 +0200 (CEST)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 05A96481;\n\tWed, 10 Aug 2022 02:29:20 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660091363;\n\tbh=3+LLHIx7JHt4B2nWjKpg7cgeXKrzk1gsHhHaKandpAM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=Q5+REoEV0F7Vh/Zl09qrdzlqidllvQRmfEXpsrVohsPk6LKZA0J5l1fh9OxghDfFd\n\tnMT3IhEsJXwuH7ww9JSzlQyISyWmDPJdW+N0Uj8eClX8q95K7JM/JKbHL+AHtWT51S\n\tCopkamxdJkf8IzGU9Rt8O3V+LQCELspz6jwRdToMSlie/YKNe7Vh97x5evTt2hCGxm\n\tw1VSuiy1CpB+M4sigYGije1KdrLP486kXGjNi81o3DAWub609Q9qrbrtNsBxmJRItH\n\tpQTpfVi702jrPQ/a4Gop4VTRVwTO43YRIpn+BDvSAtiRbRNV2cW9kbDSruhq31hQdE\n\tKqxisyWY1P9sA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660091361;\n\tbh=3+LLHIx7JHt4B2nWjKpg7cgeXKrzk1gsHhHaKandpAM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZHdr27RaK19sH7k3MM/admh5s/HzwN1Ng7w6uv4Vel9IjrWxJ8jVGuBN6XP9brziQ\n\tCLfCkw0dA/tjtt9avfUnIB0N53RkfDmPeE0ql3d0ub9qGv8ONzZ/FzrfrrNv6bY7cN\n\tcpvej5yIk6I/Wo0fkUX6sR0ArtZVq3+lX7fMtsSc=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZHdr27Ra\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 10 Aug 2022 03:29:04 +0300", "Message-Id": "<20220810002906.5406-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220810002906.5406-1-laurent.pinchart@ideasonboard.com>", "References": "<20220810002906.5406-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/4] utils: gen-controls: Improve YAML\n\tnotation for variable-size array controls", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Array controls specify the array size through the YAML 'size' element,\nwhich stores a list of values, one per dimension. Variable-size arrays\ncurrently use an empty 'size' list, which prevents describing the number\nof dimensions of the array.\n\nImprove this by using the same notation for fixed-size and variable-size\narray controls. Dimensions that are not fixed are described as a string\ninstead of an integer, such as [n], [n,3] or [w,h]. The strings have\ncurrently no special meaning, this may change in the future.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/control_ids.yaml | 2 +-\n src/libcamera/property_ids.yaml | 4 ++--\n utils/gen-controls.py | 31 +++++++++++++++++++++++++------\n 3 files changed, 28 insertions(+), 9 deletions(-)", "diff": "diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex c93f362463dd..a456e6c0358f 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -525,7 +525,7 @@ controls:\n the window where the focal distance for the objects shown in that part\n of the image are closest to the camera.\n \n- size: []\n+ size: [n]\n \n - AfTrigger:\n type: int32_t\ndiff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\nindex 960e254495b7..cb55e0ed2283 100644\n--- a/src/libcamera/property_ids.yaml\n+++ b/src/libcamera/property_ids.yaml\n@@ -497,7 +497,7 @@ controls:\n \n - PixelArrayOpticalBlackRectangles:\n type: Rectangle\n- size: []\n+ size: [n]\n description: |\n The pixel array region(s) which contain optical black pixels\n considered valid for calibration purposes.\n@@ -592,7 +592,7 @@ controls:\n \n - PixelArrayActiveAreas:\n type: Rectangle\n- size: []\n+ size: [n]\n description: |\n The PixelArrayActiveAreas property defines the (possibly multiple and\n overlapping) portions of the camera sensor readable pixel matrix\ndiff --git a/utils/gen-controls.py b/utils/gen-controls.py\nindex f6a3ae39cc84..bcfbeb7f9f17 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -39,11 +39,33 @@ class Control(object):\n self.__name = name\n self.__data = data\n self.__enum = None\n+ self.__size = None\n \n enum_values = data.get('enum')\n if enum_values is not None:\n self.__enum_values = [ControlEnum(enum) for enum in enum_values]\n \n+ size = self.__data.get('size')\n+ if size is not None:\n+ if len(size) == 0:\n+ raise RuntimeError(f'Control `{self.__name}` size must have at least one dimension')\n+\n+ # Compute the total number of elemens in the array. If any of the\n+ # array dimension is a string, the array is variable-sized.\n+ num_elems = 1\n+ for dim in size:\n+ if type(dim) is str:\n+ num_elems = 0\n+ break\n+\n+ dim = int(dim)\n+ if dim <= 0:\n+ raise RuntimeError(f'Control `{self.__name}` size must have positive values only')\n+\n+ num_elems *= dim\n+\n+ self.__size = num_elems\n+\n @property\n def description(self):\n \"\"\"The control description\"\"\"\n@@ -86,15 +108,12 @@ class Control(object):\n if typ == 'string':\n return 'std::string'\n \n- if size is None:\n+ if self.__size is None:\n return typ\n \n- if len(size) > 0:\n- # fixed-sized Span\n- span_size = reduce(operator.mul, size)\n- return f\"Span<const {typ}, {span_size}>\"\n+ if self.__size:\n+ return f\"Span<const {typ}, {self.__size}>\"\n else:\n- # variable-sized Span\n return f\"Span<const {typ}>\"\n \n \n", "prefixes": [ "libcamera-devel", "2/4" ] }