radv: Allocate BOs as implicit sync even if the WSI is doing implicit sync.

As noted, the flag we allocate with controls whether *anyone* can implicit
sync on the BO through amdgpu interfaces, not just whether our fd does.
This restores radv to the behavior before the regressing commit.

Fixes: 4dcf32c56e ("wsi/drm: Don't request implicit sync if we're doing implicit sync ourselves.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37772>
This commit is contained in:
Emma Anholt 2025-10-08 15:01:37 -07:00 committed by Marge Bot
parent 38ac55ebff
commit f7cbc7b1c5
3 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -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 */

View file

@ -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,