From: Ville Syrjälä Date: Tue, 10 Oct 2017 13:33:22 +0000 (+0300) Subject: drm/vblank: Fix flip event vblank count X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7c33c32d39b9d11338624d4a7bad4e75bf64fbf8;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/vblank: Fix flip event vblank count commit 632c6e4edef17c40bba3be67c980d959790d142f upstream. On machines where the vblank interrupt fires some time after the start of vblank (or we just manage to race with the vblank interrupt handler) we will currently stuff a stale vblank counter value into the flip event, and thus we'll prematurely complete the flip. Switch over to drm_crtc_accurate_vblank_count() to make sure we have an up to date counter value, crucially also remember to add the +1 so that the delayed vblank interrupt won't complete the flip prematurely. Cc: Daniel Vetter Suggested-by: Daniel Vetter Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20171010133322.24029-1-ville.syrjala@linux.intel.com Reviewed-by: Daniel Vetter #irc Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 70f2b9593edc..f14e6c92e332 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -869,7 +869,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc, assert_spin_locked(&dev->event_lock); e->pipe = pipe; - e->event.sequence = drm_vblank_count(dev, pipe); + e->event.sequence = drm_crtc_accurate_vblank_count(crtc) + 1; e->event.crtc_id = crtc->base.id; list_add_tail(&e->base.link, &dev->vblank_event_list); }