zink: store and reuse memory heap flags for buffer placement
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 16 Jun 2022 15:06:53 +0000 (11:06 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 17 Jun 2022 01:14:45 +0000 (01:14 +0000)
the flags in vk_domain_from_heap() are the MINIMUM required flags for
the heap, but there may be other flags present, so ensure those are picked
up as expected

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17093>

src/gallium/drivers/zink/zink_bo.c
src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_screen.h

index 74dfe28..5c70480 100644 (file)
@@ -310,7 +310,7 @@ demote:
    bo->base.alignment_log2 = util_logbase2(alignment);
    bo->base.size = mai.allocationSize;
    bo->base.vtbl = &bo_vtbl;
-   bo->base.placement = vk_domain_from_heap(heap);
+   bo->base.placement = screen->heap_flags[heap];
    bo->base.usage = flags;
    bo->unique_id = p_atomic_inc_return(&screen->pb.next_bo_unique_id);
 
index 53a1ba6..21a4762 100644 (file)
@@ -2312,6 +2312,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
          else
             screen->heap_map[i] = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL];
       }
+      screen->heap_flags[i] = screen->info.mem_props.memoryTypes[screen->heap_map[i]].propertyFlags;
    }
    {
       unsigned vis_vram = screen->heap_map[ZINK_HEAP_DEVICE_LOCAL_VISIBLE];
index a40004e..e5f7866 100644 (file)
@@ -131,6 +131,7 @@ struct zink_screen {
       uint32_t next_bo_unique_id;
    } pb;
    uint8_t heap_map[VK_MAX_MEMORY_TYPES];
+   VkMemoryPropertyFlags heap_flags[VK_MAX_MEMORY_TYPES];
    bool resizable_bar;
 
    uint64_t total_video_mem;