[RFC,v2,05/13] libcamera: simple: Identify requested stream roles
diff mbox series

Message ID 20250124215806.158024-6-mzamazal@redhat.com
State New
Headers show
Series
  • Enable raw streams with software ISP
Related show

Commit Message

Milan Zamazal Jan. 24, 2025, 9:57 p.m. UTC
Currently, raw streams don't work in the simple pipeline and the
requested stream roles are ignored.  In order to support raw streams, we
now track in SimpleCameraData whether raw and/or software ISP processed
streams are requested.  We also check that at most one raw stream is
requested, there is no reason to have more.

That information will be used in the followup patches.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 71853bb2..e6bbff5d 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -298,6 +298,8 @@  public:
 	};
 	std::queue<RequestOutputs> conversionQueue_;
 	bool useConversion_;
+	bool swispRequested_;
+	bool rawRequested_;
 
 	std::unique_ptr<Converter> converter_;
 	std::unique_ptr<SoftwareIsp> swIsp_;
@@ -1188,6 +1190,22 @@  SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo
 	if (roles.empty())
 		return config;
 
+	data->swispRequested_ = false;
+	data->rawRequested_ = false;
+	if (data->swIsp_) {
+		for (auto &role : roles)
+			if (role == StreamRole::Raw) {
+				if (data->rawRequested_) {
+					LOG(SimplePipeline, Error)
+						<< "Can't capture multiple raw streams";
+					return nullptr;
+				}
+				data->rawRequested_ = true;
+			} else {
+				data->swispRequested_ = true;
+			}
+	}
+
 	/* Create the formats map. */
 	std::map<PixelFormat, std::vector<SizeRange>> formats;