diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-11 17:05:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-11 17:05:12 +0000 |
commit | 6b5c63be724793e9ba67996ec81d3bf2ecbf5c2c (patch) | |
tree | 154957e08cb63f3bff25732708e13fbf2afb3f6e /amdgpu/amdgpu_cs.c | |
parent | Adding upstream version 2.4.120. (diff) | |
download | libdrm-6b5c63be724793e9ba67996ec81d3bf2ecbf5c2c.tar.xz libdrm-6b5c63be724793e9ba67996ec81d3bf2ecbf5c2c.zip |
Adding upstream version 2.4.121.upstream/2.4.121upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | amdgpu/amdgpu_cs.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 49fc16c..2db4967 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -598,24 +598,31 @@ drm_public int amdgpu_cs_signal_semaphore(amdgpu_context_handle ctx, uint32_t ring, amdgpu_semaphore_handle sem) { + int ret; + if (!ctx || !sem) return -EINVAL; if (ip_type >= AMDGPU_HW_IP_NUM) return -EINVAL; if (ring >= AMDGPU_CS_MAX_RINGS) return -EINVAL; - /* sem has been signaled */ - if (sem->signal_fence.context) - return -EINVAL; + pthread_mutex_lock(&ctx->sequence_mutex); + /* sem has been signaled */ + if (sem->signal_fence.context) { + ret = -EINVAL; + goto unlock; + } sem->signal_fence.context = ctx; sem->signal_fence.ip_type = ip_type; sem->signal_fence.ip_instance = ip_instance; sem->signal_fence.ring = ring; sem->signal_fence.fence = ctx->last_seq[ip_type][ip_instance][ring]; update_references(NULL, &sem->refcount); + ret = 0; +unlock: pthread_mutex_unlock(&ctx->sequence_mutex); - return 0; + return ret; } drm_public int amdgpu_cs_wait_semaphore(amdgpu_context_handle ctx, |