asahi: Add ASAHI_MESA_DEBUG=nowc flag

Add a debug flag to disable write-combining as a performance hack. This may help
diagnose slowness with glReadPixels() heavy workloads like screen capture.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23480>
This commit is contained in:
Alyssa Rosenzweig
2023-05-12 08:13:22 -04:00
committed by Marge Bot
parent 3a0d1f83d5
commit 389c0fdc7c
3 changed files with 11 additions and 0 deletions

View File

@@ -1633,6 +1633,10 @@ Asahi driver environment variables
possible) or added in the Mesa-wide driconf (if closed source).
``dirty``
In debug builds only: disable dirty tracking optimizations.
``nowc``
Disable write-combining (force all allocations to be write-through). This
may be useful for diagnosing certain performance issues. Note imported
buffers may still be write-combined.
.. envvar:: AGX_MESA_DEBUG

View File

@@ -25,6 +25,7 @@ enum agx_dbg {
AGX_DBG_STATS = BITFIELD_BIT(9),
AGX_DBG_RESOURCE = BITFIELD_BIT(10),
AGX_DBG_BATCH = BITFIELD_BIT(11),
AGX_DBG_NOWC = BITFIELD_BIT(12),
};
/* Dummy partial declarations, pending real UAPI */

View File

@@ -69,6 +69,7 @@ static const struct debug_named_value agx_debug_options[] = {
{"stats", AGX_DBG_STATS, "Show command execution statistics"},
{"resource", AGX_DBG_RESOURCE, "Log resource operations"},
{"batch", AGX_DBG_BATCH, "Log batches"},
{"nowc", AGX_DBG_NOWC, "Disable write-combining"},
DEBUG_NAMED_VALUE_END
};
/* clang-format on */
@@ -557,6 +558,11 @@ agx_resource_create_with_modifiers(struct pipe_screen *screen,
create_flags |= AGX_BO_WRITEBACK;
}
/* Allow disabling write-combine to debug performance issues */
if (dev->debug & AGX_DBG_NOWC) {
create_flags |= AGX_BO_WRITEBACK;
}
/* Create buffers that might be shared with the SHAREABLE flag */
if (bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SHARED))
create_flags |= AGX_BO_SHAREABLE;