diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-08-06 05:18:02 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2020-08-10 09:44:48 +0300 |
commit | e6babe71612cdb5e8d75dfcb8ad97e54e92b596d (patch) | |
tree | af89594d448e70e8f43a9d2b8b64b30b25c3f817 /kms++ | |
parent | 97aba6dc55aebf9ee61b71985cecc0ae90af756b (diff) |
dumbfb: Fix pitch for tri-planar formats
The BO pitches are unconditionally set to the frame buffer pitch, for
all planes. This is correct for semiplanar YUV formats, as they
subsample chroma horizontally by two but combined U and V in a single
plane, cancelling each other. For fully planar YUV formats, however, the
horizontal subsampling need to be taken into account to compute the
pitch. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'kms++')
-rw-r--r-- | kms++/src/dumbframebuffer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kms++/src/dumbframebuffer.cpp b/kms++/src/dumbframebuffer.cpp index 18f3f15..4c3c031 100644 --- a/kms++/src/dumbframebuffer.cpp +++ b/kms++/src/dumbframebuffer.cpp @@ -42,6 +42,14 @@ DumbFramebuffer::DumbFramebuffer(Card& card, uint32_t width, uint32_t height, Pi struct drm_mode_create_dumb creq = drm_mode_create_dumb(); creq.width = width; creq.height = height / pi.ysub; + /* + * For fully planar YUV buffers, the chroma planes don't combine + * U and V components, their width must thus be divided by the + * horizontal subsampling factor. + */ + if (format_info.type == PixelColorType::YUV && + format_info.num_planes == 3) + creq.width /= pi.xsub; creq.bpp = pi.bitspp; r = drmIoctl(card.fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq); if (r) |