Mesa (main): zink: determine whether the gpu has a resizable BAR at startup

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 30 13:58:05 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jul 30 09:18:54 2021 -0400

zink: determine whether the gpu has a resizable BAR at startup

this can be used to make different allocation and mapping decisions

Acked-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12579>

---

 src/gallium/drivers/zink/zink_screen.c | 8 ++++++++
 src/gallium/drivers/zink/zink_screen.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 3df9edf6517..915673aff1e 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1907,6 +1907,14 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
          screen->heap_map[i] = screen->heap_map[ZINK_HEAP_HOST_VISIBLE_ANY];
       }
    }
+   {
+      unsigned vis_vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE];
+      unsigned vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL];
+      /* determine if vis vram is roughly equal to total vram */
+      if (screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[vis_vram].heapIndex].size >
+          screen->info.mem_props.memoryHeaps[screen->info.mem_props.memoryTypes[vram].heapIndex].size * 0.9)
+         screen->resizable_bar = true;
+   }
 
    simple_mtx_init(&screen->surface_mtx, mtx_plain);
    simple_mtx_init(&screen->bufferview_mtx, mtx_plain);
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index feeb80cbe07..4f7a22094f4 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -109,6 +109,7 @@ struct zink_screen {
       uint32_t next_bo_unique_id;
    } pb;
    uint8_t heap_map[VK_MAX_MEMORY_TYPES];
+   bool resizable_bar;
 
    uint64_t total_video_mem;
    uint64_t clamp_video_mem;



More information about the mesa-commit mailing list