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

Message ID 20261117-kbingham-orientation-v3-1-b86563a93c34@ideasonboard.com
State New
Headers show
Series
  • libcamera: rkisp1: Camera Sensor Mode Validation (Orientation support)
Related show

Commit Message

Kieran Bingham Nov. 17, 2026, 3:15 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

v3:
 - Keep log level as Debug in *both* cases
---
 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..5caa9122f962 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, Debug)
+			<< "No supported format or size found. Requested "
+			<< size << " with a maximum size " << maxSize;
 		return {};
 	}