{"id":27439,"url":"https://patchwork.libcamera.org/api/patches/27439/?format=json","web_url":"https://patchwork.libcamera.org/patch/27439/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260722-pi4-upstream-v2-4-eb44d3c6fd92@ideasonboard.com>","date":"2026-07-22T11:23:20","name":"[v2,4/8] ipa: rpi: Allow sharing params buffer to the IPA","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e2902bf4facfbfcbec070f4428a3c7aed96c62e9","submitter":{"id":223,"url":"https://patchwork.libcamera.org/api/people/223/?format=json","name":"Jai Luthra","email":"jai.luthra@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27439/mbox/","series":[{"id":6072,"url":"https://patchwork.libcamera.org/api/series/6072/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6072","date":"2026-07-22T11:23:16","name":"Raspberry Pi: Update VC4 pipeline for mainline","version":2,"mbox":"https://patchwork.libcamera.org/series/6072/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27439/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27439/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 6CE59BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jul 2026 11:25:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D57367E9E;\n\tWed, 22 Jul 2026 13:25:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B5BC67E8A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2026 13:25:03 +0200 (CEST)","from mail.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1c68:25d4:fa24:78d1:31:7a56])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C0E06447;\n\tWed, 22 Jul 2026 13:24:02 +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=\"ldi4jh51\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784719443;\n\tbh=4LNUMEB6mFPpD4zAvN1pO7+Tpb68w3zqahLeEQzRyxQ=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=ldi4jh51HjMucP3xgeux+SyNc7w5f1OZKv+G9gD5nrA3GsYoEabIADa4FPcBLTbI+\n\to6wbwdGLrT0OS6Ev0NFNrg5XbLF1ZOLQ9eKNkTuzpKvxzBJkr8UvQ91GWivHYezsgY\n\tJdQ/EqU6DkJWSpPpEF+xfCGAe24iKSBzrUj4jxhw=","From":"Jai Luthra <jai.luthra@ideasonboard.com>","Date":"Wed, 22 Jul 2026 16:53:20 +0530","Subject":"[PATCH v2 4/8] ipa: rpi: Allow sharing params buffer to the IPA","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260722-pi4-upstream-v2-4-eb44d3c6fd92@ideasonboard.com>","References":"<20260722-pi4-upstream-v2-0-eb44d3c6fd92@ideasonboard.com>","In-Reply-To":"<20260722-pi4-upstream-v2-0-eb44d3c6fd92@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>, \n\tDavid Plowman <david.plowman@raspberrypi.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>, \n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tDaniel Scally <dan.scally@ideasonboard.com>, \n\tJai Luthra <jai.luthra@ideasonboard.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=6404;\n\ti=jai.luthra@ideasonboard.com; h=from:subject:message-id;\n\tbh=4LNUMEB6mFPpD4zAvN1pO7+Tpb68w3zqahLeEQzRyxQ=;\n\tb=owEBbQKS/ZANAwAKAUPekfkkmnFFAcsmYgBqYKhqOECbV7LotjHUDVrzPJZdvF6PCsjrr8dEx\n\tCBRmEbZ5a+JAjMEAAEKAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCamCoagAKCRBD3pH5JJpx\n\tRfbtEACJAOOEwi/3WWXaxIZYan6fjBi1qwxHjG0yQgUnuU599iac6EMflImR/qT+0pxn/ldsFIu\n\tPLiU+n9I4SW78i/8o6mqrZJYTjFIN9Wq2MXMAakp4t48uatCV2uJ6nHt3HFxzjA27Pc/JIf+/Hv\n\tO79DgJIDIy5bE4h+MQqe1uA8jGQ07NE9WyMUkl859nuUclFw0dwxvBszobMj0r7tbSEUc6vREg3\n\tbUxHtLG49gm2ZjIJHQOvvBiAQdNjNMqzdmLZreYYOImpG+tUDV8i0uwj+EL9N4RdUqwS+fZmRW9\n\tU4vN9P/beSofL3XfZFozu8vIErz32zCfiSbNFDThzxzPONb+vno3hkZIVp3SfCHYurR2cy0FzB8\n\tabhlwDssMhq7gBgTu0qH2khGrwHD0ixoV+OmpOxzZTmjftFyFj1xYFLYYi34j1j8rk7iFwQIWMm\n\tgjQjAdoIHLpkGrAWtrdLjnQNdxRUBy2fkAvlEU4F6XaH+OpyBtvYgBRvOfP+W1HRl3L+3cksoA1\n\toM2sY8hdc+4Dtc+5GkY71KdbS3vIHTrkuUeBb5I+uZmhQDTcSxmwZDJPMKhdz1luhLejmY0Id97\n\tLo2qN/PA+TMrHYBKX0EZHRitiU8ZCfD4Jc/lMm7JiA0XQC7gak2reljM26lz1U0pViAOfYcn5Eo\n\tU0WReqWRZjv/cZg==","X-Developer-Key":"i=jai.luthra@ideasonboard.com; a=openpgp;\n\tfpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145","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":"While the VC4 IPA currently writes control values for configuration, the\nmainline driver expects a parameter buffer.\n\nIn preparation for the migration, add plumbing to pass the parameter\nbuffer to the IPA, while reporting back how many bytes were filled\nthrough the prepareIspComplete() callback.\n\nThis is unused for now, VC4 will use it in subsequent commits.\n\nSigned-off-by: Jai Luthra <jai.luthra@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.mojom  |  3 ++-\n src/ipa/rpi/common/ipa_base.cpp          | 11 ++++++++++-\n src/ipa/rpi/common/ipa_base.h            |  4 ++++\n src/libcamera/pipeline/rpi/pisp/pisp.cpp |  6 ++++--\n src/libcamera/pipeline/rpi/vc4/vc4.cpp   |  6 ++++--\n 5 files changed, 24 insertions(+), 6 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 1b7e03582..dcd3b2c66 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -33,6 +33,7 @@ struct BufferIds {\n \tuint32 bayer;\n \tuint32 embedded;\n \tuint32 stats;\n+\tuint32 params;\n };\n \n struct ConfigParams {\n@@ -227,7 +228,7 @@ interface IPARPiEventInterface {\n \t * processing the frame. The embedded data buffer may be recycled after\n \t * this event.\n \t */\n-\tprepareIspComplete(BufferIds buffers, bool stitchSwapBuffers);\n+\tprepareIspComplete(BufferIds buffers, bool stitchSwapBuffers, uint32 paramsBytesUsed);\n \n \t/**\n \t * \\fn processStatsComplete()\ndiff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex e3f7b99a8..b3313f577 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -427,6 +427,7 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n \tunsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n \tRPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n \tSpan<uint8_t> embeddedBuffer;\n+\tSpan<uint8_t> paramsBuffer;\n \n \trpiMetadata.clear();\n \tfillDeviceStatus(params.sensorControls, ipaContext);\n@@ -450,6 +451,13 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n \t\tembeddedBuffer = it->second.planes()[0];\n \t}\n \n+\tif (params.buffers.params) {\n+\t\tauto it = buffers_.find(params.buffers.params);\n+\t\tASSERT(it != buffers_.end());\n+\t\tparamsBuffer = it->second.planes()[0];\n+\t\tplatformParamsBufferInit(paramsBuffer);\n+\t}\n+\n \t/*\n \t * AGC wants to know the algorithm status from the time it actioned the\n \t * sensor exposure/gain changes. So fetch it from the metadata list\n@@ -519,7 +527,8 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n \t\treportMetadata(ipaContext);\n \n \t/* Ready to push the input buffer into the ISP. */\n-\tprepareIspComplete.emit(params.buffers, stitchSwapBuffers_);\n+\tprepareIspComplete.emit(params.buffers, stitchSwapBuffers_,\n+\t\t\t\tplatformParamsBytesUsed());\n }\n \n void IpaBase::processStats(const ProcessParams &params)\ndiff --git a/src/ipa/rpi/common/ipa_base.h b/src/ipa/rpi/common/ipa_base.h\nindex f4157e9ec..1e9b0e57e 100644\n--- a/src/ipa/rpi/common/ipa_base.h\n+++ b/src/ipa/rpi/common/ipa_base.h\n@@ -79,6 +79,8 @@ protected:\n \t/* Whether the stitch block (if available) needs to swap buffers. */\n \tbool stitchSwapBuffers_;\n \n+\tvirtual size_t platformParamsBytesUsed() const { return 0; }\n+\n private:\n \t/* Number of metadata objects available in the context list. */\n \tstatic constexpr unsigned int numMetadataContexts = 16;\n@@ -87,7 +89,9 @@ private:\n \tvirtual int32_t platformStart(const ControlList &controls, StartResult *result) = 0;\n \tvirtual int32_t platformConfigure(const ConfigParams &params, ConfigResult *result) = 0;\n \n+\tvirtual void platformParamsBufferInit([[maybe_unused]] Span<uint8_t> paramsBuffer) {}\n \tvirtual void platformPrepareIsp(RPiController::Metadata &rpiMetadata) = 0;\n+\n \tvirtual void platformPrepareAgc(RPiController::Metadata &rpiMetadata) = 0;\n \tvirtual RPiController::StatisticsPtr platformProcessStats(Span<uint8_t> mem) = 0;\n \ndiff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\nindex 406d683dc..616014729 100644\n--- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n+++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n@@ -759,7 +759,8 @@ public:\n \tvoid beOutputDequeue(FrameBuffer *buffer);\n \n \tvoid processStatsComplete(const ipa::RPi::BufferIds &buffers);\n-\tvoid prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers);\n+\tvoid prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers,\n+\t\t\t\tunsigned int paramsBytesUsed);\n \tvoid setCameraTimeout(uint32_t maxFrameLengthMs);\n \n \t/* Array of CFE and ISP device streams and associated buffers/streams. */\n@@ -1885,7 +1886,8 @@ void PiSPCameraData::setCameraTimeout(uint32_t maxFrameLengthMs)\n \tcfe_[Cfe::Output0].dev()->setDequeueTimeout(timeout);\n }\n \n-void PiSPCameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers)\n+void PiSPCameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers,\n+\t\t\t\t\t[[maybe_unused]] unsigned int paramsBytesUsed)\n {\n \tunsigned int embeddedId = buffers.embedded & RPi::MaskID;\n \tunsigned int bayerId = buffers.bayer & RPi::MaskID;\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 3e9a49058..c18358876 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -79,7 +79,8 @@ public:\n \tvoid ispOutputDequeue(FrameBuffer *buffer);\n \n \tvoid processStatsComplete(const ipa::RPi::BufferIds &buffers);\n-\tvoid prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers);\n+\tvoid prepareIspComplete(const ipa::RPi::BufferIds &buffers, bool stitchSwapBuffers,\n+\t\t\t\tunsigned int paramsBytesUsed);\n \tvoid setIspControls(const ControlList &controls);\n \tvoid setCameraTimeout(uint32_t maxFrameLengthMs);\n \n@@ -863,7 +864,8 @@ void Vc4CameraData::processStatsComplete(const ipa::RPi::BufferIds &buffers)\n }\n \n void Vc4CameraData::prepareIspComplete(const ipa::RPi::BufferIds &buffers,\n-\t\t\t\t       [[maybe_unused]] bool stitchSwapBuffers)\n+\t\t\t\t       [[maybe_unused]] bool stitchSwapBuffers,\n+\t\t\t\t       [[maybe_unused]] unsigned int paramsBytesUsed)\n {\n \tunsigned int embeddedId = buffers.embedded & RPi::MaskID;\n \tunsigned int bayer = buffers.bayer & RPi::MaskID;\n","prefixes":["v2","4/8"]}