Patch Detail
Show a patch.
GET /api/patches/26684/?format=api
{ "id": 26684, "url": "https://patchwork.libcamera.org/api/patches/26684/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26684/", "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": "<20260507213721.2137448-3-laurent.pinchart@ideasonboard.com>", "date": "2026-05-07T21:37:20", "name": "[2/3] ipa: libipa: v4l2_params: Enforce uint16_t for id_type underlying type", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "39130cb80cdc244fc8e77b2a097c4b7a8f005b94", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26684/mbox/", "series": [ { "id": 5921, "url": "https://patchwork.libcamera.org/api/series/5921/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5921", "date": "2026-05-07T21:37:19", "name": "ipa: libipa: Avoid code duplication in V4L2Params", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5921/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26684/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26684/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@ideasonboard.com>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": [ "parsemail@patchwork.libcamera.org", "kbingham@ideasonboard.com" ], "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1700FBDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 8 May 2026 08:21:48 +0000 (UTC)", "from monstersaurus.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net\n\t[86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 62967ABF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 8 May 2026 10:21:43 +0200 (CEST)", "from perceval.ideasonboard.com\n\tby perceval.ideasonboard.com with LMTP id 6IWcExYG/WkpahUA4E0KoQ\n\t(envelope-from <libcamera-devel-bounces@lists.libcamera.org>)\n\tfor <kbingham@ideasonboard.com>; Thu, 07 May 2026 23:37:26 +0200", "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\tby perceval.ideasonboard.com (Postfix) with ESMTPS\n\tid 2BD4E1121;\tThu, 7 May 2026 23:37:26 +0200 (CEST)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A40B56302A;\n\tThu, 7 May 2026 23:37:28 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E0BED62010\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 7 May 2026 23:37:25 +0200 (CEST)", "from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 263841121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 7 May 2026 23:37:21 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778228503;\n\tbh=9DBr/npHvLuQCKSmhepiDwkLsz+KI8uRPUPyBNSEsB8=;\n\th=From:To:Subject:Date:In-Reply-To:References:List-Id:\n\tList-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\tResent-From:Resent-To:From;\n\tb=WQBDHUjeGZ5TXKEf6u1tqkriNlqHSpgU+QTMzVJVmysi6h+0Lmy5WcPwMtPWSkGxD\n\tKF4LgjvMiyoReCV7w9Ip8O2t9rJytXUPKlc6YdjLF33EGuQguVi3s8EDid+ESCTuL0\n\t4xaNBn4hz/K500dz2zUiEOfW0ndX5DsVeQj78aeA=", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778189841;\n\tbh=9DBr/npHvLuQCKSmhepiDwkLsz+KI8uRPUPyBNSEsB8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=L4FewWsPQRHVofFIS9ULu1UiiLGGTRfKhjXHNC//v7LZuDgWI8X3c5oeE1Xws/STr\n\t2BzU/QeAegiCe/ADCajiBr/oux2Q4SsH/XcluebLZXOw1DgISurReDiXR2Awc/m/FP\n\t7uAh1ZlH/hZSCPz/umEc7MhAXmn7dyKhvSYUrJ7M=" ], "Authentication-Results": [ "perceval.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.a=rsa-sha256 header.s=mail header.b=L4FewWsP; dkim-atps=neutral", "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"L4FewWsP\";\tdkim-atps=neutral" ], "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH 2/3] ipa: libipa: v4l2_params: Enforce uint16_t for id_type\n\tunderlying type", "Date": "Fri, 8 May 2026 00:37:20 +0300", "Message-ID": "<20260507213721.2137448-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260507213721.2137448-1-laurent.pinchart@ideasonboard.com>", "References": "<20260507213721.2137448-1-laurent.pinchart@ideasonboard.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>", "X-TUID": "o8uLq+KHvbF1", "Resent-From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "Resent-To": "parsemail@patchwork.libcamera.org" }, "content": "The Linux kernel V4L2 extensible ISP parameters API uses a 16-bit\ninteger for the block type. We can therefore standardize on the same\ntype for the underlying type of the Traits::id_type enum class, as there\nwill never be more block types in libcamera than in the kernel. This\nwill help sharing code between different specializations of V4L2Params.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/libipa/v4l2_params.cpp | 2 +-\n src/ipa/libipa/v4l2_params.h | 11 +++++++----\n src/ipa/mali-c55/params.h | 4 +++-\n src/ipa/rkisp1/params.cpp | 3 ++-\n src/ipa/rkisp1/params.h | 4 +++-\n 5 files changed, 16 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/ipa/libipa/v4l2_params.cpp b/src/ipa/libipa/v4l2_params.cpp\nindex c2971f1caf28..d44a366a60b8 100644\n--- a/src/ipa/libipa/v4l2_params.cpp\n+++ b/src/ipa/libipa/v4l2_params.cpp\n@@ -217,7 +217,7 @@ namespace ipa {\n */\n \n /**\n- * \\fn V4L2Params::block(typename Traits::id_type type, unsigned int blockType, size_t blockSize)\n+ * \\fn V4L2Params::block(uint16_t type, unsigned int blockType, size_t blockSize)\n * \\brief Populate an ISP configuration block a returns a reference to its\n * memory\n * \\param[in] type The ISP block identifier enumerated by the IPA module\ndiff --git a/src/ipa/libipa/v4l2_params.h b/src/ipa/libipa/v4l2_params.h\nindex f400b37d74b5..4f84360ee449 100644\n--- a/src/ipa/libipa/v4l2_params.h\n+++ b/src/ipa/libipa/v4l2_params.h\n@@ -15,6 +15,7 @@\n \n #include <libcamera/base/log.h>\n #include <libcamera/base/span.h>\n+#include <libcamera/base/utils.h>\n \n namespace libcamera {\n \n@@ -72,6 +73,8 @@ template<typename Traits>\n class V4L2Params\n {\n public:\n+\tstatic_assert(std::is_same_v<std::underlying_type_t<typename Traits::id_type>, uint16_t>);\n+\n \tV4L2Params(Span<uint8_t> data, unsigned int version)\n \t\t: data_(data)\n \t{\n@@ -93,13 +96,13 @@ public:\n \t\tusing Type = typename Details::type;\n \t\tconstexpr auto kernelId = Details::blockType;\n \n-\t\tauto data = block(Id, kernelId, sizeof(Type));\n+\t\tauto data = block(utils::to_underlying(Id), kernelId, sizeof(Type));\n \t\treturn V4L2ParamsBlock<Type>(data);\n \t}\n \n protected:\n-\tSpan<uint8_t> block(typename Traits::id_type type,\n-\t\t\t unsigned int blockType, size_t blockSize)\n+\tSpan<uint8_t> block(uint16_t type, unsigned int blockType,\n+\t\t\t size_t blockSize)\n \t{\n \t\t/*\n \t\t * Look up the block in the cache first. If an algorithm\n@@ -144,7 +147,7 @@ protected:\n \tSpan<uint8_t> data_;\n \tsize_t used_;\n \n-\tstd::map<typename Traits::id_type, Span<uint8_t>> blocks_;\n+\tstd::map<uint16_t, Span<uint8_t>> blocks_;\n };\n \n } /* namespace ipa */\ndiff --git a/src/ipa/mali-c55/params.h b/src/ipa/mali-c55/params.h\nindex 64be68583ddb..3abcb7f94916 100644\n--- a/src/ipa/mali-c55/params.h\n+++ b/src/ipa/mali-c55/params.h\n@@ -7,6 +7,8 @@\n \n #pragma once\n \n+#include <stdint.h>\n+\n #include <linux/media/arm/mali-c55-config.h>\n #include <linux/videodev2.h>\n \n@@ -16,7 +18,7 @@ namespace libcamera {\n \n namespace ipa::mali_c55 {\n \n-enum class MaliC55Blocks {\n+enum class MaliC55Blocks : uint16_t {\n \tBls,\n \tAexpHist,\n \tAexpHistWeights,\ndiff --git a/src/ipa/rkisp1/params.cpp b/src/ipa/rkisp1/params.cpp\nindex 7040207c2655..b8abbdf6ec66 100644\n--- a/src/ipa/rkisp1/params.cpp\n+++ b/src/ipa/rkisp1/params.cpp\n@@ -128,7 +128,8 @@ Span<uint8_t> RkISP1Params::block(BlockType type)\n \t\treturn data_.subspan(info.offset, info.size);\n \t}\n \n-\treturn V4L2Params::block(type, info.type, info.size);\n+\treturn V4L2Params::block(utils::to_underlying(type), info.type,\n+\t\t\t\t info.size);\n }\n \n } /* namespace ipa::rkisp1 */\ndiff --git a/src/ipa/rkisp1/params.h b/src/ipa/rkisp1/params.h\nindex eddb37d5c000..8e3672ca8340 100644\n--- a/src/ipa/rkisp1/params.h\n+++ b/src/ipa/rkisp1/params.h\n@@ -7,6 +7,8 @@\n \n #pragma once\n \n+#include <stdint.h>\n+\n #include <linux/rkisp1-config.h>\n #include <linux/videodev2.h>\n \n@@ -16,7 +18,7 @@ namespace libcamera {\n \n namespace ipa::rkisp1 {\n \n-enum class BlockType {\n+enum class BlockType : uint16_t {\n \tBls,\n \tDpcc,\n \tSdg,\n", "prefixes": [ "2/3" ] }