radv: Add an app layer driconf and use it for Metro Exodus

To make adding more application layers easier.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20439>
This commit is contained in:
Konstantin Seurer 2022-12-27 16:57:36 +01:00 committed by Marge Bot
parent 1525063055
commit 28ee90bc7f
4 changed files with 11 additions and 7 deletions

View file

@ -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);

View file

@ -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);

View file

@ -146,6 +146,10 @@ Application bugs worked around in this file:
<option name="radv_rt" value="true" />
</application>
<application name="Metro Exodus (Linux native)" application_name_match="metroexodus">
<option name="radv_app_layer" value="metroexodus" />
</application>
<!-- OpenGL Game workarounds (zink) -->
<application name="Black Geyser: Couriers of Darkness" executable="BlackGeyser.x86_64">
<option name="radv_zero_vram" value="true" />

View file

@ -603,6 +603,8 @@
DRI_CONF_OPT_B(radv_rt, def, \
"Expose support for VK_KHR_ray_tracing_pipeline")
#define DRI_CONF_RADV_APP_LAYER() DRI_CONF_OPT_S_NODEF(radv_app_layer, "Select an application layer.")
/**
* \brief ANV specific configuration options
*/