From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 15/19] drm: Update vblank->last in drm_update_vblank_count() Date: Wed, 6 Aug 2014 16:19:49 +0200 Message-ID: <20140806141949.GP8727@phenom.ffwll.local> References: <1407325803-6944-1-git-send-email-ville.syrjala@linux.intel.com> <1407325803-6944-16-git-send-email-ville.syrjala@linux.intel.com> <20140806130825.GH8727@phenom.ffwll.local> <20140806133029.GT4193@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: <20140806133029.GT4193@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 =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Wed, Aug 06, 2014 at 04:30:29PM +0300, Ville Syrj=E4l=E4 wrote: > On Wed, Aug 06, 2014 at 03:08:25PM +0200, Daniel Vetter wrote: > > On Wed, Aug 06, 2014 at 02:49:58PM +0300, ville.syrjala@linux.intel.com= wrote: > > > From: Ville Syrj=E4l=E4 > > > = > > > We should update the last in drm_update_vblank_count() to avoid apply= ing > > > the diff more than once. This could occur eg. if drm_vblank_off() gets > > > called multiple times for the crtc. > > > = > > > Signed-off-by: Ville Syrj=E4l=E4 > > = > > Currently we update ->last when disabling the vblank and use it when > > re-enabling it. Those calls should be symmetric, except for driver bugs. > > Imo would be better to tighten up the checks for that. > > = > > Or do I completely misunderstand what's going on here? > = > The issue is that we want to call drm_vblank_off() in > intel_sanitize_crtc() for already disabled crtcs in order to > to bump the refcount and set inmodeset=3D1 so that > drm_vblank_get() won't try to enable vblank interrupts if someone calls > drm_vblank_get() on it. So during suspend+resume we can get two > drm_vblank_off() calls for the same crtc w/o a drm_vblank_on() in > between. > = > Although this patch doesn't actually fix the problem really since > vblank counter query during sanitize will just return 0 because the pipe > isn't active, so there's a later patch to just override .last=3D0 in > intel_sanitize_crtc(). Another approach might be to set .last=3D0 in > drm_vblank_off() itself (after vblank_disable_and_save()), mainly > just to hide the details from the caller. Resetting ->last (if it works, need to be careful with drivers calling _off multiple times perhaps) sounds like the much simpler option, and probably does what everyone expects anyway. -Daniel > = > = > > -Daniel > > = > > > --- > > > drivers/gpu/drm/drm_irq.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > = > > > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c > > > index 0523f5b..67507a4 100644 > > > --- a/drivers/gpu/drm/drm_irq.c > > > +++ b/drivers/gpu/drm/drm_irq.c > > > @@ -109,6 +109,8 @@ static void drm_update_vblank_count(struct drm_de= vice *dev, int crtc) > > > if (diff =3D=3D 0) > > > return; > > > = > > > + vblank->last =3D cur_vblank; > > > + > > > /* Reinitialize corresponding vblank timestamp if high-precision qu= ery > > > * available. Skip this step if query unsupported or failed. Will > > > * reinitialize delayed at next vblank interrupt in that case. > > > -- = > > > 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 > = > -- = > Ville Syrj=E4l=E4 > Intel OTC -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch