From: Chaoyi Chen <[email protected]> Packed YUV formats store chroma interleaved with luma in the same plane, so they have no plane 1 that the UV address registers could point at.
Restrict both the plane 1 offset calculation and the UV register writes to formats with more than one plane. Signed-off-by: Chaoyi Chen <[email protected]> --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 480aa8c8a8d2..42ef1b996656 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -1305,7 +1305,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, rk_obj = to_rockchip_obj(fb->obj[0]); yrgb_mst = rk_obj->dma_addr + offset + fb->offsets[0]; - if (fb->format->is_yuv) { + if (fb->format->is_yuv && fb->format->num_planes > 1) { int hsub = fb->format->hsub; int vsub = fb->format->vsub; @@ -1461,7 +1461,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, uv_swap = vop2_win_uv_swap(fb->format->format); vop2_win_write(win, VOP2_WIN_UV_SWAP, uv_swap); - if (fb->format->is_yuv) { + if (fb->format->is_yuv && fb->format->num_planes > 1) { vop2_win_write(win, VOP2_WIN_UV_VIR, DIV_ROUND_UP(fb->pitches[1], 4)); vop2_win_write(win, VOP2_WIN_UV_MST, uv_mst); } -- 2.53.0
