Patch Detail
Show a patch.
GET /api/patches/26410/?format=api
{ "id": 26410, "url": "https://patchwork.libcamera.org/api/patches/26410/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26410/", "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": "<20260401-mali-cru-v8-4-44c48f990e28@ideasonboard.com>", "date": "2026-04-01T16:25:53", "name": "[v8,4/8] libcamera: mali-c55: Register memory input camera", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d058a193d43a88bd8acb50f6a874bb83b4036b98", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26410/mbox/", "series": [ { "id": 5864, "url": "https://patchwork.libcamera.org/api/series/5864/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5864", "date": "2026-04-01T16:25:49", "name": "libcamera: mali-c55: Add support for memory-to-memory", "version": 8, "mbox": "https://patchwork.libcamera.org/series/5864/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26410/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26410/checks/", "tags": {}, "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 7B822C32F5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 1 Apr 2026 16:26:10 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE31862D6F;\n\tWed, 1 Apr 2026 18:26:07 +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 E76E562D5C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 1 Apr 2026 18:26:01 +0200 (CEST)", "from [100.93.44.16] (net-93-65-100-155.cust.vodafonedsl.it\n\t[93.65.100.155])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC0511752;\n\tWed, 1 Apr 2026 18:24:38 +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=\"QJuJYTAi\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775060678;\n\tbh=8GJoWmvnnhVfjvW8kFKHhENpJe9siUMg4bcn9jHEZB8=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=QJuJYTAihH+K0TBWQhsHttBz123BDtQOYx57cAWoSh/hNJys8/m4R5VSlkttkMUmz\n\tHXMXf6lST09eZnEkX8FxkROQImBIEzUvPLNMOU4KBWD9+1jvYN9STm9N8q5Nu7HrIh\n\t1Z2i5hIyVQ6FW7/Nti2GYMa89F3C7rBkCZ6+sxwM=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Wed, 01 Apr 2026 18:25:53 +0200", "Subject": "[PATCH v8 4/8] libcamera: mali-c55: Register memory input camera", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260401-mali-cru-v8-4-44c48f990e28@ideasonboard.com>", "References": "<20260401-mali-cru-v8-0-44c48f990e28@ideasonboard.com>", "In-Reply-To": "<20260401-mali-cru-v8-0-44c48f990e28@ideasonboard.com>", "To": "Daniel Scally <dan.scally@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org", "Cc": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=9956;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=8GJoWmvnnhVfjvW8kFKHhENpJe9siUMg4bcn9jHEZB8=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBpzUcXEZvNpY1/FDChnfynSpRk9GRsSqJrNzNNK\n\tdrOKlHeJRiJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCac1HFwAKCRByNAaPFqFW\n\tPOxEEAC/d5s2IFZhiYjOEyhQ/D63bPgs3XL+TyHJHsqPEJeLrWdPwWw4UpxK64COlzr1MHABmmS\n\tjJxHAuQ47Yr0C7HqQvyaS4vrd/vQui5ywNxjfioPrpkmx3IHvfx5ntAt71Vy4AhzTy+45yCrb7r\n\t/AhI5WeKODAkwgLwWeBTIVTVbbi1psdtLDX1ztHd5bupFpsmZK+jcEzvVIafqorQe3oLMusQ/Hs\n\tslqWA6anXCSupeAjto6p4fsfyiOuqsFX/UKN5LAF2EPMqLmlyEFXuSmNVuKipu8IjnCXczR3tc9\n\tijazg43K1YKcbBJ7bKAVXuQFlAQqEgIJMA5RnOsniohBHt9nEuB3B4/Eksl1uaYOjpgt88V0B0q\n\tZmhB/EpduEmZc3sCDYVkuVfZR96VZAxJBf+AbmwSnKSFQO+PaLtqw8bZrZV/fhG5oDnNe3FczUJ\n\tzK60cfe/Q+9/LtZiGgwDuxLbi7+aqPMOdArSUvm+uBY49s3JQoEZF1G2hAtBqp5yvwSRN7bt/D4\n\tX+nLr7N+LA7MmL/67+gWkpj9LlW8ILHx0LYkP4/qWJ6/yt8magDHXbELKLhHxjRFlwg3R15sm1F\n\tnnnnmBLn758MsowymXIg1szXz/n4Geqe+U0nRwErd6hh5D15eUmDpB6jUR5hv5K2mXhInhtskxi\n\tXgzRRy3pKqzEvQg==", "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B", "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>" }, "content": "Add support to Mali C55 pipeline handler for memory-to-memory camera\nmode.\n\nThe Mali-C55, as integrated in the Renesas RZ/V2H(P) SoC, is fed with\nimages saved to memory by the CRU unit and read on behalf of the ISP\nby the IVC.\n\nUpdate the pipeline handler's match() function to search for the CRU\nmedia entity necessary to register a memory input camera. Create and\ninitialize a CameraData instance for the memory camera use case if a\nvalid CRU is found and initialize the IVC components used to feed the\nISP with images read from memory.\n\nDo not implement camera configuration for the time being to reuce\nthe patch size. It will be provided in the following patches.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/libcamera/pipeline/mali-c55/mali-c55.cpp | 154 +++++++++++++++++++++++----\n 1 file changed, 136 insertions(+), 18 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\nindex 26dfd0aef73c..d17b026db119 100644\n--- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n+++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp\n@@ -44,6 +44,8 @@\n #include \"libcamera/internal/v4l2_subdevice.h\"\n #include \"libcamera/internal/v4l2_videodevice.h\"\n \n+#include \"rzg2l-cru.h\"\n+\n namespace {\n \n bool isFormatRaw(const libcamera::PixelFormat &pixFmt)\n@@ -105,7 +107,12 @@ public:\n \t\tstd::unique_ptr<V4L2Subdevice> csi2_;\n \t\tstd::unique_ptr<CameraSensor> sensor_;\n \t};\n-\tusing CameraType = std::variant<Tpg, Inline>;\n+\n+\tstruct Memory {\n+\t\tstd::unique_ptr<RZG2LCRU> cru_;\n+\t};\n+\n+\tusing CameraType = std::variant<Tpg, Inline, Memory>;\n \n \tMaliC55CameraData(PipelineHandler *pipe)\n \t\t: Camera::Private(pipe)\n@@ -116,6 +123,7 @@ public:\n \n \tTpg *initTpg(MediaEntity *entity);\n \tInline *initInline(MediaEntity *entity);\n+\tMemory *initMemory(MediaDevice *cruMedia);\n \n \tstd::vector<Size> sizes(unsigned int mbusCode) const\n \t{\n@@ -125,7 +133,10 @@ public:\n \t\t\t},\n \t\t\t[&](const Inline &in) -> std::vector<Size> {\n \t\t\t\treturn in.sensor_->sizes(mbusCode);\n-\t\t\t}\n+\t\t\t},\n+\t\t\t[&](const Memory &mem) -> std::vector<Size> {\n+\t\t\t\treturn mem.cru_->sizes();\n+\t\t\t},\n \t\t}, input_);\n \t}\n \n@@ -138,6 +149,9 @@ public:\n \t\t\t[&](const Inline &in) -> V4L2Subdevice * {\n \t\t\t\treturn in.sensor_->device();\n \t\t\t},\n+\t\t\t[&](const Memory &mem) -> V4L2Subdevice * {\n+\t\t\t\treturn mem.cru_->sensor()->device();\n+\t\t\t},\n \t\t}, input_);\n \t}\n \n@@ -151,6 +165,9 @@ public:\n \t\t\t[&](const Inline &in) -> CameraSensor * {\n \t\t\t\treturn in.sensor_.get();\n \t\t\t},\n+\t\t\t[&](const Memory &mem) -> CameraSensor * {\n+\t\t\t\treturn mem.cru_->sensor();\n+\t\t\t},\n \t\t}, input_);\n \t}\n \n@@ -163,6 +180,9 @@ public:\n \t\t\t[&](const Inline &in) -> Size {\n \t\t\t\treturn in.sensor_->resolution();\n \t\t\t},\n+\t\t\t[&](const Memory &mem) -> Size {\n+\t\t\t\treturn mem.cru_->resolution();\n+\t\t\t},\n \t\t}, input_);\n \t}\n \n@@ -241,6 +261,19 @@ MaliC55CameraData::Inline *MaliC55CameraData::initInline(MediaEntity *sensor)\n \treturn &input_.emplace<Inline>(std::move(in));\n }\n \n+MaliC55CameraData::Memory *MaliC55CameraData::initMemory(MediaDevice *cruMedia)\n+{\n+\tMemory mem;\n+\n+\tmem.cru_ = std::make_unique<RZG2LCRU>();\n+\n+\tint ret = mem.cru_->init(cruMedia);\n+\tif (ret)\n+\t\treturn nullptr;\n+\n+\treturn &input_.emplace<Memory>(std::move(mem));\n+}\n+\n std::vector<Size> MaliC55CameraData::Tpg::sizes(unsigned int mbusCode) const\n {\n \tV4L2Subdevice::Formats formats = sd_->formats(0);\n@@ -721,11 +754,15 @@ private:\n \t\t\t\tconst std::string &name);\n \tbool registerTPGCamera(MediaLink *link);\n \tbool registerSensorCamera(MediaLink *link);\n+\tbool registerMemoryInputCamera(MediaLink *link);\n \n \tstd::shared_ptr<MediaDevice> media_;\n+\tstd::shared_ptr<MediaDevice> cruMedia_;\n \tstd::unique_ptr<V4L2Subdevice> isp_;\n \tstd::unique_ptr<V4L2VideoDevice> stats_;\n \tstd::unique_ptr<V4L2VideoDevice> params_;\n+\tstd::unique_ptr<V4L2Subdevice> ivcSd_;\n+\tstd::unique_ptr<V4L2VideoDevice> ivc_;\n \n \tstd::vector<std::unique_ptr<FrameBuffer>> statsBuffers_;\n \tstd::queue<FrameBuffer *> availableStatsBuffers_;\n@@ -976,6 +1013,9 @@ int PipelineHandlerMaliC55::configure(Camera *camera,\n \t\t\tconst MediaEntity *csi2Entity = in.csi2_->entity();\n \t\t\treturn csi2Entity->getPadByIndex(1)->links()[0]->setEnabled(true);\n \t\t},\n+\t\t[](MaliC55CameraData::Memory &) {\n+\t\t\treturn 0;\n+\t\t},\n \t}, data->input_);\n \tif (ret)\n \t\treturn ret;\n@@ -1001,6 +1041,9 @@ int PipelineHandlerMaliC55::configure(Camera *camera,\n \n \t\t\treturn in.csi2_->getFormat(1, &subdevFormat);\n \t\t},\n+\t\t[](MaliC55CameraData::Memory &) {\n+\t\t\treturn 0;\n+\t\t},\n \t}, data->input_);\n \tif (ret)\n \t\treturn ret;\n@@ -1673,6 +1716,66 @@ bool PipelineHandlerMaliC55::registerSensorCamera(MediaLink *ispLink)\n \treturn true;\n }\n \n+bool PipelineHandlerMaliC55::registerMemoryInputCamera(MediaLink *link)\n+{\n+\t/*\n+\t * Errors are not fatal at this point, return true and just skip\n+\t * registering a camera for this media link.\n+\t */\n+\tconst std::string &name = link->source()->entity()->name();\n+\tif (name != \"rzv2h ivc block\") {\n+\t\tLOG(MaliC55, Warning) << \"Unsupported direct connection to \"\n+\t\t\t\t << link->source()->entity()->name();\n+\t\treturn true;\n+\t}\n+\n+\tif (!cruMedia_) {\n+\t\tLOG(MaliC55, Warning) << \"Unable to find CRU for memory input\";\n+\t\treturn true;\n+\t}\n+\n+\t/*\n+\t * From now on, errors should be reported up as we have the components\n+\t * we need to support memory-to-memory and if we fail something has\n+\t * to be fixed.\n+\t */\n+\n+\tivcSd_ = V4L2Subdevice::fromEntityName(media_.get(),\n+\t\t\t\t\t \"rzv2h ivc block\");\n+\tif (!ivcSd_ || ivcSd_->open() < 0)\n+\t\treturn false;\n+\n+\tivc_ = V4L2VideoDevice::fromEntityName(media_.get(),\n+\t\t\t\t\t \"rzv2h-ivc\");\n+\tif (!ivc_ || ivc_->open() < 0)\n+\t\treturn false;\n+\n+\tstd::unique_ptr<MaliC55CameraData> data =\n+\t\tstd::make_unique<MaliC55CameraData>(this);\n+\n+\tauto *mem = data->initMemory(cruMedia_.get());\n+\tif (!mem)\n+\t\treturn false;\n+\n+\tCameraSensor *sensor = data->sensor();\n+\tdata->properties_ = sensor->properties();\n+\n+\tconst CameraSensorProperties::SensorDelays &delays = sensor->sensorDelays();\n+\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> params = {\n+\t\t{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },\n+\t\t{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },\n+\t};\n+\n+\tdata->delayedCtrls_ =\n+\t\tstd::make_unique<DelayedControls>(sensor->device(), params);\n+\tisp_->frameStart.connect(data->delayedCtrls_.get(),\n+\t\t\t\t &DelayedControls::applyControls);\n+\n+\tivc_->bufferReady.connect(mem->cru_.get(), &RZG2LCRU::returnBuffer);\n+\n+\treturn registerMaliCamera(std::move(data), sensor->device()->entity()->name());\n+}\n+\n bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)\n {\n \tconst MediaPad *ispSink;\n@@ -1682,14 +1785,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 c55Dm(\"mali-c55\");\n+\tc55Dm.add(\"mali-c55 isp\");\n+\tc55Dm.add(\"mali-c55 resizer fr\");\n+\tc55Dm.add(\"mali-c55 fr\");\n+\tc55Dm.add(\"mali-c55 3a stats\");\n+\tc55Dm.add(\"mali-c55 3a params\");\n+\n+\tmedia_ = acquireMediaDevice(enumerator, c55Dm);\n \tif (!media_)\n \t\treturn false;\n \n@@ -1749,6 +1852,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 +1884,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 +1903,10 @@ 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\tregistered = registerMemoryInputCamera(link);\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", "prefixes": [ "v8", "4/8" ] }