summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Tatz <tatz.j@northeastern.edu>2023-01-16 15:34:47 -0500
committerEric Engestrom <eric@engestrom.ch>2023-01-26 15:40:33 +0000
commit8d955313dc882df304031756db26d08f21cd37ae (patch)
treedda6c93b635aa3837fd9b2611348968707201fec
parent87146b215889d4ec5b3d35c375fea7246a023aee (diff)
downloadmesa-8d955313dc882df304031756db26d08f21cd37ae.tar.gz
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> (cherry picked from commit c71287e70c2bf4aac96b24635e48ec13cd31fddf)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/zink/zink_bo.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 099ebce3954..c4a39ab24f4 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2632,7 +2632,7 @@
"description": "zink: correct sparse bo mem_type_idx placement",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "f9515d9376752c0355de71957347e1241e3a226b"
},
diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c
index f7cfbc6dc66..011d1b85195 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -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;