From 55fab098168069af74348f2ad832b077c3afe330 Mon Sep 17 00:00:00 2001 From: Andy Yan Date: Thu, 25 Mar 2021 11:49:04 +0800 Subject: [PATCH] drm/rockchip: vop2: wb uv address must follow yrgb address without gap VOP writeback directly without stride, and the uv buffer is follow yrgb buffer without gap. Change-Id: I9f63eb0527499e2d18d99fc248dbfd95b5d6179d Signed-off-by: Andy Yan --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index de9c23c87974..d7d3eb678b89 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -1866,9 +1866,14 @@ static int vop2_wb_encoder_atomic_check(struct drm_encoder *encoder, wb_state->vp_id = vp->id; wb_state->yrgb_addr = rockchip_fb_get_dma_addr(fb, 0); + /* + * uv address must follow yrgb address without gap. + * the fb->offsets is include stride, so we should + * not use it. + */ if (fb->format->is_yuv) { - wb_state->uv_addr = rockchip_fb_get_dma_addr(fb, 1); - wb_state->uv_addr += fb->offsets[1]; + wb_state->uv_addr = wb_state->yrgb_addr; + wb_state->uv_addr += DIV_ROUND_UP(fb->width * fb->format->bpp[0], 8) * fb->height; } return 0;