diff --git a/.pick_status.json b/.pick_status.json index 93af9ffa9e5..ed8339c43bf 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -76,7 +76,7 @@ "description": "zink: move BAR allocation demotion up the stack", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c index d2e354ae441..933d06e1b66 100644 --- a/src/gallium/drivers/zink/zink_bo.c +++ b/src/gallium/drivers/zink/zink_bo.c @@ -247,7 +247,6 @@ bo_create_internal(struct zink_screen *screen, mai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; mai.pNext = pNext; mai.allocationSize = size; -demote: mai.memoryTypeIndex = screen->heap_map[heap]; if (screen->info.mem_props.memoryTypes[mai.memoryTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { alignment = MAX2(alignment, screen->info.props.limits.minMemoryMapAlignment); @@ -270,11 +269,6 @@ demote: VkResult ret = VKSCR(AllocateMemory)(screen->dev, &mai, NULL, &bo->mem); if (!zink_screen_handle_vkresult(screen, ret)) { - if (heap == ZINK_HEAP_DEVICE_LOCAL_VISIBLE) { - heap = ZINK_HEAP_DEVICE_LOCAL; - mesa_loge("zink: %p couldn't allocate memory! from BAR heap: retrying as device-local", bo); - goto demote; - } mesa_loge("zink: couldn't allocate memory! from heap %u", heap); goto fail; } diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index fa0901795f6..add991cedc7 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -876,9 +876,15 @@ 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: obj->bo = zink_bo(zink_bo_create(screen, reqs.size, alignment, heap, mai.pNext ? ZINK_ALLOC_NO_SUBALLOC : 0, mai.pNext)); - if (!obj->bo) - goto fail2; + if (!obj->bo) { + if (heap == ZINK_HEAP_DEVICE_LOCAL_VISIBLE) { + heap = ZINK_HEAP_DEVICE_LOCAL; + goto retry; + } + goto fail2; + } if (aflags == ZINK_ALLOC_SPARSE) { obj->size = templ->width0; } else {