1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

lavu/vulkan: wait for the frame timeline before the export layout transition

switch_layout() submits vkCmdPipelineBarrier2 on the compute queue. The
image was last written by vkCmdDecodeVideoKHR on the video queue, which
signals the frame timeline at VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR.
The layout transition is a write, and the cross-queue order is that
semaphore wait. VK_PIPELINE_STAGE_2_NONE names no stage, so the barrier
was outside the wait and raced VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR
(SYNC-HAZARD-WRITE-AFTER-WRITE). Wait at
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT so every command in the submission,
including the transition, happens after the signal.
This commit is contained in:
Tymur Boiko
2026-10-16 22:01:25 +02:00
committed by Lynne
parent b4b77383ae
commit dc54ec7a0d

View File

@@ -2644,8 +2644,10 @@ static int switch_layout(AVHWFramesContext *hwfc, FFVkExecPool *ectx,
if (err < 0)
return err;
/* NONE does not block any stage, so this queue's layout transition
* races a decode write submitted on the video queue. */
err = ff_vk_exec_add_dep_frame(&p->vkctx, exec, &tmp_frame,
VK_PIPELINE_STAGE_2_NONE,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT);
if (err < 0)
return err;