[libcamera-devel] [PATCH v3 1/3] ipa: ipu3: Consolidate querying of exposure and gain limits

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Mar 24 16:42:26 CET 2022


Hi Umang,

Thank you for the patch.

On Thu, Mar 24, 2022 at 07:50:33PM +0530, Umang Jain via libcamera-devel wrote:
> The exposure and gain limits are required for AGC configuration
> handled in IPAIPU3::updateSessionConfiguration(), which is happening
> already. Therefore the max/min private members in IPAIPU3 class for
> exposure/gain serve no use except setting initial values of exposure_
> and gain_ members.
> 
> Drop the max/min private members from IPAIPU3 class and set initial
> gain_ and exposure_ in  IPAIPU3::updateSessionConfiguration().
> 
> Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

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

> ---
>  src/ipa/ipu3/ipu3.cpp | 26 ++------------------------
>  1 file changed, 2 insertions(+), 24 deletions(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 1ea2c898..a8cc2f6c 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -169,11 +169,7 @@ private:
>  	/* Camera sensor controls. */
>  	uint32_t defVBlank_;
>  	uint32_t exposure_;
> -	uint32_t minExposure_;
> -	uint32_t maxExposure_;
>  	uint32_t gain_;
> -	uint32_t minGain_;
> -	uint32_t maxGain_;
>  
>  	/* Interface to the Camera Helper */
>  	std::unique_ptr<CameraSensorHelper> camHelper_;
> @@ -194,10 +190,12 @@ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls)
>  	const ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;
>  	int32_t minExposure = v4l2Exposure.min().get<int32_t>();
>  	int32_t maxExposure = v4l2Exposure.max().get<int32_t>();
> +	exposure_ = minExposure;
>  
>  	const ControlInfo &v4l2Gain = sensorControls.find(V4L2_CID_ANALOGUE_GAIN)->second;
>  	int32_t minGain = v4l2Gain.min().get<int32_t>();
>  	int32_t maxGain = v4l2Gain.max().get<int32_t>();
> +	gain_ = minGain;
>  
>  	/*
>  	 * When the AGC computes the new exposure values for a frame, it needs
> @@ -434,32 +432,12 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,
>  	 */
>  	sensorCtrls_ = configInfo.sensorControls;
>  
> -	const auto itExp = sensorCtrls_.find(V4L2_CID_EXPOSURE);
> -	if (itExp == sensorCtrls_.end()) {
> -		LOG(IPAIPU3, Error) << "Can't find exposure control";
> -		return -EINVAL;
> -	}
> -
> -	const auto itGain = sensorCtrls_.find(V4L2_CID_ANALOGUE_GAIN);
> -	if (itGain == sensorCtrls_.end()) {
> -		LOG(IPAIPU3, Error) << "Can't find gain control";
> -		return -EINVAL;
> -	}
> -
>  	const auto itVBlank = sensorCtrls_.find(V4L2_CID_VBLANK);
>  	if (itVBlank == sensorCtrls_.end()) {
>  		LOG(IPAIPU3, Error) << "Can't find VBLANK control";
>  		return -EINVAL;
>  	}
>  
> -	minExposure_ = itExp->second.min().get<int32_t>();
> -	maxExposure_ = itExp->second.max().get<int32_t>();
> -	exposure_ = minExposure_;
> -
> -	minGain_ = itGain->second.min().get<int32_t>();
> -	maxGain_ = itGain->second.max().get<int32_t>();
> -	gain_ = minGain_;
> -
>  	defVBlank_ = itVBlank->second.def().get<int32_t>();
>  
>  	calculateBdsGrid(configInfo.bdsOutputSize);

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list