[RFC,08/12] pipeline: rpi: Allow generation of raw input configurations
diff mbox series

Message ID 20250827090739.86955-9-david.plowman@raspberrypi.com
State New
Headers show
Series
  • Bayer Re-Processing
Related show

Commit Message

David Plowman Aug. 27, 2025, 9:07 a.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 1d4d6088..e7b01f9f 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -393,12 +393,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;
@@ -410,6 +421,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;
@@ -495,6 +515,7 @@  PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole
 		cfg.pixelFormat = pixelFormat;
 		cfg.colorSpace = colorSpace;
 		cfg.bufferCount = bufferCount;
+		cfg.direction = direction;
 		config->addConfiguration(cfg);
 	}