From ff35eadf97e99fa6abf907941a6125f1b44a8951 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 15 Apr 2025 14:48:19 +0100 Subject: [PATCH] drm/vc4: plane: Increase UPM allocation size for YUV444 YUV444 support isn't officially supported by the hardware, but worked if you told it the image was YUV422 with double the width and altered chroma scaling. Adding BCM2712 support gained a fetcher memory (UPM). The code handling UPM allocations didn't have a case for YUV444, so only allocated based on the base width, and therefore underflowed. Increase the UPM allocation size for the luma plane of YUV444 to match. Fixes: 076eedaf762f ("drm/vc4: hvs: Add support for BCM2712 HVS") Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_plane.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -851,6 +851,9 @@ static size_t vc6_upm_size(const struct else stride = ALIGN(state->fb->width, 128); } + if (!plane && (state->fb->format->format == DRM_FORMAT_YUV444 || + state->fb->format->format == DRM_FORMAT_YVU444)) + stride <<= 1; /* * TODO: This only works for raster formats, and is sub-optimal * for buffers with a stride aligned on 32 bytes.