{"id":24085,"url":"https://patchwork.libcamera.org/api/1.1/patches/24085/?format=json","web_url":"https://patchwork.libcamera.org/patch/24085/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20250808141315.413839-15-stefan.klug@ideasonboard.com>","date":"2025-08-08T14:12:52","name":"[v2,14/16] pipeline: rkisp1: Query kernel for available params blocks","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f0fe70e4da7bfdb1e718206ef78d64d9f0a66db8","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/1.1/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24085/mbox/","series":[{"id":5364,"url":"https://patchwork.libcamera.org/api/1.1/series/5364/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5364","date":"2025-08-08T14:12:38","name":"Implement WDR algorithm","version":2,"mbox":"https://patchwork.libcamera.org/series/5364/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24085/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24085/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 6AAE2BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 Aug 2025 14:14:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2FDAE6923B;\n\tFri,  8 Aug 2025 16:14:27 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BD6F869236\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Aug 2025 16:14:25 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:3ea1:35ac:90da:a221])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id CFE18208E; \n\tFri,  8 Aug 2025 16:13:35 +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=\"awNS7bAD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1754662415;\n\tbh=rHLRW8tsxo92xq06cMILer0SZh0C4g1B7Gozbfd/pTU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=awNS7bADIWP0rLLXFs+h9SVI4NMN+kOzj/zM8NVNFVbw953/vg1GoU0FyS3+evUY2\n\t043t6aOY6pjyo/Eh+MlbRriPZZ8b4iTvis/8n3rwTDQ1NgUAPudpON3EJTztxXTs/m\n\thoHbH3GmYXonOk7p/MqehitAJzH0X/FnWb6gC7BE=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 14/16] pipeline: rkisp1: Query kernel for available params\n\tblocks","Date":"Fri,  8 Aug 2025 16:12:52 +0200","Message-ID":"<20250808141315.413839-15-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","In-Reply-To":"<20250808141315.413839-1-stefan.klug@ideasonboard.com>","References":"<20250808141315.413839-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","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>"},"content":"Query the params device for RKISP1_CID_SUPPORTED_PARAMS_BLOCKS and\ninject the information into the IPA hardware context for use by the\nalgorithms.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom       |  2 +-\n src/ipa/rkisp1/ipa_context.h             |  1 +\n src/ipa/rkisp1/rkisp1.cpp                | 20 +++++++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 29 ++++++++++++++++++++----\n 4 files changed, 41 insertions(+), 11 deletions(-)","diff":"diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 043ad27ea199..068e898848c4 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -16,7 +16,7 @@ struct IPAConfigInfo {\n \n interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n-\t     uint32 hwRevision,\n+\t     uint32 hwRevision, uint32 supportedBlocks,\n \t     libcamera.IPACameraSensorInfo sensorInfo,\n \t     libcamera.ControlInfoMap sensorControls)\n \t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 362ab2fda5fe..60cfab228edf 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -36,6 +36,7 @@ struct IPAHwSettings {\n \tunsigned int numHistogramBins;\n \tunsigned int numHistogramWeights;\n \tunsigned int numGammaOutSamples;\n+\tuint32_t supportedBlocks;\n \tbool compand;\n };\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex cf66d5553dcd..9ba0f0e6eb9d 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -52,6 +52,7 @@ public:\n \tIPARkISP1();\n \n \tint init(const IPASettings &settings, unsigned int hwRevision,\n+\t\t uint32_t supportedBlocks,\n \t\t const IPACameraSensorInfo &sensorInfo,\n \t\t const ControlInfoMap &sensorControls,\n \t\t ControlInfoMap *ipaControls) override;\n@@ -89,27 +90,30 @@ private:\n \n namespace {\n \n-const IPAHwSettings ipaHwSettingsV10{\n+IPAHwSettings ipaHwSettingsV10{\n \tRKISP1_CIF_ISP_AE_MEAN_MAX_V10,\n \tRKISP1_CIF_ISP_HIST_BIN_N_MAX_V10,\n \tRKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10,\n \tRKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10,\n+\t0,\n \tfalse,\n };\n \n-const IPAHwSettings ipaHwSettingsIMX8MP{\n+IPAHwSettings ipaHwSettingsIMX8MP{\n \tRKISP1_CIF_ISP_AE_MEAN_MAX_V10,\n \tRKISP1_CIF_ISP_HIST_BIN_N_MAX_V10,\n \tRKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10,\n \tRKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10,\n+\t0,\n \ttrue,\n };\n \n-const IPAHwSettings ipaHwSettingsV12{\n+IPAHwSettings ipaHwSettingsV12{\n \tRKISP1_CIF_ISP_AE_MEAN_MAX_V12,\n \tRKISP1_CIF_ISP_HIST_BIN_N_MAX_V12,\n \tRKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12,\n \tRKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12,\n+\t0,\n \tfalse,\n };\n \n@@ -132,20 +136,22 @@ std::string IPARkISP1::logPrefix() const\n }\n \n int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n+\t\t    uint32_t supportedBlocks,\n \t\t    const IPACameraSensorInfo &sensorInfo,\n \t\t    const ControlInfoMap &sensorControls,\n \t\t    ControlInfoMap *ipaControls)\n {\n+\tIPAHwSettings *hw = nullptr;\n \t/* \\todo Add support for other revisions */\n \tswitch (hwRevision) {\n \tcase RKISP1_V10:\n-\t\tcontext_.hw = &ipaHwSettingsV10;\n+\t\thw = &ipaHwSettingsV10;\n \t\tbreak;\n \tcase RKISP1_V_IMX8MP:\n-\t\tcontext_.hw = &ipaHwSettingsIMX8MP;\n+\t\thw = &ipaHwSettingsIMX8MP;\n \t\tbreak;\n \tcase RKISP1_V12:\n-\t\tcontext_.hw = &ipaHwSettingsV12;\n+\t\thw = &ipaHwSettingsV12;\n \t\tbreak;\n \tdefault:\n \t\tLOG(IPARkISP1, Error)\n@@ -153,6 +159,8 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \t\t\t<< \" is currently not supported\";\n \t\treturn -ENODEV;\n \t}\n+\thw->supportedBlocks = supportedBlocks;\n+\tcontext_.hw = hw;\n \n \tLOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 06785cb2fd57..435c618731a2 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -100,7 +100,7 @@ public:\n \n \tPipelineHandlerRkISP1 *pipe();\n \tconst PipelineHandlerRkISP1 *pipe() const;\n-\tint loadIPA(unsigned int hwRevision);\n+\tint loadIPA(unsigned int hwRevision, uint32_t supportedBlocks);\n \n \tStream mainPathStream_;\n \tStream selfPathStream_;\n@@ -390,7 +390,7 @@ const PipelineHandlerRkISP1 *RkISP1CameraData::pipe() const\n \treturn static_cast<const PipelineHandlerRkISP1 *>(Camera::Private::pipe());\n }\n \n-int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n+int RkISP1CameraData::loadIPA(unsigned int hwRevision, uint32_t supportedBlocks)\n {\n \tipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);\n \tif (!ipa_)\n@@ -412,7 +412,8 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \t}\n \n \tret = ipa_->init({ ipaTuningFile, sensor_->model() }, hwRevision,\n-\t\t\t sensorInfo, sensor_->controls(), &ipaControls_);\n+\t\t\t supportedBlocks, sensorInfo, sensor_->controls(),\n+\t\t\t &ipaControls_);\n \tif (ret < 0) {\n \t\tLOG(RkISP1, Error) << \"IPA initialization failure\";\n \t\treturn ret;\n@@ -1318,6 +1319,12 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data)\n \treturn 0;\n }\n \n+/*\n+ * By default we assume all the blocks that were included in the first\n+ * extensible parameters series are available. That is the lower 20bits.\n+ */\n+const uint32_t kDefaultExtParamsBlocks = 0xfffff;\n+\n int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n {\n \tint ret;\n@@ -1355,7 +1362,21 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \tisp_->frameStart.connect(data->delayedCtrls_.get(),\n \t\t\t\t &DelayedControls::applyControls);\n \n-\tret = data->loadIPA(media_->hwRevision());\n+\tuint32_t supportedBlocks = kDefaultExtParamsBlocks;\n+\n+\tauto &controls = param_->controls();\n+\tif (controls.find(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS) != controls.end()) {\n+\t\tauto ctrl = param_->getControls({ RKISP1_CID_SUPPORTED_PARAMS_BLOCKS });\n+\t\tsupportedBlocks = static_cast<uint32_t>(\n+\t\t\tctrl.get(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS).get<int32_t>());\n+\t} else {\n+\t\tLOG(RkISP1, Error)\n+\t\t\t<< \"Failed to query supported params blocks. Falling back to defaults.\";\n+\t}\n+\n+\tLOG(RkISP1, Error) << \"Supported params blocks: \" << supportedBlocks;\n+\n+\tret = data->loadIPA(media_->hwRevision(), supportedBlocks);\n \tif (ret)\n \t\treturn ret;\n \n","prefixes":["v2","14/16"]}