From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [Intel-gfx] [PATCH 16/19] drm: Store the vblank timestamp when adjusting the counter during disable Date: Wed, 6 Aug 2014 15:12:08 +0200 Message-ID: <20140806131208.GJ8727@phenom.ffwll.local> References: <1407325803-6944-1-git-send-email-ville.syrjala@linux.intel.com> <1407325803-6944-17-git-send-email-ville.syrjala@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by gabe.freedesktop.org (Postfix) with ESMTP id C573B6E674 for ; Wed, 6 Aug 2014 06:11:56 -0700 (PDT) Received: by mail-wi0-f170.google.com with SMTP id f8so9643335wiw.3 for ; Wed, 06 Aug 2014 06:11:56 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1407325803-6944-17-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Wed, Aug 06, 2014 at 02:49:59PM +0300, ville.syrjala@linux.intel.com wro= te: > From: Ville Syrj=E4l=E4 > = > During vblank disable the code tries to guess based on the > timestamps whether we just missed one vblank or not. And if so > it increments the counter. However it forgets to store the new > timestamp to the approriate slot in our timestamp ring buffer. > So anyone querying the timestamp for the resulting sequence > number would get a stale timestamp. Fix it up by storing the > new timestamp. > = > Signed-off-by: Ville Syrj=E4l=E4 > --- > drivers/gpu/drm/drm_irq.c | 7 +++++++ > 1 file changed, 7 insertions(+) > = > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index 67507a4..e927e5f 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -203,6 +203,13 @@ static void vblank_disable_and_save(struct drm_devic= e *dev, int crtc) > * hope for the best. > */ > if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { We should use DRM_REDUNDANT_VBLIRQ_THRESH_NS here for symmtry. With that addressed this is Reviewed-by: Daniel Vetter > + /* Store new timestamp in ringbuffer. */ > + vblanktimestamp(dev, crtc, vblcount + 1) =3D tvblank; > + > + /* Increment cooked vblank count. This also atomically commits > + * the timestamp computed above. > + */ > + smp_mb__before_atomic(); > atomic_inc(&vblank->count); > smp_mb__after_atomic(); > } > -- = > 1.8.5.5 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch