Commit 1b5bdf07 authored by Christian König's avatar Christian König

drm/i915: use the new iterator in i915_sw_fence_await_reservation v3

Simplifying the code a bit.

v2: use dma_resv_for_each_fence instead, according to Tvrtko the lock is
    held here anyway.
v3: back to using dma_resv_for_each_fence_unlocked.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarDaniel Vetter <daniel@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211116102431.198905-4-christian.koenig@amd.com
parent 73495209
...@@ -572,56 +572,25 @@ int i915_sw_fence_await_reservation(struct i915_sw_fence *fence, ...@@ -572,56 +572,25 @@ int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
unsigned long timeout, unsigned long timeout,
gfp_t gfp) gfp_t gfp)
{ {
struct dma_fence *excl; struct dma_resv_iter cursor;
struct dma_fence *f;
int ret = 0, pending; int ret = 0, pending;
debug_fence_assert(fence); debug_fence_assert(fence);
might_sleep_if(gfpflags_allow_blocking(gfp)); might_sleep_if(gfpflags_allow_blocking(gfp));
if (write) { dma_resv_iter_begin(&cursor, resv, write);
struct dma_fence **shared; dma_resv_for_each_fence_unlocked(&cursor, f) {
unsigned int count, i; pending = i915_sw_fence_await_dma_fence(fence, f, timeout,
ret = dma_resv_get_fences(resv, &excl, &count, &shared);
if (ret)
return ret;
for (i = 0; i < count; i++) {
if (shared[i]->ops == exclude)
continue;
pending = i915_sw_fence_await_dma_fence(fence,
shared[i],
timeout,
gfp);
if (pending < 0) {
ret = pending;
break;
}
ret |= pending;
}
for (i = 0; i < count; i++)
dma_fence_put(shared[i]);
kfree(shared);
} else {
excl = dma_resv_get_excl_unlocked(resv);
}
if (ret >= 0 && excl && excl->ops != exclude) {
pending = i915_sw_fence_await_dma_fence(fence,
excl,
timeout,
gfp); gfp);
if (pending < 0) if (pending < 0) {
ret = pending; ret = pending;
else break;
ret |= pending; }
}
dma_fence_put(excl);
ret |= pending;
}
dma_resv_iter_end(&cursor);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment