[libcamera-devel] [PATCH v5 05/13] libcamera: rpi: Allow platformValidate() to adjust format strides

Jacopo Mondi jacopo.mondi at ideasonboard.com
Thu Sep 21 18:55:42 CEST 2023


From: Naushir Patuck <naush at raspberrypi.com>

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 at raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
---
 src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index c02ceb65cae8..502cdff0051b 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_;
 
-- 
2.42.0



More information about the libcamera-devel mailing list