From 28ee90bc7ff57bc7f9190fb278d7251b7f0f2ded Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Tue, 27 Dec 2022 16:57:36 +0100 Subject: [PATCH] radv: Add an app layer driconf and use it for Metro Exodus To make adding more application layers easier. Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_device.c | 11 ++++------- src/amd/vulkan/radv_private.h | 1 + src/util/00-radv-defaults.conf | 4 ++++ src/util/driconf.h | 2 ++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 66eb68dbd2d..8486aa94fe7 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1146,6 +1146,7 @@ static const driOptionDescription radv_dri_options[] = { DRI_CONF_RADV_ENABLE_UNIFIED_HEAP_ON_APU(false) DRI_CONF_RADV_TEX_NON_UNIFORM(false) DRI_CONF_RADV_RT(false) + DRI_CONF_RADV_APP_LAYER() DRI_CONF_SECTION_END }; // clang-format on @@ -1202,6 +1203,8 @@ radv_init_dri_options(struct radv_instance *instance) driQueryOptionb(&instance->dri_options, "radv_enable_unified_heap_on_apu"); instance->tex_non_uniform = driQueryOptionb(&instance->dri_options, "radv_tex_non_uniform"); + + instance->app_layer = driQueryOptionstr(&instance->dri_options, "radv_app_layer"); } static VkResult create_null_physical_device(struct vk_instance *vk_instance); @@ -3607,14 +3610,8 @@ init_dispatch_tables(struct radv_device *device, struct radv_physical_device *ph b.tables[RADV_RGP_DISPATCH_TABLE] = &device->layer_dispatch.rgp; b.tables[RADV_RRA_DISPATCH_TABLE] = &device->layer_dispatch.rra; - if (physical_device->instance->vk.app_info.app_name && - !strcmp(physical_device->instance->vk.app_info.app_name, "metroexodus")) { - /* Metro Exodus (Linux native) calls vkGetSemaphoreCounterValue() with a NULL semaphore and it - * crashes sometimes. Workaround this game bug by enabling an internal layer. Remove this - * when the game is fixed. - */ + if (!strcmp(physical_device->instance->app_layer, "metroexodus")) add_entrypoints(&b, &metro_exodus_device_entrypoints, RADV_APP_DISPATCH_TABLE); - } if (radv_thread_trace_enabled()) add_entrypoints(&b, &sqtt_device_entrypoints, RADV_RGP_DISPATCH_TABLE); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index b9a0b783d9d..8bd8579f929 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -370,6 +370,7 @@ struct radv_instance { bool flush_before_query_copy; bool enable_unified_heap_on_apu; bool tex_non_uniform; + char *app_layer; }; VkResult radv_init_wsi(struct radv_physical_device *physical_device); diff --git a/src/util/00-radv-defaults.conf b/src/util/00-radv-defaults.conf index 05d7616e7e5..68717c5ee31 100644 --- a/src/util/00-radv-defaults.conf +++ b/src/util/00-radv-defaults.conf @@ -146,6 +146,10 @@ Application bugs worked around in this file: