Patch Detail
Show a patch.
GET /api/patches/19788/?format=api
{ "id": 19788, "url": "https://patchwork.libcamera.org/api/patches/19788/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19788/", "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": "<20240322131451.3092931-3-dan.scally@ideasonboard.com>", "date": "2024-03-22T13:14:43", "name": "[02/10] libcamera: controls: Generate enum value-name maps", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "04644feb8e654ac00c9ae0195fd602b85dad46c3", "submitter": { "id": 156, "url": "https://patchwork.libcamera.org/api/people/156/?format=api", "name": "Dan Scally", "email": "dan.scally@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19788/mbox/", "series": [ { "id": 4236, "url": "https://patchwork.libcamera.org/api/series/4236/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4236", "date": "2024-03-22T13:14:41", "name": "Centralise Agc into libipa", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4236/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19788/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19788/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 F3B28C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Mar 2024 13:15:16 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6FB9863075;\n\tFri, 22 Mar 2024 14:15:12 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1641263036\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Mar 2024 14:15:08 +0100 (CET)", "from mail.ideasonboard.com\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C390842;\n\tFri, 22 Mar 2024 14:14:39 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"cha/aXzh\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1711113279;\n\tbh=8NYpgW+u2h4uyxVkXYwlsAwOIZHi6oT2EGsDgM4I6lw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cha/aXzh3jxaY43Uc0Nmx1V4mgtneG/EC+0VfbalcL6/OOoSgZo3aeUX5mfKg4etM\n\tsTxmZtj+jlip6fPxS/sdjkCuaFlzvx8Z/Tat6nruSPTuk4tcfVnJct5HRNPPFm55oX\n\tkiiR42HtHaeRn8WWoQev3P9fEBSzcwUky+VYnO54=", "From": "Daniel Scally <dan.scally@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Daniel Scally <dan.scally@ideasonboard.com>", "Subject": "[PATCH 02/10] libcamera: controls: Generate enum value-name maps", "Date": "Fri, 22 Mar 2024 13:14:43 +0000", "Message-Id": "<20240322131451.3092931-3-dan.scally@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20240322131451.3092931-1-dan.scally@ideasonboard.com>", "References": "<20240322131451.3092931-1-dan.scally@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": "Generate maps associating control enumerated control values with a\nstring representing that value to provide a central reference for\nthem across all pipeline handlers.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\n include/libcamera/control_ids.h.in | 2 ++\n include/libcamera/property_ids.h.in | 2 ++\n utils/gen-controls.py | 19 +++++++++++++++++++\n 3 files changed, 23 insertions(+)", "diff": "diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in\nindex d53b1cf7..58dd48e1 100644\n--- a/include/libcamera/control_ids.h.in\n+++ b/include/libcamera/control_ids.h.in\n@@ -10,7 +10,9 @@\n #pragma once\n \n #include <array>\n+#include <map>\n #include <stdint.h>\n+#include <string>\n \n #include <libcamera/controls.h>\n \ndiff --git a/include/libcamera/property_ids.h.in b/include/libcamera/property_ids.h.in\nindex 43372c71..f51ba028 100644\n--- a/include/libcamera/property_ids.h.in\n+++ b/include/libcamera/property_ids.h.in\n@@ -9,7 +9,9 @@\n \n #pragma once\n \n+#include <map>\n #include <stdint.h>\n+#include <string>\n \n #include <libcamera/controls.h>\n \ndiff --git a/utils/gen-controls.py b/utils/gen-controls.py\nindex 6cd5e362..4fe1e705 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -140,6 +140,12 @@ ${description}\n */''')\n enum_values_start = string.Template('''extern const std::array<const ControlValue, ${size}> ${name}Values = {''')\n enum_values_values = string.Template('''\\tstatic_cast<int32_t>(${name}),''')\n+ name_value_map_doc = string.Template('''/**\n+ * \\\\var ${name}NameValueMap\n+ * \\\\brief Map of all $name supported value names (in std::string format) to value\n+ */''')\n+ name_value_map_start = string.Template('''extern const std::map<std::string, ${type}> ${name}NameValueMap = {''')\n+ name_value_values = string.Template('''\\t{ \"${name}\", ${name} },''')\n \n ctrls_doc = {}\n ctrls_def = {}\n@@ -183,6 +189,7 @@ ${description}\n \n values_info = {\n 'name': info['name'],\n+ 'type': ctrl.type,\n 'size': num_entries,\n }\n target_doc.append(enum_values_doc.substitute(values_info))\n@@ -194,6 +201,15 @@ ${description}\n target_def.append(enum_values_values.substitute(value_info))\n target_def.append(\"};\")\n \n+ target_doc.append(name_value_map_doc.substitute(values_info))\n+ target_def.append(name_value_map_start.substitute(values_info))\n+ for enum in ctrl.enum_values:\n+ value_info = {\n+ 'name': enum.name\n+ }\n+ target_def.append(name_value_values.substitute(value_info))\n+ target_def.append(\"};\")\n+\n target_doc.append(doc_template.substitute(info))\n target_def.append(def_template.substitute(info))\n \n@@ -231,6 +247,7 @@ def generate_h(controls, mode, ranges):\n enum_template_start = string.Template('''enum ${name}Enum {''')\n enum_value_template = string.Template('''\\t${name} = ${value},''')\n enum_values_template = string.Template('''extern const std::array<const ControlValue, ${size}> ${name}Values;''')\n+ name_value_map_template = string.Template('''extern const std::map<std::string, ${type}> ${name}NameValueMap;''')\n template = string.Template('''extern const Control<${type}> ${name};''')\n \n ctrls = {}\n@@ -273,9 +290,11 @@ def generate_h(controls, mode, ranges):\n \n values_info = {\n 'name': info['name'],\n+ 'type': ctrl.type,\n 'size': num_entries,\n }\n target_ctrls.append(enum_values_template.substitute(values_info))\n+ target_ctrls.append(name_value_map_template.substitute(values_info))\n \n target_ctrls.append(template.substitute(info))\n id_value[vendor] += 1\n", "prefixes": [ "02/10" ] }