From a2d8c2aeb01eefc5c717da28aa273dfeb0814f13 Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Thu, 13 Jan 2022 16:07:03 +0800 Subject: [PATCH] drm/rockchip: vop2: fix double config done at one frame time Maybe appear the following case: -> set gamma -> config done -> atomic commit --> update win format --> update win address ---> here maybe meet vop hardware frame start, and triggle some config take affect. ---> as only some config take affect, this maybe lead to iommu pagefault. --> update win size --> update win other parameters -> config done so we add readx_poll_timeout() to make sure the first config done take effect and then to do next frame config. Signed-off-by: Sandy Huang Change-Id: I6ec67b374b3afd2bed4a57aa1e7b729964df1736 --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 311fab6c7d63..51a44dd15ae7 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2348,6 +2348,23 @@ static void vop2_crtc_load_lut(struct drm_crtc *crtc) vp->gamma_lut_active = true; spin_unlock(&vop2->reg_lock); +/* + * maybe appear the following case: + * -> set gamma + * -> config done + * -> atomic commit + * --> update win format + * --> update win address + * ---> here maybe meet vop hardware frame start, and triggle some config take affect. + * ---> as only some config take affect, this maybe lead to iommu pagefault. + * --> update win size + * --> update win other parameters + * -> config done + * + * so we add readx_poll_timeout() to make sure the first config done take + * effect and then to do next frame config. + */ + readx_poll_timeout(CTRL_GET, dsp_lut_en, dle, dle, 5, 33333); #undef CTRL_GET }