dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: stable@vger.kernel.org, Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH] drm/vblank: Fix flip event vblank count
Date: Thu, 12 Oct 2017 18:20:15 +0300	[thread overview]
Message-ID: <20171012152015.GL10981@intel.com> (raw)
In-Reply-To: <20171010133322.24029-1-ville.syrjala@linux.intel.com>

On Tue, Oct 10, 2017 at 04:33:22PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> 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 <daniel@ffwll.ch>
> Suggested-by: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

  reply	other threads:[~2017-10-12 15:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171010133338epcas4p3860854878d180c8fae89d9072fcf76be@epcas4p3.samsung.com>
2017-10-10 13:33 ` [PATCH] drm/vblank: Fix flip event vblank count Ville Syrjala
2017-10-12 15:20   ` Ville Syrjälä [this message]
2017-10-18  7:07   ` Andrzej Hajda
2017-10-18 13:50     ` Ville Syrjälä
2017-10-18 14:32       ` Daniel Vetter
2017-10-23 15:25     ` [PATCH] drm/vblank: Tune drm_crtc_accurate_vblank_count() WARN down to a debug Ville Syrjala
2017-10-24  9:01       ` Benjamin Gaignard
2017-10-30  9:19         ` Daniel Vetter
2017-11-16 14:19           ` Benjamin Gaignard
2017-11-16 16:14             ` Ville Syrjälä

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=20171012152015.GL10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).