[FFmpeg-cvslog] hwcontext_vulkan: use vkDeviceWaitIdle instead of vkWaitSemaphores on uninit

Lynne git at videolan.org
Fri Nov 12 15:51:27 EET 2021


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Fri Nov 12 13:05:42 2021 +0100| [57e11321ea378a57a909d817c2fcf2ebcaf8c123] | committer: Lynne

hwcontext_vulkan: use vkDeviceWaitIdle instead of vkWaitSemaphores on uninit

To silence a possible validation layer bug, switch the function. It only gets
triggered by vf_libplacebo, which is odd.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57e11321ea378a57a909d817c2fcf2ebcaf8c123
---

 libavutil/hwcontext_vulkan.c | 12 +++---------
 libavutil/vulkan_functions.h |  1 +
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 93a304ca95..6e746d4aa4 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1589,15 +1589,9 @@ static void vulkan_frame_free(void *opaque, uint8_t *data)
     FFVulkanFunctions *vk = &p->vkfn;
     int planes = av_pix_fmt_count_planes(hwfc->sw_format);
 
-    VkSemaphoreWaitInfo wait_info = {
-        .sType          = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
-        .flags          = 0x0,
-        .pSemaphores    = f->sem,
-        .pValues        = f->sem_value,
-        .semaphoreCount = planes,
-    };
-
-    vk->WaitSemaphores(hwctx->act_dev, &wait_info, UINT64_MAX);
+    /* We could use vkWaitSemaphores, but the validation layer seems to have
+     * issues tracking command buffer execution state on uninit. */
+    vk->DeviceWaitIdle(hwctx->act_dev);
 
     vulkan_free_internal(f->internal);
 
diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h
index de2054e0c2..913667befb 100644
--- a/libavutil/vulkan_functions.h
+++ b/libavutil/vulkan_functions.h
@@ -47,6 +47,7 @@ typedef enum FFVulkanExtensions {
     MACRO(1, 0, FF_VK_EXT_NO_FLAG,              CreateDevice)                            \
     MACRO(1, 0, FF_VK_EXT_NO_FLAG,              GetPhysicalDeviceFeatures2)              \
     MACRO(1, 0, FF_VK_EXT_NO_FLAG,              GetPhysicalDeviceProperties)             \
+    MACRO(1, 0, FF_VK_EXT_NO_FLAG,              DeviceWaitIdle)                          \
     MACRO(1, 0, FF_VK_EXT_NO_FLAG,              DestroyDevice)                           \
                                                                                          \
     MACRO(1, 0, FF_VK_EXT_NO_FLAG,              EnumeratePhysicalDevices)                \



More information about the ffmpeg-cvslog mailing list