Patch Detail
Show a patch.
GET /api/1.1/patches/19252/?format=api
{ "id": 19252, "url": "https://patchwork.libcamera.org/api/1.1/patches/19252/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19252/", "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-5-naush@raspberrypi.com>", "date": "2023-11-30T14:25:32", "name": "[libcamera-devel,v4,4/6] libcamera: control: Add vendor control id range reservation", "commit_ref": "d3365b358f350931ce5b1e51c39c23fa47b4a7ca", "pull_url": null, "state": "accepted", "archived": false, "hash": "a27581dd87d9c98692753c90455a4b81e13340db", "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/19252/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/19252/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19252/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 C8D91C32B5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Nov 2023 14:25:48 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7FE44629CF;\n\tThu, 30 Nov 2023 15:25:48 +0100 (CET)", "from mail-ej1-x631.google.com (mail-ej1-x631.google.com\n\t[IPv6:2a00:1450:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 36C75629D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Nov 2023 15:25:45 +0100 (CET)", "by mail-ej1-x631.google.com with SMTP id\n\ta640c23a62f3a-9fa45e75ed9so142167866b.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Nov 2023 06:25:45 -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.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 30 Nov 2023 06:25:44 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1701354348;\n\tbh=2cqMmfpJysqXAMnIJX1SsnoAlqgYBQFtjEQO/6n7xZ0=;\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=gmTIeNCwIQas6JPTF/RHMZThk8X2upF+sWYjVINIQ2NyS/pvcKdpkJbx+kVyTYgtv\n\t+Aqllc00FLjAH2VtwIv3xtrDAhtxquR9nOPHmAZ1W0GgzG6JoDnKMQNCl75lyEGEd+\n\trmjCZO2RAHPUwXkC07zYNuWggTqV9nVgk0byfNyXwUL2wAaNkJWscYRo/KGtThhxFI\n\tB78RhthrFwS6T+RY7PAvZu94o5s0Lpfh65sWvZo8bJPTs6DRBWlueyommIKb66apZR\n\tYWpfFrrZBI3R0FCxRmz2SV+/YHuc+JLFvjZuUaJJEhQU8N/w3hH/GEbYIyRvEVtylS\n\txb53Uj6gTvaLA==", "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=8MNvkO447TQABbMc0LlAq8P6s+MCZZx+lmqdO0CLVRk=;\n\tb=Sy1476eSsVGSwS90kkb6u7G0Wjv2Wgphu77Z/brxgeoBn1953Ps3T6D1V4JyrBeUL2\n\tV1yE9AaW82qlorvtb9mM9lTg7GMI0pXLpQsalaaOhgBZBPzrBwJcqxIofRg30gT8l4ok\n\tlue+p62vO6fdafP5hqB+k+BxC0igzOZQQe80JF0zyF+jGr8h1z9gdZPEVp8RNh8dlyiY\n\tYi6vTZmuMoER5hCHWkJLQ3CBl0CCtuBBFqay6js43g2f+oKl+7BHyjka7fgyRj2uko2E\n\t3coYNYd/Ks725rUMOrIPYOsdABd8xjIZkEgEfoAHsXiqzUTFpW57ow1siI0CLpPHRewW\n\tiFlA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Sy1476eS\"; 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=8MNvkO447TQABbMc0LlAq8P6s+MCZZx+lmqdO0CLVRk=;\n\tb=XkuQc3nIp51LpnverZVz8p7uFXt9Q/+ZMq+K0ZuCf5Fk15Vgmb30F2bUTyR3dt5Erq\n\t0S7R2CyHZ5sqDEryZMmw/ptouC2dqT7d55YgZ1Pdg/zO29s7vvts35tOk159HvgeBqfh\n\tcIGTh1StdLTWmNBYeSv62ioqeolCzXnDJwRAkeXJDxa7+udh3zYXhnQB4d9Vm0a6DVrp\n\t6nnph6Vz0N1PDMF7Nd6+XL4UBoZj1j/nPqJ8/biUFNSbIWXn1OHpqIzzYC1RD84vcEK2\n\tLGfH9HZbEIHeZVsPGb6bTTDb+DHLNPMlvb8uPnne+1fXiOR8oGNHS3pPXaz9jHfARNSN\n\t5GQA==", "X-Gm-Message-State": "AOJu0Yxe0RkTiXxNyS6VJFFWuoH5KsKDW3K5A3CTpYvt3qyEx/jaOR03\n\tb0jsk4JDqImUCaksj/59Pd4HGwbjsuLkA4Q2ODl8kQ==", "X-Google-Smtp-Source": "AGHT+IFSPmOsHRHyZ09FPi8s5EAmI4Fgme0XA37LlW2Vd+LDDZo+9zCMDIrNkKDgO7hW5R4sxJ/Iig==", "X-Received": "by 2002:a17:906:f806:b0:a0e:3a12:a62a with SMTP id\n\tkh6-20020a170906f80600b00a0e3a12a62amr8461100ejb.59.1701354344643; \n\tThu, 30 Nov 2023 06:25:44 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 30 Nov 2023 14:25:32 +0000", "Message-Id": "<20231130142534.2075-5-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 4/6] libcamera: control: Add vendor\n\tcontrol id range reservation", "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 a new control_ranges.yaml file that is used to reserve control id\nranges/offsets for libcamera and vendor specific controls. This file is\nused by the gen-controls.py script to generate control id values for\neach control.\n\nDraft controls now have a separate range from core libcamera controls,\nbreaking the existing numbering behaviour.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/meson.build | 3 ++-\n src/libcamera/control_ranges.yaml | 18 ++++++++++++++++++\n src/libcamera/meson.build | 4 +++-\n utils/gen-controls.py | 15 ++++++++++++---\n 4 files changed, 35 insertions(+), 5 deletions(-)\n create mode 100644 src/libcamera/control_ranges.yaml", "diff": "diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex c46a4e701ac4..a2bb5d163ece 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -74,12 +74,13 @@ foreach mode, entry : controls_map\n endif\n \n template_file = files(outfile + '.in')\n+ ranges_file = files('../../src/libcamera/control_ranges.yaml')\n control_headers += custom_target(header + '_h',\n input : input_files,\n output : outfile,\n command : [gen_controls, '-o', '@OUTPUT@',\n '--mode', mode, '-t', template_file,\n- '@INPUT@'],\n+ '-r', ranges_file, '@INPUT@'],\n install : true,\n install_dir : libcamera_headers_install_dir)\n endforeach\ndiff --git a/src/libcamera/control_ranges.yaml b/src/libcamera/control_ranges.yaml\nnew file mode 100644\nindex 000000000000..d42447d04647\n--- /dev/null\n+++ b/src/libcamera/control_ranges.yaml\n@@ -0,0 +1,18 @@\n+# SPDX-License-Identifier: LGPL-2.1-or-later\n+#\n+# Copyright (C) 2023, Raspberry Pi Ltd\n+#\n+%YAML 1.1\n+---\n+# Specifies the control id ranges/offsets for core/draft libcamera and vendor\n+# controls and properties.\n+ranges:\n+ # Core libcamera controls\n+ libcamera: 0\n+ # Draft designated libcamera controls\n+ draft: 10000\n+ # Raspberry Pi vendor controls\n+ rpi: 20000\n+ # Next range starts at 30000\n+\n+...\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 6d9902e6ffd1..45f63e932e4f 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -141,11 +141,13 @@ foreach mode, input_files : controls_mode_files\n template_file = files('property_ids.cpp.in')\n endif\n \n+ ranges_file = files('control_ranges.yaml')\n control_sources += custom_target(mode + '_cpp',\n input : input_files,\n output : mode + '_ids.cpp',\n command : [gen_controls, '-o', '@OUTPUT@',\n- '--mode', mode, '-t', template_file, '@INPUT@'])\n+ '--mode', mode, '-t', template_file,\n+ '-r', ranges_file, '@INPUT@'])\n endforeach\n \n libcamera_sources += control_sources\ndiff --git a/utils/gen-controls.py b/utils/gen-controls.py\nindex 2a633cc0aba9..8e592148af3d 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -239,7 +239,7 @@ ${vendor_controls_str}\n }\n \n \n-def generate_h(controls, mode):\n+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@@ -254,8 +254,10 @@ def generate_h(controls, mode):\n \n vendor = 'draft' if ctrl.is_draft else ctrl.vendor\n if vendor not in ctrls:\n+ if vendor not in ranges.keys():\n+ raise RuntimeError(f'Control id range is not defined for vendor {vendor}')\n+ id_value[vendor] = ranges[vendor] + 1\n ids[vendor] = []\n- id_value[vendor] = 1\n ctrls[vendor] = []\n \n # Core and draft controls use the same ID value\n@@ -341,6 +343,8 @@ def main(argv):\n help='Mode of operation')\n parser.add_argument('--output', '-o', metavar='file', type=str,\n help='Output file name. Defaults to standard output if not specified.')\n+ parser.add_argument('--ranges', '-r', type=str, required=True,\n+ help='Control id range reservation file.')\n parser.add_argument('--template', '-t', dest='template', type=str, required=True,\n help='Template file name.')\n parser.add_argument('input', type=str, nargs='+',\n@@ -348,6 +352,11 @@ def main(argv):\n \n args = parser.parse_args(argv[1:])\n \n+ ranges = {}\n+ with open(args.ranges, 'rb') as f:\n+ data = open(args.ranges, 'rb').read()\n+ ranges = yaml.safe_load(data)['ranges']\n+\n controls = []\n for input in args.input:\n with open(input, 'rb') as f:\n@@ -359,7 +368,7 @@ def main(argv):\n if args.template.endswith('.cpp.in'):\n data = generate_cpp(controls)\n elif args.template.endswith('.h.in'):\n- data = generate_h(controls, args.mode)\n+ data = generate_h(controls, args.mode, ranges)\n else:\n raise RuntimeError('Unknown template type')\n \n", "prefixes": [ "libcamera-devel", "v4", "4/6" ] }