zink: correct sparse bo mem_type_idx placement

VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x01 has been incidently the
correct memory type index, but isn't guaranteed to be, which is why it
hasn't caused issues yet

Fixes: f9515d93 ("zink: allocate/place memory using memoryTypeIndex directly")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20264>
This commit is contained in:
Julia Tatz
2023-01-16 15:34:47 -05:00
committed by Marge Bot
parent e20e8f2243
commit c71287e70c

View File

@@ -539,7 +539,9 @@ bo_sparse_create(struct zink_screen *screen, uint64_t size)
bo->base.alignment_log2 = util_logbase2(ZINK_SPARSE_BUFFER_PAGE_SIZE);
bo->base.size = size;
bo->base.vtbl = &bo_sparse_vtbl;
bo->base.placement = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
unsigned placement = zink_mem_type_idx_from_bits(screen, ZINK_HEAP_DEVICE_LOCAL_SPARSE, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
assert(placement != UINT32_MAX);
bo->base.placement = placement;
bo->unique_id = p_atomic_inc_return(&screen->pb.next_bo_unique_id);
bo->base.usage = ZINK_ALLOC_SPARSE;