zink: force host-visible allocations for MAP_COHERENT resources

this fixes persistent maps for systems without any BAR

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27707>
(cherry picked from commit ccbf9b0ea7)
This commit is contained in:
Mike Blumenkrantz 2024-02-20 16:23:39 -05:00 committed by Eric Engestrom
parent 0738409dc7
commit 7426889729
2 changed files with 5 additions and 1 deletions

View file

@ -2104,7 +2104,7 @@
"description": "zink: force host-visible allocations for MAP_COHERENT resources",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1181,6 +1181,10 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
mai.pNext = NULL;
mai.allocationSize = reqs.size;
enum zink_heap heap = zink_heap_from_domain_flags(flags, aflags);
if (templ->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT) {
if (!(vk_domain_from_heap(heap) & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT))
heap = zink_heap_from_domain_flags(flags & ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, aflags);
}
VkMemoryDedicatedAllocateInfo ded_alloc_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,