[libcamera-devel,v2,6/7] libcamera: pipeline: ipu3: Report available sensor test pattern mode
diff mbox series

Message ID 20210421042346.312854-7-hiroh@chromium.org
State Superseded
Headers show
Series
  • Report Android HAL client test pattern modes
Related show

Commit Message

Hirokazu Honda April 21, 2021, 4:23 a.m. UTC
PipelineHandlerIPU3 gets available test pattern modes of the
sensor device and reports them to a client.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Laurent Pinchart April 27, 2021, 4:07 a.m. UTC | #1
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@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.
>  	 *

Patch
diff mbox series

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