[PATCH 2/3] libcamera: camera_sensor: Extend reporting in getFormat()

Kieran Bingham kieran.bingham at ideasonboard.com
Thu May 1 16:16:08 CEST 2025


When a pipeline handler asks the CameraSensor for a format, which is not
achievable, it can be very helpful to the user to identify what size was
requested and why it could not be provided within any constrained
maximum size.

This can make otherwise difficult to diagnose user errors visible and
quickly correctable.

Both of the CameraSensorRaw and CameraSensorLegacy are updated
accordingly but that likely means these two classes could soon benefit
from a more common base class to share otherwise identical code.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/libcamera/sensor/camera_sensor_legacy.cpp | 4 +++-
 src/libcamera/sensor/camera_sensor_raw.cpp    | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp
index 32989c19c019..20275f3bb1b2 100644
--- a/src/libcamera/sensor/camera_sensor_legacy.cpp
+++ b/src/libcamera/sensor/camera_sensor_legacy.cpp
@@ -742,7 +742,9 @@ CameraSensorLegacy::getFormat(const std::vector<unsigned int> &mbusCodes,
 	}
 
 	if (!bestSize) {
-		LOG(CameraSensor, Debug) << "No supported format or size found";
+		LOG(CameraSensor, Warning)
+			<< "No supported format or size found. Requested "
+			<< size << " with a maximum size " << maxSize;
 		return {};
 	}
 
diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp
index ab75b1f8204c..07d1e2bfa600 100644
--- a/src/libcamera/sensor/camera_sensor_raw.cpp
+++ b/src/libcamera/sensor/camera_sensor_raw.cpp
@@ -800,7 +800,9 @@ CameraSensorRaw::getFormat(const std::vector<unsigned int> &mbusCodes,
 	}
 
 	if (!bestSize) {
-		LOG(CameraSensor, Debug) << "No supported format or size found";
+		LOG(CameraSensor, Warning)
+			<< "No supported format or size found. Requested "
+			<< size << " with a maximum size " << maxSize;
 		return {};
 	}
 
-- 
2.48.1



More information about the libcamera-devel mailing list