Commit 6b77b16d authored by Dave Stevenson's avatar Dave Stevenson Committed by Maxime Ripard

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: fc04023f ("drm/vc4: Add support for YUV planes.")
Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20230127155708.454704-1-maxime@cerno.tech
parent 85e26dd5
...@@ -340,7 +340,7 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) ...@@ -340,7 +340,7 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
{ {
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state); struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
struct drm_framebuffer *fb = state->fb; struct drm_framebuffer *fb = state->fb;
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0); struct drm_gem_dma_object *bo;
int num_planes = fb->format->num_planes; int num_planes = fb->format->num_planes;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
u32 h_subsample = fb->format->hsub; u32 h_subsample = fb->format->hsub;
...@@ -359,8 +359,10 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) ...@@ -359,8 +359,10 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
if (ret) if (ret)
return ret; return ret;
for (i = 0; i < num_planes; i++) for (i = 0; i < num_planes; i++) {
bo = drm_fb_dma_get_gem_obj(fb, i);
vc4_state->offsets[i] = bo->dma_addr + fb->offsets[i]; vc4_state->offsets[i] = bo->dma_addr + fb->offsets[i];
}
/* /*
* We don't support subpixel source positioning for scaling, * We don't support subpixel source positioning for scaling,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment