summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2024-02-21 12:49:19 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-02-23 15:12:15 +0200
commit366077c4db502c8129eacc81a59d6e0ec958e4f0 (patch)
tree267e114a3a0440194ac53d73544aabea35f4c0c6
parent5e4dc46a0c6fc3138c887e9afbabfe7dfa6ebd98 (diff)
pipeline: rpi: vc4: Use an unpacked format if no packed one is available
When validating a stream, and no valid packed pixel format can be found, see if an unpacked format can be used instead. This is particularly helpful for 8 (and 16) bit raw formats, where asking for a packed format would previously have failed. Now the configuration will be adjusted to give you a format (in fact, the only format) that will work. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/rpi/vc4/vc4.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
index a52f0e7a..6b6ecd3d 100644
--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
@@ -434,6 +434,17 @@ CameraConfiguration::Status Vc4CameraData::platformValidate(RPi::RPiCameraConfig
rawBayer.packing = BayerFormat::Packing::CSI2;
PixelFormat rawFormat = rawBayer.toPixelFormat();
+
+ /*
+ * Try for an unpacked format if a packed one wasn't available.
+ * This catches 8 (and 16) bit formats which would otherwise
+ * fail.
+ */
+ if (!rawFormat.isValid() && rawBayer.packing != BayerFormat::Packing::None) {
+ rawBayer.packing = BayerFormat::Packing::None;
+ rawFormat = rawBayer.toPixelFormat();
+ }
+
if (rawStream->pixelFormat != rawFormat ||
rawStream->size != rpiConfig->sensorFormat_.size) {
rawStream->pixelFormat = rawFormat;