Skip to content

Commit 6b77b16

Browse files
6by9mripard
authored andcommitted
drm/vc4: Fix YUV plane handling when planes are in different buffers
YUV images can either be presented as one allocation with offsets for the different planes, or multiple allocations with 0 offsets. The driver only ever calls drm_fb_[dma|cma]_get_gem_obj with plane index 0, therefore any application using the second approach was incorrectly rendered. Correctly determine the address for each plane, removing the assumption that the base address is the same for each. Fixes: fc04023 ("drm/vc4: Add support for YUV planes.") Signed-off-by: Dave Stevenson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 85e26dd commit 6b77b16

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
340340
{
341341
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
342342
struct drm_framebuffer *fb = state->fb;
343-
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0);
343+
struct drm_gem_dma_object *bo;
344344
int num_planes = fb->format->num_planes;
345345
struct drm_crtc_state *crtc_state;
346346
u32 h_subsample = fb->format->hsub;
@@ -359,8 +359,10 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
359359
if (ret)
360360
return ret;
361361

362-
for (i = 0; i < num_planes; i++)
362+
for (i = 0; i < num_planes; i++) {
363+
bo = drm_fb_dma_get_gem_obj(fb, i);
363364
vc4_state->offsets[i] = bo->dma_addr + fb->offsets[i];
365+
}
364366

365367
/*
366368
* We don't support subpixel source positioning for scaling,

0 commit comments

Comments
 (0)