Mesa (staging/21.2): zink: sum available memory heaps instead of assigning

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 5 16:27:37 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: d634d31c329563f0c667874b25478be480bc73f4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d634d31c329563f0c667874b25478be480bc73f4

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Aug  4 11:44:28 2021 -0400

zink: sum available memory heaps instead of assigning

this is supposed to accumulate now

Fixes: 73f6bff07f1 ("zink: fix mem info query to be more permissive")

Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12199>
(cherry picked from commit 42442a0d4e3125db00922c4d0a2c4d0f4d415205)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index bdb434a2b86..474dc00a473 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -184,7 +184,7 @@
         "description": "zink: sum available memory heaps instead of assigning",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "73f6bff07f1f3a5aa31e906cd69eeef58d95104c"
     },
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index ecb2b373aa4..c9d8941cfa7 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1645,12 +1645,12 @@ zink_query_memory_info(struct pipe_screen *pscreen, struct pipe_memory_info *inf
       for (unsigned i = 0; i < mem.memoryProperties.memoryHeapCount; i++) {
          if (mem.memoryProperties.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
             /* VRAM */
-            info->total_device_memory = mem.memoryProperties.memoryHeaps[i].size / 1024;
-            info->avail_device_memory = (budget.heapBudget[i] - budget.heapUsage[i]) / 1024;
+            info->total_device_memory += mem.memoryProperties.memoryHeaps[i].size / 1024;
+            info->avail_device_memory += (budget.heapBudget[i] - budget.heapUsage[i]) / 1024;
          } else if (mem.memoryProperties.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
             /* GART */
-            info->total_staging_memory = mem.memoryProperties.memoryHeaps[i].size / 1024;
-            info->avail_staging_memory = (budget.heapBudget[i] - budget.heapUsage[i]) / 1024;
+            info->total_staging_memory += mem.memoryProperties.memoryHeaps[i].size / 1024;
+            info->avail_staging_memory += (budget.heapBudget[i] - budget.heapUsage[i]) / 1024;
          }
       }
       /* evictions not yet supported in vulkan */
@@ -1658,14 +1658,14 @@ zink_query_memory_info(struct pipe_screen *pscreen, struct pipe_memory_info *inf
       for (unsigned i = 0; i < screen->info.mem_props.memoryHeapCount; i++) {
          if (screen->info.mem_props.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
             /* VRAM */
-            info->total_device_memory = screen->info.mem_props.memoryHeaps[i].size / 1024;
+            info->total_device_memory += screen->info.mem_props.memoryHeaps[i].size / 1024;
             /* free real estate! */
-            info->avail_device_memory = info->total_device_memory;
+            info->avail_device_memory += info->total_device_memory;
          } else if (screen->info.mem_props.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
             /* GART */
-            info->total_staging_memory = screen->info.mem_props.memoryHeaps[i].size / 1024;
+            info->total_staging_memory += screen->info.mem_props.memoryHeaps[i].size / 1024;
             /* free real estate! */
-            info->avail_staging_memory = info->total_staging_memory;
+            info->avail_staging_memory += info->total_staging_memory;
          }
       }
    }



More information about the mesa-commit mailing list