All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Packard <keithp@keithp.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: don't set unpin_work if vblank_get fails
Date: Mon, 22 Aug 2011 11:45:05 -0700	[thread overview]
Message-ID: <yunei0d5lqm.fsf@aiko.keithp.com> (raw)
In-Reply-To: <20110822110531.57d85c32@jbarnes-desktop>


[-- Attachment #1.1: Type: text/plain, Size: 1645 bytes --]

On Mon, 22 Aug 2011 11:05:31 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> This fixes a race where we may try to finish a page flip and decrement
> the refcount even if our vblank_get failed and we ended up with a
> spurious flip pending interrupt.
> 
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=34211.
> 
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 2319f62..0910537 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6896,6 +6896,10 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>  	work->old_fb_obj = intel_fb->obj;
>  	INIT_WORK(&work->work, intel_unpin_work_fn);
>  
> +	ret = drm_vblank_get(dev, intel_crtc->pipe);
> +	if (ret)
> +		goto free_work;
> +
>  	/* We borrow the event spin lock for protecting unpin_work */
>  	spin_lock_irqsave(&dev->event_lock, flags);
>  	if (intel_crtc->unpin_work) {
> @@ -6906,6 +6910,11 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>  		return -EBUSY;

You'll need a drm_vblank_put above this return.

>  	}
>  	intel_crtc->unpin_work = work;
> +	/*
> +	 * Past this point, if we fail we'll let the flip completion code
> +	 * clean up the vblank refcount and pin work.  It'll be a spurious
> +	 * completion, but we handle that case.
> +	 */

I don't see how this is going to happen reliably; the hardware will have
to generate a suitable interrupt, which on IRL and later will have to be
an actual page flip interrupt.

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2011-08-22 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 18:05 [PATCH] drm/i915: don't set unpin_work if vblank_get fails Jesse Barnes
2011-08-22 18:45 ` Keith Packard [this message]
2011-08-29 16:44 ` Jesse Barnes
2011-08-29 16:45   ` Jesse Barnes
2011-09-20  4:04     ` Keith Packard
2011-11-11 20:36       ` Jesse Barnes

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=yunei0d5lqm.fsf@aiko.keithp.com \
    --to=keithp@keithp.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.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.