anv: Fix PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES with large BAR
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 27 Jul 2022 03:20:24 +0000 (20:20 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 27 Jul 2022 09:44:38 +0000 (09:44 +0000)
Reported-by: Dave Airlie <airlied@redhat.com>
Fixes: fae88d8791b ("anv: make use of the new smallbar uAPI")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6937
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17761>

src/intel/vulkan/anv_device.c

index 63309be..a1ada41 100644 (file)
@@ -2771,7 +2771,11 @@ anv_get_memory_budget(VkPhysicalDevice physicalDevice,
 
       if (device->memory.heaps[i].is_local_mem) {
          total_heaps_size = total_vram_heaps_size;
-         mem_available = device->vram_non_mappable.available;
+         if (device->vram_non_mappable.size > 0 && i == 0) {
+            mem_available = device->vram_non_mappable.available;
+         } else {
+            mem_available = device->vram_mappable.available;
+         }
       } else {
          total_heaps_size = total_sys_heaps_size;
          mem_available = device->sys.available;