{"id":27057,"url":"https://patchwork.libcamera.org/api/1.1/patches/27057/?format=json","web_url":"https://patchwork.libcamera.org/patch/27057/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260626120041.627376-2-naush@raspberrypi.com>","date":"2026-06-26T11:54:01","name":"[1/3] utils: codegen: gen-formats: Resolve Broadcom SAND modifiers","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8d3794def37cad05780c7ccc1811af3ba6ea257f","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27057/mbox/","series":[{"id":6021,"url":"https://patchwork.libcamera.org/api/1.1/series/6021/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6021","date":"2026-06-26T11:54:00","name":"Add NV12MT_COL128 8/10-bit pixel formats","version":1,"mbox":"https://patchwork.libcamera.org/series/6021/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27057/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27057/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 58BD0C3301\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 26 Jun 2026 12:00:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 524BA658FA;\n\tFri, 26 Jun 2026 14:00:50 +0200 (CEST)","from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 24C75658F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 14:00:48 +0200 (CEST)","by mail-wm1-x335.google.com with SMTP id\n\t5b1f17b1804b1-49254e68922so230735e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Jun 2026 05:00:48 -0700 (PDT)","from naush-dell.pitowers.org\n\t([2a00:1098:3142:1f:9337:c770:257e:d321])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4926c02088dsm39163015e9.0.2026.06.26.05.00.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 26 Jun 2026 05:00:47 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"PZaBmfJ4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1782475248; x=1783080048;\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:content-type;\n\tbh=YJ2j2YFI2gtwpHQ6GxpM81KxZWVYfpTifYHhAI9CDqg=;\n\tb=PZaBmfJ4KMhYMMTqAeCjb5eOmRu/pbhiUJX0Xj1E8DmulYspeb0IkkOj+HUdNT/dEo\n\t2tZOY1HC/r6sNctxRttxg4Y/qp/2kiBw2B7Ok7u//VxqNoQ9eEFeTwFR0Z5W187upMEs\n\tDBJC6gmuUq66lEdmo+h0/x2tiQqqDXdy4PXMjsE/q316rzfR+JzxDtfB02FnMI9LaO/O\n\tY6qpYV6rniEvavAbsFvC52O0Mwsxa3ckWuIjQDdn1WV1NUcqQKmmH3yugEoOCxNbLk4Q\n\tMcVpPPTvcXC1gbIvFrP4nM2qJkHEXtNlHLMr5AH41RRGMhvejd+7VHPMKk5R10/8TDTj\n\tst2A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782475248; x=1783080048;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to:content-type;\n\tbh=YJ2j2YFI2gtwpHQ6GxpM81KxZWVYfpTifYHhAI9CDqg=;\n\tb=H72l54l46WykvSRu85dN5I5NyMyyvAARp0wKN0I248yVdOz76FdbbZUmg+d1xlxxf7\n\tub0mDF1fZyAuspfoR2IbCaD+AGwdxTN14F6B8VHoYVDY/N6MwS1a15slmrbNJNdUEYvg\n\t46VueLtzCcsLsxZ2CgJX/9F8m03eBFrCGfgXapxsizxRs+dVgACtH793aRZezlKKSRxg\n\t+FrrP5mux4q9nNDBF443UGEvQqfTBvRmHZJjSEbe/OIdKVqr3KbFJiyPVKNChjUnSGWw\n\tEyqUWeZ42AutMH4/iCkXcxNsDLrO9AIf0hDsOjl/sRxWo8bPeqVV04HAfFQqtCWCFop3\n\tjXag==","X-Gm-Message-State":"AOJu0YxuIiDyFHFefkbkRc0v/fWyuPXAhMZelHBAkvnWCOw5yi44cHCf\n\tNVVRbidYUOKEwV1cnTbAjLW+FsLjP5c/dcAC3jEyJ1hxvV5KtdO2hUAFLztqtB6yp0iTnVm/wOb\n\tVpP74khw=","X-Gm-Gg":"AfdE7clau2W7ZzlpnCZOXoMwPaqebuXFqF3uoBBiu0MNXFAem6vsNrngDiwj/VUMs/2\n\tqvyIYvUm1bF1DZfEDF+zYCcNoihUuzi5su2+z1Gl6CmqJQQJWCUdM5kPypfMccBCr4T2MoZ2gFY\n\tdzMlqOrZdoz/DnK1GWH0Go+LqqzmFFzBbB0EyxbAVJeAXL8VSivd8dLZvG6LF4NNjIZLq1E0DCX\n\tk3wtWWsZN7zok/EsLzz0kMwX9vkMnTsGeyLHxL78R3SRDrDD1jjfDv9XBBSWLAXYFhMlcLO5ylO\n\twLNfRTSCj8yWZCo3naYC897ZRrv74eWDTE2qKe0YdJtnj8FIgGmlWpFgD6UJLM+TMATbk2broKa\n\tEIidEvwZzAZTW2ECibjqEGwLHO6ErI044NWNW3INgKLW+6A2dF1nRvo6XDH88QaT5c42M3BC8QG\n\tIBxMVWq1Bn38IAarmPFlr2H/UWMdKDPMXq3lyjdQZVOeiYi1Gk+6ShsGdlRk4cUTjN/KnmDqOxu\n\tgJivMa9XCgsafvHEy0iD/vyEL8y/fuMo2NKtNnFyjbO53Pzh4zOgXxziHmd9W/42Fr3g+RxRJUX\n\tPITk3MY0TN57hl3FFV3SLgHkxR8+cIQ=","X-Received":"by 2002:a05:600c:83c4:b0:492:6f90:d92a with SMTP id\n\t5b1f17b1804b1-4926f90d94bmr5510385e9.4.1782475247549; \n\tFri, 26 Jun 2026 05:00:47 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH 1/3] utils: codegen: gen-formats: Resolve Broadcom SAND\n\tmodifiers","Date":"Fri, 26 Jun 2026 12:54:01 +0100","Message-ID":"<20260626120041.627376-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260626120041.627376-1-naush@raspberrypi.com>","References":"<20260626120041.627376-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The Broadcom SAND (coloumn mode) modifiers are defined through the\nfourcc_mod_broadcom_code() column-height helper rather than a plain\nfourcc_mod_code(), so the generator script cannot not resolve them.\n\nCollapse line continuations and match the helper form so formats may\nreference the DRM_FORMAT_MOD_BROADCOM_SAND* modifiers.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n utils/codegen/gen-formats.py | 17 ++++++++++++++++-\n 1 file changed, 16 insertions(+), 1 deletion(-)","diff":"diff --git a/utils/codegen/gen-formats.py b/utils/codegen/gen-formats.py\nindex 740790e8f1a6..add04558f65f 100755\n--- a/utils/codegen/gen-formats.py\n+++ b/utils/codegen/gen-formats.py\n@@ -18,13 +18,22 @@ class DRMFourCC(object):\n     format_regex = re.compile(r\"#define (DRM_FORMAT_[A-Z0-9_]+)[ \\t]+fourcc_code\\(('.', '.', '.', '.')\\)\")\n     mod_vendor_regex = re.compile(r\"#define DRM_FORMAT_MOD_VENDOR_([A-Z0-9_]+)[ \\t]+([0-9a-fA-Fx]+)\")\n     mod_regex = re.compile(r\"#define ([A-Za-z0-9_]+)[ \\t]+fourcc_mod_code\\(([A-Z0-9_]+), ([0-9a-fA-Fx]+)\\)\")\n+    # Broadcom SAND modifiers are defined indirectly via a _COL_HEIGHT(v) helper\n+    # that wraps fourcc_mod_broadcom_code(<code>, v) (which injects the BROADCOM\n+    # vendor). Match that helper, strip _COL_HEIGHT to recover the convenience\n+    # macro name, and use <code> as the value - valid as the convenience macro is\n+    # the height-0 case, which contributes nothing to it.\n+    mod_brcm_regex = re.compile(r\"#define (DRM_FORMAT_MOD_BROADCOM_SAND[0-9]+)_COL_HEIGHT\\(v\\)\"\n+                                r\"[ \\t]+fourcc_mod_broadcom_code\\(([0-9]+), v\\)\")\n \n     def __init__(self, file):\n         self.formats = {}\n         self.vendors = {}\n         self.mods = {}\n \n-        for line in file:\n+        # Collapse line continuations so multi-line macros match on one line.\n+        lines = re.sub(r'\\\\[ \\t]*\\n', ' ', file.read()).splitlines()\n+        for line in lines:\n             match = DRMFourCC.format_regex.match(line)\n             if match:\n                 format, fourcc = match.groups()\n@@ -43,6 +52,12 @@ class DRMFourCC(object):\n                 self.mods[mod] = (vendor, int(value, 0))\n                 continue\n \n+            match = DRMFourCC.mod_brcm_regex.match(line)\n+            if match:\n+                mod, code = match.groups()\n+                self.mods[mod] = ('BROADCOM', int(code))\n+                continue\n+\n     def fourcc(self, name):\n         return self.formats[name]\n \n","prefixes":["1/3"]}