[PATCH v6 4/5] pipeline: simple: Create DelayedControls instance once only

Stefan Klug stefan.klug at ideasonboard.com
Mon Mar 31 17:54:49 CEST 2025


Hi Stanislaw,

Thank you for the patch.

On Wed, Mar 05, 2025 at 02:52:55PM +0100, Stanislaw Gruszka wrote:
> From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
> The DelayedControls instance for the camera sensor is created in
> SimplePipelineHandler::configure(). Constant deletion and reconstruction
> of a new object is unnecessary, as the control delays are an intrinsic
> property of the sensor and are known at initialization time. Move the
> DelayedControls creation to the SimpleCameraData class constructor.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka at linux.intel.com>

Reviewed-by: Stefan Klug <stefan.klug at ideasonboard.com> 

Cheers,
Stefan

> ---
>  src/libcamera/pipeline/simple/simple.cpp | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 7be49017..58aa3dba 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -489,6 +489,13 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
>  	if (!sensor_)
>  		return;
>  
> +	const CameraSensorProperties::SensorDelays &delays = sensor_->sensorDelays();
> +	std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
> +		{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },
> +		{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },
> +	};
> +	delayedCtrls_ = std::make_unique<DelayedControls>(sensor_->device(), params);
> +
>  	LOG(SimplePipeline, Debug)
>  		<< "Found pipeline: "
>  		<< utils::join(entities_, " -> ",
> @@ -1302,15 +1309,6 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
>  	if (outputCfgs.empty())
>  		return 0;
>  
> -	const CameraSensorProperties::SensorDelays &delays = data->sensor_->sensorDelays();
> -	std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
> -		{ V4L2_CID_ANALOGUE_GAIN, { delays.gainDelay, false } },
> -		{ V4L2_CID_EXPOSURE, { delays.exposureDelay, false } },
> -	};
> -	data->delayedCtrls_ =
> -		std::make_unique<DelayedControls>(data->sensor_->device(),
> -						  params);
> -
>  	StreamConfiguration inputCfg;
>  	inputCfg.pixelFormat = pipeConfig->captureFormat;
>  	inputCfg.size = pipeConfig->captureSize;
> -- 
> 2.43.0
> 


More information about the libcamera-devel mailing list