From 90c661b591636834d7f023e27d4cdb0c1469cf9e Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Tue, 23 Jan 2024 19:57:48 +0800 Subject: [PATCH] drm/rockchip: vop2: hdisplay must roundup 2/4 when calc pre_scan_dly splice mode: hdisplay must roundup as 4 pixel, no splice mode: hdisplay must roundup as 2 pixel. otherwise will lead to POST_BUF_EMPTY and display black screen. Signed-off-by: Sandy Huang Change-Id: I0971a052751c411acef8ed2fcfd9f142caa37598 --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 425338e041b0..81ae368f18c1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -7743,7 +7743,8 @@ static void vop3_setup_pipe_dly(struct vop2_video_port *vp, const struct vop2_zp sdr_win_dly = 0; } - pre_scan_dly = bg_dly + (hdisplay >> 1) - 1; + /* hdisplay must roundup as 2 pixel */ + pre_scan_dly = bg_dly + (roundup(hdisplay, 2) >> 1) - 1; pre_scan_dly = (pre_scan_dly << 16) | hsync_len; VOP_MODULE_SET(vop2, vp, bg_dly, bg_dly); VOP_MODULE_SET(vop2, vp, pre_scan_htiming, pre_scan_dly); @@ -9309,10 +9310,14 @@ static void vop2_setup_dly_for_vp(struct vop2_video_port *vp) hdisplay = adjusted_mode->crtc_hdisplay; } + /* + * splice mode: hdisplay must roundup as 4 pixel, + * no splice mode: hdisplay must roundup as 2 pixel. + */ if (vcstate->splice_mode) - pre_scan_dly = bg_dly + (hdisplay >> 2) - 1; + pre_scan_dly = bg_dly + (roundup(hdisplay, 4) >> 2) - 1; else - pre_scan_dly = bg_dly + (hdisplay >> 1) - 1; + pre_scan_dly = bg_dly + (roundup(hdisplay, 2) >> 1) - 1; if (vop2->version == VOP_VERSION_RK3588 && hsync_len < 8) hsync_len = 8;