1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

hwcontext_vulkan: add support for implicit DRM synchronization

More recent kernel versions allow for users to extract a sync_file
handle from a DMA-BUF, which can then be imported into Vulkan as a
binary semaphore.

This finally allows for synchronization between Vulkan and DMA-BUF
images, such as those from screen capture software, or VAAPI,
avoiding any corruption artifacts.

This is done fully asynchronously, where we use the kernel's
given binary semaphores as a dependency to increment the image's
usual VkSemaphores we allocate. The old imported binary semaphores
are cleaned up after execution as usual.

In the future, hwcontext_drm should receive support for explicitly
synchronized images as well, which would make the synchronization
more robust and portable.
This commit is contained in:
Lynne
2024-09-20 05:28:19 +02:00
parent 2395444c80
commit a577d313b2
2 changed files with 138 additions and 11 deletions

View File

@@ -114,6 +114,7 @@ typedef enum FFVulkanExtensions {
\
/* Semaphores */ \
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_SEM, GetSemaphoreFdKHR) \
MACRO(1, 1, FF_VK_EXT_EXTERNAL_FD_SEM, ImportSemaphoreFdKHR) \
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateSemaphore) \
MACRO(1, 1, FF_VK_EXT_NO_FLAG, WaitSemaphores) \
MACRO(1, 1, FF_VK_EXT_NO_FLAG, DestroySemaphore) \