dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: dri-devel@lists.freedesktop.org, stable@vger.kernel.org,
	"Szyprowski, Marek" <m.szyprowski@samsung.com>,
	Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH] drm/vblank: Fix flip event vblank count
Date: Wed, 18 Oct 2017 16:50:19 +0300	[thread overview]
Message-ID: <20171018135019.GJ10981@intel.com> (raw)
In-Reply-To: <f0cd9ead-365b-3c6b-eefe-91051617e30d@samsung.com>

On Wed, Oct 18, 2017 at 09:07:47AM +0200, Andrzej Hajda wrote:
> Hi Ville,
> 
> On 10.10.2017 15:33, 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>
> > ---
> >  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;
> 
> With this patch drm_crtc_arm_vblank_event calls
> drm_crtc_accurate_vblank_count, which requires get_vblank_timestamp
> callback, otherwise it issue WARN every time it is called.

Argh! Maybe just remove the WARN then?

> On the other side most of the users of drm_crtc_arm_vblank_event do not
> implement this callback. As a result one can observe multiple WARNs.
> It was observed on Exynos platform but grep shows it can affect many
> other platforms:
> 
> $ git grep -l drm_crtc_arm_vblank_event drivers/gpu/drm/
> drivers/gpu/drm/arm/hdlcd_crtc.c
> drivers/gpu/drm/arm/malidp_drv.c
> drivers/gpu/drm/drm_vblank.c
> drivers/gpu/drm/exynos/exynos_drm_crtc.c
> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> drivers/gpu/drm/i915/intel_sprite.c
> drivers/gpu/drm/imx/ipuv3-crtc.c
> drivers/gpu/drm/mxsfb/mxsfb_crtc.c
> drivers/gpu/drm/nouveau/nouveau_display.c
> drivers/gpu/drm/pl111/pl111_display.c
> drivers/gpu/drm/sti/sti_crtc.c
> drivers/gpu/drm/stm/ltdc.c
> drivers/gpu/drm/sun4i/sun4i_crtc.c
> drivers/gpu/drm/tve200/tve200_display.c
> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> drivers/gpu/drm/zte/zx_vou.c
> 
> $ git grep -l get_vblank_timestamp drivers/gpu/drm/
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> drivers/gpu/drm/drm_vblank.c
> drivers/gpu/drm/i915/i915_irq.c
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
> drivers/gpu/drm/nouveau/nouveau_drm.c
> drivers/gpu/drm/radeon/radeon_drv.c
> drivers/gpu/drm/vc4/vc4_drv.c
> 
> Regards
> Andrzej
> 
> >  	e->event.crtc_id = crtc->base.id;
> >  	list_add_tail(&e->base.link, &dev->vblank_event_list);
> >  }
> 

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2017-10-18 13:50 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ä
2017-10-18  7:07   ` Andrzej Hajda
2017-10-18 13:50     ` Ville Syrjälä [this message]
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=20171018135019.GJ10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=a.hajda@samsung.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=m.szyprowski@samsung.com \
    --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).