{"id":24124,"url":"https://patchwork.libcamera.org/api/patches/24124/?format=json","web_url":"https://patchwork.libcamera.org/patch/24124/","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":"<20250815102945.1602071-15-stefan.klug@ideasonboard.com>","date":"2025-08-15T10:29:34","name":"[v3,14/19] pipeline: rkisp1: Query kernel for available params blocks","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a5ab29589603d849fa0466b9aba0bdc9c8878c7c","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24124/mbox/","series":[{"id":5382,"url":"https://patchwork.libcamera.org/api/series/5382/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5382","date":"2025-08-15T10:29:20","name":"Implement WDR algorithm","version":3,"mbox":"https://patchwork.libcamera.org/series/5382/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24124/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24124/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 046A2BDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Aug 2025 10:30:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AECFC692CF;\n\tFri, 15 Aug 2025 12:30:36 +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 E1A6E69257\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Aug 2025 12:30:34 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:83d1:ae5d:93a6:6837])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 0A9138FA;\n\tFri, 15 Aug 2025 12:29:40 +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=\"JoLL0LSJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755253780;\n\tbh=PJCC0lHXXPZqmBsH56jjbfB4vmwvikn4rZeSgYuGvYc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=JoLL0LSJPNVMZSI9ptDf060HlgVOXnrBAh1UXjph3PToGWfgdpw28MbxY8CL4P/tG\n\t0VS6dStw1OSouleh8t8ki/SAjefMj3ZA2yhPSzBikcvwO0puupYOz3cV6xtEQNuE/k\n\tGxG1Nquv/07HVIFojzxr2UT6+ig8srwtQb5sA4wE=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v3 14/19] pipeline: rkisp1: Query kernel for available params\n\tblocks","Date":"Fri, 15 Aug 2025 12:29:34 +0200","Message-ID":"<20250815102945.1602071-15-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","In-Reply-To":"<20250815102945.1602071-1-stefan.klug@ideasonboard.com>","References":"<20250815102945.1602071-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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\n\nChanges in v3:\n- Removed unnecessary log statement\n- Collected tags\n- Added case for getControls() failing internally\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 c4d4fdc6aa73..199f53d9e631 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@@ -383,7 +383,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@@ -405,7 +405,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@@ -1311,6 +1312,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@@ -1348,7 +1355,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 list = param_->getControls({ { RKISP1_CID_SUPPORTED_PARAMS_BLOCKS } });\n+\t\tif (!list.empty())\n+\t\t\tsupportedBlocks = static_cast<uint32_t>(\n+\t\t\t\tlist.get(RKISP1_CID_SUPPORTED_PARAMS_BLOCKS)\n+\t\t\t\t\t.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+\tret = data->loadIPA(media_->hwRevision(), supportedBlocks);\n \tif (ret)\n \t\treturn ret;\n \n","prefixes":["v3","14/19"]}