Skip to content

Commit

Permalink
drm/i915: use the new iterator in i915_request_await_object v2
Browse files Browse the repository at this point in the history
Simplifying the code a bit.

v2: add missing rcu_read_lock()/rcu_read_unlock()
v3: use dma_resv_for_each_fence instead

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-20-christian.koenig@amd.com
  • Loading branch information
Christian König committed Oct 7, 2021
1 parent 9c2ba26 commit a585070
Showing 1 changed file with 5 additions and 29 deletions.
34 changes: 5 additions & 29 deletions drivers/gpu/drm/i915/i915_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,38 +1509,14 @@ i915_request_await_object(struct i915_request *to,
struct drm_i915_gem_object *obj,
bool write)
{
struct dma_fence *excl;
struct dma_resv_iter cursor;
struct dma_fence *fence;
int ret = 0;

if (write) {
struct dma_fence **shared;
unsigned int count, i;

ret = dma_resv_get_fences(obj->base.resv, &excl, &count,
&shared);
dma_resv_for_each_fence(&cursor, obj->base.resv, write, fence) {
ret = i915_request_await_dma_fence(to, fence);
if (ret)
return ret;

for (i = 0; i < count; i++) {
ret = i915_request_await_dma_fence(to, shared[i]);
if (ret)
break;

dma_fence_put(shared[i]);
}

for (; i < count; i++)
dma_fence_put(shared[i]);
kfree(shared);
} else {
excl = dma_resv_get_excl_unlocked(obj->base.resv);
}

if (excl) {
if (ret == 0)
ret = i915_request_await_dma_fence(to, excl);

dma_fence_put(excl);
break;
}

return ret;
Expand Down

0 comments on commit a585070

Please sign in to comment.