Module: Mesa Branch: staging/23.1 Commit: 47bea0f65a762d48a2a35146effa90b2d9fb697a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=47bea0f65a762d48a2a35146effa90b2d9fb697a
Author: Mike Blumenkrantz <[email protected]> Date: Thu Apr 13 13:56:55 2023 -0400 zink: restore BAR allocation failure demotion this restores the fallback used when BAR allocation fails due to oom by re-selecting memoryTypeIndex after the heap demotion Fixes: f6d3a5755f6 ("zink: zink_heap isn't 1-to-1 with memoryTypeIndex") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22479> (cherry picked from commit 9d923b14f959e23bd5fc24d5542b00de2d3c0d38) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_resource.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index f0a752af46a..05b767c89e5 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -130,7 +130,7 @@ "description": "zink: restore BAR allocation failure demotion", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f6d3a5755f63c81881ff5647fe783038c955e8e3" }, diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 18886c6822b..27e554a251e 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1077,7 +1077,10 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t if (templ->usage == PIPE_USAGE_STAGING && obj->is_buffer) alignment = MAX2(alignment, screen->info.props.limits.minMemoryMapAlignment); obj->alignment = alignment; + retry: + mai.memoryTypeIndex = zink_mem_type_idx_from_bits(screen, heap, reqs.memoryTypeBits); + assert(reqs.memoryTypeBits & BITFIELD_BIT(mai.memoryTypeIndex)); obj->bo = zink_bo(zink_bo_create(screen, reqs.size, alignment, heap, mai.pNext ? ZINK_ALLOC_NO_SUBALLOC : 0, mai.memoryTypeIndex, mai.pNext)); if (!obj->bo) { if (heap == ZINK_HEAP_DEVICE_LOCAL_VISIBLE) {
