tu: Create meta device

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28447>
This commit is contained in:
Connor Abbott 2024-03-28 08:19:44 -04:00 committed by Marge Bot
parent c103d5a05e
commit cdb1857a4d
2 changed files with 14 additions and 3 deletions

View file

@ -2469,6 +2469,10 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
} }
} }
result = vk_meta_device_init(&device->vk, &device->meta);
if (result != VK_SUCCESS)
goto fail_queues;
{ {
struct ir3_compiler_options ir3_options = { struct ir3_compiler_options ir3_options = {
.push_ubo_with_preamble = true, .push_ubo_with_preamble = true,
@ -2486,7 +2490,7 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
result = vk_startup_errorf(physical_device->instance, result = vk_startup_errorf(physical_device->instance,
VK_ERROR_INITIALIZATION_FAILED, VK_ERROR_INITIALIZATION_FAILED,
"failed to initialize ir3 compiler"); "failed to initialize ir3 compiler");
goto fail_queues; goto fail_compiler;
} }
/* Initialize sparse array for refcounting imported BOs */ /* Initialize sparse array for refcounting imported BOs */
@ -2735,12 +2739,14 @@ fail_global_bo_map:
vk_free(&device->vk.alloc, device->submit_bo_list); vk_free(&device->vk.alloc, device->submit_bo_list);
util_dynarray_fini(&device->dump_bo_list); util_dynarray_fini(&device->dump_bo_list);
fail_global_bo: fail_global_bo:
ir3_compiler_destroy(device->compiler);
util_sparse_array_finish(&device->bo_map);
if (physical_device->has_set_iova) if (physical_device->has_set_iova)
util_vma_heap_finish(&device->vma); util_vma_heap_finish(&device->vma);
fail_free_zombie_vma: fail_free_zombie_vma:
util_sparse_array_finish(&device->bo_map);
u_vector_finish(&device->zombie_vmas); u_vector_finish(&device->zombie_vmas);
ir3_compiler_destroy(device->compiler);
fail_compiler:
vk_meta_device_finish(&device->vk, &device->meta);
fail_queues: fail_queues:
for (unsigned i = 0; i < TU_MAX_QUEUE_FAMILIES; i++) { for (unsigned i = 0; i < TU_MAX_QUEUE_FAMILIES; i++) {
for (unsigned q = 0; q < device->queue_count[i]; q++) for (unsigned q = 0; q < device->queue_count[i]; q++)
@ -2790,6 +2796,8 @@ tu_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
tu_destroy_dynamic_rendering(device); tu_destroy_dynamic_rendering(device);
vk_meta_device_finish(&device->vk, &device->meta);
ir3_compiler_destroy(device->compiler); ir3_compiler_destroy(device->compiler);
vk_pipeline_cache_destroy(device->mem_cache, &device->vk.alloc); vk_pipeline_cache_destroy(device->mem_cache, &device->vk.alloc);

View file

@ -13,6 +13,7 @@
#include "tu_common.h" #include "tu_common.h"
#include "vk_device_memory.h" #include "vk_device_memory.h"
#include "vk_meta.h"
#include "tu_autotune.h" #include "tu_autotune.h"
#include "tu_cs.h" #include "tu_cs.h"
@ -286,6 +287,8 @@ struct tu_device
/* Backup in-memory cache to be used if the app doesn't provide one */ /* Backup in-memory cache to be used if the app doesn't provide one */
struct vk_pipeline_cache *mem_cache; struct vk_pipeline_cache *mem_cache;
struct vk_meta_device meta;
#define MIN_SCRATCH_BO_SIZE_LOG2 12 /* A page */ #define MIN_SCRATCH_BO_SIZE_LOG2 12 /* A page */
/* Currently the kernel driver uses a 32-bit GPU address space, but it /* Currently the kernel driver uses a 32-bit GPU address space, but it