Commit 7f11c59e authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

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: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 16590745
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -135,12 +135,17 @@ static bool amdgpu_sync_add_later(struct amdgpu_sync *sync, struct dma_fence *f)
	struct amdgpu_sync_entry *e;

	hash_for_each_possible(sync->fences, e, node, f->context) {
		if (unlikely(e->fence->context != f->context))
			continue;
		if (dma_fence_is_signaled(e->fence)) {
			dma_fence_put(e->fence);
			e->fence = dma_fence_get(f);
			return true;
		}

		if (likely(e->fence->context == f->context)) {
			amdgpu_sync_keep_later(&e->fence, f);
			return true;
		}
	}
	return false;
}