From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/13] drm/i915: Add a sw fence for collecting up dma fences
Date: Thu, 25 Aug 2016 14:49:59 +0300 [thread overview]
Message-ID: <1472125799.3589.27.camel@linux.intel.com> (raw)
In-Reply-To: <20160825090839.9952-2-chris@chris-wilson.co.uk>
On to, 2016-08-25 at 10:08 +0100, Chris Wilson wrote:
> +++ b/drivers/gpu/drm/i915/i915_sw_fence.c
> @@ -0,0 +1,329 @@
> +/*
> + * (C) Copyright 2016 Intel Corporation
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2
> + * of the License.
> + */
Copyright notice is rather brief, copy from i915_gem_execbuffer.c
> +static int __i915_sw_fence_notify(struct i915_sw_fence *fence)
> +{
> + i915_sw_fence_notify_t fn;
> +
> + fn = (i915_sw_fence_notify_t)(fence->flags & I915_SW_FENCE_MASK);
I'd define an accessor functions in scatterlist.h fashion.
Although I'm not convinced of packing the flags with the function
pointer. How many fences do we expect to be allocated simultaneously on
a real usage scenario?
> +static void __i915_sw_fence_wake_up_all(struct i915_sw_fence *fence,
> + struct list_head *continuation)
> +{
> + wait_queue_head_t *x = &fence->wait;
> + unsigned long flags;
> +
> + atomic_dec(&fence->pending);
> +
> + /*
> + * To prevent unbounded recursion as we traverse the graph of i915_sw_fences,
Long line due to s/kfence/.../
> + * we move the task_list from this the next ready fence to the tail of
> + * the original fence's task_list (and so added to the list to be
> + * woken).
> + */
> + smp_mb__before_spinlock();
> + if (!list_empty_careful(&x->task_list)) {
if (list_empty_careful()
return;
> +static bool __i915_sw_fence_check_if_after(struct i915_sw_fence *fence,
> + const struct i915_sw_fence * const signaler)
> +{
> + wait_queue_t *wq;
> +
> + if (__test_and_set_bit(I915_SW_FENCE_CHECKED_BIT, &fence->flags))
> + return false;
> +
> + if (fence == signaler)
> + return true;
Not sure if I would expect _if_after to return true on an equal
object...
> +int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
> + struct reservation_object *resv,
> + const struct fence_ops *exclude,
> + bool write,
> + gfp_t gfp)
> +{
> + struct fence *excl, **shared;
> + unsigned int count, i;
> + int ret;
> +
> + ret = reservation_object_get_fences_rcu(resv, &excl, &count, &shared);
> + if (ret)
> + return ret;
> +
> + if (write) {
> + for (i = 0; i < count; i++) {
> + if (shared[i]->ops == exclude)
> + continue;
> +
> + ret |= i915_sw_fence_await_dma_fence(fence, shared[i], gfp);
Do we really want to bitwise here?
> + if (ret < 0)
> + goto out;
> + }
> + }
> +
> + if (excl && excl->ops != exclude)
> + ret |= i915_sw_fence_await_dma_fence(fence, excl, gfp);
Ditto.
> +
> +out:
> + fence_put(excl);
> + for (i = 0; i < count; i++)
> + fence_put(shared[i]);
> + kfree(shared);
> +
> + return ret;
> +}
<SNIP>
> +struct i915_sw_fence {
> + wait_queue_head_t wait;
> + unsigned long flags;
Name is rather deceiving to contain a callback function.
> +#define __i915_sw_fence_call __aligned(4)
Not packing would get rid of this too...
> +
> +void i915_sw_fence_init(struct i915_sw_fence *fence, i915_sw_fence_notify_t fn);
> +void i915_sw_fence_commit(struct i915_sw_fence *fence);
Not _signal?
> +static inline bool i915_sw_fence_done(const struct i915_sw_fence *fence)
_is_done() or _is_completed()
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-08-25 11:50 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 9:08 Shortest path to EGL_ANDRIOD_native_sync Chris Wilson
2016-08-25 9:08 ` [PATCH 01/13] drm/i915: Add a sw fence for collecting up dma fences Chris Wilson
2016-08-25 10:42 ` John Harrison
2016-08-25 10:51 ` Chris Wilson
2016-08-25 11:49 ` Joonas Lahtinen [this message]
2016-08-25 12:25 ` Chris Wilson
2016-08-25 16:52 ` Chris Wilson
2016-08-25 9:08 ` [PATCH 02/13] drm/i915: Only queue requests during execlists submission Chris Wilson
2016-08-26 9:41 ` Mika Kuoppala
2016-08-26 9:51 ` Chris Wilson
2016-08-26 9:54 ` Chris Wilson
2016-08-26 10:43 ` Mika Kuoppala
2016-08-26 10:53 ` Chris Wilson
2016-08-25 9:08 ` [PATCH 03/13] drm/i915: Record the position of the workarounds in the tail of the request Chris Wilson
2016-08-25 9:35 ` Mika Kuoppala
2016-08-25 9:08 ` [PATCH 04/13] drm/i915: Compute the ELSP register location once Chris Wilson
2016-08-25 9:51 ` Mika Kuoppala
2016-08-25 10:37 ` Chris Wilson
2016-08-25 9:08 ` [PATCH 05/13] drm/i915: Reorder submitting the requests to ELSP Chris Wilson
2016-08-25 13:02 ` Mika Kuoppala
2016-08-25 9:08 ` [PATCH 06/13] drm/i915: Simplify ELSP queue request tracking Chris Wilson
2016-08-25 9:08 ` [PATCH 07/13] drm/i915: Update reset path to fix incomplete requests Chris Wilson
2016-08-25 9:08 ` [PATCH 08/13] drm/i915: Drive request submission through fence callbacks Chris Wilson
2016-08-25 12:08 ` Joonas Lahtinen
2016-08-25 12:35 ` Chris Wilson
2016-08-26 12:47 ` John Harrison
2016-08-26 16:20 ` Chris Wilson
2016-08-25 9:08 ` [PATCH 09/13] drm/i915: Move execbuf object synchronisation to i915_gem_execbuffer Chris Wilson
2016-08-26 13:29 ` John Harrison
2016-08-25 9:08 ` [PATCH 10/13] drm/i915: Nonblocking request submission Chris Wilson
2016-08-26 13:39 ` John Harrison
2016-08-26 16:14 ` Chris Wilson
2016-08-25 9:08 ` [PATCH 11/13] drm/i915: Serialise execbuf operation after a dma-buf reservation object Chris Wilson
2016-08-26 13:52 ` John Harrison
2016-08-25 9:08 ` [PATCH 12/13] drm/i915: Enable userspace to opt-out of implicit fencing Chris Wilson
2016-08-25 9:08 ` [PATCH 13/13] drm/i915: Support explicit fencing for execbuf Chris Wilson
2016-08-26 15:08 ` John Harrison
2016-08-26 15:29 ` John Harrison
2016-08-26 15:44 ` Chris Wilson
2016-08-25 9:08 ` [PATCH libdrm 14/15] intel: Allow the client to control implicit synchronisation Chris Wilson
2016-08-25 9:08 ` [PATCH libdrm 15/15] intel: Support passing of explicit fencing from execbuf Chris Wilson
2016-09-30 20:53 ` Rafael Antognolli
2016-10-01 8:36 ` Chris Wilson
2016-08-25 9:08 ` [PATCH 16/21] i965: Add explicit fence tracking to batch flush Chris Wilson
2016-08-25 9:08 ` [PATCH 17/21] i965: Split intel_syncobject into vfuncs Chris Wilson
2016-08-25 9:08 ` [PATCH 18/21] i965: Add fd-fence backend to intel_syncobject Chris Wilson
2016-08-25 9:08 ` [PATCH 19/21] rfc! i965: Add intel_screen::has_fence_fd Chris Wilson
2016-08-25 9:08 ` [PATCH 20/21] i965: Implement EGL_ANDROID_native_fence_sync support for DRI2_FENCE Chris Wilson
2016-08-25 9:08 ` [PATCH 21/21] i965: Disable implicit sync when using EGL_ANDROID_native_fence_sync Chris Wilson
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=1472125799.3589.27.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.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.