From 843048499fe1f1f8cea74838c1e3436945c1b1b7 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 5 Sep 2021 23:24:29 +0300 Subject: cam: drm: Support per-plane stride values The stride is not always identical for all planes for multi-planar formats. Semi-planar YUV formats without horizontal subsampling often have a chroma stride equal to twice the luma stride, and tri-planar YUV formats with a 1/2 horizontal subsampling often have a chroma stride equal to half the luma stride. This isn't correctly taken into account when creating a DRM frame buffer, as the same stride is set for all planes. libcamera doesn't report per-plane stride values yet, but uses chroma strides that match the above description for all currently supported platforms. Calculation the chrome strides appropriately in the KMSSink class, and pass them to DRM::createFrameBuffer(). Signed-off-by: Laurent Pinchart Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- src/cam/drm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cam/drm.h') diff --git a/src/cam/drm.h b/src/cam/drm.h index ee230402..00f7e798 100644 --- a/src/cam/drm.h +++ b/src/cam/drm.h @@ -7,9 +7,11 @@ #ifndef __CAM_DRM_H__ #define __CAM_DRM_H__ +#include #include #include #include +#include #include #include @@ -298,7 +300,8 @@ public: std::unique_ptr createFrameBuffer( const libcamera::FrameBuffer &buffer, const libcamera::PixelFormat &format, - const libcamera::Size &size, unsigned int stride); + const libcamera::Size &size, + const std::array &strides); libcamera::Signal requestComplete; -- cgit v1.2.1