Mesa (main): zink: be a little selective about BAR fallback memory type

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 01:31:19 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Jun 16 17:55:50 2022 -0400

zink: be a little selective about BAR fallback memory type

some resources MUST be host-visible, so use the appropriate heap for them

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17093>

---

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

diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index f4e0bb82b84..7c01fd03d2c 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -961,7 +961,10 @@ retry:
    obj->bo = zink_bo(zink_bo_create(screen, reqs.size, alignment, heap, mai.pNext ? ZINK_ALLOC_NO_SUBALLOC : 0, mai.pNext));
    if (!obj->bo) {
       if (heap == ZINK_HEAP_DEVICE_LOCAL_VISIBLE) {
-         heap = ZINK_HEAP_DEVICE_LOCAL;
+         if (templ->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT || templ->usage == PIPE_USAGE_DYNAMIC)
+            heap = ZINK_HEAP_HOST_VISIBLE_COHERENT;
+         else
+            heap = ZINK_HEAP_DEVICE_LOCAL;
          goto retry;
       }
       goto fail2;



More information about the mesa-commit mailing list