From b2d636b275b058e8539b94bcb9f1217fe9dab918 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 10 May 2023 05:38:58 +0000 Subject: [PATCH] anv: apply ANV_BO_ALLOC_IMPLICIT_SYNC for external memory This is necessary to make anv work with clients like VA-API which relies on implicit fencing only. The bahavior matches iris i915_batch_submit. Signed-off-by: Yiwei Zhang Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 1e09efd12bf..6a8b1ff35cf 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3805,9 +3805,12 @@ VkResult anv_AllocateMemory( if (mem->vk.alloc_flags & VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT) alloc_flags |= ANV_BO_ALLOC_CLIENT_VISIBLE_ADDRESS; - /* Anything imported or exported is EXTERNAL */ + /* Anything imported or exported is EXTERNAL. Apply implicit sync to be + * compatible with clients relying on implicit fencing. This matches the + * behavior in iris i915_batch_submit. An example client is VA-API. + */ if (mem->vk.export_handle_types || mem->vk.import_handle_type) - alloc_flags |= ANV_BO_ALLOC_EXTERNAL; + alloc_flags |= (ANV_BO_ALLOC_EXTERNAL | ANV_BO_ALLOC_IMPLICIT_SYNC); if (mem->vk.ahardware_buffer) { result = anv_import_ahw_memory(_device, mem);