hwcontext_vulkan: update prepare_frame() for multiple semaphores when exporting

This commit is contained in:
Lynne 2020-05-12 19:08:54 +01:00
parent f0c0471075
commit 0e39fce1e1
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
1 changed files with 7 additions and 5 deletions

View File

@ -1244,8 +1244,6 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
}; };
VkPipelineStageFlagBits wait_st = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
VkSubmitInfo s_info = { VkSubmitInfo s_info = {
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
.commandBufferCount = 1, .commandBufferCount = 1,
@ -1255,6 +1253,10 @@ static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
.signalSemaphoreCount = planes, .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) { switch (pmode) {
case PREP_MODE_WRITE: case PREP_MODE_WRITE:
new_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; 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_layout = VK_IMAGE_LAYOUT_GENERAL;
new_access = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; new_access = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
dst_qf = VK_QUEUE_FAMILY_EXTERNAL_KHR; dst_qf = VK_QUEUE_FAMILY_EXTERNAL_KHR;
s_info.pWaitSemaphores = &frame->sem; s_info.pWaitSemaphores = frame->sem;
s_info.pWaitDstStageMask = &wait_st; s_info.pWaitDstStageMask = wait_st;
s_info.waitSemaphoreCount = 1; s_info.waitSemaphoreCount = planes;
break; break;
} }