[libcamera-devel,3/3] libcamera: rkisp1: Reserve main path for StillCapture
diff mbox series

Message ID 20230221164504.120738-4-jacopo.mondi@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: rkisp1: Fix generateConfiguration
Related show

Commit Message

Jacopo Mondi Feb. 21, 2023, 4:45 p.m. UTC
The main output path can produce images in higher resolution and
should be reserved for the StillCapture role when a configuration
is generated.

Before this change if StillCapture was not requested first it got
assigned to the self-path and thus down-scaled to 1920x1920.

With this change, StillCapture can be asked last and it would take
precedence over other streams for the usage of the main path.

$ cam -c1 --stream role=viewfinder --stream role=still
Camera camera.cpp:969 streams configuration: (0) 1920x1080-NV12 (1) 4208x3120-NV12

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 05a7ba03b2d2..23ff859e3835 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -626,6 +626,16 @@  PipelineHandlerRkISP1::generateConfiguration(Camera *camera,
 	if (roles.empty())
 		return config;
 
+	/* If still capture is requested, reserve the main path for it. */
+	bool reserveMainPath = false;
+	for (const StreamRole role : roles) {
+		if (role != StreamRole::StillCapture)
+			continue;
+
+		reserveMainPath = true;
+		break;
+	}
+
 	/*
 	 * As the ISP can't output different color spaces for the main and self
 	 * path, pick a sensible default color space based on the role of the
@@ -644,6 +654,9 @@  PipelineHandlerRkISP1::generateConfiguration(Camera *camera,
 			if (!colorSpace)
 				colorSpace = ColorSpace::Sycc;
 
+			/* Unlock usage of main path which was reserved. */
+			reserveMainPath = false;
+
 			size = data->sensor_->resolution();
 			break;
 
@@ -685,7 +698,7 @@  PipelineHandlerRkISP1::generateConfiguration(Camera *camera,
 
 		RkISP1Path *path;
 
-		if (useMainPath) {
+		if (useMainPath && !reserveMainPath) {
 			path = data->mainPath_;
 			mainPathAvailable = false;
 		} else {