diff --git a/docs/envvars.rst b/docs/envvars.rst index cfa26588538..9b200f8756a 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -1619,19 +1619,6 @@ RADV driver environment variables ``peak`` force GPU clocks to their maximum level, this is the default value -.. envvar:: RADV_GFX12_HIZ_WA - - choose the specific HiZ workaround to apply on GFX12 (RDNA4). The possible - values are: - - ``disabled`` - no HiZ workaround is enabled, use at your own risk but optimal for performance - ``partial`` - mitigate the issue partially, potentially risky but performance should be - mostly optimal (default value) - ``full`` - mitigate the issue completely, no risk but performance might be decreased - .. envvar:: ACO_DEBUG a comma-separated list of named flags, which do various things: @@ -1662,6 +1649,19 @@ RADV driver environment variables ``liveinfo`` print liveness and register demand information before scheduling +.. envvar:: radv_gfx12_hiz_wa + + choose the specific HiZ workaround to apply on GFX12 (RDNA4). The possible + values are: + + ``disabled`` + no HiZ workaround is enabled, use at your own risk but optimal for performance + ``partial`` + mitigate the issue partially, potentially risky but performance should be + mostly optimal (default value) + ``full`` + mitigate the issue completely, no risk but performance might be decreased + RadeonSI driver environment variables ------------------------------------- diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c index 559393c8a34..6683057bf34 100644 --- a/src/amd/vulkan/radv_instance.c +++ b/src/amd/vulkan/radv_instance.c @@ -165,6 +165,7 @@ static const driOptionDescription radv_dri_options[] = { DRI_CONF_RADV_OVERRIDE_UNIFORM_OFFSET_ALIGNMENT(0) DRI_CONF_RADV_CLEAR_LDS(false) DRI_CONF_RADV_DISABLE_NGG_GS(false) + DRI_CONF_RADV_GFX12_HIZ_WA() DRI_CONF_SECTION_END DRI_CONF_SECTION_DEBUG @@ -258,6 +259,7 @@ radv_init_dri_performance_options(struct radv_instance *instance) drirc->performance.enable_unified_heap_on_apu = driQueryOptionb(&drirc->options, "radv_enable_unified_heap_on_apu"); drirc->performance.report_llvm9_version_string = driQueryOptionb(&drirc->options, "radv_report_llvm9_version_string"); + drirc->performance.gfx12_hiz_wa = driQueryOptionstr(&drirc->options, "radv_gfx12_hiz_wa"); } static void diff --git a/src/amd/vulkan/radv_instance.h b/src/amd/vulkan/radv_instance.h index bb1d3baee13..e43b61276ea 100644 --- a/src/amd/vulkan/radv_instance.h +++ b/src/amd/vulkan/radv_instance.h @@ -66,6 +66,7 @@ struct radv_drirc { bool disable_ngg_gs; bool enable_unified_heap_on_apu; bool report_llvm9_version_string; + char *gfx12_hiz_wa; } performance; struct { diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index 5bf65ec82a2..219b2e9c7bd 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -2313,11 +2313,11 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm pdev->use_hiz = false; if (pdev->info.gfx_level == GFX12) { - const char *gfx12_hiz_wa_str = getenv("RADV_GFX12_HIZ_WA"); + const char *gfx12_hiz_wa_str = instance->drirc.performance.gfx12_hiz_wa; pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_PARTIAL; /* Default */ - if (gfx12_hiz_wa_str) { + if (strlen(gfx12_hiz_wa_str) > 0) { if (!strcmp(gfx12_hiz_wa_str, "disabled")) { pdev->gfx12_hiz_wa = RADV_GFX12_HIZ_WA_DISABLED; } else if (!strcmp(gfx12_hiz_wa_str, "partial")) { diff --git a/src/util/driconf.h b/src/util/driconf.h index fc6aea1725d..2d7d1698ce0 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -796,6 +796,11 @@ DRI_CONF_OPT_B(radv_cooperative_matrix2_nv, def, \ "Expose VK_NV_cooperative_matrix2 on supported hardware.") +#define DRI_CONF_RADV_GFX12_HIZ_WA() \ + DRI_CONF_OPT_S_NODEF(radv_gfx12_hiz_wa, \ + "Choose the specific HiZ workaround to apply on GFX12 (RDNA4). " \ + "Accepted values are: disabled, partial or full") + /** * \brief ANV specific configuration options */