[FFmpeg-cvslog] hwcontext_vulkan: host wait on semaphores before freeing frame

Lynne git at videolan.org
Fri Nov 12 06:52:34 EET 2021


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sun Nov  7 08:44:46 2021 +0100| [bde1fc5386282142697dbaf91fe57744ba63fec1] | committer: Lynne

hwcontext_vulkan: host wait on semaphores before freeing frame

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

 libavutil/hwcontext_vulkan.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 6aba9e3b8e..69de06e6c2 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -112,6 +112,7 @@ enum VulkanExtensions {
     /* Semaphores */                                                               \
     MACRO(1, 1, EXT_EXTERNAL_FD_SEM,      GetSemaphoreFdKHR)                       \
     MACRO(1, 1, EXT_NO_FLAG,              CreateSemaphore)                         \
+    MACRO(1, 1, EXT_NO_FLAG,              WaitSemaphores)                          \
     MACRO(1, 1, EXT_NO_FLAG,              DestroySemaphore)                        \
                                                                                    \
     /* Memory */                                                                   \
@@ -1737,6 +1738,16 @@ static void vulkan_frame_free(void *opaque, uint8_t *data)
     VulkanFunctions *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);
+
     vulkan_free_internal(f->internal);
 
     for (int i = 0; i < planes; i++) {



More information about the ffmpeg-cvslog mailing list