Commit 028fd7bb6f for ffmpeg
commit 028fd7bb6f809f8b3c1c08740120817acd9221b1
Author: Philip Langdale <philipl@overt.org>
Date: Mon Aug 31 11:45:41 2026 -0700
avutil/hwcontext_vulkan: wait for the frame timeline befor mapping drm frames
This is the same principle as in dc54ec7a0dc.
The imported sync file is used to order access relative to the external
operations but the frame itself may have been operated on within our
Vulkan context on a different queue, and we must synchronise against those
operations as well. That means waiting at VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT
rather than VK_PIPELINE_STAGE_2_NONE.
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 72e4df26c8..8e17f258f0 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -3922,8 +3922,13 @@ static int vulkan_map_from_drm_frame_sync(AVHWFramesContext *hwfc, AVFrame *dst,
drm_sync_sem, desc->nb_objects,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, 1);
+ /* The imported DRM sync file only orders the external data, not this
+ * frame's earlier use by FFmpeg. The frame may be recycled from the
+ * pool while it is still in flight (and last used on another queue),
+ * so the map waits on its last signal, at ALL_COMMANDS, to be ordered
+ * after that previous use. */
err = ff_vk_exec_add_dep_frame(&p->vkctx, exec, dst,
- VK_PIPELINE_STAGE_2_NONE,
+ VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT);
if (err < 0) {
ff_vk_exec_discard(&p->vkctx, exec);