From: Arun Iyengar <[email protected]>

vop2_plane_atomic_update() takes the chroma plane address from
fb->obj[0]. The planes of a framebuffer can be in different GEM objects
(ADDFB2 with two handles, e.g. NV12M from a V4L2 decoder), and the
window then fetches the chroma plane from the luma buffer.

Use fb->obj[1] for formats with more than one plane.

Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Reported-by: Sashiko <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Cc: [email protected]
Signed-off-by: Arun Iyengar <[email protected]>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 76d151b8bc52..e8ef83d6924b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -1369,7 +1369,8 @@ static void vop2_plane_atomic_update(struct drm_plane 
*plane,
                if ((pstate->rotation & DRM_MODE_REFLECT_Y) && !afbc_en)
                        offset += fb->pitches[1] * ((pstate->src_h >> 16) - 2) 
/ vsub;
 
-               rk_obj = to_rockchip_obj(fb->obj[0]);
+               if (fb->format->num_planes > 1)
+                       rk_obj = to_rockchip_obj(fb->obj[1]);
                uv_mst = rk_obj->dma_addr + offset + fb->offsets[1];
        }
 

-- 
2.55.0


Reply via email to