summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-09-21 18:55:42 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-09-27 14:41:31 +0300
commit3caaafafa80d268bd879f6046447714484748f23 (patch)
tree8c493e1a6a6e1bbb46097662f2f1df5773e34994
parent40d50263f553c10f2ed8b30a6d473553c8163674 (diff)
libcamera: rpi: Allow platformValidate() to adjust format strides
Propagate any changes to the format stride done by platformValidate(). The stride value may be adjusted for performace reasons. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/rpi/common/pipeline_base.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index 40630ddf..ad4a1812 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -309,6 +309,17 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
V4L2DeviceFormat format;
format.fourcc = out.dev->toV4L2PixelFormat(cfg.pixelFormat);
format.size = cfg.size;
+
+ /*
+ * platformValidate may have worked out the correct stride so we
+ * must pass it in. This also needs the planesCount to be set
+ * correctly or the stride will be ignored.
+ */
+ const PixelFormat &pixFormat = format.fourcc.toPixelFormat();
+ const PixelFormatInfo &info = PixelFormatInfo::info(pixFormat);
+ format.planesCount = info.numPlanes();
+ format.planes[0].bpl = cfg.stride;
+
/* We want to send the associated YCbCr info through to the driver. */
format.colorSpace = yuvColorSpace_;