Mesa (staging/22.1): zink: be a little selective about BAR fallback memory type

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 16:05:10 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 494b4d0c411d5e13eb1df06a4c76f0980da02a7d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=494b4d0c411d5e13eb1df06a4c76f0980da02a7d

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>
(cherry picked from commit be4f120476cb2b537126d34949f497210cc4586a)

---

 .pick_status.json                        | 2 +-
 src/gallium/drivers/zink/zink_resource.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ed8339c43bf..fe8b2b4058b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -67,7 +67,7 @@
         "description": "zink: be a little selective about BAR fallback memory type",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index add991cedc7..b3bad975070 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -880,7 +880,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