{"id":15345,"url":"https://patchwork.libcamera.org/api/1.1/patches/15345/?format=json","web_url":"https://patchwork.libcamera.org/patch/15345/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220209071917.559993-2-hanlinchen@chromium.org>","date":"2022-02-09T07:19:09","name":"[libcamera-devel,1/9] libcamera: Introduce option to customize behavior for a camera module","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b5d0fdd422f98f0926877e060718e19f0810cf88","submitter":{"id":98,"url":"https://patchwork.libcamera.org/api/1.1/people/98/?format=json","name":"Hanlin Chen","email":"hanlinchen@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15345/mbox/","series":[{"id":2923,"url":"https://patchwork.libcamera.org/api/1.1/series/2923/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2923","date":"2022-02-09T07:19:08","name":"Introduce Pipeline configuration preference for IPU3","version":1,"mbox":"https://patchwork.libcamera.org/series/2923/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15345/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15345/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 0A6FDC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Feb 2022 07:19:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CA611610EA;\n\tWed,  9 Feb 2022 08:19:30 +0100 (CET)","from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com\n\t[IPv6:2607:f8b0:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1406860E66\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Feb 2022 08:19:28 +0100 (CET)","by mail-pl1-x62a.google.com with SMTP id 10so1489625plj.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Feb 2022 23:19:28 -0800 (PST)","from localhost ([2401:fa00:1:10:a5cf:9a43:1c6d:824])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\ta5sm1900138pfh.101.2022.02.08.23.19.25\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tTue, 08 Feb 2022 23:19:26 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"OrBOP5Sq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=WAjeWglpTXXvm2qM30sZOk2hyFk1CLMYUo2yD83YX/c=;\n\tb=OrBOP5SqAhVlAq4j9ezYn1F5bNOWjYqmAUH8QwFHOjqrgJOV3QfEe08xLLeCjAWJla\n\tC7CTQi5vRQiQWoKTig6/FdVg7ZFPZmWxMER6HY3ef/fMttW4Ef+Vjk5tZAQG9Eyhbfej\n\tKYLIN00ZQ0UhD19FkjBgtP55TZjuJoAuJ4Whw=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=WAjeWglpTXXvm2qM30sZOk2hyFk1CLMYUo2yD83YX/c=;\n\tb=uREzoUyWnJH1maZR71PxlLIr/2uc+k7PzK/ghN5TEhkhlfhUNCajqzy1/tBdpOsrNF\n\tnhOViCbxcm3+St/t8WRHdRzUakWqd+q+A1dMyqxZ/6Y0Rib6+44OkR0wG10D0Qt+0DUY\n\tAuTXnJ//CxMjmJdasgMKmahFML1q7y5wMbAhur1BEGsAOF7SF6lOl0rFp6BaV8a+v7eo\n\ta0XbtrSuSgCoMNMjsAZX3qpuH4M+M1XT0laQ/76ukWVrGjIpIKwmKH9BO2QMNtFJuNJ3\n\tPoaMI3Sevj83b9bX1mLc+6mO5tCwdSMdGwzUZmWRgraaUiAr5Z+qH3Sssitsg+fIvKZL\n\tEutQ==","X-Gm-Message-State":"AOAM530Owy3Qo5EHOMtYGXHlXqV+5sAb5so5+caFYFdv3BQsc6KPwXpu\n\tOexHNiYNnCLJSfLpY4SchsWeomQJ3y9D/A==","X-Google-Smtp-Source":"ABdhPJw4ntJsUnKrbj1nAHG1nMO9enanzBKo5sV+qQCW02aN9txXeHOX1HmfFZ3gqFyQp0/X9ZBLOA==","X-Received":"by 2002:a17:90a:7e15:: with SMTP id\n\ti21mr1980775pjl.74.1644391166337; \n\tTue, 08 Feb 2022 23:19:26 -0800 (PST)","From":"Han-Lin Chen <hanlinchen@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  9 Feb 2022 15:19:09 +0800","Message-Id":"<20220209071917.559993-2-hanlinchen@chromium.org>","X-Mailer":"git-send-email 2.35.0.263.gb82422642f-goog","In-Reply-To":"<20220209071917.559993-1-hanlinchen@chromium.org>","References":"<20220209071917.559993-1-hanlinchen@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/9] libcamera: Introduce option to\n\tcustomize behavior for a camera module","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":"Introduce option to customize behavior for a camera module, which might\nalter the camera characteristic and should be set before inspecting it.\n\nRe-use the Control generation infrastructure to generate options and define\nthe first 'PipelineConfigFile' option, which allows user to specify\npreference for pipeline configuration.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n---\n include/libcamera/ipa/ipa_controls.h |  1 +\n include/libcamera/meson.build        |  3 +-\n include/libcamera/option_ids.h.in    | 36 +++++++++++++++++\n src/libcamera/control_serializer.cpp | 12 ++++++\n src/libcamera/option_ids.cpp.in      | 58 ++++++++++++++++++++++++++++\n src/libcamera/option_ids.yaml        | 16 ++++++++\n 6 files changed, 125 insertions(+), 1 deletion(-)\n create mode 100644 include/libcamera/option_ids.h.in\n create mode 100644 src/libcamera/option_ids.cpp.in\n create mode 100644 src/libcamera/option_ids.yaml","diff":"diff --git a/include/libcamera/ipa/ipa_controls.h b/include/libcamera/ipa/ipa_controls.h\nindex da1a7596..8173a2e5 100644\n--- a/include/libcamera/ipa/ipa_controls.h\n+++ b/include/libcamera/ipa/ipa_controls.h\n@@ -18,6 +18,7 @@ extern \"C\" {\n enum ipa_controls_id_map_type {\n \tIPA_CONTROL_ID_MAP_CONTROLS,\n \tIPA_CONTROL_ID_MAP_PROPERTIES,\n+\tIPA_CONTROL_ID_MAP_OPTIONS,\n \tIPA_CONTROL_ID_MAP_V4L2,\n };\n \ndiff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex 408b7acf..a9b71bc3 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -31,10 +31,11 @@ install_headers(libcamera_public_headers,\n \n libcamera_headers_install_dir = get_option('includedir') / libcamera_include_dir\n \n-# control_ids.h and property_ids.h\n+# control_ids.h, property_ids.h, and option_ids.h\n control_source_files = [\n     'control_ids',\n     'property_ids',\n+    'option_ids',\n ]\n \n control_headers = []\ndiff --git a/include/libcamera/option_ids.h.in b/include/libcamera/option_ids.h.in\nnew file mode 100644\nindex 00000000..53058a4b\n--- /dev/null\n+++ b/include/libcamera/option_ids.h.in\n@@ -0,0 +1,36 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * option_ids.h - Option ID list\n+ *\n+ * This file is auto-generated. Do not edit.\n+ */\n+\n+#pragma once\n+\n+#include <stdint.h>\n+\n+#include <libcamera/controls.h>\n+\n+namespace libcamera {\n+\n+namespace options {\n+\n+enum {\n+${ids}\n+};\n+\n+${controls}\n+\n+namespace draft {\n+\n+${draft_controls}\n+\n+} /* namespace draft */\n+\n+extern const ControlIdMap options;\n+\n+} /* namespace options */\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp\nindex e87d2362..dc8d2906 100644\n--- a/src/libcamera/control_serializer.cpp\n+++ b/src/libcamera/control_serializer.cpp\n@@ -16,6 +16,7 @@\n \n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n+#include <libcamera/option_ids.h>\n #include <libcamera/property_ids.h>\n \n #include <libcamera/ipa/ipa_controls.h>\n@@ -239,6 +240,8 @@ int ControlSerializer::serialize(const ControlInfoMap &infoMap,\n \tenum ipa_controls_id_map_type idMapType;\n \tif (idmap == &controls::controls)\n \t\tidMapType = IPA_CONTROL_ID_MAP_CONTROLS;\n+\telse if (idmap == &options::options)\n+\t\tidMapType = IPA_CONTROL_ID_MAP_OPTIONS;\n \telse if (idmap == &properties::properties)\n \t\tidMapType = IPA_CONTROL_ID_MAP_PROPERTIES;\n \telse\n@@ -333,6 +336,8 @@ int ControlSerializer::serialize(const ControlList &list,\n \tenum ipa_controls_id_map_type idMapType;\n \tif (idmap == &controls::controls)\n \t\tidMapType = IPA_CONTROL_ID_MAP_CONTROLS;\n+\telse if (idmap == &options::options)\n+\t\tidMapType = IPA_CONTROL_ID_MAP_OPTIONS;\n \telse if (idmap == &properties::properties)\n \t\tidMapType = IPA_CONTROL_ID_MAP_PROPERTIES;\n \telse\n@@ -458,6 +463,9 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &\n \tcase IPA_CONTROL_ID_MAP_CONTROLS:\n \t\tidMap = &controls::controls;\n \t\tbreak;\n+\tcase IPA_CONTROL_ID_MAP_OPTIONS:\n+\t\tidMap = &options::options;\n+\t\tbreak;\n \tcase IPA_CONTROL_ID_MAP_PROPERTIES:\n \t\tidMap = &properties::properties;\n \t\tbreak;\n@@ -589,6 +597,10 @@ ControlList ControlSerializer::deserialize<ControlList>(ByteStreamBuffer &buffer\n \t\t\tidMap = &controls::controls;\n \t\t\tbreak;\n \n+\t\tcase IPA_CONTROL_ID_MAP_OPTIONS:\n+\t\t\tidMap = &options::options;\n+\t\t\tbreak;\n+\n \t\tcase IPA_CONTROL_ID_MAP_PROPERTIES:\n \t\t\tidMap = &properties::properties;\n \t\t\tbreak;\ndiff --git a/src/libcamera/option_ids.cpp.in b/src/libcamera/option_ids.cpp.in\nnew file mode 100644\nindex 00000000..adfd0633\n--- /dev/null\n+++ b/src/libcamera/option_ids.cpp.in\n@@ -0,0 +1,58 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * option_ids.cpp : Option ID list\n+ *\n+ * This file is auto-generated. Do not edit.\n+ */\n+\n+#include <libcamera/option_ids.h>\n+\n+/**\n+ * \\file option_ids.h\n+ * \\brief Camera option identifiers\n+ */\n+\n+namespace libcamera {\n+\n+/**\n+ * \\brief Namespace for libcamera options\n+ */\n+namespace options {\n+\n+${controls_doc}\n+\n+/**\n+ * \\brief Namespace for libcamera draft options\n+ */\n+namespace draft {\n+\n+${draft_controls_doc}\n+\n+} /* namespace draft */\n+\n+#ifndef __DOXYGEN__\n+/*\n+ * Keep the options definitions hidden from doxygen as it incorrectly parses\n+ * them as functions.\n+ */\n+${controls_def}\n+\n+namespace draft {\n+\n+${draft_controls_def}\n+\n+} /* namespace draft */\n+#endif\n+\n+/**\n+ * \\brief List of all supported libcamera options\n+ */\n+extern const ControlIdMap options {\n+${controls_map}\n+};\n+\n+} /* namespace options */\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/option_ids.yaml b/src/libcamera/option_ids.yaml\nnew file mode 100644\nindex 00000000..3f9304be\n--- /dev/null\n+++ b/src/libcamera/option_ids.yaml\n@@ -0,0 +1,16 @@\n+# SPDX-License-Identifier: LGPL-2.1-or-later\n+#\n+# Copyright (C) 2022, Google Inc.\n+#\n+%YAML 1.2\n+---\n+controls:\n+  - PipelineConfigFile:\n+      type: string\n+      description: |\n+        Some platform supports customizing pipeline configuration preference\n+        for a camera module. The structure and contents of the configuration\n+        file is specific to each platform in YAML format. The PipelineConfigFile\n+        option can be used to specify the path to load the configuration file.\n+\n+...\n","prefixes":["libcamera-devel","1/9"]}