From b8c472c111ee1e5a7feb45a9da81e5f73145b6fb Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 19 Aug 2022 23:31:08 +0300 Subject: [PATCH] anv: fix assert in memory budget code when extension is not supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First we should only support the extension if we can support reporting on all the heaps. Second we should not run any query code if the extension is not supported. Signed-off-by: Lionel Landwerlin Fixes: fae88d8791b2 ("anv: make use of the new smallbar uAPI") Reviewed-by: José Roberto de Souza Reviewed-by: Tapani Pälli Part-of: --- src/intel/vulkan/anv_device.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 048c7b6030d..a355751a6ba 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -285,7 +285,12 @@ get_device_extensions(const struct anv_physical_device *device, .EXT_index_type_uint8 = true, .EXT_inline_uniform_block = true, .EXT_line_rasterization = true, - .EXT_memory_budget = device->sys.available, + /* Enable the extension only if we have support on both the local & + * system memory + */ + .EXT_memory_budget = (!device->info.has_local_mem || + device->vram_mappable.available > 0) && + device->sys.available, .EXT_non_seamless_cube_map = true, .EXT_pci_bus_info = true, .EXT_physical_device_drm = true, @@ -2747,6 +2752,9 @@ anv_get_memory_budget(VkPhysicalDevice physicalDevice, { ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice); + if (!device->vk.supported_extensions.EXT_memory_budget) + return; + anv_update_meminfo(device, device->local_fd); VkDeviceSize total_sys_heaps_size = 0, total_vram_heaps_size = 0;