[RFC,1/6] libcamera: simple: Set the number of software ISP streams to 2
diff mbox series

Message ID 20250716142027.236277-2-uajain@igalia.com
State New
Headers show
Series
  • libcamera: simple: Enable Raw capture
Related show

Commit Message

Umang Jain July 16, 2025, 2:20 p.m. UTC
From: Milan Zamazal <mzamazal@redhat.com>

When software ISP is enabled, we want to be able to provide a raw stream
in addition to the processed stream.  For this purpose, we need two
streams.  If only the processed stream is requested, it doesn't harm to
allocate two.

This is a hack for the lack of a better easy option.  The number of
streams is determined as a camera property in the pipeline matching.
The actual number of streams needed (one or two) is determined only when
examining roles in SimplePipelineHandler::generateConfiguration.

In theory, software ISP could produce multiple processed streams but
this is out of scope of this patch series.  Hence two streams are
sufficient at the moment.

When software ISP is not enabled, the camera won't be able to produce
multiple streams (assuming there's no hardware converter) and only
single stream should be allocated as before.  The simple pipeline
handler assumes there's a linear pipeline from the camera sensor to a
video capture device, and only supports a single stream.  Branches in
the hardware pipeline that would allow capturing multiple streams from
the same camera sensor are not supported.  We have no plan to change
that, as a device that can produce multiple streams will likely be
better supported by a dedicated pipeline handler.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Umang Jain <uajain@igalia.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index efb07051..de6b29ab 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -1265,7 +1265,7 @@  CameraConfiguration::Status SimpleCameraConfiguration::validate()
  */
 
 SimplePipelineHandler::SimplePipelineHandler(CameraManager *manager)
-	: PipelineHandler(manager), converter_(nullptr)
+	: PipelineHandler(manager), converter_(nullptr), swIspEnabled_(false)
 {
 }
 
@@ -1687,7 +1687,16 @@  bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
 		}
 	}
 
-	swIspEnabled_ = info->swIspEnabled;
+	if (info->swIspEnabled) {
+		/*
+		 * When the software ISP is enabled, the simple pipeline handler
+		 * exposes the raw stream, giving a total of two streams. This
+		 * is mutally exclusive with the presence of a converter.
+		 */
+		ASSERT(!converter_);
+		numStreams = 2;
+		swIspEnabled_ = true;
+	}
 
 	/* Locate the sensors. */
 	std::vector<MediaEntity *> sensors = locateSensors(media);