From 0e39fce1e1332842f658e1b5c04ec8ef4c367fb0 Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 12 May 2020 19:08:54 +0100 Subject: [PATCH] hwcontext_vulkan: update prepare_frame() for multiple semaphores when exporting --- libavutil/hwcontext_vulkan.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 6b147f0fc0..89c40cb9bf 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1244,8 +1244,6 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx, .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, }; - VkPipelineStageFlagBits wait_st = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; - VkSubmitInfo s_info = { .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .commandBufferCount = 1, @@ -1255,6 +1253,10 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx, .signalSemaphoreCount = planes, }; + VkPipelineStageFlagBits wait_st[AV_NUM_DATA_POINTERS]; + for (int i = 0; i < planes; i++) + wait_st[i] = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; + switch (pmode) { case PREP_MODE_WRITE: new_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; @@ -1270,9 +1272,9 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx, new_layout = VK_IMAGE_LAYOUT_GENERAL; new_access = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; dst_qf = VK_QUEUE_FAMILY_EXTERNAL_KHR; - s_info.pWaitSemaphores = &frame->sem; - s_info.pWaitDstStageMask = &wait_st; - s_info.waitSemaphoreCount = 1; + s_info.pWaitSemaphores = frame->sem; + s_info.pWaitDstStageMask = wait_st; + s_info.waitSemaphoreCount = planes; break; }