diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/amd/vulkan/radv_device.c | 88 | ||||
| -rw-r--r-- | src/amd/vulkan/radv_sqtt.c | 4 |
2 files changed, 50 insertions, 42 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index df34ce4282a..7421ae0805b 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1139,6 +1139,8 @@ radv_destroy_device(struct radv_device *device, const VkAllocationCallbacks *pAl if (device->capture_replay_arena_vas) _mesa_hash_table_u64_destroy(device->capture_replay_arena_vas); + ac_sqtt_finish(&device->sqtt); + vk_device_finish(&device->vk); vk_free(&device->vk.alloc, device); } @@ -1184,6 +1186,8 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr init_dispatch_tables(device, pdev); + /* Initialize everything required for compilation, first. */ + simple_mtx_init(&device->ctx_roll_mtx, mtx_plain); simple_mtx_init(&device->trace_mtx, mtx_plain); simple_mtx_init(&device->pstate_mtx, mtx_plain); @@ -1192,6 +1196,52 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr device->rt_handles = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal); + radv_init_shader_arenas(device); + + /* Initialize the per-device cache key. */ + radv_device_init_cache_key(device); + + if (!device->vk.disable_internal_cache) { + result = radv_device_init_memory_cache(device); + if (result != VK_SUCCESS) + goto fail; + } + + if (pdev->info.gfx_level == GFX10_3) { + if (os_get_option("RADV_FORCE_VRS_CONFIG_FILE")) { + const char *file = radv_get_force_vrs_config_file(); + + device->force_vrs = radv_parse_force_vrs_config_file(file); + + if (radv_device_init_notifier(device)) { + device->force_vrs_enabled = true; + } else { + fprintf(stderr, "radv: Failed to initialize the notifier for RADV_FORCE_VRS_CONFIG_FILE!\n"); + } + } else if (os_get_option("RADV_FORCE_VRS")) { + const char *vrs_rates = os_get_option("RADV_FORCE_VRS"); + + device->force_vrs = radv_parse_vrs_rates(vrs_rates); + device->force_vrs_enabled = device->force_vrs != RADV_FORCE_VRS_1x1; + } + } + + device->force_aniso = MIN2(16, (int)debug_get_num_option("RADV_TEX_ANISO", -1)); + if (device->force_aniso >= 0) { + fprintf(stderr, "radv: Forcing anisotropy filter to %ix\n", 1 << util_logbase2(device->force_aniso)); + } + + /* PKT3_LOAD_SH_REG_INDEX is supported on GFX8+, but it hangs with compute queues until GFX10.3. */ + device->load_grid_size_from_user_sgpr = pdev->info.gfx_level >= GFX10_3; + + ac_sqtt_init(&device->sqtt); + + /* If this is a NULL device, we are done here. */ + if (pdev->info.family_overridden) { + *pDevice = radv_device_to_handle(device); + return VK_SUCCESS; + } + device->ws = pdev->ws; device->vk.sync = device->ws->get_sync_provider(device->ws); device->vk.copy_sync_payloads = pdev->ws->copy_sync_payloads; @@ -1217,8 +1267,6 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr } } - radv_init_shader_arenas(device); - device->overallocation_disallowed = overallocation_disallowed; mtx_init(&device->overallocation_mutex, mtx_plain); @@ -1325,34 +1373,9 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr */ device->dispatch_initiator_task = device->dispatch_initiator | S_00B800_DISABLE_DISP_PREMPT_EN(1); - if (pdev->info.gfx_level == GFX10_3) { - if (os_get_option("RADV_FORCE_VRS_CONFIG_FILE")) { - const char *file = radv_get_force_vrs_config_file(); - - device->force_vrs = radv_parse_force_vrs_config_file(file); - - if (radv_device_init_notifier(device)) { - device->force_vrs_enabled = true; - } else { - fprintf(stderr, "radv: Failed to initialize the notifier for RADV_FORCE_VRS_CONFIG_FILE!\n"); - } - } else if (os_get_option("RADV_FORCE_VRS")) { - const char *vrs_rates = os_get_option("RADV_FORCE_VRS"); - - device->force_vrs = radv_parse_vrs_rates(vrs_rates); - device->force_vrs_enabled = device->force_vrs != RADV_FORCE_VRS_1x1; - } - } - - /* PKT3_LOAD_SH_REG_INDEX is supported on GFX8+, but it hangs with compute queues until GFX10.3. */ - device->load_grid_size_from_user_sgpr = pdev->info.gfx_level >= GFX10_3; - /* Keep shader info for GPU hangs debugging. */ device->keep_shader_info = radv_device_fault_detection_enabled(device) || radv_trap_handler_enabled(); - /* Initialize the per-device cache key before compiling meta shaders. */ - radv_device_init_cache_key(device); - result = radv_device_init_tools(device); if (result != VK_SUCCESS) goto fail; @@ -1387,17 +1410,6 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr if (pdev->info.has_graphics && !(instance->debug_flags & RADV_DEBUG_NO_IB_CHAINING)) radv_create_gfx_preamble(device); - if (!device->vk.disable_internal_cache) { - result = radv_device_init_memory_cache(device); - if (result != VK_SUCCESS) - goto fail; - } - - device->force_aniso = MIN2(16, (int)debug_get_num_option("RADV_TEX_ANISO", -1)); - if (device->force_aniso >= 0) { - fprintf(stderr, "radv: Forcing anisotropy filter to %ix\n", 1 << util_logbase2(device->force_aniso)); - } - if (device->vk.enabled_features.performanceCounterQueryPools) { result = radv_device_init_perf_counter(device); if (result != VK_SUCCESS) diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c index de63c0b38a5..14c4f9b968f 100644 --- a/src/amd/vulkan/radv_sqtt.c +++ b/src/amd/vulkan/radv_sqtt.c @@ -400,8 +400,6 @@ radv_sqtt_init(struct radv_device *device) if (!radv_device_acquire_performance_counters(device)) return false; - ac_sqtt_init(sqtt); - radv_register_queues(device, sqtt); return true; @@ -424,8 +422,6 @@ radv_sqtt_finish(struct radv_device *device) } radv_unregister_queues(device, sqtt); - - ac_sqtt_finish(sqtt); } static bool |