[libcamera-devel] [RFC PATCH v2 4/5] libcamera: ipu3: Apply a requested test pattern mode

Hirokazu Honda hiroh at chromium.org
Tue Jun 22 04:36:53 CEST 2021


Apply a camera sensor a requested test pattern mode. The test
pattern mode can be specified per frame.

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

diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
index 8548f749..9d1ff07d 100644
--- a/src/libcamera/pipeline/ipu3/cio2.cpp
+++ b/src/libcamera/pipeline/ipu3/cio2.cpp
@@ -12,6 +12,7 @@
 #include <libcamera/control_ids.h>
 #include <libcamera/formats.h>
 #include <libcamera/geometry.h>
+#include <libcamera/request.h>
 #include <libcamera/stream.h>
 
 #include "libcamera/internal/camera_sensor.h"
@@ -289,6 +290,20 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)
 		buffer->setRequest(request);
 	}
 
+	if (request->controls().contains(controls::draft::TestPatternMode)) {
+		const uint8_t testPatternMode =
+			static_cast<uint8_t>(request->controls().get(
+				controls::draft::TestPatternMode));
+		int ret = sensor_->setTestPatternMode(testPatternMode);
+		if (ret) {
+			LOG(IPU3, Error)
+				<< "Failed to set test pattern mode: " << ret;
+		} else {
+			request->metadata().set(controls::draft::TestPatternMode,
+						testPatternMode);
+		}
+	}
+
 	int ret = output_->queueBuffer(buffer);
 	if (ret)
 		return nullptr;
-- 
2.32.0.288.g62a8d224e6-goog



More information about the libcamera-devel mailing list