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

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

Commit Message

Hirokazu Honda June 10, 2021, 8:25 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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 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 b986bb70..52b11687 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -935,6 +935,16 @@  int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
 
 	ControlInfoMap::Map controls = IPU3Controls;
 	const ControlInfoMap &sensorControls = sensor->controls();
+	const std::vector<int32_t> &testPatternModes = sensor->testPatternModes();
+	if (!testPatternModes.empty()) {
+		std::vector<ControlValue> values;
+		values.reserve(testPatternModes.size());
+
+		for (int32_t pattern : testPatternModes)
+			values.emplace_back(pattern);
+
+		controls[&controls::draft::TestPatternMode] = ControlInfo(values);
+	}
 
 	/*
 	 * Compute exposure time limits.