drm/armada: fix YUV planar format framebuffer offsets
authorRussell King <rmk+kernel@armlinux.org.uk>
Fri, 8 Dec 2017 12:16:22 +0000 (12:16 +0000)
committerRussell King <rmk+kernel@armlinux.org.uk>
Fri, 8 Dec 2017 12:16:22 +0000 (12:16 +0000)
We weren't correctly calculating the YUV planar offsets for subsampled
chroma planes correctly - fix up the coordinates for planes 1 and 2.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
drivers/gpu/drm/armada/armada_crtc.c

index 7f7b3e738679d0f0a76d3481f2c502c859c1e57d..a0f4d2a2a481085095dc7a76281e636b1161db7e 100644 (file)
@@ -176,7 +176,13 @@ void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
        if (num_planes > 3)
                num_planes = 3;
 
-       for (i = 0; i < num_planes; i++)
+       addrs[0] = addr + fb->offsets[0] + y * fb->pitches[0] +
+                  x * format->cpp[0];
+
+       y /= format->vsub;
+       x /= format->hsub;
+
+       for (i = 1; i < num_planes; i++)
                addrs[i] = addr + fb->offsets[i] + y * fb->pitches[i] +
                             x * format->cpp[i];
        for (; i < 3; i++)