Patch Detail
Show a patch.
GET /api/patches/19218/?format=api
{ "id": 19218, "url": "https://patchwork.libcamera.org/api/patches/19218/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19218/", "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": "<20231121145350.5956-4-naush@raspberrypi.com>", "date": "2023-11-21T14:53:47", "name": "[libcamera-devel,v2,3/6] controls: build: Allow separate vendor control YAML files", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "44f7a13db83b54033f931409938d87e48ecda342", "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/19218/mbox/", "series": [ { "id": 4077, "url": "https://patchwork.libcamera.org/api/series/4077/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4077", "date": "2023-11-21T14:53:44", "name": "Vendor controls and properties", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4077/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19218/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19218/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 2C6EFC32B6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Nov 2023 14:54:01 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A9C861DAE;\n\tTue, 21 Nov 2023 15:54:00 +0100 (CET)", "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A8656629C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Nov 2023 15:53:58 +0100 (CET)", "by mail-wm1-x331.google.com with SMTP id\n\t5b1f17b1804b1-40859c464daso25602965e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Nov 2023 06:53:58 -0800 (PST)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\th18-20020a05600c351200b004063ea92492sm17570968wmq.22.2023.11.21.06.53.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 21 Nov 2023 06:53:57 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1700578440;\n\tbh=u1pzwaJCyQvFTyvZsijtKDuzg3WHLwqOttR93D7fqk8=;\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=NIeg185CnTEazeZol6kKLy9gyzgLy+1WW9L/3aKlickd18tU2o8YZtDPO9YK5RE90\n\todsItdpYDxc+bJkYOS5Qd8G1ZU8MnXZoZ5aiS1PfpHmC/UYo0wWLsZM3yG6b2yd944\n\tFfT19sCqGnxvx7dVfAzs8tLEJWVl2AWHplZg9y/xH4DqEeSPE/4caxkVJNAa5B2DqI\n\tmX0tWUKpboWzed1cZBBguqDCBbI30tc3kDlZezymv7bOuitmS8+xkGus1cc8R0R+/3\n\t4wNbswhy8+8a8AQqAzxzVMK2Z98+LHrFtJ9eQVt9yZ8tYGw7g36ldpKUamoLxOBRVF\n\teBgkaAEpAwUPw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1700578438; x=1701183238;\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=ktpi15tBs8cYjJhOKHEBmP3OaeY5TzoUYnry6TQur+I=;\n\tb=flyltw9h9rMHcLxO4G5ATtNuI5+3v6312zL0b2/PQMNESFCfF16AXY5valx6yj/ETq\n\tIGGjiEU425wqsBDTLWZYAhIaP4Jq2l8DojrlIcoMKb9mKTh2k2C1UYkcHDCIp73XXVQK\n\tNuTC9RX722dmrP7hZgpi/Tyy4qVfMTXlaavHJ9ZHFF8plmGHVEz5TIBgXFMCPsRZFWJl\n\ttLvfR1vmbI8U0jxjupv9Mc/EAFb6cEFBPvxN3G667m3Tr4tPz8xZLVLCmKZXQH9CoXqN\n\twgCyLEdJPoHyJ9V2+DtsY/e3KSx849ZqXm9BbBzO15MKRwGfE6ybHqua3sr/ee/zeZZE\n\tLcEw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"flyltw9h\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1700578438; x=1701183238;\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=ktpi15tBs8cYjJhOKHEBmP3OaeY5TzoUYnry6TQur+I=;\n\tb=jsk6oYlffKswRNXEeJwNSzm7MhTn56cqZDiEt2Gnzl4yPEj8aWb/TovDPCOwCeyysf\n\tvvvzu2MHuOHsuAUDxAietTLm1/fGewXmNbQEn7OlwZQ0ftt17OyK4ckXc/GMgvcgMcY9\n\tPcaahc6gV0kDFCqqZ8iNLVbf8khvwUvlPPY3tfjXWcMj8V1fYGDffHIyJLFqA8NYqtMB\n\tY8WihY6hyXEIuRqHPBX/+7EwBilvIs7yJvQoSyBsuSfnwo+xg6dretHTkzEoX+NBUpSh\n\ty8NCRvQYa0nfPH9nSmXbv167+mQm92vfGxGoHsDXDrLtaAbHHwMU6IZSlk0cIemVwJyv\n\t8zZA==", "X-Gm-Message-State": "AOJu0YxMpBfWQYXb/mVmHHabWVczfz0ViatZTKJB5Yhg6wFT94OjqCWq\n\tHgMrKfm06iPiCKc6EWf8YF3UbrkjaIv+AVxV3eBIkA==", "X-Google-Smtp-Source": "AGHT+IFipRwKbifJWtND2SAAyf0h08d+WsllpwBMmyFK1CCJ5a6HXLoyEPcLW9UBNr+besTwbYxXyQ==", "X-Received": "by 2002:a05:600c:a02:b0:408:53d4:52dd with SMTP id\n\tz2-20020a05600c0a0200b0040853d452ddmr8050359wmp.22.1700578438025; \n\tTue, 21 Nov 2023 06:53:58 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 21 Nov 2023 14:53:47 +0000", "Message-Id": "<20231121145350.5956-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231121145350.5956-1-naush@raspberrypi.com>", "References": "<20231121145350.5956-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/6] controls: build: Allow separate\n\tvendor control YAML files", "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 vendor specific controls.\nThis simplifies management of vendor control definitions and avoids\npossible merge conflicts when changing the control_ids.yaml file for\ncore and draft controls. The mapping of vendor/pipeline handler to\ncontrol file is done through the vendor_controls_mapping variable in\ninclude/libcamera/meson.build.\n\nAdd a new control_ids_rpi.yaml file to hold the Raspberry Pi specific\nvendor controls. This contains a single control PispConfigDumpFile that\nwill be used in the Pi 5 pipeline handler as a trigger to dump the\nBackend configuration as a JSON file.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/meson.build | 42 ++++++++++++++++++++++++++++-\n meson.build | 2 ++\n src/libcamera/control_ids_rpi.yaml | 16 +++++++++++\n src/libcamera/meson.build | 12 +++++++++\n src/py/libcamera/gen-py-controls.py | 10 +++----\n src/py/libcamera/meson.build | 8 ++++++\n utils/gen-controls.py | 12 +++++----\n 7 files changed, 91 insertions(+), 11 deletions(-)\n create mode 100644 src/libcamera/control_ids_rpi.yaml", "diff": "diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex 5fb772e6dd14..54123c5b858d 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -38,10 +38,50 @@ control_source_files = {\n 'property_ids': 'properties',\n }\n \n+vendor_controls_mapping = {\n+ # Mapping of vendor (pipeline handler) specific controls files\n+ 'controls':\n+ {\n+ 'rpi/pisp': 'control_ids_rpi.yaml',\n+ 'rpi/vc4': 'control_ids_rpi.yaml'\n+ },\n+ # Mapping of vendor (pipeline handler) specific properties files\n+ 'properties':\n+ {\n+\n+ }\n+}\n+\n control_headers = []\n+vendor_ctrl_files = []\n+vendor_prop_files = []\n \n foreach header, mode : control_source_files\n- input_files = files('../../src/libcamera/' + header +'.yaml')\n+\n+ # Start by populating the vendor specific mappings into vendor_ctrl_files\n+ # and vendor_prop_files. These will be cached for later use.\n+ vendor_files = []\n+ foreach pipeline, file : vendor_controls_mapping[mode]\n+ if pipeline not in pipelines\n+ continue\n+ endif\n+ if file not in vendor_files\n+ vendor_files += file\n+ endif\n+ endforeach\n+\n+ if mode == 'controls'\n+ vendor_ctrl_files = vendor_files\n+ else\n+ vendor_prop_files = vendor_files\n+ endif\n+\n+ input_files = files('../../src/libcamera/' + header + '.yaml')\n+\n+ foreach file : vendor_files\n+ input_files += files('../../src/libcamera/' + file)\n+ endforeach\n+\n template_file = files(header + '.h.in')\n control_headers += custom_target(header + '_h',\n input : input_files,\ndiff --git a/meson.build b/meson.build\nindex e9a1c7e360ce..1423abf16c77 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+ 'Vendor controls': vendor_ctrl_files,\n+ 'Vendor properties': vendor_prop_files,\n 'Hotplug support': libudev.found(),\n 'Tracing support': tracing_enabled,\n 'Android support': android_enabled,\ndiff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml\nnew file mode 100644\nindex 000000000000..a6f8b43a5f62\n--- /dev/null\n+++ b/src/libcamera/control_ids_rpi.yaml\n@@ -0,0 +1,16 @@\n+# SPDX-License-Identifier: LGPL-2.1-or-later\n+#\n+# Copyright (C) 2023, Raspberry Pi Ltd\n+#\n+%YAML 1.1\n+---\n+vendor: rpi\n+controls:\n+ - PispConfigDumpFile:\n+ type: string\n+ description: |\n+ Triggers the Raspberry Pi PiSP pipeline handler to generate a JSON\n+ formatted dump of the Backend configuration to the filename given by the\n+ value of the control.\n+\n+...\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 05ee38daf22b..7eb26ccbb7f5 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -129,6 +129,18 @@ control_sources = []\n \n foreach source, mode : control_source_files\n input_files = files(source +'.yaml')\n+\n+ # Add the vendor specific files to the input.\n+ if mode == 'controls'\n+ vendor_files = vendor_ctrl_files\n+ else\n+ vendor_files = vendor_prop_files\n+ endif\n+\n+ foreach file : vendor_files\n+ input_files += files(file)\n+ endforeach\n+\n template_file = files(source + '.cpp.in')\n control_sources += custom_target(source + '_cpp',\n input : input_files,\ndiff --git a/src/py/libcamera/gen-py-controls.py b/src/py/libcamera/gen-py-controls.py\nindex ea28f0139f23..e2ddad8581fd 100755\n--- a/src/py/libcamera/gen-py-controls.py\n+++ b/src/py/libcamera/gen-py-controls.py\n@@ -91,7 +91,7 @@ def main(argv):\n parser = argparse.ArgumentParser()\n parser.add_argument('-o', dest='output', metavar='file', type=str,\n help='Output file name. Defaults to standard output if not specified.')\n- parser.add_argument('input', type=str,\n+ parser.add_argument('input', type=str, nargs='+',\n help='Input file name.')\n parser.add_argument('-t', dest='template', type=str, required=True,\n help='Template file name.')\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..ea38ad6ca829 100644\n--- a/src/py/libcamera/meson.build\n+++ b/src/py/libcamera/meson.build\n@@ -33,6 +33,10 @@ gen_py_controls_template = files('py_controls_generated.cpp.in')\n \n gen_py_controls = files('gen-py-controls.py')\n \n+foreach file : vendor_ctrl_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@@ -44,6 +48,10 @@ pycamera_sources += custom_target('py_gen_controls',\n gen_py_property_enums_input_files = files('../../libcamera/property_ids.yaml')\n gen_py_properties_template = files('py_properties_generated.cpp.in')\n \n+foreach file : vendor_prop_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 8af33d29cd07..d7862142b8c1 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -359,7 +359,7 @@ def main(argv):\n parser = argparse.ArgumentParser()\n parser.add_argument('-o', dest='output', metavar='file', type=str,\n help='Output file name. Defaults to standard output if not specified.')\n- parser.add_argument('input', type=str,\n+ parser.add_argument('input', type=str, nargs='+',\n help='Input file name.')\n parser.add_argument('-t', dest='template', type=str, required=True,\n help='Template file name.')\n@@ -367,10 +367,12 @@ def main(argv):\n help='Mode of operation')\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", "v2", "3/6" ] }