From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk
Subject: [PATCH 2/4] drm/i915: use new reservation_object_fences helper
Date: Wed, 7 Aug 2019 15:53:10 +0200 [thread overview]
Message-ID: <20190807135312.1730-2-christian.koenig@amd.com> (raw)
In-Reply-To: <20190807135312.1730-1-christian.koenig@amd.com>
Instead of open coding the sequence loop use the new helper.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/i915/gem/i915_gem_busy.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_busy.c b/drivers/gpu/drm/i915/gem/i915_gem_busy.c
index 6ad93a09968c..8473292096cb 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_busy.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_busy.c
@@ -83,7 +83,8 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
struct drm_i915_gem_busy *args = data;
struct drm_i915_gem_object *obj;
struct reservation_object_list *list;
- unsigned int seq;
+ unsigned int i, shared_count;
+ struct dma_fence *excl;
int err;
err = -ENOENT;
@@ -109,29 +110,18 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
* to report the overall busyness. This is what the wait-ioctl does.
*
*/
-retry:
- seq = raw_read_seqcount(&obj->base.resv->seq);
+ reservation_object_fences(obj->base.resv, &excl, &list, &shared_count);
/* Translate the exclusive fence to the READ *and* WRITE engine */
- args->busy =
- busy_check_writer(rcu_dereference(obj->base.resv->fence_excl));
+ args->busy = busy_check_writer(excl);
/* Translate shared fences to READ set of engines */
- list = rcu_dereference(obj->base.resv->fence);
- if (list) {
- unsigned int shared_count = list->shared_count, i;
+ for (i = 0; i < shared_count; ++i) {
+ struct dma_fence *fence = rcu_dereference(list->shared[i]);
- for (i = 0; i < shared_count; ++i) {
- struct dma_fence *fence =
- rcu_dereference(list->shared[i]);
-
- args->busy |= busy_check_reader(fence);
- }
+ args->busy |= busy_check_reader(fence);
}
- if (args->busy && read_seqcount_retry(&obj->base.resv->seq, seq))
- goto retry;
-
err = 0;
out:
rcu_read_unlock();
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-08-07 13:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 13:53 [PATCH 1/4] dma-buf: add reservation_object_fences helper Christian König
2019-08-07 13:53 ` Christian König [this message]
2019-08-07 16:08 ` [PATCH 2/4] drm/i915: use new " Chris Wilson
2019-08-07 13:53 ` [PATCH 3/4] dma-buf: further relax reservation_object_add_shared_fence Christian König
2019-08-07 16:10 ` Chris Wilson
2019-08-07 13:53 ` [PATCH 4/4] dma-buf: nuke reservation_object seq number Christian König
2019-08-07 14:17 ` Chris Wilson
2019-08-10 10:51 ` Christian König
2019-08-14 15:39 ` Daniel Vetter
2019-08-14 16:42 ` Chris Wilson
2019-08-14 17:06 ` Chris Wilson
2019-08-14 17:22 ` Chris Wilson
2019-08-14 17:38 ` Chris Wilson
2019-08-14 17:48 ` Chris Wilson
2019-08-14 17:58 ` Koenig, Christian
2019-08-14 18:52 ` Chris Wilson
2019-08-14 17:06 ` Daniel Vetter
2019-08-14 17:20 ` Chris Wilson
2019-08-14 17:48 ` Daniel Vetter
2019-08-07 16:07 ` [PATCH 1/4] dma-buf: add reservation_object_fences helper Chris Wilson
2019-08-09 13:07 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] " Patchwork
2019-08-09 13:31 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-10 6:31 ` ✓ Fi.CI.IGT: " 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=20190807135312.1730-2-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox