Module: Mesa Branch: staging/22.2 Commit: ec1d48938c57a3bd370b038e3ac966e7b55b5cc4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec1d48938c57a3bd370b038e3ac966e7b55b5cc4
Author: Lionel Landwerlin <[email protected]> Date: Fri Aug 19 23:31:08 2022 +0300 anv: fix assert in memory budget code when extension is not supported 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 <[email protected]> Fixes: fae88d8791b2 ("anv: make use of the new smallbar uAPI") Reviewed-by: José Roberto de Souza <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18153> (cherry picked from commit b8c472c111ee1e5a7feb45a9da81e5f73145b6fb) --- .pick_status.json | 2 +- src/intel/vulkan/anv_device.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9024bea6a94..ec025f6318f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -12001,7 +12001,7 @@ "description": "anv: fix assert in memory budget code when extension is not supported", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "fae88d8791b2903771c85958903ee81080b66aec" }, diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index a1ada41ecc4..e667f76a334 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, @@ -2752,6 +2757,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;
