[libcamera-devel] [PATCH 04/11] pipeline: ipu3: Identify sensors that do not need the Imgu

Daniel Scally dan.scally at ideasonboard.com
Sun Mar 19 00:40:07 CET 2023


Some sensors connected to the CIO2 device do not need to be connected
to the Imgu - for example the OmniVision 7251 outputs Y10 data which
needn't be debayered and which is unsupported by the kernel's ipu3-imgu
driver.

To be able to handle those sensors we need to be able to skip the Imgu
related parts of the processing in the IPU3 pipeline. As a preliminary
step, check whether the sensor needs the Imgu during CIO2Device::init()
and provide a method to check that later.

Signed-off-by: Daniel Scally <dan.scally at ideasonboard.com>
---
 src/libcamera/pipeline/ipu3/cio2.cpp | 20 ++++++++++++++++++++
 src/libcamera/pipeline/ipu3/cio2.h   |  4 ++++
 2 files changed, 24 insertions(+)

diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
index 7400cb0b..d100df57 100644
--- a/src/libcamera/pipeline/ipu3/cio2.cpp
+++ b/src/libcamera/pipeline/ipu3/cio2.cpp
@@ -17,6 +17,7 @@
 #include <libcamera/stream.h>
 #include <libcamera/transform.h>
 
+#include "libcamera/internal/bayer_format.h"
 #include "libcamera/internal/camera_sensor.h"
 #include "libcamera/internal/framebuffer.h"
 #include "libcamera/internal/media_device.h"
@@ -160,6 +161,25 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index)
 		return -EINVAL;
 	}
 
+	/*
+	 * A camera sensor connected to the CIO2 device need not necessarily be
+	 * connected to the Imgu. This is the case for some IR cameras for
+	 * example, which output IPU3-packed Y10 data rather than packed data in
+	 * bayer patterns. In the case of those sensors we need to be able to
+	 * skip dealing with the Imgu during the pipeline, so we need to be able
+	 * to identify them.
+	 *
+	 * Check whether this sensor needs to be connected to the Imgu.
+	 */
+	needsImgu_ = false;
+	for (unsigned int mbusCode : sensorCodes) {
+		const BayerFormat &bayerFormat = BayerFormat::fromMbusCode(mbusCode);
+		if (bayerFormat.isValid() && bayerFormat.order < BayerFormat::MONO) {
+			needsImgu_ = true;
+			break;
+		}
+	}
+
 	/*
 	 * \todo Define when to open and close video device nodes, as they
 	 * might impact on power consumption.
diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h
index bbd87eb8..064673d9 100644
--- a/src/libcamera/pipeline/ipu3/cio2.h
+++ b/src/libcamera/pipeline/ipu3/cio2.h
@@ -63,6 +63,8 @@ public:
 
 	Signal<> bufferAvailable;
 
+	bool needsImgu() { return needsImgu_; }
+
 private:
 	void freeBuffers();
 
@@ -74,6 +76,8 @@ private:
 
 	std::vector<std::unique_ptr<FrameBuffer>> buffers_;
 	std::queue<FrameBuffer *> availableBuffers_;
+
+	bool needsImgu_;
 };
 
 } /* namespace libcamera */
-- 
2.34.1



More information about the libcamera-devel mailing list