diff --git a/docs/drivers/freedreno.rst b/docs/drivers/freedreno.rst index 69048ba3209..032dd6e798c 100644 --- a/docs/drivers/freedreno.rst +++ b/docs/drivers/freedreno.rst @@ -636,3 +636,26 @@ the cases where stale data is read. The best way to pinpoint the reg which causes a failure is to bisect the regs range. In case when a fail is caused by combination of several registers the ``inverse`` flag may be set to find the reg which prevents the failure. + +Runtime toggling of ``TU_DEBUG`` options +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In some cases, it is useful to toggle ``TU_DEBUG`` options at runtime, such as +when assessing the performance impact of a particular option. This can be done +by setting the ``TU_DEBUG_FILE`` environment variable to a file path, and writing +the desired ``TU_DEBUG`` options to that file. The driver will check the file for +changes and apply them. + +The folder containing the file should exist prior to running the application, and +deleting the folder during runtime will result in the driver no longer picking up +any changes even if the folder is recreated. + +Additionally, not all ``TU_DEBUG`` options can be toggled at runtime, the following +are supported at the moment: ``nir``, ``nobin``, ``sysmem``, ``gmem``, ``forcebin``, +``layout``, ``nolrz``, ``nolrzfc``, ``perf``, ``flushall``, ``syncdraw``, +``rast_order``, ``unaligned_store``, ``log_skip_gmem_ops``, ``3d_load``, ``fdm``, +``noconcurrentresolves``, ``noconcurrentunresolves``. + +Some of these options will behave differently when toggled at runtime, for example: +``nolrz`` will still result in LRZ allocation which would not happen if the option +was set in the environment variable. \ No newline at end of file diff --git a/src/freedreno/vulkan/tu_util.cc b/src/freedreno/vulkan/tu_util.cc index 86ec45f9519..3c5dd35f58a 100644 --- a/src/freedreno/vulkan/tu_util.cc +++ b/src/freedreno/vulkan/tu_util.cc @@ -54,6 +54,7 @@ static const struct debug_control tu_debug_options[] = { * The runtime debug flags are a subset of the debug flags that can be set at * runtime. Flags which depend on running state of the driver, the application * or the hardware and would otherwise break when toggled should not be set here. + * Note: Keep in sync with the list of flags in 'docs/drivers/freedreno.rst'. */ const uint32_t tu_runtime_debug_flags = TU_DEBUG_NIR | TU_DEBUG_NOBIN | TU_DEBUG_SYSMEM | TU_DEBUG_GMEM |