All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Android sync points for i915 v2
Date: Wed, 3 Sep 2014 19:41:34 +0300	[thread overview]
Message-ID: <20140903164134.GX4193@intel.com> (raw)
In-Reply-To: <20140903070901.GK25238@nuc-i3427.alporthouse.com>

On Wed, Sep 03, 2014 at 08:09:01AM +0100, Chris Wilson wrote:
> On Tue, Sep 02, 2014 at 02:32:40PM -0700, Jesse Barnes wrote:
> > +static int i915_fence_check(wait_queue_t *wait, unsigned mode, int flags,
> > +			    void *key)
> > +{
> > +	struct i915_fence *intel_fence = wait->private;
> > +	struct intel_engine_cs *ring = intel_fence->ring;
> > +
> > +	if (!i915_seqno_passed(ring->get_seqno(ring, false),
> > +			       intel_fence->seqno))
> > +		return 0;
> > +
> > +	fence_signal_locked(&intel_fence->base);
> > +
> > +	__remove_wait_queue(&ring->irq_queue, wait);
> > +	fence_put(&intel_fence->base);
> > +	ring->irq_put(ring);
> > +
> > +	return 0;
> > +}
> > +
> > +static bool i915_fence_enable_signaling(struct fence *fence)
> > +{
> > +	struct i915_fence *intel_fence = to_intel_fence(fence);
> > +	struct intel_engine_cs *ring = intel_fence->ring;
> > +	struct drm_i915_private *dev_priv = ring->dev->dev_private;
> > +	wait_queue_t *wait = &intel_fence->wait;
> > +
> > +	/* queue fence wait queue on irq queue and get fence */
> > +	if (i915_seqno_passed(ring->get_seqno(ring, false),
> > +			      intel_fence->seqno) ||
> > +	    i915_terminally_wedged(&dev_priv->gpu_error))
> > +		return false;
> > +
> > +	if (!ring->irq_get(ring))
> > +		return false;
> > +
> > +	wait->flags = 0;
> > +	wait->private = intel_fence;
> > +	wait->func = i915_fence_check;
> > +
> > +	__add_wait_queue(&ring->irq_queue, wait);
> > +	fence_get(fence);
> > +
> > +	return true;
> > +}
> 
> This looks like it implements poll(). 
> 
> You should recheck i915_request_complete() after setting up the irq
> waiter. Or does struct fence_ops handle that?

Also looks quite a bit like my ring notify doohicky from:
http://lists.freedesktop.org/archives/intel-gfx/2014-June/047623.html

Except I kept the list in the driver so you would need to do only one
get_seqno() per irq. Also if the list would be sorted (which it wasn't
in my patch) it would prevent signalling the fences out of order. But
maybe that's not really a problem for anyone.

Hmm, so if the out of order thing isn't a problem maybe use the wait
queue still but replace the wake_up() with __wake_up() so that the seqno
can be passed in as the key. That's assuming people care about
optimizing the seqno reads.

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-09-03 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 21:32 Updated fence patches Jesse Barnes
2014-09-02 21:32 ` [PATCH 1/2] drm/i915: Android sync points for i915 v2 Jesse Barnes
2014-09-03  7:09   ` Chris Wilson
2014-09-03 16:41     ` Ville Syrjälä [this message]
2014-09-03 17:05       ` Chris Wilson
2014-09-03 17:12         ` Chris Wilson
2014-09-02 21:32 ` [PATCH 2/2] drm/i915: allow sync points within batches Jesse Barnes
2014-09-03  7:01   ` Chris Wilson
2014-09-03 15:41     ` Jesse Barnes
2014-09-03 16:08       ` Chris Wilson
2014-09-03 19:01         ` Jesse Barnes
2014-09-03 19:41           ` Daniel Vetter
2014-09-03 19:48             ` 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=20140903164134.GX4193@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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.