public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/i915: Move drm_crtc_vblank_get out of disabled pre-emption area.
Date: Thu, 4 Aug 2016 10:52:34 +0200	[thread overview]
Message-ID: <20160804085234.GZ6232@phenom.ffwll.local> (raw)
In-Reply-To: <1470260019-6173-3-git-send-email-rodrigo.vivi@intel.com>

On Wed, Aug 03, 2016 at 02:33:35PM -0700, Rodrigo Vivi wrote:
> drm_crtc_vblank_get call the drm_vblank_prepare that will be used soon
> to control power saving states or anything else that needs a mutex
> before the vblank happens.
> 
> local_irq_disable disables kernel preemption so we won't be able
> to use mutex inside drm_crtc_vblank_get. For this reason we need
> to move the drm_crtc_vblank_get a little up before disabling the
> interruptions.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_sprite.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0de935a..d8bc27c 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -94,14 +94,14 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
>  	min = vblank_start - usecs_to_scanlines(adjusted_mode, 100);
>  	max = vblank_start - 1;
>  
> -	local_irq_disable();
> -
>  	if (min <= 0 || max <= 0)
>  		return;
>  
>  	if (WARN_ON(drm_crtc_vblank_get(&crtc->base)))
>  		return;
>  
> +	local_irq_disable();
> +
>  	crtc->debug.min_vbl = min;
>  	crtc->debug.max_vbl = max;
>  	trace_i915_pipe_update_start(crtc);
> @@ -166,6 +166,8 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct intel_flip_work *work
>  
>  	trace_i915_pipe_update_end(crtc, end_vbl_count, scanline_end);
>  
> +	local_irq_enable();
> +
>  	/* We're still in the vblank-evade critical section, this can't race.
>  	 * Would be slightly nice to just grab the vblank count and arm the
>  	 * event outside of the critical section - the spinlock might spin for a
> @@ -180,8 +182,6 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct intel_flip_work *work
>  		crtc->base.state->event = NULL;
>  	}
>  
> -	local_irq_enable();

You can't do this. Pls reaad the comment right above why.

What we need here is a drm_crtc_vblank_get_noresume() or similar which
will fail very loudly if the vblank refcount is 0. _noresume since that
mirroros runtime PM, but it's a really bad name.
-Daniel


> -
>  	if (crtc->debug.start_vbl_count &&
>  	    crtc->debug.start_vbl_count != end_vbl_count) {
>  		DRM_ERROR("Atomic update failure on pipe %c (start=%u end=%u) time %lld us, min %d, max %d, scanline start %d, end %d\n",
> -- 
> 2.4.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-08-04  8:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 21:33 [PATCH 0/6] Allow DC state to reset the counter on screen enabled Rodrigo Vivi
2016-08-03 21:33 ` [PATCH 1/6] drm: Add vblank prepare and unprepare hooks Rodrigo Vivi
2016-08-04  8:49   ` [Intel-gfx] " Daniel Vetter
2016-08-03 21:33 ` [PATCH 2/6] drm/i915: Move drm_crtc_vblank_get out of disabled pre-emption area Rodrigo Vivi
2016-08-04  8:52   ` Daniel Vetter [this message]
2016-08-03 21:33 ` [PATCH 3/6] drm/i915: Split gen 9 irq hooks definitions Rodrigo Vivi
2016-08-03 21:33 ` [PATCH 4/6] drm/i915: Introduce vblank power domain to avoid DC entry when waiting for vblank Rodrigo Vivi
2016-08-03 21:33 ` [PATCH 5/6] drm: Introduce drm_crtc_vblank_sanitize_counter Rodrigo Vivi
2016-08-04  8:32   ` Daniel Vetter
2016-08-03 21:33 ` [PATCH 6/6] drm/i915: Sanitize drm crtc vblank counter after DC reset frame count Rodrigo Vivi
2016-08-04  8:26   ` Daniel Vetter
2016-08-05 21:49     ` Rodrigo Vivi
2016-08-08  8:12       ` Daniel Vetter
2016-08-04  2:39 ` [PATCH 0/6] Allow DC state to reset the counter on screen enabled Michel Dänzer
2016-08-04  5:50 ` ✗ Ro.CI.BAT: failure for " Patchwork

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=20160804085234.GZ6232@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /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