From c1dc2dc56801277d57a73f7ecc223fc87e2408af Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 10:47:00 +0000 Subject: [PATCH] UPSTREAM: drm/rockchip: explain why we can't wait_for_vblanks Change-Id: I073cf5b91554a293009a121845ac1bf3b6b3e6ce Signed-off-by: Mark Yao Signed-off-by: John Keeping (cherry picked from commit c9ad1d9946e849ac3d8821d91e136d7fd728dec5) --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index f706d393f04a..f1631e3dd3d9 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -176,6 +176,21 @@ static void rockchip_crtc_wait_for_update(struct drm_crtc *crtc) crtc_funcs->wait_for_update(crtc); } +/* + * We can't use drm_atomic_helper_wait_for_vblanks() because rk3288 and rk3066 + * have hardware counters for neither vblanks nor scanlines, which results in + * a race where: + * | <-- HW vsync irq and reg take effect + * plane_commit --> | + * get_vblank and wait --> | + * | <-- handle_vblank, vblank->count + 1 + * cleanup_fb --> | + * iommu crash --> | + * | <-- HW vsync irq and reg take effect + * + * This function is equivalent but uses rockchip_crtc_wait_for_update() instead + * of waiting for vblank_count to change. + */ static void rockchip_atomic_wait_for_complete(struct drm_device *dev, struct drm_atomic_state *old_state) { -- 2.34.1