hwcontext_vulkan: host wait on semaphores before freeing frame

This commit is contained in:
Lynne 2021-11-07 08:44:46 +01:00
parent f7f1613638
commit bde1fc5386
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464

View File

@ -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++) {