[v2,1/3] libcamera: pipeline: rkisp1: Detect invalid sensor configurations
diff mbox series

Message ID 20261102-kbingham-orientation-v2-1-21b1cdd0d167@ideasonboard.com
State New
Headers show
Series
  • libcamera: rkisp1: Camera Sensor Mode Validation
Related show

Commit Message

Kieran Bingham Nov. 2, 2026, 12:11 p.m. UTC
If we select a Sensor Format that is larger than the ISP capabilities
the pipeline will not be able to successfully start.

Detect this during validate - and report accordingly, returning
an 'Invalid' state to reflect that we were not able to
reconfigure to adjust to a working state in this instance.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 39fe0f0964d7..3086ddbeef76 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -772,9 +772,21 @@  CameraConfiguration::Status RkISP1CameraConfiguration::validate()
 	sensorFormat_ = sensor->getFormat(mbusCodes, accumulatedSensorSize,
 					  mainPath->maxResolution());
 
+
+	/*
+	 * TODO: There doesn't seem to be a valid occasion to set the size to
+	 * the native resolution if there was not a supported size found above.
+	 */
 	if (sensorFormat_.size.isNull())
 		sensorFormat_.size = sensor->resolution();
 
+	if (sensorFormat_.size > mainPath->maxResolution()) {
+		LOG(RkISP1, Error)
+			<< "Sensor format size " << sensorFormat_.size
+			<< " exceeds maximum possible size " << mainPath->maxResolution();
+		return Invalid;
+	}
+
 	return status;
 }