Show a patch.

GET /api/patches/19219/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 19219,
    "url": "https://patchwork.libcamera.org/api/patches/19219/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19219/",
    "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-5-naush@raspberrypi.com>",
    "date": "2023-11-21T14:53:48",
    "name": "[libcamera-devel,v2,4/6] libcamera: control: Add vendor control id range reservation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "bbd42d34795ad33b477913b0a6f3967a70bf326a",
    "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/19219/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/19219/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19219/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 6AD54C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Nov 2023 14:54:03 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 25773629C6;\n\tTue, 21 Nov 2023 15:54:03 +0100 (CET)",
            "from mail-lj1-x233.google.com (mail-lj1-x233.google.com\n\t[IPv6:2a00:1450:4864:20::233])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A67B2629C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Nov 2023 15:54:00 +0100 (CET)",
            "by mail-lj1-x233.google.com with SMTP id\n\t38308e7fff4ca-2c503dbe50dso72736941fa.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Nov 2023 06:54:00 -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.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 21 Nov 2023 06:53:58 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1700578443;\n\tbh=Lz7bqg4woco1wsI1dg+O/x/h8wf+lZqPik1AGilmbFQ=;\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=AfZa15WCYZ0AMzK+NjSMRO3szDUtTQcSnEe/PcZYcHERAPgE/MSzEFyTwhn190/O3\n\tD4JzxZopLGei6Fka20Q9YdhLA7Ps/6jLY0Vv2c4vDrxxQt2EbTbx8xr/leDz1PMhjc\n\tff7KTYk7bRbYqyo0jmO/ql38xgnvF/bQ4rd1PdMcliq8fKlQvYV+bW5V3Plsubo7Se\n\tbOIxC1FIfUayYGnH0DizfwK3PzKAncue75IrKvSABCXNBsuXrYOD9psRtxadbUM05Y\n\t0EEkD8BSw7ertY0NQaxchT/tY9O2nin8z78S9rpoULHzvSVkzSsRpQXCQUQGqW7tgg\n\tZ/UG4xXCHUotw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1700578439; x=1701183239;\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=+se7h2b/3Pvt4IUgxQJOXLlI94EI05IQfuZIl3Zu+sI=;\n\tb=E0UdMOQi6s06A4NElxKIIccnp1JqQxRvCD27V8SUpt2NEotgTPZug7amJvTDkrX6wC\n\tR3CRQT5ZqptutneHpr4yMC0MtYt2LP+CdWErw824EHUS2tRGwaTGuRxGstAHjEgoE7nw\n\tRBlhvTsh/2rfDzu86PSEXgLjFWi0YTf40J6LkpM+ZE1AsmwSsx/0DnWJOa6wj4oYQaWH\n\tsDhAtKTx95ffgQCqWPl4bm45ENWBfxef46kdyW4sfb62uX4qeaxFOxcMxG8E5OlNHRPv\n\tpBg24KwGSkI+hOTRCVxqCr4Zcor4UDtv2E3QqZN/UAaet1d18ZmxA5oJlPTQ/YJFIxWx\n\tiWwA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"E0UdMOQi\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1700578439; x=1701183239;\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=+se7h2b/3Pvt4IUgxQJOXLlI94EI05IQfuZIl3Zu+sI=;\n\tb=J/cYaBXhDjqMcwt0UQM1yHUN5Ox5DgEpYYREvyPCRFQWA00HjAbFUUO6NHnWVun1HM\n\tv/kf8MTpcXVs+tGM/3iOV1b5ynWpmuh61hOfHmeFeO2E+nSVJMnVOXnSwrr1LdGnz3QN\n\tlCHe4NF6P6R1XTnUlD5sTCmTPEtCgnbSZCcJ7jKYRU+grhUNg8kGcuU7Cgth97P0SvHu\n\tjXasgJPkEJ4hLPAtziOkyVXUqM/i1UWlNMtq2p/LJRYmULNyV/MG+J+SVDb8yZW7rj8D\n\tJFbtyPefdP2Om4jycfT/+6RcutoQkwoO338m3Ho2qbze7fI05/bjfuyKEytZUJ8zk6v1\n\t998Q==",
        "X-Gm-Message-State": "AOJu0Yz/4vslZaUeRHiHbDqwcJBaLJXjyIs+7KSwDgS3PfyYff2BIwi5\n\tfMk5dJrfA0OX25bhKJozk2kihm4OOJkPJ+6emKWWOg==",
        "X-Google-Smtp-Source": "AGHT+IGGfldFshS3FwXUyM8TM/WvZvbX/Kpkh4iF+gHzJ35D7TGr+uKSAF60MPAHI4B+NhC9HyO0PA==",
        "X-Received": "by 2002:a2e:9ec4:0:b0:2c8:7192:817 with SMTP id\n\th4-20020a2e9ec4000000b002c871920817mr6337638ljk.15.1700578439510; \n\tTue, 21 Nov 2023 06:53:59 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 21 Nov 2023 14:53:48 +0000",
        "Message-Id": "<20231121145350.5956-5-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 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>",
        "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>\n---\n include/libcamera/meson.build     |  4 +++-\n src/libcamera/control_ranges.yaml | 18 ++++++++++++++++++\n src/libcamera/meson.build         |  4 +++-\n utils/gen-controls.py             | 15 ++++++++++++---\n 4 files changed, 36 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 54123c5b858d..6cac385fdee4 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -83,11 +83,13 @@ foreach header, mode : control_source_files\n     endforeach\n \n     template_file = files(header + '.h.in')\n+    ranges_file = files('../../src/libcamera/control_ranges.yaml')\n     control_headers += custom_target(header + '_h',\n                                      input : input_files,\n                                      output : header + '.h',\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                                      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..150ae7fa5efd\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 libcamera and vendor specific\n+# controls.\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 7eb26ccbb7f5..303eee84a77e 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -142,11 +142,13 @@ foreach source, mode : control_source_files\n     endforeach\n \n     template_file = files(source + '.cpp.in')\n+    ranges_file = files('control_ranges.yaml')\n     control_sources += custom_target(source + '_cpp',\n                                      input : input_files,\n                                      output : source + '.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 d7862142b8c1..9eede8940f24 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -257,7 +257,7 @@ ${vendor_controls_map}\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@@ -272,8 +272,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@@ -365,8 +367,15 @@ def main(argv):\n                         help='Template file name.')\n     parser.add_argument('--mode', type=str, required=True, choices=['controls', 'properties'],\n                         help='Mode of operation')\n+    parser.add_argument('-r', dest='ranges', type=str, required=True,\n+                        help='Control id range reservation file.')\n     args = parser.parse_args(argv[1:])\n \n+    ranges = []\n+    if args.ranges:\n+        data = open(args.ranges, 'rb').read()\n+        ranges = yaml.safe_load(data)['ranges']\n+\n     controls = []\n     for input in args.input:\n         data = open(input, 'rb').read()\n@@ -377,7 +386,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",
        "v2",
        "4/6"
    ]
}