91821944034797c02b26e728be6ffdedb7cf095c
[openwrt/staging/blocktrron.git] /
1 From bb1ee75de382c7a5218750476aa2a5792309cc70 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 30 Mar 2023 17:18:36 +0100
4 Subject: [PATCH] drm/vc4: Fix FKMS for when the YUV chroma planes are
5 different buffers
6
7 The code was assuming that it was a single buffer with offsets,
8 when kmstest uses separate buffers and 0 offsets for each plane.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 ---
12 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 10 +++++++---
13 1 file changed, 7 insertions(+), 3 deletions(-)
14
15 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
16 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
17 @@ -528,7 +528,7 @@ static int vc4_plane_to_mb(struct drm_pl
18 struct drm_plane_state *state)
19 {
20 struct drm_framebuffer *fb = state->fb;
21 - struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, 0);
22 + struct drm_gem_dma_object *bo;
23 const struct drm_format_info *drm_fmt = fb->format;
24 const struct vc_image_format *vc_fmt =
25 vc4_get_vc_image_fmt(drm_fmt->format);
26 @@ -552,6 +552,7 @@ static int vc4_plane_to_mb(struct drm_pl
27 state->normalized_zpos : -127;
28 mb->plane.num_planes = num_planes;
29 mb->plane.is_vu = vc_fmt->is_vu;
30 + bo = drm_fb_dma_get_gem_obj(fb, 0);
31 mb->plane.planes[0] = bo->dma_addr + fb->offsets[0];
32
33 rotation = drm_rotation_simplify(state->rotation,
34 @@ -572,11 +573,14 @@ static int vc4_plane_to_mb(struct drm_pl
35 /* Makes assumptions on the stride for the chroma planes as we
36 * can't easily plumb in non-standard pitches.
37 */
38 + bo = drm_fb_dma_get_gem_obj(fb, 1);
39 mb->plane.planes[1] = bo->dma_addr + fb->offsets[1];
40 - if (num_planes > 2)
41 + if (num_planes > 2) {
42 + bo = drm_fb_dma_get_gem_obj(fb, 2);
43 mb->plane.planes[2] = bo->dma_addr + fb->offsets[2];
44 - else
45 + } else {
46 mb->plane.planes[2] = 0;
47 + }
48
49 /* Special case the YUV420 with U and V as line interleaved
50 * planes as we have special handling for that case.