From 0b561f691bd29f2c6eeb87498ba7fe6d8d2e576e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Fri, 21 Feb 2025 09:24:11 -0800 Subject: [PATCH] anv: Add support for ANV_BO_ALLOC_DYNAMIC_VISIBLE_POOL in anv_slab_bo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This flag was not supported in anv_slab_bo because it is set together with ANV_BO_ALLOC_CAPTURE and more important it has a specific VMA range. We can support it by adding a custom heap and allocating all bos in the heap with all necessary flags, but because application can also allocate those with vkAllocateMemory() here the ANV_BO_ALLOC_CAPTURE is appended to the vkAllocateMemory() path for integrated gpu and anv_slab_bo check if all the alloc_flags matches, because application could choose to allocate it in a cached but not coherent memory type for example. Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_slab_bo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/intel/vulkan/anv_slab_bo.c b/src/intel/vulkan/anv_slab_bo.c index 028846e26ce..07b9cdf9f07 100644 --- a/src/intel/vulkan/anv_slab_bo.c +++ b/src/intel/vulkan/anv_slab_bo.c @@ -5,6 +5,7 @@ #include "anv_slab_bo.h" enum anv_bo_slab_heap { + ANV_BO_SLAB_HEAP_DYNAMIC_VISIBLE_POOL, ANV_BO_SLAB_HEAP_DESCRIPTOR_POOL, ANV_BO_SLAB_HEAP_SMEM_CACHED_COHERENT, ANV_BO_SLAB_HEAP_SMEM_CACHED_INCOHERENT, @@ -47,6 +48,9 @@ anv_bo_alloc_flags_to_slab_heap(struct anv_device *device, ANV_BO_ALLOC_IMPLICIT_WRITE); } + if (alloc_flags == ANV_BO_ALLOC_DYNAMIC_VISIBLE_POOL_FLAGS) + return ANV_BO_SLAB_HEAP_DYNAMIC_VISIBLE_POOL; + if (alloc_flags == ANV_BO_ALLOC_DESCRIPTOR_POOL_FLAGS) return ANV_BO_SLAB_HEAP_DESCRIPTOR_POOL; @@ -229,6 +233,9 @@ anv_slab_alloc(void *priv, break; case ANV_BO_SLAB_HEAP_LMEM_ONLY: break; + case ANV_BO_SLAB_HEAP_DYNAMIC_VISIBLE_POOL: + alloc_flags |= ANV_BO_ALLOC_DYNAMIC_VISIBLE_POOL_FLAGS; + break; case ANV_BO_SLAB_HEAP_DESCRIPTOR_POOL: alloc_flags |= ANV_BO_ALLOC_DESCRIPTOR_POOL_FLAGS; break;