zink: avoid infinite recursion on (very) small BAR systems in bo alloc

this should only try a full reclaim if possible, not unconditionally

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27606>
(cherry picked from commit c6635c09d0)
This commit is contained in:
Mike Blumenkrantz 2024-02-02 09:08:04 -05:00 committed by Eric Engestrom
parent e730b1b62b
commit 4d87eb83da
2 changed files with 3 additions and 1 deletions

View file

@ -2474,7 +2474,7 @@
"description": "zink: avoid infinite recursion on (very) small BAR systems in bo alloc",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -622,6 +622,8 @@ zink_bo_create(struct zink_screen *screen, uint64_t size, unsigned alignment, en
low_bound *= 2; //nvidia has fat textures or something
unsigned vk_heap_idx = screen->info.mem_props.memoryTypes[mem_type_idx].heapIndex;
reclaim_all = screen->info.mem_props.memoryHeaps[vk_heap_idx].size <= low_bound;
if (reclaim_all)
reclaim_all = clean_up_buffer_managers(screen);
}
entry = pb_slab_alloc_reclaimed(slabs, alloc_size, mem_type_idx, reclaim_all);
if (!entry) {