Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1309463

Re: [PATCH 3/3] drm/rockchip: explain why we can't wait_for_vblanks

From John Keeping <john@metanate.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] drm/rockchip: explain why we can't wait_for_vblanks
Date 2016-01-14 17:30 +0100
Message-ID <qQSWD-197-45@gated-at.bofh.it> (permalink)
References <qQR4t-8kt-3@gated-at.bofh.it> <qQRnQ-8rT-15@gated-at.bofh.it> <qQRnQ-8rT-23@gated-at.bofh.it> <qQRxw-8vf-9@gated-at.bofh.it>
Organization Metanate Ltd

Show all headers | View raw


On Thu, 14 Jan 2016 15:57:05 +0100, Thierry Reding wrote:

> On Thu, Jan 14, 2016 at 02:39:42PM +0000, John Keeping wrote:
> > Signed-off-by: John Keeping <john@metanate.com>
> > ---
> >  drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> > index 679d23a..b267ce4 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> > @@ -177,6 +177,12 @@ static void rockchip_crtc_wait_for_update(struct drm_crtc *crtc)
> >  		crtc_funcs->wait_for_update(crtc);
> >  }
> >  
> > +/*
> > + * We can't use drm_atomic_helper_wait_for_vblanks() because rk3288 and rk3066
> > + * have hardware counters for neither vblanks nor scanlines.  This function is
> > + * equivalent but uses rockchip_crtc_wait_for_update() instead of waiting for
> > + * vblank_count to change.
> > + */  
> 
> This is kind of misleading. From reading earlier parts of the thread the
> reason why drm_atomic_helper_wait_for_vblanks() won't work is because it
> has a potential race condition that can't be detected unless you also
> have a vblank counter. However, the above comment makes it work like
> drm_atomic_helper_wait_for_vblanks() doesn't work in the absence of a
> vblank counter, which isn't quite true.

How about something like this (using the sequence from Mark's message):

/*
 * We can't use drm_atomic_helper_wait_for_vblanks() because rk3288 and rk3066
 * have hardware counters for neither vblanks nor scanlines, which results in
 * a race where:
 *				| <-- HW vsync irq and reg take effect
 *	       plane_commit --> |
 *	get_vblank and wait --> |
 *				| <-- handle_vblank, vblank->count + 1
 *		 cleanup_fb --> |
 *		iommu crash --> |
 *				| <-- HW vsync irq and reg take effect
 *
 * This function is equivalent but uses rockchip_crtc_wait_for_update() instead
 * of waiting for vblank_count to change.
 */

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't changed John Keeping <john@metanate.com> - 2016-01-13 14:00 +0100
  Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Daniel Vetter <daniel@ffwll.ch> - 2016-01-13 15:30 +0100
    Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed John Keeping <john@metanate.com> - 2016-01-13 15:40 +0100
      Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Daniel Vetter <daniel@ffwll.ch> - 2016-01-13 16:50 +0100
        Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed John Keeping <john@metanate.com> - 2016-01-13 17:00 +0100
          Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Daniel Vetter <daniel@ffwll.ch> - 2016-01-13 17:30 +0100
            Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed John Keeping <john@metanate.com> - 2016-01-13 17:50 +0100
              Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Daniel Vetter <daniel@ffwll.ch> - 2016-01-13 18:20 +0100
                Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed John Keeping <john@metanate.com> - 2016-01-13 18:50 +0100
                Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Mark yao <mark.yao@rock-chips.com> - 2016-01-14 02:20 +0100
                Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't changed Daniel Vetter <daniel@ffwll.ch> - 2016-01-14 09:40 +0100
                Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Mark yao <mark.yao@rock-chips.com> - 2016-01-14 09:50 +0100
                Re: [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't  changed Daniel Vetter <daniel@ffwll.ch> - 2016-01-14 15:30 +0100
                [PATCH 0/3] drm/rockchip: fix cursor performance with atomic John Keeping <john@metanate.com> - 2016-01-14 15:50 +0100
                [PATCH 3/3] drm/rockchip: explain why we can't wait_for_vblanks John Keeping <john@metanate.com> - 2016-01-14 15:50 +0100
                Re: [PATCH 3/3] drm/rockchip: explain why we can't wait_for_vblanks Thierry Reding <thierry.reding@gmail.com> - 2016-01-14 16:00 +0100
                Re: [PATCH 3/3] drm/rockchip: explain why we can't wait_for_vblanks John Keeping <john@metanate.com> - 2016-01-14 17:30 +0100

csiph-web