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

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

Commit Message

Hirokazu Honda April 28, 2021, 7:36 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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 73306cea..b4d4b97d 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -891,6 +891,16 @@  int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
 	ControlInfoMap::Map controls = IPU3Controls;
 	const ControlInfoMap &sensorControls = sensor->controls();
 
+	if (!sensorInfo.testPatternModes.empty()) {
+		std::vector<ControlValue> values;
+		values.reserve(sensorInfo.testPatternModes.size());
+
+		for (int32_t pattern : sensorInfo.testPatternModes)
+			values.emplace_back(pattern);
+
+		controls[&controls::draft::TestPatternMode] = ControlInfo(values);
+	}
+
 	/*
 	 * Compute exposure time limits.
 	 *