{"id":24276,"url":"https://patchwork.libcamera.org/api/1.1/patches/24276/?format=json","web_url":"https://patchwork.libcamera.org/patch/24276/","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":"<20250901092320.44615-2-barnabas.pocze@ideasonboard.com>","date":"2025-09-01T09:23:20","name":"[v1,2/2] utils: codegen: gen-formats.py: Fix big endian formats","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7105c0ca10218eb8fa9339dbbea391dcdc2ed91b","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24276/mbox/","series":[{"id":5418,"url":"https://patchwork.libcamera.org/api/1.1/series/5418/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5418","date":"2025-09-01T09:23:19","name":"[v1,1/2] utils: codegen: gen-formats.py: Use jinja","version":1,"mbox":"https://patchwork.libcamera.org/series/5418/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24276/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24276/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 3AB56BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Sep 2025 09:23:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75E4669333;\n\tMon,  1 Sep 2025 11:23:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EDDC46931D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Sep 2025 11:23:23 +0200 (CEST)","from pb-laptop.local (185.221.143.232.nat.pool.zt.hu\n\t[185.221.143.232])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B5D3BF52\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Sep 2025 11:22:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wUURHAgk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1756718536;\n\tbh=JYdj6/BAO7KfMuGdl9thg4EuFbQ99vcs6KN7hhGUGEY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=wUURHAgknIKRTxJc7pMMl+z/SJZ4hYAG5i6FOVegxhP5oROFqspYYps3WYXGKcZct\n\tBikSK8TaTsvPgbRIVU2GvDOgjeiB5nVGSo8C0D7zEigyztHcwSk1miLYJJcvG6n1gn\n\tvGO7l8d/oiHp2USNMmvmJSXRXaKQOgOTZ9X7QXm8=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v1 2/2] utils: codegen: gen-formats.py: Fix big endian\n\tformats","Date":"Mon,  1 Sep 2025 11:23:20 +0200","Message-ID":"<20250901092320.44615-2-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20250901092320.44615-1-barnabas.pocze@ideasonboard.com>","References":"<20250901092320.44615-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","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":"First there is a single big endian format defined in `formats.yaml`: RGB565_BE.\nHowever, while the yaml file specifies \"big_endian: true\", the python script\nlooks for a key named \"big-endian\". Causing `RGB565{,_BE}` both to be the same.\n\nSecond, the python script simply appends \" | DRM_FORMAT_BIG_ENDIAN\" to the\nfourcc of the format. However, there is no definition of that macro is\navailable in the only user, `formats.h.in`.\n\nFix the first one by checking for \"big_endian\" in the script as well, and\nfix the second one by defining a constant with the same value and using that.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nFixes: 7c496f1c54dd58 (\"utils: gen-formats: Support big-endian DRM formats\")\n---\n include/libcamera/formats.h.in | 4 +++-\n utils/codegen/gen-formats.py   | 3 +--\n 2 files changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/include/libcamera/formats.h.in b/include/libcamera/formats.h.in\nindex 5ff9c3bf4..c821ffbb1 100644\n--- a/include/libcamera/formats.h.in\n+++ b/include/libcamera/formats.h.in\n@@ -33,10 +33,12 @@ constexpr uint64_t __mod(unsigned int vendor, unsigned int mod)\n \t       (static_cast<uint64_t>(mod) << 0);\n }\n \n+constexpr uint32_t kDrmFormatBigEndian = uint32_t(1) << 31; /* DRM_FORMAT_BIG_ENDIAN */\n+\n } /* namespace */\n \n {% for f in formats %}\n-constexpr PixelFormat {{f.name}}(__fourcc({{f.fourcc}}), __mod({{f.mod}}));\n+constexpr PixelFormat {{f.name}}(__fourcc({{f.fourcc}}){{ ' | kDrmFormatBigEndian' if f.big_endian }}, __mod({{f.mod}}));\n {%- endfor %}\n \n } /* namespace formats */\ndiff --git a/utils/codegen/gen-formats.py b/utils/codegen/gen-formats.py\nindex 872f3fe34..01adf5e1f 100755\n--- a/utils/codegen/gen-formats.py\n+++ b/utils/codegen/gen-formats.py\n@@ -59,13 +59,12 @@ def generate_formats(formats, drm_fourcc):\n     for format in formats:\n         name, format = format.popitem()\n         fourcc = drm_fourcc.fourcc(format['fourcc'])\n-        if format.get('big-endian'):\n-            fourcc += '| DRM_FORMAT_BIG_ENDIAN'\n \n         data = {\n             'name': name,\n             'fourcc': fourcc,\n             'mod': '0, 0',\n+            'big_endian': format.get('big_endian') == True,\n         }\n \n         mod = format.get('mod')\n","prefixes":["v1","2/2"]}