diff options
author | Lynne <dev@lynne.ee> | 2024-12-18 14:58:33 +0900 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2024-12-23 04:25:09 +0900 |
commit | 157cd820adbbfcfd1870a6ce12d072dc0f623e9b (patch) | |
tree | ad8ce1f1676a448fc2ff0defcaac8cf8e503f989 /libavutil/vulkan.c | |
parent | 7239be07bea6cce5a9e09d5dc7ebb1a14e34121f (diff) | |
download | ffmpeg-157cd820adbbfcfd1870a6ce12d072dc0f623e9b.tar.gz |
vulkan: remove pointless mutex locks
This code was simply incorrect through and through. It did not
protect what actually has to be protected in a multi-threaded setup.
Perhaps it was used to silence threading errors?
Either way, remove it, and document the correct way to use execution
pools in a threaded environment.
Diffstat (limited to 'libavutil/vulkan.c')
-rw-r--r-- | libavutil/vulkan.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c index dc30539115..55b039d5ef 100644 --- a/libavutil/vulkan.c +++ b/libavutil/vulkan.c @@ -251,7 +251,6 @@ void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool) vk->WaitForFences(s->hwctx->act_dev, 1, &e->fence, VK_TRUE, UINT64_MAX); vk->DestroyFence(s->hwctx->act_dev, e->fence, s->hwctx->alloc); } - pthread_mutex_destroy(&e->lock); ff_vk_exec_discard_deps(s, e); @@ -424,11 +423,6 @@ int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, .flags = VK_FENCE_CREATE_SIGNALED_BIT, }; - /* Mutex */ - err = pthread_mutex_init(&e->lock, NULL); - if (err != 0) - return AVERROR(err); - /* Fence */ ret = vk->CreateFence(s->hwctx->act_dev, &fence_create, s->hwctx->alloc, &e->fence); @@ -498,10 +492,8 @@ FFVkExecContext *ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool) void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e) { FFVulkanFunctions *vk = &s->vkfn; - pthread_mutex_lock(&e->lock); vk->WaitForFences(s->hwctx->act_dev, 1, &e->fence, VK_TRUE, UINT64_MAX); ff_vk_exec_discard_deps(s, e); - pthread_mutex_unlock(&e->lock); } int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e) @@ -517,11 +509,7 @@ int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e) /* Wait for the fence to be signalled */ vk->WaitForFences(s->hwctx->act_dev, 1, &e->fence, VK_TRUE, UINT64_MAX); - - /* vkResetFences is defined as being host-synchronized */ - pthread_mutex_lock(&e->lock); vk->ResetFences(s->hwctx->act_dev, 1, &e->fence); - pthread_mutex_unlock(&e->lock); /* Discard queue dependencies */ ff_vk_exec_discard_deps(s, e); |