From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com ([192.55.52.115]:34446 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbdJLPUT (ORCPT ); Thu, 12 Oct 2017 11:20:19 -0400 Date: Thu, 12 Oct 2017 18:20:15 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: dri-devel@lists.freedesktop.org Cc: stable@vger.kernel.org, Daniel Vetter Subject: Re: [PATCH] drm/vblank: Fix flip event vblank count Message-ID: <20171012152015.GL10981@intel.com> References: <20171010133322.24029-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171010133322.24029-1-ville.syrjala@linux.intel.com> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Oct 10, 2017 at 04:33:22PM +0300, Ville Syrjala wrote: > From: Ville Syrj�l� > > 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: stable@vger.kernel.org > Cc: Daniel Vetter > Suggested-by: Daniel Vetter > Signed-off-by: Ville Syrj�l� Pushed to drm-misc-next with Daniel's irc r-b: 16:48 < danvet> vsyrjala, r-b, I think ... 17:31 < vsyrjala> danvet: your irc r-b for vblank_accurate+1 still holds? 17:32 < danvet> vsyrjala, yeah > --- > drivers/gpu/drm/drm_vblank.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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); > } > -- > 2.13.6 -- Ville Syrj�l� Intel OTC