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

Message ID 20210413075013.3069213-6-hiroh@chromium.org
State Superseded
Headers show
Series
  • Report available test pattern modes
Related show

Commit Message

Hirokazu Honda April 13, 2021, 7:50 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(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 519cad4f..bcef331c 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::SensorTestPatternMode] =
+			ControlInfo(libcamera::Span<const ControlValue>(values));
+	}
+
 	/*
 	 * Compute exposure time limits.
 	 *