From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 5/9] drm: Have the vblank counter account for the time between vblank irq disable and drm_vblank_off() Date: Mon, 26 May 2014 15:27:47 +0200 Message-ID: <20140526132746.GL14357@phenom.ffwll.local> References: <1401104792-26560-1-git-send-email-ville.syrjala@linux.intel.com> <1401104792-26560-6-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: Content-Disposition: inline In-Reply-To: <1401104792-26560-6-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 Mon, May 26, 2014 at 02:46:28PM +0300, ville.syrjala@linux.intel.com wro= te: > From: Ville Syrj=E4l=E4 > = > If the vblank irq has already been disabled (via the disable timer) when > we call drm_vblank_off() sample the counter and timestamp one last time. > This will make the sure that the user space visible counter will account > for time between vblank irq disable and drm_vblank_off(). > = > Signed-off-by: Ville Syrj=E4l=E4 Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_irq.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > = > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > index e12cf69..bb64f0f 100644 > --- a/drivers/gpu/drm/drm_irq.c > +++ b/drivers/gpu/drm/drm_irq.c > @@ -140,6 +140,19 @@ static void vblank_disable_and_save(struct drm_devic= e *dev, int crtc) > */ > spin_lock_irqsave(&dev->vblank_time_lock, irqflags); > = > + /* > + * If the vblank interrupt was already disbled update the count > + * and timestamp to maintain the appearance that the counter > + * has been ticking all along until this time. This makes the > + * count account for the entire time between drm_vblank_on() and > + * drm_vblank_off(). > + */ > + if (!dev->vblank[crtc].enabled) { > + drm_update_vblank_count(dev, crtc); > + spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); > + return; > + } > + > dev->driver->disable_vblank(dev, crtc); > dev->vblank[crtc].enabled =3D false; > = > -- = > 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