All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>,
	Liviu Dudau <Liviu.Dudau@arm.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 4/8] drm/crtc: Add a generic infrastructure to fake VBLANK events
Date: Mon, 2 Jul 2018 11:01:27 +0200	[thread overview]
Message-ID: <20180702110127.2d6d6ba7@bbrezillon> (raw)
In-Reply-To: <20180702083722.GJ13978@phenom.ffwll.local>

On Mon, 2 Jul 2018 10:37:22 +0200
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Mon, Jul 02, 2018 at 10:14:51AM +0200, Boris Brezillon wrote:
> > On Mon, 2 Jul 2018 10:02:52 +0200
> > Daniel Vetter <daniel@ffwll.ch> wrote:
> >   
> > > On Fri, Jun 29, 2018 at 01:17:17PM +0200, Boris Brezillon wrote:  
> > > > In some cases CRTCs are active but are not able to generating events, at
> > > > least not at every frame at it's expected to.
> > > > This is typically the case when the CRTC is feeding a writeback connector
> > > > that has no job queued. In this situation the CRTC is usually stopped
> > > > until a new job is queued, and this can lead to timeouts when part of
> > > > the pipeline is updated but no new jobs are queued to the active
> > > > writeback connector.
> > > > 
> > > > In order to solve that, we add a ->no_vblank flag to drm_crtc_state
> > > > and ask the CRTC drivers to set it to true when they know they're not
> > > > able to generate VBLANK events. The core drm_atomic_helper_fake_vblank()
> > > > helper can then be used to fake VBLANKs at commit time.
> > > > 
> > > > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > ---
> > > >  drivers/gpu/drm/drm_atomic_helper.c | 40 +++++++++++++++++++++++++++++++++++++
> > > >  include/drm/drm_atomic_helper.h     |  1 +
> > > >  include/drm/drm_crtc.h              | 15 ++++++++++++++
> > > >  3 files changed, 56 insertions(+)
> > > > 
> > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > > > index 69063bcf2334..ca586993c2a2 100644
> > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > @@ -2051,6 +2051,46 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state)
> > > >  }
> > > >  EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies);
> > > >  
> > > > +/**
> > > > + * drm_atomic_helper_fake_vblank - fake VBLANK events if needed
> > > > + * @old_state: atomic state object with old state structures
> > > > + *
> > > > + * This function walks all CRTCs and fake VBLANK events on those with
> > > > + * &drm_crtc_state.no_vblank set to true and &drm_crtc_state.event != NULL.
> > > > + * The primary use of this function is writeback connectors working in oneshot
> > > > + * mode and faking VBLANK events. In this case they only fake the VBLANK event
> > > > + * when a job is queued, and any change to the pipeline that does not touch the
> > > > + * connector is leading to timeouts when calling
> > > > + * drm_atomic_helper_wait_for_vblanks() or
> > > > + * drm_atomic_helper_wait_for_flip_done().
> > > > + *
> > > > + * This is part of the atomic helper support for nonblocking commits, see
> > > > + * drm_atomic_helper_setup_commit() for an overview.
> > > > + */
> > > > +void drm_atomic_helper_fake_vblank(struct drm_atomic_state *old_state)
> > > > +{
> > > > +	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > +	struct drm_crtc *crtc;
> > > > +	int i;
> > > > +
> > > > +	for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state,
> > > > +				      new_crtc_state, i) {
> > > > +		unsigned long flags;
> > > > +
> > > > +		if (!new_crtc_state->no_vblank && !old_crtc_state->no_vblank)    
> > > 
> > > Uh, this essentially makes it impossible to reset no_vblank.  
> > 
> > I don't want ->no_vblank to be reset by the core. It's up to the CRTC
> > driver to clear/set it when something changes in the pipeline.
> >   
> > > For control
> > > flow state bits we only check the new state for it (see e.g. the various
> > > *_changed or plane_bits or whatever).  
> > 
> > I tried with !new_crtc_state->no_vblank only, but then it does not
> > handle the case where the CRTC and connector are being disabled, and I
> > end up with a timeout.  
> 
> Why that? You should have a new_crtc_state even when you disable the crtc,
> and you can set the ->no_vblank on that one too.

Hm, right. I'll have to check why I didn't have ->no_blank set to true
when I disable the CRTC. Probably a problem in vc4_crtc.c.


-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-07-02  9:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 11:17 [PATCH v2 0/8] drm/vc4: Add support for the transposer IP Boris Brezillon
2018-06-29 11:17 ` [PATCH v2 1/8] drm/atomic: Avoid connector to writeback_connector casts Boris Brezillon
2018-07-02  7:49   ` Daniel Vetter
2018-06-29 11:17 ` [PATCH v2 2/8] drm/connector: Pass a drm_connector_state to ->atomic_commit() Boris Brezillon
2018-06-29 11:23   ` Liviu Dudau
2018-06-29 11:37   ` Liviu Dudau
2018-07-02  7:51     ` Daniel Vetter
2018-07-02  9:49       ` Boris Brezillon
2018-07-02 11:14         ` Liviu Dudau
2018-07-02 11:58           ` Boris Brezillon
2018-06-29 11:17 ` [PATCH v2 3/8] drm/vc4: Use wait_for_flip_done() instead of wait_for_vblanks() Boris Brezillon
2018-06-29 20:19   ` Eric Anholt
2018-06-29 11:17 ` [PATCH v2 4/8] drm/crtc: Add a generic infrastructure to fake VBLANK events Boris Brezillon
2018-06-29 11:38   ` Liviu Dudau
2018-07-02  8:02   ` Daniel Vetter
2018-07-02  8:14     ` Boris Brezillon
2018-07-02  8:37       ` Daniel Vetter
2018-07-02  9:01         ` Boris Brezillon [this message]
2018-07-02  8:40       ` Daniel Vetter
2018-07-02  8:46         ` Boris Brezillon
2018-06-29 11:17 ` [PATCH v2 5/8] drm/atomic: Call drm_atomic_helper_fake_vblank() from the generic commit_tail() helpers Boris Brezillon
2018-06-29 11:38   ` Liviu Dudau
2018-07-02  7:54   ` Daniel Vetter
2018-07-02  7:57     ` Daniel Vetter
2018-07-02  7:59       ` Boris Brezillon
2018-07-02  7:58     ` Boris Brezillon
2018-06-29 11:17 ` [PATCH v2 6/8] drm/vc4: Call drm_atomic_helper_fake_vblank() in the commit path Boris Brezillon
2018-06-29 20:27   ` Eric Anholt
2018-06-29 11:17 ` [PATCH v2 7/8] drm/vc4: Add support for the transposer block Boris Brezillon
2018-06-29 20:35   ` Eric Anholt
2018-07-02 10:19     ` Boris Brezillon
2018-06-29 11:17 ` [PATCH v2 8/8] ARM: dts: bcm283x: Add Transposer block Boris Brezillon
2018-06-29 20:27   ` Eric Anholt
2018-06-29 11:17 ` [PATCH v2 0/8] drm/vc4: Add support for the transposer IP Boris Brezillon
2018-06-29 11:40   ` Liviu Dudau
2018-07-02 10:21     ` Boris Brezillon

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=20180702110127.2d6d6ba7@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.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 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.