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 <zzyiwei@chromium.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22937>
This commit is contained in:
Yiwei Zhang
2023-05-10 05:38:58 +00:00
committed by Marge Bot
parent bcdd5b5e74
commit b2d636b275
+5 -2
View File
@@ -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);