diff --git a/src/amd/vulkan/radv_device_memory.c b/src/amd/vulkan/radv_device_memory.c index c964b5cee64..9c54d773a59 100644 --- a/src/amd/vulkan/radv_device_memory.c +++ b/src/amd/vulkan/radv_device_memory.c @@ -121,7 +121,13 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc } if (wsi_info) { - if (wsi_info->implicit_sync) + /* Even if the WSI is managing implicit-sync fencing on the dma-buf with + * dma-buf fence import/export, RADEON_FLAG_IMPLICIT_SYNC also controls + * whether other users of the BO (such as an X server using an + * implicit-syncing GL driver for rendering) will respect the BO's + * implicit sync. + */ + if (wsi_info->implicit_sync || wsi_info->dma_buf_sync_file) flags |= RADEON_FLAG_IMPLICIT_SYNC; /* Mark the linear prime buffer (aka the destination of the prime blit diff --git a/src/vulkan/util/vk_internal_exts.h b/src/vulkan/util/vk_internal_exts.h index 9acab6979e0..59395009051 100644 --- a/src/vulkan/util/vk_internal_exts.h +++ b/src/vulkan/util/vk_internal_exts.h @@ -51,6 +51,16 @@ struct wsi_memory_allocate_info { * point DMA_BUF_IOCTL_IMPORT_SYNC_FILE was added. */ bool implicit_sync; + + /** + * If set, then the WSI will attach implicit synchronization's fences to + * (and reference implicit sync fences from) the dma-buf for this memory, to + * meet the requirement for implicit synchronization with the window system. + * This does mean that the kernel BO must be able to participate in implicit + * sync still when used as part of a non-explicit-synced submit (e.g. by a + * GL driver in the X server). + */ + bool dma_buf_sync_file; }; /* To be chained into VkSurfaceCapabilities2KHR */ diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index d88323a91ed..98262fc8c7d 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1973,6 +1973,7 @@ wsi_create_buffer_blit_context(const struct wsi_swapchain *chain, .pNext = NULL, .implicit_sync = info->image_type == WSI_IMAGE_TYPE_DRM && !info->explicit_sync && !chain->dma_buf_semaphore, + .dma_buf_sync_file = chain->dma_buf_semaphore, }; VkMemoryDedicatedAllocateInfo buf_mem_dedicated_info = { .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,