anv: Add support for ANV_BO_ALLOC_DYNAMIC_VISIBLE_POOL in anv_slab_bo

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 <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33558>
This commit is contained in:
José Roberto de Souza 2025-02-21 09:24:11 -08:00 committed by Marge Bot
parent 8fd4423d99
commit 0b561f691b

View file

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