{"id":27074,"url":"https://patchwork.libcamera.org/api/patches/27074/?format=json","web_url":"https://patchwork.libcamera.org/patch/27074/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20260629094216.747340-2-naush@raspberrypi.com>","date":"2026-06-29T08:36:40","name":"[v2,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/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27074/mbox/","series":[{"id":6023,"url":"https://patchwork.libcamera.org/api/series/6023/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6023","date":"2026-06-29T08:36:39","name":"Add NV12MT_COL128 8/10-bit pixel formats","version":2,"mbox":"https://patchwork.libcamera.org/series/6023/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27074/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27074/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 B02C0C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2026 09:42:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0996765F13;\n\tMon, 29 Jun 2026 11:42:28 +0200 (CEST)","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 4510565F10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 11:42:25 +0200 (CEST)","by mail-wm1-x331.google.com with SMTP id\n\t5b1f17b1804b1-490d6730461so2806885e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 02:42:25 -0700 (PDT)","from naush-dell.pitowers.org\n\t([2a00:1098:3142:1f:496e:3dec:bc78:809f])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-49268f700c0sm345499125e9.0.2026.06.29.02.42.24\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Jun 2026 02:42:24 -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=\"VPd9/qTJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1782726145; x=1783330945;\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=VPd9/qTJOZXgDBbUr2DHpIVmHimpmE4AiNGHi1R7ri4Psbe0RVYbAmja1ThvlEuCeW\n\tFNfCBD6+G8FeWfQHdkCZBf89Vs4b3ESgeQsexBMXEZSkIG6HuEQqmDP03oBlbjpe8xXJ\n\ttIrgEpiIU7hz6PjvuETImnd+CBc18k1kknLEMCigkY7kdZ1QOvvo2qUo/+gZTGcv+aQL\n\tP2vb1EFivoBLyxpBK45wRiBNEmDIoXepWS+cW4Z1Hc9znMQSn5F6MBvfWZSC2qaP5Byc\n\t9+zyGIvfwzb6np2RxqZR01/1+8xe4awKYMY1ZGvaQ5QvS5IV22JHqaCuknear7UCzDpt\n\tXJbQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1782726145; x=1783330945;\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=mafuyTjKe8Ejc7zn/Ysz8mrC404byhTsPg+xtmMj4qoa9eHeMhlEASm9xxA3o7Z04U\n\tQgAqfDCv10kxYS1BD4EigTWVLWX6pHLVFoYj443yvb5wkYga1Z1/TUBzK8qCcVtBcvGf\n\txkmERBOeOfP1C1XYF74oNH9H6i2TfVS8BCPXdL4JCLYF/2TQ0n+xVVBxUNaw6EDdycp6\n\tXJTW1Ja7KEQZjw1mYFZXIUv6pDuTtec8uci3RvVgxHHDCpGdsBDsw96qBfjDCtvNgCKq\n\tngYYZsdxZRl1DjTOu49bb3ln2RpV4G/xkgb35m0ljnIunh2XJq65av65o4vVnjlyfZUG\n\tG2fg==","X-Gm-Message-State":"AOJu0YxFVOw1ZUG0XvZ6oXHq6K9O/YyErpG4FgAx9bbh4XtEDYcMiOim\n\tBCZEy1m0gMZ4Vu9l8Ury5sex1Od5evhmmdt5K2TnqKneR4YFNaQrIfWoGzGHTAfhMMVLfc1sp0f\n\tXBXkLIXI=","X-Gm-Gg":"AfdE7cnEE9ld6/1Xtce8uRaguUwN6JTqw3W/ntx9NXUmES2uM6lnGvpc1LAasIXq80c\n\twmPdDBhu3Sh7bl8KiNTQSkgREHIXl7HU0OEY2cRnuTsIjRJMn9oSVhk6L8q/eSdfewguqk5Wk5R\n\tAaRd9NXkDk8FPPpK3sy2cF4P8pufiNEhl4ATaw7JV6WOJjjnXRNxEv8LhjWQYPPXKhxMPV/jnHi\n\tDqQEeqBY7NJM7qfwBK9Xj4qOhYwZOxvKXNJvdvE5W6XpTU9oRUX4xWuYE0yUGmjCFtpgEEZVSpj\n\t0N1mPLACWcMDaW3hKjypJiLuaOr8GmmP+1K3N2pBqawruGKJr/r/xO0o94QscCC0BOjiuZHOvyO\n\tiWMaNGfyfsve9YkDZoKOWm1DCCxjgb9GLfsz5YgDbLo1GmZR7uOpWg6VhZ3Rew+ofcC4pL8s7Fj\n\tT5CXocoE1aVTyPE7NGbVMLGuAoregExPmA/+u1YeZ6b7DImjdghvR0HV0tujr1tsKUUNzNTgWgu\n\tA/taRYEwLtcJMrXbHaxMvrKbzC9bfgouDXhqOVBNIcTq9iDtJEQxAC/Xe0pnXqN7M80gZ8frUJr\n\tTSX4THhUg+tfhKutEClR","X-Received":"by 2002:a05:600d:117:b0:490:b4d4:5c16 with SMTP id\n\t5b1f17b1804b1-4926689f7a8mr85414975e9.8.1782726144693; \n\tMon, 29 Jun 2026 02:42:24 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH v2 1/3] utils: codegen: gen-formats: Resolve Broadcom SAND\n\tmodifiers","Date":"Mon, 29 Jun 2026 09:36:40 +0100","Message-ID":"<20260629094216.747340-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260629094216.747340-1-naush@raspberrypi.com>","References":"<20260629094216.747340-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":["v2","1/3"]}