Patch Detail
Show a patch.
GET /api/patches/21276/?format=api
{ "id": 21276, "url": "https://patchwork.libcamera.org/api/patches/21276/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21276/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20240915235044.2188179-2-paul.elder@ideasonboard.com>", "date": "2024-09-15T23:50:43", "name": "[v3,1/2] libcamera: controls: Add array information to ControlId", "commit_ref": "ab67fdd210e30ad3806f10cb5f6d4e325059f8de", "pull_url": null, "state": "accepted", "archived": false, "hash": "91b6b15317a7769a11a94c84d2e8dfcd2e9ea534", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21276/mbox/", "series": [ { "id": 4599, "url": "https://patchwork.libcamera.org/api/series/4599/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4599", "date": "2024-09-15T23:50:42", "name": "Add array information to ControlId", "version": 3, "mbox": "https://patchwork.libcamera.org/series/4599/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21276/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21276/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 17FF0C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 15 Sep 2024 23:51:01 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EC5D2634FC;\n\tMon, 16 Sep 2024 01:50:56 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 228B9634F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Sep 2024 01:50:52 +0200 (CEST)", "from pyrite.hamster-moth.ts.net (unknown\n\t[IPv6:2001:4bc9:a45:b0af:31d1:7a87:7f90:977b])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E40CC8BE;\n\tMon, 16 Sep 2024 01:49:30 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"vSnKzd0M\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726444171;\n\tbh=mFug70AfRsEgEcEwFM1apvTEv4TzDlY9G497qsoDxs8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=vSnKzd0MLe1gorIJhZ4Qo59Xt/gt7w+tC/2zGM0/colcO5JIL24oXVnAXvN5aFBI0\n\tLzcAt5okr8F8p/e7epI5N4UEmONCKMZuckzUM0Csp3fW4LsXofm+pMoAMOHrSwv9nM\n\tAWSr1+oWdObAUpKHQLA/sP96OR2y5OmHF83eV6X0=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Paul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tstefan.klug@ideasonboard.com,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>", "Subject": "[PATCH v3 1/2] libcamera: controls: Add array information to\n\tControlId", "Date": "Mon, 16 Sep 2024 01:50:43 +0200", "Message-Id": "<20240915235044.2188179-2-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.39.2", "In-Reply-To": "<20240915235044.2188179-1-paul.elder@ideasonboard.com>", "References": "<20240915235044.2188179-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add to ControlId information on whether or not it is an array control,\nand the size of the control if it is an array control.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nChanges in v3:\n- rebase on v4 of \"libcamera: controls: Add enum information to ControlId\"\n- fix typo and line wrap\n\nChanges in v2:\n- fix documentation\n---\n include/libcamera/controls.h | 17 ++++++++++++++++-\n src/libcamera/controls.cpp | 18 ++++++++++++++++--\n 2 files changed, 32 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 96a774ccd..25f67ed94 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -46,50 +46,60 @@ struct control_type {\n template<>\n struct control_type<void> {\n \tstatic constexpr ControlType value = ControlTypeNone;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<bool> {\n \tstatic constexpr ControlType value = ControlTypeBool;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<uint8_t> {\n \tstatic constexpr ControlType value = ControlTypeByte;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<int32_t> {\n \tstatic constexpr ControlType value = ControlTypeInteger32;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<int64_t> {\n \tstatic constexpr ControlType value = ControlTypeInteger64;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<float> {\n \tstatic constexpr ControlType value = ControlTypeFloat;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<std::string> {\n \tstatic constexpr ControlType value = ControlTypeString;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<Rectangle> {\n \tstatic constexpr ControlType value = ControlTypeRectangle;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<Size> {\n \tstatic constexpr ControlType value = ControlTypeSize;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<typename T, std::size_t N>\n struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {\n+\tstatic constexpr std::size_t size = N;\n };\n \n } /* namespace details */\n@@ -215,11 +225,14 @@ class ControlId\n {\n public:\n \tControlId(unsigned int id, const std::string &name, ControlType type,\n+\t\t std::size_t size = 0,\n \t\t const std::map<std::string, int32_t> &enumStrMap = {});\n \n \tunsigned int id() const { return id_; }\n \tconst std::string &name() const { return name_; }\n \tControlType type() const { return type_; }\n+\tbool isArray() const { return size_ > 0; }\n+\tstd::size_t size() const { return size_; }\n \tconst std::map<int32_t, std::string> &enumerators() const { return reverseMap_; }\n \n private:\n@@ -228,6 +241,7 @@ private:\n \tunsigned int id_;\n \tstd::string name_;\n \tControlType type_;\n+\tstd::size_t size_;\n \tstd::map<std::string, int32_t> enumStrMap_;\n \tstd::map<int32_t, std::string> reverseMap_;\n };\n@@ -259,7 +273,8 @@ public:\n \tusing type = T;\n \n \tControl(unsigned int id, const char *name, const std::map<std::string, int32_t> &enumStrMap = {})\n-\t\t: ControlId(id, name, details::control_type<std::remove_cv_t<T>>::value, enumStrMap)\n+\t\t: ControlId(id, name, details::control_type<std::remove_cv_t<T>>::value,\n+\t\t\t details::control_type<std::remove_cv_t<T>>::size, enumStrMap)\n \t{\n \t}\n \ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex a46c431a1..ea4397302 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -389,11 +389,12 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen\n * \\param[in] id The control numerical ID\n * \\param[in] name The control name\n * \\param[in] type The control data type\n+ * \\param[in] size The size of the array control, or 0 if scalar control\n * \\param[in] enumStrMap The map from enum names to values (optional)\n */\n ControlId::ControlId(unsigned int id, const std::string &name, ControlType type,\n-\t\t const std::map<std::string, int32_t> &enumStrMap)\n-\t: id_(id), name_(name), type_(type), enumStrMap_(enumStrMap)\n+\t\t std::size_t size, const std::map<std::string, int32_t> &enumStrMap)\n+\t: id_(id), name_(name), type_(type), size_(size), enumStrMap_(enumStrMap)\n {\n \tfor (const auto &pair : enumStrMap_)\n \t\treverseMap_[pair.second] = pair.first;\n@@ -417,6 +418,19 @@ ControlId::ControlId(unsigned int id, const std::string &name, ControlType type,\n * \\return The control data type\n */\n \n+/**\n+ * \\fn bool ControlId::isArray() const\n+ * \\brief Determine if the control is an array control\n+ * \\return True if the control is an array control, false otherwise\n+ */\n+\n+/**\n+ * \\fn std::size_t ControlId::size() const\n+ * \\brief Retrieve the size of the control if it is an array control\n+ * \\return The size of the array control, size_t::max for dynamic extent, or 0\n+ * for non-array\n+ */\n+\n /**\n * \\fn const std::map<int32_t, std::string> &ControlId::enumerators() const\n * \\brief Retrieve the map of enum values to enum names\n", "prefixes": [ "v3", "1/2" ] }