[{"id":38408,"web_url":"https://patchwork.libcamera.org/comment/38408/","msgid":"<acQQWsgsgMLFo8kY@zed>","date":"2026-03-25T16:43:54","subject":"Re: [PATCH v1 2/4] libcamera: v4l2_device: Map `BITMASK` type to\n\t`Unsigned32`","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Wed, Mar 25, 2026 at 10:26:57AM +0100, Barnabás Pőcze wrote:\n> A bitmask is conceptually an unsigned integer, as implied by the documentation:\n>\n>   The maximum value is interpreted as a __u32,\n>   allowing the use of bit 31 in the bitmask.\n>\n> so map it to a 32-bit unsigned integer. Adjust the rkisp1 pipeline handler\n> accordingly.\n>\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 4 +---\n>  src/libcamera/v4l2_device.cpp            | 3 ++-\n>  2 files changed, 3 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 320a4dc5a..c14b57322 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -1479,9 +1479,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>  \tif (controls.find(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS) != controls.end()) {\n>  \t\tauto list = param_->getControls({ { RKISP1_CID_SUPPORTED_PARAMS_BLOCKS } });\n>  \t\tif (!list.empty())\n> -\t\t\tsupportedBlocks = static_cast<uint32_t>(\n> -\t\t\t\tlist.get(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS)\n> -\t\t\t\t\t.get<int32_t>());\n> +\t\t\tsupportedBlocks = list.get(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS).get<uint32_t>();\n\nThis is not related to the below changes right ?\n\nI mean, the cast wasn't necessary even without the below changes ?\n\n\n>  \t} else {\n>  \t\tLOG(RkISP1, Error)\n>  \t\t\t<< \"Failed to query supported params blocks. Falling back to defaults.\";\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index e0099cb7a..db1eb70e4 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -572,6 +572,7 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType)\n>  \t\treturn ControlTypeUnsigned16;\n>\n>  \tcase V4L2_CTRL_TYPE_U32:\n> +\tcase V4L2_CTRL_TYPE_BITMASK:\n>  \t\treturn ControlTypeUnsigned32;\n>\n>  \tcase V4L2_CTRL_TYPE_INTEGER:\n> @@ -582,7 +583,6 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType)\n>\n>  \tcase V4L2_CTRL_TYPE_MENU:\n>  \tcase V4L2_CTRL_TYPE_BUTTON:\n> -\tcase V4L2_CTRL_TYPE_BITMASK:\n\nBecaue bitmask was deflected to the U32 case already, wasn't it ?\n\n>  \tcase V4L2_CTRL_TYPE_INTEGER_MENU:\n>  \t\t/*\n>  \t\t * More precise types may be needed, for now use a 32-bit\n> @@ -636,6 +636,7 @@ std::optional<ControlInfo> V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl\n>  \t\t\t\t   static_cast<uint16_t>(ctrl.default_value));\n>\n>  \tcase V4L2_CTRL_TYPE_U32:\n> +\tcase V4L2_CTRL_TYPE_BITMASK:\n>  \t\treturn ControlInfo(static_cast<uint32_t>(ctrl.minimum),\n>  \t\t\t\t   static_cast<uint32_t>(ctrl.maximum),\n>  \t\t\t\t   static_cast<uint32_t>(ctrl.default_value));\n\nAnyway, I don't have objections on making this more precise\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n> --\n> 2.53.0\n>","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 19B6DBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Mar 2026 16:44:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 54BC562840;\n\tWed, 25 Mar 2026 17:43:59 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B7B406274D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 17:43:57 +0100 (CET)","from ideasonboard.com (net-93-65-100-155.cust.vodafonedsl.it\n\t[93.65.100.155])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 96F4610BE;\n\tWed, 25 Mar 2026 17:42:39 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oVAk0S+j\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774456959;\n\tbh=s1jIxOB+VaPbDdzAxXYpZ1T4eMmOIxgVQhoZP5AVPco=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oVAk0S+jmRmBeCy5aoK+b0h0xlQx2TzDM0CMwt2k4HOVHntdpWfoAeQt+MHyMPtgw\n\tZM365rnh185LgyVOFMunNEHIo6XV3PQtUzPCYVHMJG4cu3b2/DkWtRYkBGrSRWsRBa\n\tuF2bBm5/1PQeowGbsw+vd2IAZWiGMve9fQtRSqws=","Date":"Wed, 25 Mar 2026 17:43:54 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1 2/4] libcamera: v4l2_device: Map `BITMASK` type to\n\t`Unsigned32`","Message-ID":"<acQQWsgsgMLFo8kY@zed>","References":"<20260325092659.79453-1-barnabas.pocze@ideasonboard.com>\n\t<20260325092659.79453-2-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20260325092659.79453-2-barnabas.pocze@ideasonboard.com>","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>"}},{"id":38426,"web_url":"https://patchwork.libcamera.org/comment/38426/","msgid":"<6e59c23d-8bcb-4f36-b85d-9993526fc3b2@ideasonboard.com>","date":"2026-03-27T07:47:15","subject":"Re: [PATCH v1 2/4] libcamera: v4l2_device: Map `BITMASK` type to\n\t`Unsigned32`","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 03. 25. 17:43 keltezéssel, Jacopo Mondi írta:\n> Hi Barnabás\n> \n> On Wed, Mar 25, 2026 at 10:26:57AM +0100, Barnabás Pőcze wrote:\n>> A bitmask is conceptually an unsigned integer, as implied by the documentation:\n>>\n>>    The maximum value is interpreted as a __u32,\n>>    allowing the use of bit 31 in the bitmask.\n>>\n>> so map it to a 32-bit unsigned integer. Adjust the rkisp1 pipeline handler\n>> accordingly.\n>>\n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>>   src/libcamera/pipeline/rkisp1/rkisp1.cpp | 4 +---\n>>   src/libcamera/v4l2_device.cpp            | 3 ++-\n>>   2 files changed, 3 insertions(+), 4 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>> index 320a4dc5a..c14b57322 100644\n>> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n>> @@ -1479,9 +1479,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>>   \tif (controls.find(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS) != controls.end()) {\n>>   \t\tauto list = param_->getControls({ { RKISP1_CID_SUPPORTED_PARAMS_BLOCKS } });\n>>   \t\tif (!list.empty())\n>> -\t\t\tsupportedBlocks = static_cast<uint32_t>(\n>> -\t\t\t\tlist.get(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS)\n>> -\t\t\t\t\t.get<int32_t>());\n>> +\t\t\tsupportedBlocks = list.get(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS).get<uint32_t>();\n> \n> This is not related to the below changes right ?\n> \n> I mean, the cast wasn't necessary even without the below changes ?\n\nThe above part is necessary in this patch. `RKISP1_CID_SUPPORTED_PARAMS_BLOCKS` is a bitmask,\nbut previously it was queried as `int32_t` (and then cast to `uint32_t`). Now that bitmasks\nare `uint32_t`, the `get()` call template parameter needs to be adjusted (making the cast\nunnecessary).\n\n\n> \n> \n>>   \t} else {\n>>   \t\tLOG(RkISP1, Error)\n>>   \t\t\t<< \"Failed to query supported params blocks. Falling back to defaults.\";\n>> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n>> index e0099cb7a..db1eb70e4 100644\n>> --- a/src/libcamera/v4l2_device.cpp\n>> +++ b/src/libcamera/v4l2_device.cpp\n>> @@ -572,6 +572,7 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType)\n>>   \t\treturn ControlTypeUnsigned16;\n>>\n>>   \tcase V4L2_CTRL_TYPE_U32:\n>> +\tcase V4L2_CTRL_TYPE_BITMASK:\n>>   \t\treturn ControlTypeUnsigned32;\n>>\n>>   \tcase V4L2_CTRL_TYPE_INTEGER:\n>> @@ -582,7 +583,6 @@ ControlType V4L2Device::v4l2CtrlType(uint32_t ctrlType)\n>>\n>>   \tcase V4L2_CTRL_TYPE_MENU:\n>>   \tcase V4L2_CTRL_TYPE_BUTTON:\n>> -\tcase V4L2_CTRL_TYPE_BITMASK:\n> \n> Becaue bitmask was deflected to the U32 case already, wasn't it ?\n\nIf I understand you correctly, then \"yes\".\n\n\n> \n>>   \tcase V4L2_CTRL_TYPE_INTEGER_MENU:\n>>   \t\t/*\n>>   \t\t * More precise types may be needed, for now use a 32-bit\n>> @@ -636,6 +636,7 @@ std::optional<ControlInfo> V4L2Device::v4l2ControlInfo(const v4l2_query_ext_ctrl\n>>   \t\t\t\t   static_cast<uint16_t>(ctrl.default_value));\n>>\n>>   \tcase V4L2_CTRL_TYPE_U32:\n>> +\tcase V4L2_CTRL_TYPE_BITMASK:\n>>   \t\treturn ControlInfo(static_cast<uint32_t>(ctrl.minimum),\n>>   \t\t\t\t   static_cast<uint32_t>(ctrl.maximum),\n>>   \t\t\t\t   static_cast<uint32_t>(ctrl.default_value));\n> \n> Anyway, I don't have objections on making this more precise\n> \n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> \n>> --\n>> 2.53.0\n>>","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 93DB3BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Mar 2026 07:47:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 41DBE62B91;\n\tFri, 27 Mar 2026 08:47:20 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F23526274D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Mar 2026 08:47:18 +0100 (CET)","from [192.168.33.24] (185.221.143.129.nat.pool.zt.hu\n\t[185.221.143.129])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CC8BC1783;\n\tFri, 27 Mar 2026 08:45:59 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Y/f/NX8V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774597559;\n\tbh=Ljp+i65HTR53Zn0/h4/dgHVJoShGfiuQ5+eNJZiwj2c=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=Y/f/NX8VQHoMFasY0Zio7ctYbEeUQtx90KbLGesQXy32i71D8vTnvbVtO1JsXrZkr\n\tvlfCZEHmHQu6H7wpJWV3uUBdpjsBjBT7Yhz8Veusofdd7a6EvB4s1Gb8t6bc4o174Y\n\tomqVMqZ86wKloUq/dpDXI38YVkupdz9lgX83rJ7Q=","Message-ID":"<6e59c23d-8bcb-4f36-b85d-9993526fc3b2@ideasonboard.com>","Date":"Fri, 27 Mar 2026 08:47:15 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1 2/4] libcamera: v4l2_device: Map `BITMASK` type to\n\t`Unsigned32`","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20260325092659.79453-1-barnabas.pocze@ideasonboard.com>\n\t<20260325092659.79453-2-barnabas.pocze@ideasonboard.com>\n\t<acQQWsgsgMLFo8kY@zed>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<acQQWsgsgMLFo8kY@zed>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}}]