Mesa (main): zink: avoid caching visible vram allocations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 17 01:17:17 UTC 2021


Module: Mesa
Branch: main
Commit: c56a10049419401f3b28dc74d18bf6ecb82081b2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c56a10049419401f3b28dc74d18bf6ecb82081b2

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu May  6 09:52:08 2021 -0400

zink: avoid caching visible vram allocations

the visible vram heap is potentially going to be limited in size, so avoid
caching these allocations since that locks them to a given allocation size

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397>

---

 src/gallium/drivers/zink/zink_resource.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index c612773a3ed..ea1221148fb 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -537,7 +537,9 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
       mai.pNext = &memory_wsi_info;
    }
 
-   if (!mai.pNext && !(templ->flags & (PIPE_RESOURCE_FLAG_MAP_COHERENT | PIPE_RESOURCE_FLAG_SPARSE))) {
+   /* don't cache visible vram because it's more likely to be limited */
+   VkMemoryPropertyFlags visible_vram = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
+   if (!mai.pNext && !(templ->flags & (PIPE_RESOURCE_FLAG_MAP_COHERENT | PIPE_RESOURCE_FLAG_SPARSE)) && ((flags & visible_vram) != visible_vram)) {
       obj->mkey.reqs = reqs;
       obj->mkey.flags = flags;
       obj->mem_hash = mem_hash(&obj->mkey);



More information about the mesa-commit mailing list