about summary refs log blame commit diff
path: root/users/flokli/ipu6-softisp/libcamera/0001-libcamera-pipeline-simple-fix-size-adjustment-in-val.patch
blob: 7a71ed1db7a48c100b8e62910a185b292e103b2c (plain) (tree)










































                                                                                                
From aa818f7b749122f916be1ced48d1a3a2b3aeb47e Mon Sep 17 00:00:00 2001
From: Andrey Konovalov <andrey.konovalov@linaro.org>
Date: Tue, 2 Jan 2024 23:47:20 +0300
Subject: [PATCH 01/25] libcamera: pipeline: simple: fix size adjustment in
 validate()

SimpleCameraConfiguration::validate() adjusts the configuration
of its streams (if the size is not in the outputSizes) to
the captureSize. But the captureSize itself can be not in the
outputSizes, and then the adjusted configuration won't be
valid resulting in camera configuration failure.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # sc8280xp Lenovo x13s
Tested-by: Pavel Machek <pavel@ucw.cz>
---
 src/libcamera/pipeline/simple/simple.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 911051b2..4d0e7255 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -997,10 +997,13 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
 		}
 
 		if (!pipeConfig_->outputSizes.contains(cfg.size)) {
+			Size adjustedSize = pipeConfig_->captureSize;
+			if (!pipeConfig_->outputSizes.contains(adjustedSize))
+				adjustedSize = pipeConfig_->outputSizes.max;
 			LOG(SimplePipeline, Debug)
 				<< "Adjusting size from " << cfg.size
-				<< " to " << pipeConfig_->captureSize;
-			cfg.size = pipeConfig_->captureSize;
+				<< " to " << adjustedSize;
+			cfg.size = adjustedSize;
 			status = Adjusted;
 		}
 
-- 
2.43.0