[libcamera-devel] [PATCH v2 6/7] libcamera: pipeline: ipu3: Report available sensor test pattern mode

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Apr 27 06:07:04 CEST 2021


Hi Hiro,

Thank you for the patch.

On Wed, Apr 21, 2021 at 01:23:45PM +0900, Hirokazu Honda wrote:
> PipelineHandlerIPU3 gets available test pattern modes of the
> sensor device and reports them to a client.
> 
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 51446fcf..76903d31 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -891,6 +891,18 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
>  	ControlInfoMap::Map controls = IPU3Controls;
>  	const ControlInfoMap &sensorControls = sensor->controls();
>  
> +	if (!sensorInfo.availableTestPatternModes.empty()) {
> +		std::vector<ControlValue> values(
> +			sensorInfo.availableTestPatternModes.size());
> +		for (size_t i = 0; i < values.size(); ++i) {
> +			values[i] = ControlValue(
> +				sensorInfo.availableTestPatternModes[i]);
> +		}

How about this ?
		std::vector<ControlValue> values;
		values.reserve(sensorInfo.availableTestPatternModes.size());

		for (int32_t pattern : sensorInfo.availableTestPatternModes)
			values.emplace_back(pattern);

(or similar, I haven't compile-tested it)

> +
> +		controls[&controls::draft::TestPatternMode] =
> +			ControlInfo(libcamera::Span<const ControlValue>(values));
> +	}
> +
>  	/*
>  	 * Compute exposure time limits.
>  	 *

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list