Mesa (staging/21.3): zink: fix memory availability reporting

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 18 19:01:42 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Nov 17 16:48:28 2021 -0500

zink: fix memory availability reporting

this shouldn't report the budgeted available memory, it should return
the total memory, as that's what this api expects

Fixes: ff4ba3d4a77 ("zink: support PIPE_CAP_QUERY_MEMORY_INFO")

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13849>
(cherry picked from commit 72a88c77def2948e291427c963e2f4337bc059d4)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index 2bfea075c2f..8545a6b132f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -202,7 +202,7 @@
         "description": "zink: fix memory availability reporting",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ff4ba3d4a77320d1522c3a807661511b4cc075ab"
     },
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index c13f7608d90..42fc4ac4942 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1706,11 +1706,11 @@ zink_query_memory_info(struct pipe_screen *pscreen, struct pipe_memory_info *inf
          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->avail_device_memory += (mem.memoryProperties.memoryHeaps[i].size - budget.heapUsage[i]) / 1024;
          } else {
             /* GART */
             info->total_staging_memory += mem.memoryProperties.memoryHeaps[i].size / 1024;
-            info->avail_staging_memory += (budget.heapBudget[i] - budget.heapUsage[i]) / 1024;
+            info->avail_staging_memory += (mem.memoryProperties.memoryHeaps[i].size - budget.heapUsage[i]) / 1024;
          }
       }
       /* evictions not yet supported in vulkan */



More information about the mesa-commit mailing list