radv/rra: Find copy memory index when initializing the trace state
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Sat, 14 Jan 2023 12:20:05 +0000 (13:20 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 13 Feb 2023 20:39:30 +0000 (20:39 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20700>

src/amd/vulkan/layers/radv_rra_layer.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_rra.c

index 7598148..5c81517 100644 (file)
@@ -137,10 +137,7 @@ rra_init_accel_struct_data_buffer(VkDevice vk_device, struct radv_rra_accel_stru
       .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
       .pNext = &flags_info,
       .allocationSize = requirements.size,
-      .memoryTypeIndex =
-         radv_find_memory_index(device->physical_device, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
-                                                            VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
-                                                            VK_MEMORY_PROPERTY_HOST_CACHED_BIT),
+      .memoryTypeIndex = device->rra_trace.copy_memory_index,
    };
    result = radv_alloc_memory(device, &alloc_info, NULL, &data->memory, true);
    if (result != VK_SUCCESS)
index cc55935..5a0c562 100644 (file)
@@ -867,6 +867,7 @@ struct radv_rra_trace_data {
    struct hash_table_u64 *accel_struct_vas;
    simple_mtx_t data_mtx;
    bool validate_as;
+   uint32_t copy_memory_index;
 };
 
 enum radv_dispatch_table {
index 64716ab..8590a6a 100644 (file)
@@ -906,6 +906,11 @@ radv_rra_trace_init(struct radv_device *device)
    device->rra_trace.accel_structs = _mesa_pointer_hash_table_create(NULL);
    device->rra_trace.accel_struct_vas = _mesa_hash_table_u64_create(NULL);
    simple_mtx_init(&device->rra_trace.data_mtx, mtx_plain);
+
+   device->rra_trace.copy_memory_index =
+      radv_find_memory_index(device->physical_device, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
+                                                         VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
+                                                         VK_MEMORY_PROPERTY_HOST_CACHED_BIT);
 }
 
 void