This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 25663e6924 vulkan: only reset execution fences at submission time
25663e6924 is described below

commit 25663e69246ae373efb2358fdf509858045e69c8
Author:     Lynne <[email protected]>
AuthorDate: Mon Aug 3 11:32:33 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Mon Aug 3 13:18:55 2026 +0900

    vulkan: only reset execution fences at submission time
    
    The fence was reset when a context began recording, so an error
    between recording start and submission (observed in the wild as
    intermittent VK_ERROR_MEMORY_MAP_FAILED from vkEndCommandBuffer on
    ANV under threaded load) left it permanently unsignalled, deadlocking
    the next user of the context.
    
    Reset the fence only once a fully recorded submission is about to be
    handed to the queue: abandoned recordings then leave the fence
    signalled from the previous submission, and the context self-heals on
    reuse. Should the queue submission itself fail, signal the fence with
    an empty submission.
---
 libavutil/vulkan.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index dffb6724b8..65b1ddba6e 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -588,9 +588,10 @@ int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext 
*e)
         .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
     };
 
-    /* Wait for the fence to be signalled */
+    /* Wait for the fence to be signalled. The fence is only reset once a
+     * fully recorded submission is handed to the queue, so a recording
+     * abandoned after an error leaves the context reusable. */
     vk->WaitForFences(s->hwctx->act_dev, 1, &e->fence, VK_TRUE, UINT64_MAX);
-    vk->ResetFences(s->hwctx->act_dev, 1, &e->fence);
 
     /* Discard queue dependencies */
     ff_vk_exec_discard_deps(s, e);
@@ -948,12 +949,18 @@ int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext 
*e)
         return AVERROR_EXTERNAL;
     }
 
+    vk->ResetFences(s->hwctx->act_dev, 1, &e->fence);
+
 #if FF_API_VULKAN_SYNC_QUEUES
 FF_DISABLE_DEPRECATION_WARNINGS
     s->hwctx->lock_queue(s->device, e->qf, e->qi);
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
     ret = vk->QueueSubmit2(e->queue, 1, &submit_info, e->fence);
+    if (ret != VK_SUCCESS) {
+        /* Keep the context usable, signal with an empty submission */
+        vk->QueueSubmit2(e->queue, 0, NULL, e->fence);
+    }
 #if FF_API_VULKAN_SYNC_QUEUES
 FF_DISABLE_DEPRECATION_WARNINGS
     s->hwctx->unlock_queue(s->device, e->qf, e->qi);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to