[{"id":38459,"web_url":"https://patchwork.libcamera.org/comment/38459/","msgid":"<d1f48af7-91e4-4b19-86ee-09eaef4c57d1@ideasonboard.com>","date":"2026-03-31T13:07:19","subject":"Re: [PATCH v6 4/7] libcamera: mali-c55: Register memory input camera","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. 15:44 keltezéssel, Jacopo Mondi írta:\n> Add support to Mali C55 pipeline handler for memory-to-memory camera\n> mode.\n> \n> The Mali-C55, as integrated in the Renesas RZ/V2H(P) SoC, is fed with\n> images saved to memory by the CRU unit and read on behalf of the ISP\n> by the IVC.\n> \n> Update the pipeline handler's match() function to search for the CRU\n> media entity necessary to register a memory input camera. Create and\n> initialize a CameraData instance for the memory camera use case if a\n> valid CRU is found and initialize the IVC components used to feed the\n> ISP with images read from memory.\n> \n> Do not implement camera configuration for the time being to reuce\n> the patch size. It will be provided in the following patches.\n> \n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> ---\n>   src/libcamera/pipeline/mali-c55/mali-c55.cpp | 135 +++++++++++++++++++++++----\n>   1 file changed, 117 insertions(+), 18 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> index dca82564e2eb..26d368bb9132 100644\n> --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> [...]\n> @@ -1682,14 +1753,14 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n>   \t * The TPG and the downscale pipe are both optional blocks and may not\n>   \t * be fitted.\n>   \t */\n> -\tDeviceMatch dm(\"mali-c55\");\n> -\tdm.add(\"mali-c55 isp\");\n> -\tdm.add(\"mali-c55 resizer fr\");\n> -\tdm.add(\"mali-c55 fr\");\n> -\tdm.add(\"mali-c55 3a stats\");\n> -\tdm.add(\"mali-c55 3a params\");\n> -\n> -\tmedia_ = acquireMediaDevice(enumerator, dm);\n> +\tDeviceMatch c55_dm(\"mali-c55\");\n\nMinor thing, this should probably be `c55Dm`.\n\n\n> +\tc55_dm.add(\"mali-c55 isp\");\n> +\tc55_dm.add(\"mali-c55 resizer fr\");\n> +\tc55_dm.add(\"mali-c55 fr\");\n> +\tc55_dm.add(\"mali-c55 3a stats\");\n> +\tc55_dm.add(\"mali-c55 3a params\");\n> +\n> +\tmedia_ = acquireMediaDevice(enumerator, c55_dm);\n>   \tif (!media_)\n>   \t\treturn false;\n>   \n> @@ -1749,6 +1820,25 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n>   \tstats_->bufferReady.connect(this, &PipelineHandlerMaliC55::statsBufferReady);\n>   \tparams_->bufferReady.connect(this, &PipelineHandlerMaliC55::paramsBufferReady);\n>   \n> +\t/*\n> +\t * We also need to search for the rzg2l-cru CSI-2 receiver. If we find\n> +\t * that then we need to work in memory input mode instead of the inline\n> +\t * mode. The absence of this match is not necessarily a failure at this\n> +\t * point...it depends on the media links that we investigate momentarily.\n> +\t *\n> +\t * This is a bit hacky, because there could be multiple of these media\n> +\t * devices and we're just taking the first. We need modular pipelines to\n> +\t * properly solve the issue.\n> +\t */\n> +\tstatic const std::regex cruCsi2Regex(\"csi-[0-9a-f]{8}.csi2\");\n> +\tstatic const std::regex cruIpRegex(\"cru-ip-[0-9a-f]{8}.cru[0-9]\");\n> +\n> +\tDeviceMatch cruDm(\"rzg2l_cru\");\n> +\tcruDm.add(cruCsi2Regex);\n> +\tcruDm.add(cruIpRegex);\n> +\tcruDm.add(\"CRU output\");\n> +\tcruMedia_ = acquireMediaDevice(enumerator, cruDm);\n> +\n>   \tispSink = isp_->entity()->getPadByIndex(0);\n>   \tif (!ispSink || ispSink->links().empty()) {\n>   \t\tLOG(MaliC55, Error) << \"ISP sink pad error\";\n> @@ -1762,13 +1852,6 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n>   \t * MEDIA_ENT_F_CAM_SENSOR - The test pattern generator\n>   \t * MEDIA_ENT_F_VID_IF_BRIDGE - A CSI-2 receiver\n>   \t * MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER - An input device\n> -\t *\n> -\t * The last one will be unsupported for now. The TPG is relatively easy,\n> -\t * we just register a Camera for it. If we have a CSI-2 receiver we need\n> -\t * to check its sink pad and register Cameras for anything connected to\n> -\t * it (probably...there are some complex situations in which that might\n> -\t * not be true but let's pretend they don't exist until we come across\n> -\t * them)\n>   \t */\n>   \tbool registered;\n>   \tfor (MediaLink *link : ispSink->links()) {\n> @@ -1788,7 +1871,23 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n>   \n>   \t\t\tbreak;\n>   \t\tcase MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER:\n> -\t\t\tLOG(MaliC55, Warning) << \"Memory input not yet supported\";\n> +\t\t\tif (!cruMedia_)\n> +\t\t\t\treturn false;\n\nI think it could make sense to do this similarly to `registerTPGCamera()` and check\nthe name, print warning, and `continue` if it's not a match?\n\n\n> +\n> +\t\t\tivcSd_ = V4L2Subdevice::fromEntityName(media_.get(),\n> +\t\t\t\t\t\t\t       \"rzv2h ivc block\");\n> +\t\t\tif (ivcSd_->open() < 0)\n\n   !ivcSd_ || ivcSd_->open() < 0\n\nand similarly below?\n\n\n> +\t\t\t\treturn false;\n> +\n> +\t\t\tivc_ = V4L2VideoDevice::fromEntityName(media_.get(),\n> +\t\t\t\t\t\t\t       \"rzv2h-ivc\");\n> +\t\t\tif (ivc_->open() < 0)\n> +\t\t\t\treturn false;\n> +\n> +\t\t\tregistered = registerMemoryInputCamera();\n> +\t\t\tif (!registered)\n> +\t\t\t\treturn registered;\n> +\n>   \t\t\tbreak;\n>   \t\tdefault:\n>   \t\t\tLOG(MaliC55, Error) << \"Unsupported entity function\";\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 C87D0BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 Mar 2026 13:07:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 707C662D06;\n\tTue, 31 Mar 2026 15:07:24 +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 1E26C6274D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Mar 2026 15:07:23 +0200 (CEST)","from [192.168.33.35] (185.221.143.129.nat.pool.zt.hu\n\t[185.221.143.129])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 89EA1CE7;\n\tTue, 31 Mar 2026 15:06:00 +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=\"u/wWQPKP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774962360;\n\tbh=mi5sdntz1RmNy51EGeGEsXwO1UL8vjLeHLh92VJu33E=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=u/wWQPKPf/HuTWulE76BhEKyXZhAJ0GGOio8GkvU/ufORngebvdJ9S59jOeTMEXy2\n\th+IzbREkv4gdS5lbEN/D6sXwwFQUWRdgLQBVuYQPlRlx09i0kNDmwcdNI/urVusHzC\n\tHTupw624CaMMHIgQl7NCpB5waZsuYaFK5OK4ZNUs=","Message-ID":"<d1f48af7-91e4-4b19-86ee-09eaef4c57d1@ideasonboard.com>","Date":"Tue, 31 Mar 2026 15:07:19 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v6 4/7] libcamera: mali-c55: Register memory input camera","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20260325-mali-cru-v6-0-b16b0c49819a@ideasonboard.com>\n\t<20260325-mali-cru-v6-4-b16b0c49819a@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260325-mali-cru-v6-4-b16b0c49819a@ideasonboard.com>","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>"}},{"id":38462,"web_url":"https://patchwork.libcamera.org/comment/38462/","msgid":"<acvPAQ2vCEalzSoL@zed>","date":"2026-03-31T13:47:56","subject":"Re: [PATCH v6 4/7] libcamera: mali-c55: Register memory input camera","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"On Tue, Mar 31, 2026 at 03:07:19PM +0200, Barnabás Pőcze wrote:\n> 2026. 03. 25. 15:44 keltezéssel, Jacopo Mondi írta:\n> > Add support to Mali C55 pipeline handler for memory-to-memory camera\n> > mode.\n> >\n> > The Mali-C55, as integrated in the Renesas RZ/V2H(P) SoC, is fed with\n> > images saved to memory by the CRU unit and read on behalf of the ISP\n> > by the IVC.\n> >\n> > Update the pipeline handler's match() function to search for the CRU\n> > media entity necessary to register a memory input camera. Create and\n> > initialize a CameraData instance for the memory camera use case if a\n> > valid CRU is found and initialize the IVC components used to feed the\n> > ISP with images read from memory.\n> >\n> > Do not implement camera configuration for the time being to reuce\n> > the patch size. It will be provided in the following patches.\n> >\n> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > ---\n> >   src/libcamera/pipeline/mali-c55/mali-c55.cpp | 135 +++++++++++++++++++++++----\n> >   1 file changed, 117 insertions(+), 18 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> > index dca82564e2eb..26d368bb9132 100644\n> > --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> > +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n> > [...]\n> > @@ -1682,14 +1753,14 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n> >   \t * The TPG and the downscale pipe are both optional blocks and may not\n> >   \t * be fitted.\n> >   \t */\n> > -\tDeviceMatch dm(\"mali-c55\");\n> > -\tdm.add(\"mali-c55 isp\");\n> > -\tdm.add(\"mali-c55 resizer fr\");\n> > -\tdm.add(\"mali-c55 fr\");\n> > -\tdm.add(\"mali-c55 3a stats\");\n> > -\tdm.add(\"mali-c55 3a params\");\n> > -\n> > -\tmedia_ = acquireMediaDevice(enumerator, dm);\n> > +\tDeviceMatch c55_dm(\"mali-c55\");\n>\n> Minor thing, this should probably be `c55Dm`.\n>\n>\n> > +\tc55_dm.add(\"mali-c55 isp\");\n> > +\tc55_dm.add(\"mali-c55 resizer fr\");\n> > +\tc55_dm.add(\"mali-c55 fr\");\n> > +\tc55_dm.add(\"mali-c55 3a stats\");\n> > +\tc55_dm.add(\"mali-c55 3a params\");\n> > +\n> > +\tmedia_ = acquireMediaDevice(enumerator, c55_dm);\n> >   \tif (!media_)\n> >   \t\treturn false;\n> > @@ -1749,6 +1820,25 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n> >   \tstats_->bufferReady.connect(this, &PipelineHandlerMaliC55::statsBufferReady);\n> >   \tparams_->bufferReady.connect(this, &PipelineHandlerMaliC55::paramsBufferReady);\n> > +\t/*\n> > +\t * We also need to search for the rzg2l-cru CSI-2 receiver. If we find\n> > +\t * that then we need to work in memory input mode instead of the inline\n> > +\t * mode. The absence of this match is not necessarily a failure at this\n> > +\t * point...it depends on the media links that we investigate momentarily.\n> > +\t *\n> > +\t * This is a bit hacky, because there could be multiple of these media\n> > +\t * devices and we're just taking the first. We need modular pipelines to\n> > +\t * properly solve the issue.\n> > +\t */\n> > +\tstatic const std::regex cruCsi2Regex(\"csi-[0-9a-f]{8}.csi2\");\n> > +\tstatic const std::regex cruIpRegex(\"cru-ip-[0-9a-f]{8}.cru[0-9]\");\n> > +\n> > +\tDeviceMatch cruDm(\"rzg2l_cru\");\n> > +\tcruDm.add(cruCsi2Regex);\n> > +\tcruDm.add(cruIpRegex);\n> > +\tcruDm.add(\"CRU output\");\n> > +\tcruMedia_ = acquireMediaDevice(enumerator, cruDm);\n> > +\n> >   \tispSink = isp_->entity()->getPadByIndex(0);\n> >   \tif (!ispSink || ispSink->links().empty()) {\n> >   \t\tLOG(MaliC55, Error) << \"ISP sink pad error\";\n> > @@ -1762,13 +1852,6 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n> >   \t * MEDIA_ENT_F_CAM_SENSOR - The test pattern generator\n> >   \t * MEDIA_ENT_F_VID_IF_BRIDGE - A CSI-2 receiver\n> >   \t * MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER - An input device\n> > -\t *\n> > -\t * The last one will be unsupported for now. The TPG is relatively easy,\n> > -\t * we just register a Camera for it. If we have a CSI-2 receiver we need\n> > -\t * to check its sink pad and register Cameras for anything connected to\n> > -\t * it (probably...there are some complex situations in which that might\n> > -\t * not be true but let's pretend they don't exist until we come across\n> > -\t * them)\n> >   \t */\n> >   \tbool registered;\n> >   \tfor (MediaLink *link : ispSink->links()) {\n> > @@ -1788,7 +1871,23 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n> >   \t\t\tbreak;\n> >   \t\tcase MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER:\n> > -\t\t\tLOG(MaliC55, Warning) << \"Memory input not yet supported\";\n> > +\t\t\tif (!cruMedia_)\n> > +\t\t\t\treturn false;\n>\n> I think it could make sense to do this similarly to `registerTPGCamera()` and check\n> the name, print warning, and `continue` if it's not a match?\n>\n\nI can move this part to registerMemoryInputCamera().\n\nI'm not sure how it will work with multi camera, but we'll evaluate\nonce there\n\n>\n> > +\n> > +\t\t\tivcSd_ = V4L2Subdevice::fromEntityName(media_.get(),\n> > +\t\t\t\t\t\t\t       \"rzv2h ivc block\");\n> > +\t\t\tif (ivcSd_->open() < 0)\n>\n>   !ivcSd_ || ivcSd_->open() < 0\n>\n> and similarly below?\n\nThanks, better!\n\n>\n>\n> > +\t\t\t\treturn false;\n> > +\n> > +\t\t\tivc_ = V4L2VideoDevice::fromEntityName(media_.get(),\n> > +\t\t\t\t\t\t\t       \"rzv2h-ivc\");\n> > +\t\t\tif (ivc_->open() < 0)\n> > +\t\t\t\treturn false;\n> > +\n> > +\t\t\tregistered = registerMemoryInputCamera();\n> > +\t\t\tif (!registered)\n> > +\t\t\t\treturn registered;\n> > +\n> >   \t\t\tbreak;\n> >   \t\tdefault:\n> >   \t\t\tLOG(MaliC55, Error) << \"Unsupported entity function\";\n> >\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 5DE83BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 Mar 2026 13:48:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A45286274D;\n\tTue, 31 Mar 2026 15:48:00 +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 622406274D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Mar 2026 15:47:59 +0200 (CEST)","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 0BE332EC;\n\tTue, 31 Mar 2026 15:46:37 +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=\"UuodGaxh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774964797;\n\tbh=q6jUKtA3pGQemmt+/A0ptvkvXO1HQRmqdEFjKA0jgsk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UuodGaxhJocceuaps3ib/DgTCMKN8u6+IwhOfZbYIa6YSXREvkFmQjtX0YLwr9LLN\n\tDtmrcsCixppEg7qNN+TXv5FxZzvzxTygk+nnVMP+7jzbcItSZzlaF7F0mKoDZAD4dx\n\tz9XVHyfL2N3dwSUn2PtTVchYOaL6ui2X/yIdHb5o=","Date":"Tue, 31 Mar 2026 15:47:56 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tDaniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v6 4/7] libcamera: mali-c55: Register memory input camera","Message-ID":"<acvPAQ2vCEalzSoL@zed>","References":"<20260325-mali-cru-v6-0-b16b0c49819a@ideasonboard.com>\n\t<20260325-mali-cru-v6-4-b16b0c49819a@ideasonboard.com>\n\t<d1f48af7-91e4-4b19-86ee-09eaef4c57d1@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<d1f48af7-91e4-4b19-86ee-09eaef4c57d1@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>"}}]