Mesa (staging/22.1): zink: store and reuse memory heap flags for buffer placement
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 16:05:10 UTC 2022
Module: Mesa
Branch: staging/22.1
Commit: e94120e79497f581d76d4c95f7dc9e6231daecc7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e94120e79497f581d76d4c95f7dc9e6231daecc7
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Jun 16 11:06:53 2022 -0400
zink: store and reuse memory heap flags for buffer placement
the flags in vk_domain_from_heap() are the MINIMUM required flags for
the heap, but there may be other flags present, so ensure those are picked
up as expected
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17093>
(cherry picked from commit d63e04e583a9fb90154954f7c304f7c8c5773b66)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_bo.c | 2 +-
src/gallium/drivers/zink/zink_screen.c | 1 +
src/gallium/drivers/zink/zink_screen.h | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 0db9e5b59dc..93af9ffa9e5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -85,7 +85,7 @@
"description": "zink: store and reuse memory heap flags for buffer placement",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c
index 52dc25b4f0b..d2e354ae441 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -290,7 +290,7 @@ demote:
bo->base.alignment_log2 = util_logbase2(alignment);
bo->base.size = mai.allocationSize;
bo->base.vtbl = &bo_vtbl;
- bo->base.placement = vk_domain_from_heap(heap);
+ bo->base.placement = screen->heap_flags[heap];
bo->base.usage = flags;
bo->unique_id = p_atomic_inc_return(&screen->pb.next_bo_unique_id);
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 06b9982ac2c..aa21f8e064f 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -2328,6 +2328,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
else
screen->heap_map[i] = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL];
}
+ screen->heap_flags[i] = screen->info.mem_props.memoryTypes[screen->heap_map[i]].propertyFlags;
}
{
unsigned vis_vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE];
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index 7ea4a63781c..19af070346d 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -116,6 +116,7 @@ struct zink_screen {
uint32_t next_bo_unique_id;
} pb;
uint8_t heap_map[VK_MAX_MEMORY_TYPES];
+ VkMemoryPropertyFlags heap_flags[VK_MAX_MEMORY_TYPES];
bool resizable_bar;
uint64_t total_video_mem;
More information about the mesa-commit
mailing list