All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, Intel-gfx@lists.freedesktop.org
Subject: Re: [RFC v3] drm/i915: Android native sync support
Date: Tue, 27 Jan 2015 12:13:14 +0000	[thread overview]
Message-ID: <54C780DA.7060702@linux.intel.com> (raw)
In-Reply-To: <20150127114021.GI22081@nuc-i3427.alporthouse.com>

On 01/27/2015 11:40 AM, Chris Wilson wrote:
> On Tue, Jan 27, 2015 at 11:29:36AM +0000, Tvrtko Ursulin wrote:
>> +static void i915_gem_request_unreference_worker(struct work_struct *work)
>> +{
>> +	struct drm_i915_gem_request *req =
>> +		container_of(work, struct drm_i915_gem_request, unref_work);
>> +	struct drm_device *dev = req->ring->dev;
>> +
>> +	mutex_lock(&dev->struct_mutex);
>> +	i915_gem_request_unreference(req);
>> +	mutex_unlock(&dev->struct_mutex);
>> +}
>> +
>> +static int
>> +i915_fence_ring_check(wait_queue_t *wait, unsigned mode, int flags, void *key)
>> +{
>> +	struct drm_i915_gem_request *req = wait->private;
>> +	struct intel_engine_cs *ring = req->ring;
>> +
>> +	if (!i915_gem_request_completed(req, false))
>> +		return 0;
>> +
>> +	fence_signal_locked(&req->fence);
>> +
>> +	__remove_wait_queue(&ring->irq_queue, wait);
>> +	ring->irq_put(ring);
>> +
>> +	INIT_WORK(&req->unref_work, i915_gem_request_unreference_worker);
>> +	schedule_work(&req->unref_work);
>> +
>> +	return 0;
>> +}
>> +
>> +static bool i915_fence_ring_enable_signaling(struct fence *fence)
>> +{
>> +	struct drm_i915_gem_request *req = to_i915_request(fence);
>> +	struct intel_engine_cs *ring = req->ring;
>> +	struct drm_i915_private *dev_priv = ring->dev->dev_private;
>> +	wait_queue_t *wait = &req->wait;
>> +
>> +	/* queue fence wait queue on irq queue and get fence */
>> +	if (i915_gem_request_completed(req, false) ||
>> +	    i915_terminally_wedged(&dev_priv->gpu_error))
>> +		return false;
>> +
>> +	if (!ring->irq_get(ring))
>> +		return false;
>> +
>> +	if (i915_gem_request_completed(req, false)) {
>> +		ring->irq_put(ring);
>> +		return true;
>> +	}
>> +
>> +	wait->flags = 0;
>> +	wait->private = req;
>> +	wait->func = i915_fence_ring_check;
>> +
>> +	i915_gem_request_reference(req);
>> +
>> +	__add_wait_queue(&ring->irq_queue, wait);
>> +
>> +	return true;
>> +}
>
> Explain how fence_release interacts with enable_signalling. Presumably
> either the core fence routines cleanup the outstanding signalling, or we
> are expected to. Doing so will remove the requirement for the extra
> ref/unref (including the worker).

I think normally we would be expected to use fence_get/put on the 
signaling side of things but that is not possible here since struct 
fence is embedded in the request.

So as it is, sync_fence_release will tear everything down with our 
callback still on the irq_queue which is what taking a request reference 
sorts out.

Regards,

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

  reply	other threads:[~2015-01-27 12:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 11:15 [RFC] drm/i915: Android native sync support Tvrtko Ursulin
2015-01-22 11:42 ` Chris Wilson
2015-01-22 13:41   ` Tvrtko Ursulin
2015-01-22 13:49     ` Chris Wilson
2015-01-22 13:56       ` Tvrtko Ursulin
2015-01-22 14:04     ` Damien Lespiau
2015-01-22 15:28       ` Tvrtko Ursulin
2015-01-22 15:47         ` Damien Lespiau
2015-01-22 15:54           ` Tvrtko Ursulin
2015-01-22 16:07             ` Damien Lespiau
2015-01-23 11:13 ` [RFC v2] " Tvrtko Ursulin
2015-01-23 11:27   ` Chris Wilson
2015-01-23 14:02     ` Tvrtko Ursulin
2015-01-23 15:53       ` Daniel Vetter
2015-01-23 16:49         ` Tvrtko Ursulin
2015-01-24  9:47           ` Daniel Vetter
2015-01-26 11:08             ` Tvrtko Ursulin
2015-01-28  9:20               ` Daniel Vetter
2015-01-23 17:30         ` Chris Wilson
2015-01-24  9:41           ` Daniel Vetter
2015-01-24 16:08             ` Chris Wilson
2015-01-26  7:52               ` Daniel Vetter
2015-01-26  9:08                 ` Chris Wilson
2015-01-28  9:22                   ` Daniel Vetter
2015-01-28  9:23                     ` Chris Wilson
2015-01-28  9:50                       ` Daniel Vetter
2015-01-28 10:07                         ` Chris Wilson
2015-02-25 20:46                           ` Jesse Barnes
2015-02-26  9:13                             ` Chris Wilson
2015-01-27 11:29 ` [RFC v3] " Tvrtko Ursulin
2015-01-27 11:40   ` Chris Wilson
2015-01-27 12:13     ` Tvrtko Ursulin [this message]
2015-01-27 12:18       ` Chris Wilson
2015-01-27 13:43         ` Tvrtko Ursulin
2015-01-28  9:25           ` Daniel Vetter
2015-01-28  9:29   ` Daniel Vetter
2015-01-28 16:52     ` Tvrtko Ursulin
2015-01-29 16:14       ` Daniel Vetter

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=54C780DA.7060702@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    /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.