[v5,2/2] ipa: ipu3, mali-c55, rkisp1, rpi: Fix reporting non-scalar controls
diff mbox series

Message ID 20251014133404.3194952-3-paul.elder@ideasonboard.com
State New
Headers show
Series
  • Fix ControlSerializer deserializing array controls
Related show

Commit Message

Paul Elder Oct. 14, 2025, 1:34 p.m. UTC
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 <paul.elder@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1

---
Changes in v5:
- add AfWindows
- create Span arrays on-the-fly

Changes in v4:
- improve commit message

No change in v3

No change in v2
---
 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   | 9 +++++++--
 5 files changed, 17 insertions(+), 7 deletions(-)

Comments

Paul Elder Oct. 17, 2025, 8:40 a.m. UTC | #1
(Adding Naush to CC)

Hi Naush,

This touches rpi code; are you ok with this change? It's part of a fix for bug 285 [0].


Thanks,

Paul

[0] https://bugs.libcamera.org/show_bug.cgi?id=285

Quoting Paul Elder (2025-10-14 22:34:02)
> 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 <paul.elder@ideasonboard.com>
> Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1
> 
> ---
> Changes in v5:
> - add AfWindows
> - create Span arrays on-the-fly
> 
> Changes in v4:
> - improve commit message
> 
> No change in v3
> 
> No change in v2
> ---
>  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   | 9 +++++++--
>  5 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 1cae08bf255f..b926f579a9a3 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -20,6 +20,7 @@
>  
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
>  #include <libcamera/control_ids.h>
> @@ -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<const int64_t, 2>{ { 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 7d45e7310aec..4eaedabb47b8 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 <array>
>  #include <map>
>  #include <string.h>
>  #include <vector>
> @@ -14,6 +15,7 @@
>  
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/control_ids.h>
>  #include <libcamera/ipa/ipa_interface.h>
> @@ -236,7 +238,7 @@ void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo,
>  
>         ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],
>                                                               frameDurations[1],
> -                                                             frameDurations[2]);
> +                                                             Span<const int64_t, 2>{ { 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 399fb51be414..e8da7974a1d6 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<const float, 2>{ { 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 fa22bfc34904..61d3d1f6f96b 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<const int64_t, 2>{ { 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 8dfe35cc3267..47d1b8cb7963 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 <array>
>  #include <cmath>
>  
>  #include <libcamera/base/log.h>
> @@ -99,13 +100,16 @@ const ControlInfoMap::Map ipaColourControls{
>         { &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },
>  };
>  
> +std::array<Rectangle, 1> defaultAfWindows = { Rectangle{} };
> +
>  /* IPA controls handled conditionally, if the lens has a focus control */
>  const ControlInfoMap::Map ipaAfControls{
>         { &controls::AfMode, ControlInfo(controls::AfModeValues) },
>         { &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<const Rectangle, 1>{ defaultAfWindows }) },
>         { &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },
>         { &controls::AfPause, ControlInfo(controls::AfPauseValues) },
>         { &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }
> @@ -246,7 +250,8 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
>         ctrlMap[&controls::FrameDurationLimits] =
>                 ControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),
>                             static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()),
> -                           static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()));
> +                           Span<const int64_t, 2>{ { static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()),
> +                                                     static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()) } });
>  
>         ctrlMap[&controls::AnalogueGain] =
>                 ControlInfo(static_cast<float>(mode_.minAnalogueGain),
> -- 
> 2.47.2
>
Naushir Patuck Oct. 17, 2025, 8:57 a.m. UTC | #2
Hi Paul,

On Tue, 14 Oct 2025 at 14:34, Paul Elder <paul.elder@ideasonboard.com>
wrote:

> 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 <paul.elder@ideasonboard.com>
> Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1
>
> ---
> Changes in v5:
> - add AfWindows
> - create Span arrays on-the-fly
>
> Changes in v4:
> - improve commit message
>
> No change in v3
>
> No change in v2
> ---
>  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   | 9 +++++++--
>  5 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 1cae08bf255f..b926f579a9a3 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -20,6 +20,7 @@
>
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>
>  #include <libcamera/control_ids.h>
> @@ -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<const
> int64_t, 2>{ { 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 7d45e7310aec..4eaedabb47b8 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 <array>
>  #include <map>
>  #include <string.h>
>  #include <vector>
> @@ -14,6 +15,7 @@
>
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/control_ids.h>
>  #include <libcamera/ipa/ipa_interface.h>
> @@ -236,7 +238,7 @@ void IPAMaliC55::updateControls(const
> IPACameraSensorInfo &sensorInfo,
>
>         ctrlMap[&controls::FrameDurationLimits] =
> ControlInfo(frameDurations[0],
>
> frameDurations[1],
> -
>  frameDurations[2]);
> +                                                             Span<const
> int64_t, 2>{ { 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 399fb51be414..e8da7974a1d6 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<const float, 2>{ {
> 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 fa22bfc34904..61d3d1f6f96b 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<const int64_t, 2>{ {
> 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 8dfe35cc3267..47d1b8cb7963 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 <array>
>  #include <cmath>
>
>  #include <libcamera/base/log.h>
> @@ -99,13 +100,16 @@ const ControlInfoMap::Map ipaColourControls{
>         { &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },
>  };
>
> +std::array<Rectangle, 1> defaultAfWindows = { Rectangle{} };
> +
>  /* IPA controls handled conditionally, if the lens has a focus control */
>  const ControlInfoMap::Map ipaAfControls{
>         { &controls::AfMode, ControlInfo(controls::AfModeValues) },
>         { &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<const Rectangle, 1>{
> defaultAfWindows }) },
>

I can't decide if I prefer

-                                           Span<const Rectangle, 1>{
defaultAfWindows }) },
+                                           Span<const Rectangle, 1>{ {
Rectangle{} } }) },

and removing defaultAfWindows.  It's not a big deal, either way:

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>



>         { &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },
>         { &controls::AfPause, ControlInfo(controls::AfPauseValues) },
>         { &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }
> @@ -246,7 +250,8 @@ int32_t IpaBase::configure(const IPACameraSensorInfo
> &sensorInfo, const ConfigPa
>         ctrlMap[&controls::FrameDurationLimits] =
>
> ControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),
>
> static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()),
> -
>  static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()));
> +                           Span<const int64_t, 2>{ {
> static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()),
> +
>  static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()) } });
>
>         ctrlMap[&controls::AnalogueGain] =
>                 ControlInfo(static_cast<float>(mode_.minAnalogueGain),
> --
> 2.47.2
>
>
Dan Scally Oct. 31, 2025, 3:24 p.m. UTC | #3
Hi Paul

On 14/10/2025 14:34, Paul Elder wrote:
> 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 <paul.elder@ideasonboard.com>
> Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1
> 
Looks good to me also:

Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>> ---
> Changes in v5:
> - add AfWindows
> - create Span arrays on-the-fly
> 
> Changes in v4:
> - improve commit message
> 
> No change in v3
> 
> No change in v2
> ---
>   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   | 9 +++++++--
>   5 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 1cae08bf255f..b926f579a9a3 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -20,6 +20,7 @@
>   
>   #include <libcamera/base/file.h>
>   #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>   #include <libcamera/base/utils.h>
>   
>   #include <libcamera/control_ids.h>
> @@ -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<const int64_t, 2>{ { 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 7d45e7310aec..4eaedabb47b8 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 <array>
>   #include <map>
>   #include <string.h>
>   #include <vector>
> @@ -14,6 +15,7 @@
>   
>   #include <libcamera/base/file.h>
>   #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>   
>   #include <libcamera/control_ids.h>
>   #include <libcamera/ipa/ipa_interface.h>
> @@ -236,7 +238,7 @@ void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo,
>   
>   	ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],
>   							      frameDurations[1],
> -							      frameDurations[2]);
> +							      Span<const int64_t, 2>{ { 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 399fb51be414..e8da7974a1d6 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<const float, 2>{ { 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 fa22bfc34904..61d3d1f6f96b 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<const int64_t, 2>{ { 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 8dfe35cc3267..47d1b8cb7963 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 <array>
>   #include <cmath>
>   
>   #include <libcamera/base/log.h>
> @@ -99,13 +100,16 @@ const ControlInfoMap::Map ipaColourControls{
>   	{ &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },
>   };
>   
> +std::array<Rectangle, 1> defaultAfWindows = { Rectangle{} };
> +
>   /* IPA controls handled conditionally, if the lens has a focus control */
>   const ControlInfoMap::Map ipaAfControls{
>   	{ &controls::AfMode, ControlInfo(controls::AfModeValues) },
>   	{ &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<const Rectangle, 1>{ defaultAfWindows }) },
>   	{ &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },
>   	{ &controls::AfPause, ControlInfo(controls::AfPauseValues) },
>   	{ &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }
> @@ -246,7 +250,8 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
>   	ctrlMap[&controls::FrameDurationLimits] =
>   		ControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),
>   			    static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()),
> -			    static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()));
> +			    Span<const int64_t, 2>{ { static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()),
> +						      static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()) } });
>   
>   	ctrlMap[&controls::AnalogueGain] =
>   		ControlInfo(static_cast<float>(mode_.minAnalogueGain),

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 1cae08bf255f..b926f579a9a3 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -20,6 +20,7 @@ 
 
 #include <libcamera/base/file.h>
 #include <libcamera/base/log.h>
+#include <libcamera/base/span.h>
 #include <libcamera/base/utils.h>
 
 #include <libcamera/control_ids.h>
@@ -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<const int64_t, 2>{ { 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 7d45e7310aec..4eaedabb47b8 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 <array>
 #include <map>
 #include <string.h>
 #include <vector>
@@ -14,6 +15,7 @@ 
 
 #include <libcamera/base/file.h>
 #include <libcamera/base/log.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/control_ids.h>
 #include <libcamera/ipa/ipa_interface.h>
@@ -236,7 +238,7 @@  void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo,
 
 	ctrlMap[&controls::FrameDurationLimits] = ControlInfo(frameDurations[0],
 							      frameDurations[1],
-							      frameDurations[2]);
+							      Span<const int64_t, 2>{ { 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 399fb51be414..e8da7974a1d6 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<const float, 2>{ { 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 fa22bfc34904..61d3d1f6f96b 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<const int64_t, 2>{ { 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 8dfe35cc3267..47d1b8cb7963 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 <array>
 #include <cmath>
 
 #include <libcamera/base/log.h>
@@ -99,13 +100,16 @@  const ControlInfoMap::Map ipaColourControls{
 	{ &controls::Saturation, ControlInfo(0.0f, 32.0f, 1.0f) },
 };
 
+std::array<Rectangle, 1> defaultAfWindows = { Rectangle{} };
+
 /* IPA controls handled conditionally, if the lens has a focus control */
 const ControlInfoMap::Map ipaAfControls{
 	{ &controls::AfMode, ControlInfo(controls::AfModeValues) },
 	{ &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<const Rectangle, 1>{ defaultAfWindows }) },
 	{ &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },
 	{ &controls::AfPause, ControlInfo(controls::AfPauseValues) },
 	{ &controls::LensPosition, ControlInfo(0.0f, 32.0f, 1.0f) }
@@ -246,7 +250,8 @@  int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
 	ctrlMap[&controls::FrameDurationLimits] =
 		ControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),
 			    static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()),
-			    static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()));
+			    Span<const int64_t, 2>{ { static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()),
+						      static_cast<int64_t>(defaultMinFrameDuration.get<std::micro>()) } });
 
 	ctrlMap[&controls::AnalogueGain] =
 		ControlInfo(static_cast<float>(mode_.minAnalogueGain),