All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 15/19] drm: Update vblank->last in drm_update_vblank_count()
Date: Wed, 6 Aug 2014 16:19:49 +0200	[thread overview]
Message-ID: <20140806141949.GP8727@phenom.ffwll.local> (raw)
In-Reply-To: <20140806133029.GT4193@intel.com>

On Wed, Aug 06, 2014 at 04:30:29PM +0300, Ville Syrjälä 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älä <ville.syrjala@linux.intel.com>
> > > 
> > > We should update the last in drm_update_vblank_count() to avoid applying
> > > 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älä <ville.syrjala@linux.intel.com>
> > 
> > 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=1 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=0 in
> intel_sanitize_crtc(). Another approach might be to set .last=0 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_device *dev, int crtc)
> > >  	if (diff == 0)
> > >  		return;
> > >  
> > > +	vblank->last = cur_vblank;
> > > +
> > >  	/* Reinitialize corresponding vblank timestamp if high-precision query
> > >  	 * 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älä
> Intel OTC

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-08-06 14:19 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 11:49 [PATCH v2 00/19] drm: More vblank on/off work ville.syrjala
2014-08-06 11:49 ` [PATCH v2 01/19] drm: Always reject drm_vblank_get() after drm_vblank_off() ville.syrjala
2014-08-06 11:49 ` [PATCH v2 02/19] drm/i915: Warn if drm_vblank_get() still works " ville.syrjala
2014-08-06 11:49 ` [PATCH 03/19] drm: Don't clear vblank timestamps when vblank interrupt is disabled ville.syrjala
2014-08-06 11:49 ` [PATCH 04/19] drm: Move drm_update_vblank_count() ville.syrjala
2014-08-06 11:49 ` [PATCH 05/19] drm: Have the vblank counter account for the time between vblank irq disable and drm_vblank_off() ville.syrjala
2014-09-02 19:33   ` Mario Kleiner
2014-08-06 11:49 ` [PATCH 06/19] drm: Avoid random vblank counter jumps if the hardware counter has been reset ville.syrjala
2014-08-06 11:49 ` [PATCH v2 07/19] drm: Reduce the amount of dev->vblank[crtc] in the code ville.syrjala
2014-08-06 11:49 ` [PATCH 08/19] drm: Fix deadlock between event_lock and vbl_lock/vblank_time_lock ville.syrjala
2014-08-06 11:49 ` [PATCH 09/19] drm: Fix race between drm_vblank_off() and drm_queue_vblank_event() ville.syrjala
2014-08-06 13:23   ` Daniel Vetter
2014-08-06 13:33     ` [Intel-gfx] " Ville Syrjälä
2014-08-06 11:49 ` [PATCH v2 10/19] drm: Disable vblank interrupt immediately when drm_vblank_offdelay<0 ville.syrjala
2014-08-06 11:49 ` [PATCH v2 11/19] drm: Add dev->vblank_disable_immediate flag ville.syrjala
2014-08-06 11:49 ` [PATCH 12/19] drm/i915: Opt out of vblank disable timer on >gen2 ville.syrjala
2014-08-06 11:49 ` [PATCH v2 13/19] drm: Kick start vblank interrupts at drm_vblank_on() ville.syrjala
2014-08-06 11:49 ` [PATCH 14/19] drm: Don't update vblank timestamp when the counter didn't change ville.syrjala
2014-08-06 12:56   ` Daniel Vetter
2014-08-06 13:09     ` Daniel Vetter
2014-09-04 12:14   ` Mario Kleiner
2014-09-13 16:25   ` Mario Kleiner
2014-09-15  8:50     ` Daniel Vetter
2014-09-23 12:48       ` [Intel-gfx] " Jani Nikula
2014-09-23 13:51         ` Daniel Vetter
2014-09-23 14:15           ` Mario Kleiner
2014-08-06 11:49 ` [PATCH 15/19] drm: Update vblank->last in drm_update_vblank_count() ville.syrjala
2014-08-06 13:08   ` [Intel-gfx] " Daniel Vetter
2014-08-06 13:30     ` Ville Syrjälä
2014-08-06 14:19       ` Daniel Vetter [this message]
2014-08-06 11:49 ` [PATCH 16/19] drm: Store the vblank timestamp when adjusting the counter during disable ville.syrjala
2014-08-06 13:12   ` [Intel-gfx] " Daniel Vetter
2014-08-06 11:50 ` [PATCH 17/19] drm/i915: Clear .last vblank count before drm_vblank_off() when sanitizing crtc state ville.syrjala
2014-08-06 13:30   ` [Intel-gfx] " Daniel Vetter
2014-08-06 13:43     ` Ville Syrjälä
2014-08-06 11:50 ` [PATCH 18/19] drm/i915: Update scanline_offset only for active crtcs ville.syrjala
2014-08-06 11:50 ` [PATCH 19/19] drm: Fix confusing debug message in drm_update_vblank_count() ville.syrjala
2014-08-06 11:50 ` [PATCH igt] tests/kms_flip: Assert that vblank timestamps aren't zeroed ville.syrjala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140806141949.GP8727@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.