[{"id":34923,"web_url":"https://patchwork.libcamera.org/comment/34923/","msgid":"<175282352119.1641235.12388723484800962@ping.linuxembedded.co.uk>","date":"2025-07-18T07:25:21","subject":"Re: [PATCH 1/2] libcamera: mali-c55: Set bytesused appropriately","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Daniel Scally (2025-07-17 23:05:38)\n> At the moment the mali-c55 pipeline handler sets bytesused for a\n> buffer to be the maximum possible size (i.e. the size of a struct\n> mali_c55_params_buffer). This is not really in keeping with the goal\n> of the extensible parameters formats, and will not work with the new\n> framework for those formats. Update the IPA module and pipeline\n> handler to set bytesused to the size of the parameters that were\n> actually supplied rather than the maximum possible size.\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  include/libcamera/ipa/mali-c55.mojom         | 2 +-\n>  src/ipa/mali-c55/mali-c55.cpp                | 3 ++-\n>  src/libcamera/pipeline/mali-c55/mali-c55.cpp | 7 +++----\n>  3 files changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/mali-c55.mojom b/include/libcamera/ipa/mali-c55.mojom\n> index 5d7eb4ee..39b7f1f1 100644\n> --- a/include/libcamera/ipa/mali-c55.mojom\n> +++ b/include/libcamera/ipa/mali-c55.mojom\n> @@ -28,7 +28,7 @@ interface IPAMaliC55Interface {\n>  };\n>  \n>  interface IPAMaliC55EventInterface {\n> -       paramsComputed(uint32 request);\n> +       paramsComputed(uint32 request, uint32 bytesused);\n>         statsProcessed(uint32 request, libcamera.ControlList metadata);\n>         setSensorControls(libcamera.ControlList sensorControls);\n>  };\n> diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp\n> index c6941a95..5877f299 100644\n> --- a/src/ipa/mali-c55/mali-c55.cpp\n> +++ b/src/ipa/mali-c55/mali-c55.cpp\n> @@ -346,7 +346,8 @@ void IPAMaliC55::fillParams(unsigned int request,\n>                 ASSERT(params->total_size <= MALI_C55_PARAMS_MAX_SIZE);\n>         }\n>  \n> -       paramsComputed.emit(request);\n> +       size_t bytesused = offsetof(struct mali_c55_params_buffer, data) + params->total_size;\n> +       paramsComputed.emit(request, bytesused);\n>  }\n>  \n>  void IPAMaliC55::processStats(unsigned int request, unsigned int bufferId,\n> diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> index 4acc091b..17ad2055 100644\n> --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> @@ -618,7 +618,7 @@ public:\n>         void imageBufferReady(FrameBuffer *buffer);\n>         void paramsBufferReady(FrameBuffer *buffer);\n>         void statsBufferReady(FrameBuffer *buffer);\n> -       void paramsComputed(unsigned int requestId);\n> +       void paramsComputed(unsigned int requestId, uint32_t bytesused);\n>         void statsProcessed(unsigned int requestId, const ControlList &metadata);\n>  \n>         bool match(DeviceEnumerator *enumerator) override;\n> @@ -1494,7 +1494,7 @@ void PipelineHandlerMaliC55::statsBufferReady(FrameBuffer *buffer)\n>                                  sensorControls);\n>  }\n>  \n> -void PipelineHandlerMaliC55::paramsComputed(unsigned int requestId)\n> +void PipelineHandlerMaliC55::paramsComputed(unsigned int requestId, uint32_t bytesused)\n>  {\n>         MaliC55FrameInfo &frameInfo = frameInfoMap_[requestId];\n>         Request *request = frameInfo.request;\n> @@ -1505,8 +1505,7 @@ void PipelineHandlerMaliC55::paramsComputed(unsigned int requestId)\n>          * video devices.\n>          */\n>  \n> -       frameInfo.paramBuffer->_d()->metadata().planes()[0].bytesused =\n> -               sizeof(struct mali_c55_params_buffer);\n> +       frameInfo.paramBuffer->_d()->metadata().planes()[0].bytesused = bytesused;\n>         params_->queueBuffer(frameInfo.paramBuffer);\n>         stats_->queueBuffer(frameInfo.statBuffer);\n>  \n> -- \n> 2.30.2\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 DE9F5BE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jul 2025 07:25:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A899668F8E;\n\tFri, 18 Jul 2025 09:25:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 766946150A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jul 2025 09:25:24 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D9C141A37;\n\tFri, 18 Jul 2025 09:24:49 +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=\"JTC+n7yU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752823489;\n\tbh=FrAi3KQ5FnVpcOpPk1YkvwOaVSVo7BG2vWJOsqjTKQc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=JTC+n7yUTsWCbdcM+6NpX0I/Bk/5vEJ2vlrQq8VGISO0mCrmc77Kdh2LMft7+zsH9\n\tOgzAfwNBQdVbBbyO67Xw/OhgYv4D1abDATjOOYhI/c4eX0VMPe4Gby16KVQRqZnL3h\n\tHgHiRXY9513bZVHQvVqsVDy3R6mVeXqA4ITkH4zU=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250717220539.2434556-1-dan.scally@ideasonboard.com>","References":"<20250717220539.2434556-1-dan.scally@ideasonboard.com>","Subject":"Re: [PATCH 1/2] libcamera: mali-c55: Set bytesused appropriately","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 18 Jul 2025 08:25:21 +0100","Message-ID":"<175282352119.1641235.12388723484800962@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":34926,"web_url":"https://patchwork.libcamera.org/comment/34926/","msgid":"<1721c1f5606066b28fd461feba31d7599faefe53.camel@ideasonboard.com>","date":"2025-07-18T09:11:55","subject":"Re: [PATCH 1/2] libcamera: mali-c55: Set bytesused appropriately","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"content":"Hi Dan,\n\nThank you for the patch!\n\nOn Thu, 2025-07-17 at 23:05 +0100, Daniel Scally wrote:\n> At the moment the mali-c55 pipeline handler sets bytesused for a\n> buffer to be the maximum possible size (i.e. the size of a struct\n> mali_c55_params_buffer). This is not really in keeping with the goal\n> of the extensible parameters formats, and will not work with the new\n> framework for those formats. Update the IPA module and pipeline\n> handler to set bytesused to the size of the parameters that were\n> actually supplied rather than the maximum possible size.\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  include/libcamera/ipa/mali-c55.mojom         | 2 +-\n>  src/ipa/mali-c55/mali-c55.cpp                | 3 ++-\n>  src/libcamera/pipeline/mali-c55/mali-c55.cpp | 7 +++----\n>  3 files changed, 6 insertions(+), 6 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/mali-c55.mojom\n> b/include/libcamera/ipa/mali-c55.mojom\n> index 5d7eb4ee..39b7f1f1 100644\n> --- a/include/libcamera/ipa/mali-c55.mojom\n> +++ b/include/libcamera/ipa/mali-c55.mojom\n> @@ -28,7 +28,7 @@ interface IPAMaliC55Interface {\n>  };\n>  \n>  interface IPAMaliC55EventInterface {\n> -\tparamsComputed(uint32 request);\n> +\tparamsComputed(uint32 request, uint32 bytesused);\n\nGood idea!\n\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\n>  \tstatsProcessed(uint32 request, libcamera.ControlList\n> metadata);\n>  \tsetSensorControls(libcamera.ControlList sensorControls);\n>  };\n> diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-\n> c55.cpp\n> index c6941a95..5877f299 100644\n> --- a/src/ipa/mali-c55/mali-c55.cpp\n> +++ b/src/ipa/mali-c55/mali-c55.cpp\n> @@ -346,7 +346,8 @@ void IPAMaliC55::fillParams(unsigned int request,\n>  \t\tASSERT(params->total_size <=\n> MALI_C55_PARAMS_MAX_SIZE);\n>  \t}\n>  \n> -\tparamsComputed.emit(request);\n> +\tsize_t bytesused = offsetof(struct mali_c55_params_buffer,\n> data) + params->total_size;\n> +\tparamsComputed.emit(request, bytesused);\n>  }\n>  \n>  void IPAMaliC55::processStats(unsigned int request, unsigned int\n> bufferId,\n> diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> index 4acc091b..17ad2055 100644\n> --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> @@ -618,7 +618,7 @@ public:\n>  \tvoid imageBufferReady(FrameBuffer *buffer);\n>  \tvoid paramsBufferReady(FrameBuffer *buffer);\n>  \tvoid statsBufferReady(FrameBuffer *buffer);\n> -\tvoid paramsComputed(unsigned int requestId);\n> +\tvoid paramsComputed(unsigned int requestId, uint32_t\n> bytesused);\n>  \tvoid statsProcessed(unsigned int requestId, const\n> ControlList &metadata);\n>  \n>  \tbool match(DeviceEnumerator *enumerator) override;\n> @@ -1494,7 +1494,7 @@ void\n> PipelineHandlerMaliC55::statsBufferReady(FrameBuffer *buffer)\n>  \t\t\t\t sensorControls);\n>  }\n>  \n> -void PipelineHandlerMaliC55::paramsComputed(unsigned int requestId)\n> +void PipelineHandlerMaliC55::paramsComputed(unsigned int requestId,\n> uint32_t bytesused)\n>  {\n>  \tMaliC55FrameInfo &frameInfo = frameInfoMap_[requestId];\n>  \tRequest *request = frameInfo.request;\n> @@ -1505,8 +1505,7 @@ void\n> PipelineHandlerMaliC55::paramsComputed(unsigned int requestId)\n>  \t * video devices.\n>  \t */\n>  \n> -\tframeInfo.paramBuffer->_d()-\n> >metadata().planes()[0].bytesused =\n> -\t\tsizeof(struct mali_c55_params_buffer);\n> +\tframeInfo.paramBuffer->_d()-\n> >metadata().planes()[0].bytesused = bytesused;\n>  \tparams_->queueBuffer(frameInfo.paramBuffer);\n>  \tstats_->queueBuffer(frameInfo.statBuffer);\n>  \n\nBest wishes,\nIsaac","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 894D5C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Jul 2025 09:12:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6006A68F97;\n\tFri, 18 Jul 2025 11:12:01 +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 A44266150A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Jul 2025 11:11:59 +0200 (CEST)","from isaac-ThinkPad-T16-Gen-2.lan\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D784159E3;\n\tFri, 18 Jul 2025 11:11:24 +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=\"LX7ZY8CO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752829884;\n\tbh=+ZeKoihYcKaBDipISMPK+No8hmqM1MpsGPUbicC5Mas=;\n\th=Subject:From:To:Date:In-Reply-To:References:From;\n\tb=LX7ZY8CO9/dIkiU3Q35dXEe9Ww6Uy9EuxRBaoIKLE4/GhCNiTfsjvINl7U+s169hQ\n\t0Vw3YE5f/X70rsT4D7qpaXUqwSzqdJWQcbCJ8Vhww17JFuRNYG0Lwbg3U/s6f2Y7wP\n\t5xv4QYr+ox1eMWPqB4D2S+IGmOncPxowMBMnKCQg=","Message-ID":"<1721c1f5606066b28fd461feba31d7599faefe53.camel@ideasonboard.com>","Subject":"Re: [PATCH 1/2] libcamera: mali-c55: Set bytesused appropriately","From":"Isaac Scott <isaac.scott@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 18 Jul 2025 10:11:55 +0100","In-Reply-To":"<20250717220539.2434556-1-dan.scally@ideasonboard.com>","References":"<20250717220539.2434556-1-dan.scally@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.56.1 (by Flathub.org) ","MIME-Version":"1.0","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>"}}]