mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Beckett <bob.beckett@collabora.com>
To: dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
	linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>,
	Sean Paul <sean@poorly.run>
Subject: Re: [PATCH v4 1/2] drm/vblank: warn on sending stale event
Date: Fri, 28 Jun 2019 13:10:14 +0100	[thread overview]
Message-ID: <ee19affecdd64b1f835d193ae742b4f084335b93.camel@collabora.com> (raw)
In-Reply-To: <66e100219a2740e493a7b96ebb95d0a2e697f121.1561722822.git.bob.beckett@collabora.com>

Nak - I forgot the requested doc changes. Ill re-send

On Fri, 2019-06-28 at 13:05 +0100, Robert Beckett wrote:
> Warn when about to send stale vblank info and add advice to
> documentation on how to avoid.
> 
> Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
> ---
>  drivers/gpu/drm/drm_vblank.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c
> b/drivers/gpu/drm/drm_vblank.c
> index 603ab105125d..7dabb2bdb733 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -918,6 +918,19 @@ EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
>   *
>   * See drm_crtc_arm_vblank_event() for a helper which can be used in
> certain
>   * situation, especially to send out events for atomic commit
> operations.
> + *
> + * Care should be taken to avoid stale timestamps. If:
> + *   - your driver has vblank support (i.e. dev->num_crtcs > 0)
> + *   - the vblank irq is off (i.e. no one called
> drm_crtc_vblank_get)
> + *   - from the vblank code's pov the pipe is still running (i.e.
> not
> + *     in-between a drm_crtc_vblank_off()/on() pair)
> + * If all of these conditions hold then drm_crtc_send_vblank_event
> is
> + * going to give you a garbage timestamp and and sequence number
> (the last
> + * recorded before the irq was disabled). If you call
> drm_crtc_vblank_get/put
> + * around it, or after vblank_off, then either of those will have
> rolled things
> + * forward for you.
> + * So, drivers should call drm_crtc_vblank_off() before this
> function in their
> + * crtc atomic_disable handlers.
>   */
>  void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
>  				struct drm_pending_vblank_event *e)
> @@ -925,8 +938,12 @@ void drm_crtc_send_vblank_event(struct drm_crtc
> *crtc,
>  	struct drm_device *dev = crtc->dev;
>  	u64 seq;
>  	unsigned int pipe = drm_crtc_index(crtc);
> +	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>  	ktime_t now;
>  
> +	WARN_ONCE(dev->num_crtcs > 0 && !vblank->enabled && !vblank-
> >inmodeset,
> +		  "sending stale vblank info\n");
> +
>  	if (dev->num_crtcs > 0) {
>  		seq = drm_vblank_count_and_time(dev, pipe, &now);
>  	} else {


  reply	other threads:[~2019-06-28 12:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 12:05 [PATCH v4 0/2] handle vblank when disabling ctc with interrupt disabled Robert Beckett
2019-06-28 12:05 ` [PATCH v4 1/2] drm/vblank: warn on sending stale event Robert Beckett
2019-06-28 12:10   ` Robert Beckett [this message]
2019-06-28 12:05 ` [PATCH v4 2/2] Revert "drm/vblank: Do not update vblank count if interrupts are already disabled." Robert Beckett
2019-06-28 12:13   ` 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=ee19affecdd64b1f835d193ae742b4f084335b93.camel@collabora.com \
    --to=bob.beckett@collabora.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    /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

all inboxes | Powered by JetHome®