[07/11] pipeline: rpi: Allow generation of raw input configurations
diff mbox series

Message ID 20251210164055.17856-8-david.plowman@raspberrypi.com
State New
Headers show
Series
  • Bayer re-processing
Related show

Commit Message

David Plowman Dec. 10, 2025, 4:15 p.m. UTC
Support the RawInput stream role, which makes a raw stream that is
marked as an input (for example, for Bayer re-processing).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 .../pipeline/rpi/common/pipeline_base.cpp     | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index 6878bdee..76bcb2a4 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -436,12 +436,23 @@  PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole
 	V4L2VideoDevice::Formats fmts;
 	Size size;
 	std::optional<ColorSpace> colorSpace;
+	StreamDirection direction;
 
 	if (roles.empty())
 		return config;
 
-	Size sensorSize = data->sensor_->resolution();
+	/*
+	 * When running memory to memory, without an actual sensor, we can't ask for its size.
+	 * We'll make a CameraSensorMemory, to match the raw input stream configuration in due
+	 * course, but for now use a placeholder size in this case.
+	 */
+	Size sensorSize = Size(640, 480);
+	if (data->sensor_)
+		sensorSize = data->sensor_->resolution();
+
 	for (const StreamRole role : roles) {
+		direction = StreamDirection::Output;
+
 		switch (role) {
 		case StreamRole::Raw:
 			size = sensorSize;
@@ -453,6 +464,15 @@  PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole
 			bufferCount = 2;
 			break;
 
+		case StreamRole::RawInput:
+			size = sensorSize;
+			/* Placeholder value to prevent warnings, the application should override. */
+			pixelFormat = formats::SBGGR12;
+			colorSpace = ColorSpace::Raw;
+			bufferCount = 2;
+			direction = StreamDirection::Input;
+			break;
+
 		case StreamRole::StillCapture:
 			fmts = data->ispFormats();
 			pixelFormat = formats::YUV420;
@@ -538,6 +558,7 @@  PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole
 		cfg.pixelFormat = pixelFormat;
 		cfg.colorSpace = colorSpace;
 		cfg.bufferCount = bufferCount;
+		cfg.direction = direction;
 		config->addConfiguration(cfg);
 	}