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

Message ID 20210519075941.1337388-5-hiroh@chromium.org
State Superseded
Headers show
Series
  • [libcamera-devel,v5,1/6] libcamera: controls: Add sensor test pattern mode
Related show

Commit Message

Hirokazu Honda May 19, 2021, 7:59 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>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.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 ade8ffbd..c1d1d937 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 (const std::vector<uint8_t> &testPatternModes =
+		    sensor->testPatternModes();
+	    !testPatternModes.empty()) {
+		std::vector<ControlValue> values;
+		values.reserve(testPatternModes.size());
+
+		for (uint8_t pattern : testPatternModes)
+			values.emplace_back(static_cast<int32_t>(pattern));
+
+		controls[&controls::draft::TestPatternMode] = ControlInfo(values);
+	}
+
 	/*
 	 * Compute exposure time limits.
 	 *