From 4e9be7d11b9df833ce71e7c134a3d73e4ff5dcf8 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Mon, 17 Nov 2025 17:08:15 +0900 Subject: [PATCH] ipa: ipu3, mali-c55, rkisp1, rpi: Fix reporting non-scalar controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ControlInfos of non-scalar controls that are reported in controls() must have non-scalar default values for controls that have a defined size. This is because applications should be able to directly set the default value from a ControlInfo to the control. Currently this is relevant to the following controls: - ColourGains - ColourCorrectionMatrix - FrameDurationLimits - AfWindows Fix the scalarness of these controls where relevant. Signed-off-by: Paul Elder Tested-by: Barnabás Pőcze # rkisp1 Reviewed-by: Naushir Patuck Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- src/ipa/ipu3/ipu3.cpp | 4 ++-- src/ipa/mali-c55/mali-c55.cpp | 4 +++- src/ipa/rkisp1/algorithms/awb.cpp | 4 +++- src/ipa/rkisp1/rkisp1.cpp | 3 ++- src/ipa/rpi/common/ipa_base.cpp | 7 +++++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 1cae08bf..b926f579 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -280,10 +281,9 @@ void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo, uint64_t frameSize = lineLength * frameHeights[i]; frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); } - controls[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], frameDurations[1], - frameDurations[2]); + Span{ { frameDurations[2], frameDurations[2] } }); controls.merge(context_.ctrlMap); *ipaControls = ControlInfoMap(std::move(controls), controls::controls); diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp index 7d45e731..4eaedabb 100644 --- a/src/ipa/mali-c55/mali-c55.cpp +++ b/src/ipa/mali-c55/mali-c55.cpp @@ -5,6 +5,7 @@ * Mali-C55 ISP image processing algorithms */ +#include #include #include #include @@ -14,6 +15,7 @@ #include #include +#include #include #include @@ -236,7 +238,7 @@ void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo, ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0], frameDurations[1], - frameDurations[2]); + Span{ { frameDurations[2], frameDurations[2] } }); /* * Compute exposure time limits from the V4L2_CID_EXPOSURE control diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 399fb51b..e8da7974 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -91,7 +91,9 @@ int Awb::init(IPAContext &context, const YamlObject &tuningData) kMaxColourTemperature, kDefaultColourTemperature); cmap[&controls::AwbEnable] = ControlInfo(false, true); - cmap[&controls::ColourGains] = ControlInfo(0.0f, 3.996f, 1.0f); + + cmap[&controls::ColourGains] = ControlInfo(0.0f, 3.996f, + Span{ { 1.0f, 1.0f } }); if (!tuningData.contains("algorithm")) LOG(RkISP1Awb, Info) << "No AWB algorithm specified." diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index fa22bfc3..61d3d1f6 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -439,7 +439,8 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo, /* \todo Move this (and other agc-related controls) to agc */ context_.ctrlMap[&controls::FrameDurationLimits] = - ControlInfo(frameDurations[0], frameDurations[1], frameDurations[2]); + ControlInfo(frameDurations[0], frameDurations[1], + ControlValue(Span{ { frameDurations[2], frameDurations[2] } })); ctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end()); *ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls); diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index 8dfe35cc..14aba450 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -7,6 +7,7 @@ #include "ipa_base.h" +#include #include #include @@ -105,7 +106,8 @@ const ControlInfoMap::Map ipaAfControls{ { &controls::AfRange, ControlInfo(controls::AfRangeValues) }, { &controls::AfSpeed, ControlInfo(controls::AfSpeedValues) }, { &controls::AfMetering, ControlInfo(controls::AfMeteringValues) }, - { &controls::AfWindows, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, + { &controls::AfWindows, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), + Span{ { Rectangle{} } }) }, { &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) }, { &controls::AfPause, ControlInfo(controls::AfPauseValues) }, { &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) } @@ -246,7 +248,8 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa ctrlMap[&controls::FrameDurationLimits] = ControlInfo(static_cast(mode_.minFrameDuration.get()), static_cast(mode_.maxFrameDuration.get()), - static_cast(defaultMinFrameDuration.get())); + Span{ { static_cast(defaultMinFrameDuration.get()), + static_cast(defaultMinFrameDuration.get()) } }); ctrlMap[&controls::AnalogueGain] = ControlInfo(static_cast(mode_.minAnalogueGain),