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

Author: Mike Blumenkrantz <[email protected]>
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13849>

---

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

diff --git a/src/gallium/drivers/zink/zink_screen.c 
b/src/gallium/drivers/zink/zink_screen.c
index 45ae6c4b5b2..55e8ff8bc24 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1746,11 +1746,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 */

Reply via email to