Skip to content

Commit 7f11c59

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: overwrite signaled fence in amdgpu_sync
This allows using amdgpu_sync even without peeking into the fences for a long time. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1659074 commit 7f11c59

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,16 @@ static bool amdgpu_sync_add_later(struct amdgpu_sync *sync, struct dma_fence *f)
135135
struct amdgpu_sync_entry *e;
136136

137137
hash_for_each_possible(sync->fences, e, node, f->context) {
138-
if (unlikely(e->fence->context != f->context))
139-
continue;
138+
if (dma_fence_is_signaled(e->fence)) {
139+
dma_fence_put(e->fence);
140+
e->fence = dma_fence_get(f);
141+
return true;
142+
}
140143

141-
amdgpu_sync_keep_later(&e->fence, f);
142-
return true;
144+
if (likely(e->fence->context == f->context)) {
145+
amdgpu_sync_keep_later(&e->fence, f);
146+
return true;
147+
}
143148
}
144149
return false;
145150
}

0 commit comments

Comments
 (0)