From patchwork Thu May 7 21:37:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 26684 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1700FBDCBD for ; Fri, 8 May 2026 08:21:48 +0000 (UTC) Received: from monstersaurus.ideasonboard.com (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 62967ABF for ; Fri, 8 May 2026 10:21:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1778228503; bh=9DBr/npHvLuQCKSmhepiDwkLsz+KI8uRPUPyBNSEsB8=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Resent-From:Resent-To:From; b=WQBDHUjeGZ5TXKEf6u1tqkriNlqHSpgU+QTMzVJVmysi6h+0Lmy5WcPwMtPWSkGxD KF4LgjvMiyoReCV7w9Ip8O2t9rJytXUPKlc6YdjLF33EGuQguVi3s8EDid+ESCTuL0 4xaNBn4hz/K500dz2zUiEOfW0ndX5DsVeQj78aeA= Delivered-To: kbingham@ideasonboard.com Received: from perceval.ideasonboard.com by perceval.ideasonboard.com with LMTP id 6IWcExYG/WkpahUA4E0KoQ (envelope-from ) for ; Thu, 07 May 2026 23:37:26 +0200 Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by perceval.ideasonboard.com (Postfix) with ESMTPS id 2BD4E1121; Thu, 7 May 2026 23:37:26 +0200 (CEST) Authentication-Results: perceval.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=L4FewWsP; dkim-atps=neutral Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A40B56302A; Thu, 7 May 2026 23:37:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="L4FewWsP"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E0BED62010 for ; Thu, 7 May 2026 23:37:25 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-70f3-e800--a06.rev.dnainternet.fi [IPv6:2001:14ba:70f3:e800::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 263841121 for ; Thu, 7 May 2026 23:37:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1778189841; bh=9DBr/npHvLuQCKSmhepiDwkLsz+KI8uRPUPyBNSEsB8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=L4FewWsPQRHVofFIS9ULu1UiiLGGTRfKhjXHNC//v7LZuDgWI8X3c5oeE1Xws/STr 2BzU/QeAegiCe/ADCajiBr/oux2Q4SsH/XcluebLZXOw1DgISurReDiXR2Awc/m/FP 7uAh1ZlH/hZSCPz/umEc7MhAXmn7dyKhvSYUrJ7M= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 2/3] ipa: libipa: v4l2_params: Enforce uint16_t for id_type underlying 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 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" X-TUID: o8uLq+KHvbF1 Resent-From: Kieran Bingham Resent-To: parsemail@patchwork.libcamera.org The Linux kernel V4L2 extensible ISP parameters API uses a 16-bit integer for the block type. We can therefore standardize on the same type for the underlying type of the Traits::id_type enum class, as there will never be more block types in libcamera than in the kernel. This will help sharing code between different specializations of V4L2Params. Signed-off-by: Laurent Pinchart Reviewed-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- src/ipa/libipa/v4l2_params.cpp | 2 +- src/ipa/libipa/v4l2_params.h | 11 +++++++---- src/ipa/mali-c55/params.h | 4 +++- src/ipa/rkisp1/params.cpp | 3 ++- src/ipa/rkisp1/params.h | 4 +++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/ipa/libipa/v4l2_params.cpp b/src/ipa/libipa/v4l2_params.cpp index c2971f1caf28..d44a366a60b8 100644 --- a/src/ipa/libipa/v4l2_params.cpp +++ b/src/ipa/libipa/v4l2_params.cpp @@ -217,7 +217,7 @@ namespace ipa { */ /** - * \fn V4L2Params::block(typename Traits::id_type type, unsigned int blockType, size_t blockSize) + * \fn V4L2Params::block(uint16_t type, unsigned int blockType, size_t blockSize) * \brief Populate an ISP configuration block a returns a reference to its * memory * \param[in] type The ISP block identifier enumerated by the IPA module diff --git a/src/ipa/libipa/v4l2_params.h b/src/ipa/libipa/v4l2_params.h index f400b37d74b5..4f84360ee449 100644 --- a/src/ipa/libipa/v4l2_params.h +++ b/src/ipa/libipa/v4l2_params.h @@ -15,6 +15,7 @@ #include #include +#include namespace libcamera { @@ -72,6 +73,8 @@ template class V4L2Params { public: + static_assert(std::is_same_v, uint16_t>); + V4L2Params(Span data, unsigned int version) : data_(data) { @@ -93,13 +96,13 @@ public: using Type = typename Details::type; constexpr auto kernelId = Details::blockType; - auto data = block(Id, kernelId, sizeof(Type)); + auto data = block(utils::to_underlying(Id), kernelId, sizeof(Type)); return V4L2ParamsBlock(data); } protected: - Span block(typename Traits::id_type type, - unsigned int blockType, size_t blockSize) + Span block(uint16_t type, unsigned int blockType, + size_t blockSize) { /* * Look up the block in the cache first. If an algorithm @@ -144,7 +147,7 @@ protected: Span data_; size_t used_; - std::map> blocks_; + std::map> blocks_; }; } /* namespace ipa */ diff --git a/src/ipa/mali-c55/params.h b/src/ipa/mali-c55/params.h index 64be68583ddb..3abcb7f94916 100644 --- a/src/ipa/mali-c55/params.h +++ b/src/ipa/mali-c55/params.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include @@ -16,7 +18,7 @@ namespace libcamera { namespace ipa::mali_c55 { -enum class MaliC55Blocks { +enum class MaliC55Blocks : uint16_t { Bls, AexpHist, AexpHistWeights, diff --git a/src/ipa/rkisp1/params.cpp b/src/ipa/rkisp1/params.cpp index 7040207c2655..b8abbdf6ec66 100644 --- a/src/ipa/rkisp1/params.cpp +++ b/src/ipa/rkisp1/params.cpp @@ -128,7 +128,8 @@ Span RkISP1Params::block(BlockType type) return data_.subspan(info.offset, info.size); } - return V4L2Params::block(type, info.type, info.size); + return V4L2Params::block(utils::to_underlying(type), info.type, + info.size); } } /* namespace ipa::rkisp1 */ diff --git a/src/ipa/rkisp1/params.h b/src/ipa/rkisp1/params.h index eddb37d5c000..8e3672ca8340 100644 --- a/src/ipa/rkisp1/params.h +++ b/src/ipa/rkisp1/params.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include @@ -16,7 +18,7 @@ namespace libcamera { namespace ipa::rkisp1 { -enum class BlockType { +enum class BlockType : uint16_t { Bls, Dpcc, Sdg,