Patch Detail
Show a patch.
GET /api/1.1/patches/19251/?format=api
{ "id": 19251, "url": "https://patchwork.libcamera.org/api/1.1/patches/19251/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19251/", "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": "<20231130142534.2075-4-naush@raspberrypi.com>", "date": "2023-11-30T14:25:31", "name": "[libcamera-devel,v4,3/6] build: controls: Rework how controls and properties are generated", "commit_ref": "0455bbbf518cc834bd72ac65e13c9ed40bf21f3c", "pull_url": null, "state": "accepted", "archived": false, "hash": "27ab722f4b0f6d83b5d6c943fcb2b01b5b89ab4f", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19251/mbox/", "series": [ { "id": 4091, "url": "https://patchwork.libcamera.org/api/1.1/series/4091/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4091", "date": "2023-11-30T14:25:28", "name": "Vendor controls and properties", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4091/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19251/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19251/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 E95C8C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Nov 2023 14:25:46 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EBC03629D3;\n\tThu, 30 Nov 2023 15:25:45 +0100 (CET)", "from mail-ej1-x630.google.com (mail-ej1-x630.google.com\n\t[IPv6:2a00:1450:4864:20::630])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 75823629C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Nov 2023 15:25:44 +0100 (CET)", "by mail-ej1-x630.google.com with SMTP id\n\ta640c23a62f3a-a06e59384b6so147040666b.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Nov 2023 06:25:44 -0800 (PST)", "from localhost.localdomain ([88.97.53.79])\n\tby smtp.gmail.com with ESMTPSA id\n\ta5-20020a17090640c500b009e50ea0a05asm725577ejk.99.2023.11.30.06.25.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 30 Nov 2023 06:25:43 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701354346;\n\tbh=OQvnV1gK6BNSShRThLob5xSE1uIM3pEQPeydc5K8CSM=;\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:Cc:\n\tFrom;\n\tb=FuW4CMrrLe/vJ4AuTkYWilSf1OYxrii1gM69JIgxoRZXbjWJ+nYhYLIrYR1ajH2EV\n\tWZk+EZaafX/rYcYAbTgxmlcaCn0SPR4+4ULzxLxenO88E6O+58JgjYgUt17m7ky5pr\n\ttQ8BoVp5/w/3JI2E1aW/0yDD0gGUHTR979Uy+Zv/ckNUjUAWo9WJZX8vD89v4MYe4T\n\tixqk26KMVloZN1lelsRheGeZ+DPAZdJu3Fo2kZb5NsoR+1EN5fc1ePFkZOq48AvkQ+\n\tYpaEN6sG7Nmdznm/OZ1Lqx5zbAqJ7TQf0nrsyjENj2NQyozG0w/o2FtPbQEOes7Bl+\n\tBrZJVu9DFngjQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1701354344; x=1701959144;\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=FesQa8IGx1toANo6uMQtuuDPNiO8Dh6SuN9++vhdB9g=;\n\tb=lrNs3BigT/frhWjkFKhbLeLCL5NHBtJZe4cOJqdl8YeUWirV1ibH91IiPFpkonsYM8\n\t4/z1abr/eL2I1fct2xNKRk6LsI8OiViXGKtWmzLi6cSN0ZEgF3pLGKJwZ0sQY57hdZ28\n\tTyoHpa8SlFZJLX/+jfURBjYXARjV64xXOWfekBqAXBoxQbPwo3059adPS3q6Q5MvOg6n\n\tbP2IsnnLTzyNHJWzKe0LGYmWdNOLzxJ5UkGkugxnJn9o0kziRWr74lEjsvaeus/dYLz2\n\tTcgiwQvckDL9ZpWtYEi7wC0fQz4iNSx5zeK5f1rq0ZOT2vd+1bYszts+yvoLlUde+WYl\n\tOghw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"lrNs3Big\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1701354344; x=1701959144;\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=FesQa8IGx1toANo6uMQtuuDPNiO8Dh6SuN9++vhdB9g=;\n\tb=myGB2MMRc9pjaGmE/jvAFOJDJSblsqIzd9J2vIZWixwCID/Kp11zPcKRha0t9xhJn7\n\td2bCwyAOjK59TRAVlMs+TnZkZCBImhiHTmpBeSaakRrBxCt8HmdYVurP24+4YMJ0jM7F\n\taT/xuoCme3ldTTA7taKLHOVOiXqFRILgFCkpONyNm/N099N6BUzQbpeXLFuXpWzdxXoJ\n\togTDuwlwofqq4ZPsTxgZtm7tq9DcB8fMElgeL07JDg7ubdxbGel/5vYkZexkQ3LUa/jH\n\tqkXSNOTy73eAoAoz7pMi+zQ7bBdtA3JCpZIKNOkiZt7Wqf1GOMEEkDqoSEpnEUtNf3Xa\n\t4AVA==", "X-Gm-Message-State": "AOJu0Yy9TXTAIh5GPbz3npESuAVcAJdNeLk7S5eJ5a7WlhiwW24lAYL1\n\tmB8FDNG7ETc6aJwISExbjfOSjfJyPUsJ4iaH4WoNlg==", "X-Google-Smtp-Source": "AGHT+IG3+4XhkrglrpGMu6SQeshK27oL9V3hnmJkDu4PDnJj6YqkhMRyd8wlasXPp4qkjX8Y2NErbw==", "X-Received": "by 2002:a17:906:1e8f:b0:9ff:aeea:89a7 with SMTP id\n\te15-20020a1709061e8f00b009ffaeea89a7mr15662990ejj.39.1701354343769; \n\tThu, 30 Nov 2023 06:25:43 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 30 Nov 2023 14:25:31 +0000", "Message-Id": "<20231130142534.2075-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231130142534.2075-1-naush@raspberrypi.com>", "References": "<20231130142534.2075-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 3/6] 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>", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.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>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n Documentation/guides/pipeline-handler.rst | 8 +--\n include/libcamera/meson.build | 50 +++++++++++++++----\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 | 14 ++++--\n 9 files changed, 87 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..c46a4e701ac4 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -32,22 +32,54 @@ 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+ continue\n+ endif\n+ endif\n+\n+ if 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 56e0c7ba98f2..2a633cc0aba9 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@@ -342,15 +343,18 @@ 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+ with open(input, 'rb') as f:\n+ data = f.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", "v4", "3/6" ] }