[RFC PATCH] ipa: rkisp1: agc: Initialize enum controls with a list of values

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jan 23 23:56:31 CET 2025


Hi Stefan,

Thank you for the patch.

On Thu, Jan 23, 2025 at 01:09:14PM +0100, Stefan Klug wrote:
> The controls ExposureTimeMode and AnalogueGainMode are shown in camshark
> as normal int entries instead of enum popups. The reason is that
> ControlInfos for these controls are constructed using min/max instead
> of a list of valid ControlValues. Camshark uses the values() vector to
> deduce if the control is an enum or not. It might be debatable if this
> is the correct check, but all other ControlInfos for enum controls in
> libcamera are initialized using a list.

Maybe the Control (or ControlId) class should report if a control is an
enum. We don't have that now though, and even if we did, this patch
looks good as it makes the two controls consistent with the other
enumerated controls.

> Modify the construction of the ControlInfos to use the Span based
> constructor to fix that issue.
> 
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Could you please do the same for the RPi IPA module ?

> ---
>  src/ipa/rkisp1/algorithms/agc.cpp | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
> index 1680669c6875..e7c6de757593 100644
> --- a/src/ipa/rkisp1/algorithms/agc.cpp
> +++ b/src/ipa/rkisp1/algorithms/agc.cpp
> @@ -149,13 +149,13 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData)
>  		return ret;
>  
>  	context.ctrlMap[&controls::ExposureTimeMode] =
> -		ControlInfo(static_cast<int32_t>(controls::ExposureTimeModeAuto),
> -			    static_cast<int32_t>(controls::ExposureTimeModeManual),
> -			    static_cast<int32_t>(controls::ExposureTimeModeAuto));
> +		ControlInfo({ { ControlValue(controls::ExposureTimeModeAuto),
> +				ControlValue(controls::ExposureTimeModeManual) } },
> +			    controls::ExposureTimeModeAuto);
>  	context.ctrlMap[&controls::AnalogueGainMode] =
> -		ControlInfo(static_cast<int32_t>(controls::AnalogueGainModeAuto),
> -			    static_cast<int32_t>(controls::AnalogueGainModeManual),
> -			    static_cast<int32_t>(controls::AnalogueGainModeAuto));
> +		ControlInfo({ { ControlValue(controls::AnalogueGainModeAuto),
> +				ControlValue(controls::AnalogueGainModeManual) } },
> +			    controls::AnalogueGainModeAuto);
>  	/* \todo Move this to the Camera class */
>  	context.ctrlMap[&controls::AeEnable] = ControlInfo(false, true, true);
>  	context.ctrlMap.merge(controls());

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list