summaryrefslogtreecommitdiff
path: root/libavutil/hwcontext_vulkan.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2021-11-13 14:22:11 +0100
committerLynne <dev@lynne.ee>2021-11-13 14:22:11 +0100
commit9dc544cdb461789f0d950c384464fcc893cd804c (patch)
treea54bf074ebd3d4f20252b0a7c092416994c9e483 /libavutil/hwcontext_vulkan.c
parent6a23a5597cd77506210cb14265e94e012a942abd (diff)
hwcontext_vulkan: wait for semaphores when unmapping from VAAPI
We don't really want to do a full all-queue blocking wait here, since this happens once per frame, and this could delay future frames.
Diffstat (limited to 'libavutil/hwcontext_vulkan.c')
-rw-r--r--libavutil/hwcontext_vulkan.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 31c7dc2aa5..e54c10156e 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2218,6 +2218,16 @@ static void vulkan_unmap_from(AVHWFramesContext *hwfc, HWMapDescriptor *hwmap)
VulkanDevicePriv *p = hwfc->device_ctx->internal->priv;
FFVulkanFunctions *vk = &p->vkfn;
+ VkSemaphoreWaitInfo wait_info = {
+ .sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
+ .flags = 0x0,
+ .pSemaphores = map->frame->sem,
+ .pValues = map->frame->sem_value,
+ .semaphoreCount = planes,
+ };
+
+ vk->WaitSemaphores(hwctx->act_dev, &wait_info, UINT64_MAX);
+
for (int i = 0; i < planes; i++) {
vk->DestroyImage(hwctx->act_dev, map->frame->img[i], hwctx->alloc);
vk->FreeMemory(hwctx->act_dev, map->frame->mem[i], hwctx->alloc);