Patch Detail
Show a patch.
GET /api/patches/19236/?format=api
{ "id": 19236, "url": "https://patchwork.libcamera.org/api/patches/19236/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19236/", "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": "<20231124123713.22519-4-naush@raspberrypi.com>", "date": "2023-11-24T12:37:09", "name": "[libcamera-devel,v3,3/7] build: controls: Rework how controls and properties are generated", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "3c8a27d6a041fb9c9173ca399a71c8b83e8e303e", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19236/mbox/", "series": [ { "id": 4084, "url": "https://patchwork.libcamera.org/api/series/4084/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4084", "date": "2023-11-24T12:37:06", "name": "Vendor controls and properties", "version": 3, "mbox": "https://patchwork.libcamera.org/series/4084/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19236/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19236/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 056B7C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Nov 2023 12:37:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B1426629C9;\n\tFri, 24 Nov 2023 13:37:21 +0100 (CET)", "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CDEDF629BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Nov 2023 13:37:19 +0100 (CET)", "by mail-wm1-x329.google.com with SMTP id\n\t5b1f17b1804b1-4083f61312eso14522855e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Nov 2023 04:37:19 -0800 (PST)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tv11-20020a05600c444b00b0040b3867a297sm3303690wmn.36.2023.11.24.04.37.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 24 Nov 2023 04:37:17 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1700829441;\n\tbh=Kc5r5Hd304Wo/DdfgRXwsgGS0N0yybblcEsyXhe9HGU=;\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=GBr2YqI8SGoFkZKUoFJP96a123hHedj4a/+gRVJAIOajmJKeWaOiE5UyS0puxkuYN\n\tIQeljY/pAOuMXrISYpO0gteq61SyIvXlEYfPlq2PZUXUoDSNTqGVdEJ3iaLWzi61Bi\n\tq3/G3R1DBf1AuTjytMMP9K6E4rR3EzxXVri7j4ZvR+0bX4Pg33GHWnxLedKt+MQsAg\n\ts+HGUXO6E3CLK9Ta85BGALhZHIS7yi3PlDy873liqhrEd/VhzRWcR8K5bhD0YYwTv4\n\tTZb5qoAReYHzoHa+MJNXNsi7nK5GQmYTQbtbXpdhxMMz7ztJI9r0K1WpAL1ZrhW18F\n\tnbvA9+j0VC8gg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1700829439; x=1701434239;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=LrwzQEkn09KNa4CcThkl4P2nzzUI6MpLq4v6QB3BzSo=;\n\tb=S1KVivJBNvCdmRQ1E3ImDhyeXmzGtU/gzfQyZgrzFmcKSQYcTivT5ucdwKSS9hdcc9\n\tSEk0RLLTfqxi44orEpRm4TheKoN0a+72DWy4y3TWDioO8zst7jD9lisrQdANn2LtnKFm\n\tAADtbzDkcJdCFHlIayfLlDiGYkhAvRQbsruYl77Q6ZC5esN13GOrNMWq3CS0hbTOdG8o\n\t97B83twMt4u/i0ao/2UUE6oFSdRg7jtOb7iIyaUIu9Vv7EoE8xeKGarLBnifnUS/MXvX\n\t8VKk7J1rKUkUfET8g0MGzNeufaQ12b0W9aY8GVq06neZhwmp8vdcX6TbXTsjIVRys0gl\n\twfpQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"S1KVivJB\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1700829439; x=1701434239;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=LrwzQEkn09KNa4CcThkl4P2nzzUI6MpLq4v6QB3BzSo=;\n\tb=q6/WbtD3HlPx3KVN9XwBqXCHnh1G+PYrNm4OwNgI8BFxcuWI8EMMnprkLIOrPH8j3b\n\tpW+htTBHcwVXqjBSLtxbkbnqYBGb+kbT1oQvgogDf0UZnPR1f8XJOUhvO+mLb0f3lKyL\n\tSigMqCvxvruSVkI1zMbq35ghoXZaaJIZgdzccMJY3Nbt9KUfPpHGqLZ2hQ75Yswe72qf\n\tn1kS5Lk0F6TEq/CLAOczq07+NO6fSD/x86A9/kZka38wg+GQzCgtLJ/w1SVNesdJmZaL\n\tbi/fpcehJZShbyTJp70JM4e5P2Uxm1t4jxNlZpFYu7EaRVCXJhXjCak5FxOIQEdMa0dC\n\tAngg==", "X-Gm-Message-State": "AOJu0YwvrAsjViGEfCj42ygwNDvcyrMAHEZVGayWaUpIqtblUAjywfmE\n\taY2qgrnj98LsQ4xzyP9mi1q24308smkQUlEs0ZVUeA==", "X-Google-Smtp-Source": "AGHT+IGpnDbGOB2VEEiZefcx55PMrkSd8whnCJ4/Kj7P9UpIetQzJhcPV1im9wg45SgwSZAuByOZtA==", "X-Received": "by 2002:a05:600c:1986:b0:40b:367a:801 with SMTP id\n\tt6-20020a05600c198600b0040b367a0801mr2619991wmq.41.1700829438976; \n\tFri, 24 Nov 2023 04:37:18 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 24 Nov 2023 12:37:09 +0000", "Message-Id": "<20231124123713.22519-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231124123713.22519-1-naush@raspberrypi.com>", "References": "<20231124123713.22519-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 3/7] build: controls: Rework how\n\tcontrols and properties are generated", "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add support for using separate YAML files for controls and properties\ngeneration. The mapping of vendor/pipeline handler to control file is\ndone through the controls_map variable in include/libcamera/meson.build.\n\nThis simplifies management of vendor control definitions and avoids\npossible merge conflicts when changing the control_ids.yaml file for\ncore and draft controls. With this change, libcamera and draft controls\nand properties files are designated the 'libcamera' vendor tag.\n\nIn this change, we also rename control_ids.yaml -> control_ids_core.yaml\nand property_ids.yaml -> property_ids_core.yaml to designate these as\ncore libcamera controls.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n Documentation/guides/pipeline-handler.rst | 8 +--\n include/libcamera/meson.build | 52 +++++++++++++++----\n meson.build | 2 +\n ...control_ids.yaml => control_ids_core.yaml} | 0\n src/libcamera/meson.build | 21 ++++++--\n ...operty_ids.yaml => property_ids_core.yaml} | 0\n src/py/libcamera/gen-py-controls.py | 10 ++--\n src/py/libcamera/meson.build | 12 ++++-\n utils/gen-controls.py | 13 +++--\n 9 files changed, 88 insertions(+), 30 deletions(-)\n rename src/libcamera/{control_ids.yaml => control_ids_core.yaml} (100%)\n rename src/libcamera/{property_ids.yaml => property_ids_core.yaml} (100%)", "diff": "diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst\nindex 10b9c75c2a7f..66d428a19c4f 100644\n--- a/Documentation/guides/pipeline-handler.rst\n+++ b/Documentation/guides/pipeline-handler.rst\n@@ -587,12 +587,12 @@ immutable properties of the ``Camera`` device.\n \n The libcamera controls and properties are defined in YAML form which is\n processed to automatically generate documentation and interfaces. Controls are\n-defined by the src/libcamera/`control_ids.yaml`_ file and camera properties\n-are defined by src/libcamera/`properties_ids.yaml`_.\n+defined by the src/libcamera/`control_ids_core.yaml`_ file and camera properties\n+are defined by src/libcamera/`properties_ids_core.yaml`_.\n \n .. _controls framework: https://libcamera.org/api-html/controls_8h.html\n-.. _control_ids.yaml: https://libcamera.org/api-html/control__ids_8h.html\n-.. _properties_ids.yaml: https://libcamera.org/api-html/property__ids_8h.html\n+.. _control_ids_core.yaml: https://libcamera.org/api-html/control__ids_8h.html\n+.. _properties_ids_core.yaml: https://libcamera.org/api-html/property__ids_8h.html\n \n Pipeline handlers can optionally register the list of controls an application\n can set as well as a list of immutable camera properties. Being both\ndiff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex 5fb772e6dd14..a763c8ff4344 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -32,22 +32,56 @@ 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 and associated modes\n-control_source_files = {\n- 'control_ids': 'controls',\n- 'property_ids': 'properties',\n+controls_map = {\n+ 'controls': {\n+ 'core': 'control_ids_core.yaml',\n+ },\n+\n+ 'properties': {\n+ 'core': 'property_ids_core.yaml',\n+ }\n }\n \n control_headers = []\n+controls_files = []\n+properties_files = []\n+\n+foreach mode, entry : controls_map\n+ files_list = []\n+ input_files = []\n+ foreach vendor, header : entry\n+ if vendor != 'core' and vendor != 'draft'\n+ if vendor not in pipelines\n+ message('vendor not in pipelines')\n+ continue\n+ endif\n+ endif\n+\n+ if header in files_list\n+ message('header in files list')\n+ continue\n+ endif\n+\n+ files_list += header\n+ input_files += files('../../src/libcamera/' + header)\n+ endforeach\n+\n+ outfile = ''\n+ if mode == 'controls'\n+ outfile = 'control_ids.h'\n+ controls_files += files_list\n+ else\n+ outfile = 'property_ids.h'\n+ properties_files += files_list\n+ endif\n \n-foreach header, mode : control_source_files\n- input_files = files('../../src/libcamera/' + header +'.yaml')\n- template_file = files(header + '.h.in')\n+ template_file = files(outfile + '.in')\n control_headers += custom_target(header + '_h',\n input : input_files,\n- output : header + '.h',\n+ output : outfile,\n command : [gen_controls, '-o', '@OUTPUT@',\n- '--mode', mode, '-t', template_file, '@INPUT@'],\n+ '--mode', mode, '-t', template_file,\n+ '@INPUT@'],\n install : true,\n install_dir : libcamera_headers_install_dir)\n endforeach\ndiff --git a/meson.build b/meson.build\nindex e9a1c7e360ce..ee57cb780149 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -267,6 +267,8 @@ py_mod.find_installation('python3', modules : py_modules)\n summary({\n 'Enabled pipelines': pipelines,\n 'Enabled IPA modules': enabled_ipa_names,\n+ 'Controls files': controls_files,\n+ 'Properties files': properties_files,\n 'Hotplug support': libudev.found(),\n 'Tracing support': tracing_enabled,\n 'Android support': android_enabled,\ndiff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids_core.yaml\nsimilarity index 100%\nrename from src/libcamera/control_ids.yaml\nrename to src/libcamera/control_ids_core.yaml\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 05ee38daf22b..6d9902e6ffd1 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -127,12 +127,23 @@ endif\n \n control_sources = []\n \n-foreach source, mode : control_source_files\n- input_files = files(source +'.yaml')\n- template_file = files(source + '.cpp.in')\n- control_sources += custom_target(source + '_cpp',\n+controls_mode_files = {\n+ 'controls' : controls_files,\n+ 'properties' : properties_files,\n+}\n+\n+foreach mode, input_files : controls_mode_files\n+ input_files = files(input_files)\n+\n+ if mode == 'controls'\n+ template_file = files('control_ids.cpp.in')\n+ else\n+ template_file = files('property_ids.cpp.in')\n+ endif\n+\n+ control_sources += custom_target(mode + '_cpp',\n input : input_files,\n- output : source + '.cpp',\n+ output : mode + '_ids.cpp',\n command : [gen_controls, '-o', '@OUTPUT@',\n '--mode', mode, '-t', template_file, '@INPUT@'])\n endforeach\ndiff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids_core.yaml\nsimilarity index 100%\nrename from src/libcamera/property_ids.yaml\nrename to src/libcamera/property_ids_core.yaml\ndiff --git a/src/py/libcamera/gen-py-controls.py b/src/py/libcamera/gen-py-controls.py\nindex cfcfd4d16acf..8ae8d5126e39 100755\n--- a/src/py/libcamera/gen-py-controls.py\n+++ b/src/py/libcamera/gen-py-controls.py\n@@ -95,7 +95,7 @@ def main(argv):\n help='Output file name. Defaults to standard output if not specified.')\n parser.add_argument('--template', '-t', type=str, required=True,\n help='Template file name.')\n- parser.add_argument('input', type=str,\n+ parser.add_argument('input', type=str, nargs='+',\n help='Input file name.')\n args = parser.parse_args(argv[1:])\n \n@@ -103,11 +103,11 @@ def main(argv):\n print(f'Invalid mode option \"{args.mode}\"', file=sys.stderr)\n return -1\n \n- data = open(args.input, 'rb').read()\n-\n controls = {}\n- vendor = yaml.safe_load(data)['vendor']\n- controls[vendor] = yaml.safe_load(data)['controls']\n+ for input in args.input:\n+ data = open(input, 'rb').read()\n+ vendor = yaml.safe_load(data)['vendor']\n+ controls[vendor] = yaml.safe_load(data)['controls']\n \n data = generate_py(controls, args.mode)\n \ndiff --git a/src/py/libcamera/meson.build b/src/py/libcamera/meson.build\nindex 1c3ea1843ac0..31af63ec0dc6 100644\n--- a/src/py/libcamera/meson.build\n+++ b/src/py/libcamera/meson.build\n@@ -28,11 +28,15 @@ pycamera_sources = files([\n \n # Generate controls\n \n-gen_py_controls_input_files = files('../../libcamera/control_ids.yaml')\n+gen_py_controls_input_files = []\n gen_py_controls_template = files('py_controls_generated.cpp.in')\n \n gen_py_controls = files('gen-py-controls.py')\n \n+foreach file : controls_files\n+ gen_py_controls_input_files += files('../../libcamera/' + file)\n+endforeach\n+\n pycamera_sources += custom_target('py_gen_controls',\n input : gen_py_controls_input_files,\n output : ['py_controls_generated.cpp'],\n@@ -41,9 +45,13 @@ pycamera_sources += custom_target('py_gen_controls',\n \n # Generate properties\n \n-gen_py_property_enums_input_files = files('../../libcamera/property_ids.yaml')\n+gen_py_property_enums_input_files = []\n gen_py_properties_template = files('py_properties_generated.cpp.in')\n \n+foreach file : properties_files\n+ gen_py_property_enums_input_files += files('../../libcamera/' + file)\n+endforeach\n+\n pycamera_sources += custom_target('py_gen_properties',\n input : gen_py_property_enums_input_files,\n output : ['py_properties_generated.cpp'],\ndiff --git a/utils/gen-controls.py b/utils/gen-controls.py\nindex 6680ecf84acb..30c58f35473c 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -12,6 +12,7 @@ import operator\n import string\n import sys\n import yaml\n+import os\n \n \n class ControlEnum(object):\n@@ -339,15 +340,17 @@ def main(argv):\n help='Output file name. Defaults to standard output if not specified.')\n parser.add_argument('--template', '-t', dest='template', type=str, required=True,\n help='Template file name.')\n- parser.add_argument('input', type=str,\n+ parser.add_argument('input', type=str, nargs='+',\n help='Input file name.')\n \n args = parser.parse_args(argv[1:])\n \n- data = open(args.input, 'rb').read()\n- vendor = yaml.safe_load(data)['vendor']\n- controls = yaml.safe_load(data)['controls']\n- controls = [Control(*ctrl.popitem(), vendor) for ctrl in controls]\n+ controls = []\n+ for input in args.input:\n+ data = open(input, 'rb').read()\n+ vendor = yaml.safe_load(data)['vendor']\n+ ctrls = yaml.safe_load(data)['controls']\n+ controls = controls + [Control(*ctrl.popitem(), vendor) for ctrl in ctrls]\n \n if args.template.endswith('.cpp.in'):\n data = generate_cpp(controls)\n", "prefixes": [ "libcamera-devel", "v3", "3/7" ] }