Mesa (master): zink: only report device-local memory as video-memory

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 10 09:10:26 UTC 2020


Module: Mesa
Branch: master
Commit: 10f07495f694e175f50bfd088b72dc2e0ecdecad
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=10f07495f694e175f50bfd088b72dc2e0ecdecad

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Tue Jun  9 21:54:23 2020 +0200

zink: only report device-local memory as video-memory

While the definition of "video memory" isn't super clear, I think it's
pretty reasonable to assume host-memory isn't meant to be included. So
let's only count dedicated memory here.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3107
Reviewed-by: Witold Baryluk <witold.baryluk at gmail.com>
Tested-by: Witold Baryluk <witold.baryluk at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5409>

---

 src/gallium/drivers/zink/zink_screen.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 6ec29da2fe0..5cb02587526 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -80,8 +80,11 @@ static int
 get_video_mem(struct zink_screen *screen)
 {
    VkDeviceSize size = 0;
-   for (uint32_t i = 0; i < screen->mem_props.memoryHeapCount; ++i)
-      size += screen->mem_props.memoryHeaps[i].size;
+   for (uint32_t i = 0; i < screen->mem_props.memoryHeapCount; ++i) {
+      if (screen->mem_props.memoryHeaps[i].flags &
+          VK_MEMORY_HEAP_DEVICE_LOCAL_BIT)
+         size += screen->mem_props.memoryHeaps[i].size;
+   }
    return (int)(size >> 20);
 }
 



More information about the mesa-commit mailing list