Commit ca25fe5e authored by Christian König's avatar Christian König Committed by Alex Deucher

dma-buf: try to replace a signaled fence in reservation_object_add_shared_inplace

The amdgpu issue to also need signaled fences in the reservation objects should
be fixed by now.

Optimize the handling by replacing a signaled fence when adding a new
shared one.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114142436.1360-2-christian.koenig@amd.com
parent 4d9c62e8
...@@ -104,7 +104,8 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, ...@@ -104,7 +104,8 @@ reservation_object_add_shared_inplace(struct reservation_object *obj,
struct reservation_object_list *fobj, struct reservation_object_list *fobj,
struct dma_fence *fence) struct dma_fence *fence)
{ {
u32 i; struct dma_fence *signaled = NULL;
u32 i, signaled_idx;
dma_fence_get(fence); dma_fence_get(fence);
...@@ -126,17 +127,28 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, ...@@ -126,17 +127,28 @@ reservation_object_add_shared_inplace(struct reservation_object *obj,
dma_fence_put(old_fence); dma_fence_put(old_fence);
return; return;
} }
if (!signaled && dma_fence_is_signaled(old_fence)) {
signaled = old_fence;
signaled_idx = i;
}
} }
/* /*
* memory barrier is added by write_seqcount_begin, * memory barrier is added by write_seqcount_begin,
* fobj->shared_count is protected by this lock too * fobj->shared_count is protected by this lock too
*/ */
RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence); if (signaled) {
fobj->shared_count++; RCU_INIT_POINTER(fobj->shared[signaled_idx], fence);
} else {
RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence);
fobj->shared_count++;
}
write_seqcount_end(&obj->seq); write_seqcount_end(&obj->seq);
preempt_enable(); preempt_enable();
dma_fence_put(signaled);
} }
static void static void
......
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