Show a patch.

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

{
    "id": 19237,
    "url": "https://patchwork.libcamera.org/api/patches/19237/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19237/",
    "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-5-naush@raspberrypi.com>",
    "date": "2023-11-24T12:37:10",
    "name": "[libcamera-devel,v3,4/7] libcamera: control: Add vendor control id range reservation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a4fa882c5fe551828d9cbf4913284130c95fbcc1",
    "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/19237/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/19237/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19237/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 F0F9AC328F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Nov 2023 12:37:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8FAAB629CB;\n\tFri, 24 Nov 2023 13:37:24 +0100 (CET)",
            "from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com\n\t[IPv6:2a00:1450:4864:20::22f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DE58629C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Nov 2023 13:37:21 +0100 (CET)",
            "by mail-lj1-x22f.google.com with SMTP id\n\t38308e7fff4ca-2c876e44157so22649141fa.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Nov 2023 04:37:21 -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.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 24 Nov 2023 04:37:19 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1700829444;\n\tbh=e+1S4cqQKkHtFDecfrZTtIrLbNKlOg57Jl+Kb5mGX84=;\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=OPG3ODJrZY32vaK960nuiUz/qG0c44ZdsejT3Vv/A8T9TFy5CQTYaPhxyPPiIStmB\n\t91TDsYZ2SAIokBKapOBD20ObOYAglBiBci22lOA3b9Vdf2E5A+wd1Vbea0PrctyJVD\n\tYymDFy5ZsJqJT6ivbkVSqX/ienzq6uZUGv8tUs03SDf14CV4FLDSjWIbFG5NwE/dTz\n\tPHSJZmUygVLXXeX6jM5KssoA7r1GBTx7bCmlOYFAXjtRkUguO6Kpvo7FwePiC3VbjP\n\tn6sAmAdJZTKqUAfoQupqNPoCk0Jy8pVllxV1o8D7rmzj/v+jdndY2YY/kRekz/tlUN\n\tcwG4ERzaRO+QQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1700829440; x=1701434240;\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=7xQ3mT2fqmA7FxGo2hVa8X1pmLX80pzAqTF9y+yBgRw=;\n\tb=Tc94LqiC/rFD8BW3QuNTbJuP9aRAS47fVkC5GoaYuwHzpI1bYBFZ7N20SVUERPuerk\n\tvN6Kf2SXztJm9Hx6kbkUb4+TZtfmBnT0fXi/SGxcMT52IiMTKfD1yxIlsi7Dmbnn4ca3\n\tnq59ga35YsQ/J74Dj+TS/9MvCxhyLjtkpmHdfylV483Tqza10nd42K0+cnfJMa69Z7H7\n\tVbf6rVxD82Df+Bc6M7XfNnpDkjW8uPgS+ikohmAX6CTVrPJU7xmKlJBh3wBpwddke1d/\n\tZcbXZ8w9uzEDGOUPkcWuxyPTraGlmLiwQ9ewwYaEN+v+qaTyvo4W0h/JI9iAWdoBXH7R\n\tPS+w=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Tc94LqiC\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1700829440; x=1701434240;\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=7xQ3mT2fqmA7FxGo2hVa8X1pmLX80pzAqTF9y+yBgRw=;\n\tb=AcFNSfc1MFnU0zh+DCyZvCZc4KAq76M+7Yp3PqF7P1+7GBAvkHWj+g+JU0wbnPDp1P\n\tqAU/Izm27YSss/aKeHJa5JYZ0vy15IDrC6JtR6CoI7ZMQfPECI6VHwLPI5M79dmHXPZn\n\tedqxtFf6pixCNLh6wDfcuCCELOJKJd2d1gjgQOBxZY8N9hMf0KobX9wDDet9nplQXV/r\n\tCB5rkDUfuVwszU9enmO2q3C+ABPocCaJdCm0ugXEdSMAdV5rd/i88WA4wNgRmXaHH4tO\n\tQZbLlBFfO23PzEhVFAarGEgs39fa6Dc/MpejpuxZ6mwFjIqzmaeZfsfrKCKVC+GocdTh\n\tnCTA==",
        "X-Gm-Message-State": "AOJu0Yy+nbgsp4vJF7LVpWDv16eiO+qy/QODOJpaaq+Jp6izIpwgwnAm\n\tgzVxTITUwtCt+ON1MYtqHeqWUOLeAc0iemTIyK2pxQ==",
        "X-Google-Smtp-Source": "AGHT+IGoJMmTDjSfyZaQtOdqRxQKD10X9HFYeba4TAS1fFG+Z4HNQNApwfu6iu06s4XgMSBckrh/xg==",
        "X-Received": "by 2002:a2e:9410:0:b0:2c8:74f6:8446 with SMTP id\n\ti16-20020a2e9410000000b002c874f68446mr2114231ljh.12.1700829440289; \n\tFri, 24 Nov 2023 04:37:20 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 24 Nov 2023 12:37:10 +0000",
        "Message-Id": "<20231124123713.22519-5-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 4/7] 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>\nReviewed-by: Laurent Pinchart <laurent.pinchart@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             | 14 ++++++++++----\n 4 files changed, 33 insertions(+), 6 deletions(-)\n create mode 100644 src/libcamera/control_ranges.yaml",
    "diff": "diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex a763c8ff4344..79187d3fdfc9 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -76,12 +76,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 30c58f35473c..04c63098b19b 100755\n--- a/utils/gen-controls.py\n+++ b/utils/gen-controls.py\n@@ -236,7 +236,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@@ -251,8 +251,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@@ -338,13 +340,17 @@ 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                         help='Input file name.')\n-\n     args = parser.parse_args(argv[1:])\n \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@@ -355,7 +361,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",
        "v3",
        "4/7"
    ]
}