[v2,2/3] libcamera: camera_sensor: Extend reporting in getFormat()
diff mbox series

Message ID 20261102-kbingham-orientation-v2-2-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
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.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

---
v2:

 - Keep log level as Debug
---
 src/libcamera/sensor/camera_sensor_legacy.cpp | 4 +++-
 src/libcamera/sensor/camera_sensor_raw.cpp    | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp
index 792e4b09d4fa..0e2085d91345 100644
--- a/src/libcamera/sensor/camera_sensor_legacy.cpp
+++ b/src/libcamera/sensor/camera_sensor_legacy.cpp
@@ -759,7 +759,9 @@  CameraSensorLegacy::getFormat(std::span<const unsigned int> mbusCodes,
 	}
 
 	if (!bestSize) {
-		LOG(CameraSensor, Debug) << "No supported format or size found";
+		LOG(CameraSensor, Debug)
+			<< "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 55b386cef3f3..14ab15b05ab3 100644
--- a/src/libcamera/sensor/camera_sensor_raw.cpp
+++ b/src/libcamera/sensor/camera_sensor_raw.cpp
@@ -821,7 +821,9 @@  CameraSensorRaw::getFormat(std::span<const 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 {};
 	}