tu: make tu_debug_flags enum 64-bit

Soon tu_debug_flags will overgrow its 32-bit capacity. To avoid issues the
enum is resized to 64 bits and handling of these flag values is adjusted
accordingly.

Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Reviewed-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33663>
This commit is contained in:
Zan Dobersek
2025-02-21 10:32:09 +01:00
committed by Marge Bot
parent 13a3f9a972
commit 710e74a082
2 changed files with 40 additions and 40 deletions
+7 -7
View File
@@ -57,7 +57,7 @@ static const struct debug_control tu_debug_options[] = {
* 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 =
const uint64_t tu_runtime_debug_flags =
TU_DEBUG_NIR | TU_DEBUG_NOBIN | TU_DEBUG_SYSMEM | TU_DEBUG_GMEM |
TU_DEBUG_FORCEBIN | TU_DEBUG_LAYOUT | TU_DEBUG_NOLRZ | TU_DEBUG_NOLRZFC |
TU_DEBUG_PERF | TU_DEBUG_FLUSHALL | TU_DEBUG_SYNCDRAW |
@@ -73,7 +73,7 @@ static void
tu_env_notify(
void *data, const char *path, bool created, bool deleted, bool dir_deleted)
{
int file_flags = 0;
uint64_t file_flags = 0;
if (!deleted) {
FILE *file = fopen(path, "r");
if (file) {
@@ -86,10 +86,10 @@ tu_env_notify(
}
}
int runtime_flags = file_flags & tu_runtime_debug_flags;
uint64_t runtime_flags = file_flags & tu_runtime_debug_flags;
if (unlikely(runtime_flags != file_flags)) {
mesa_logw(
"Certain options in TU_DEBUG_FILE don't support runtime changes: 0x%x, ignoring",
"Certain options in TU_DEBUG_FILE don't support runtime changes: 0x%" PRIx64 ", ignoring",
file_flags & ~tu_runtime_debug_flags);
}
@@ -115,7 +115,7 @@ tu_env_init_once(void)
tu_env.env_debug = tu_env.debug & ~tu_runtime_debug_flags;
if (TU_DEBUG(STARTUP))
mesa_logi("TU_DEBUG=0x%x", tu_env.env_debug);
mesa_logi("TU_DEBUG=0x%" PRIx64 " (ENV: 0x%" PRIx64 ")", tu_env.debug.load(), tu_env.env_debug);
/* TU_DEBUG=rd functionality was moved to fd_rd_output. This debug option
* should translate to the basic-level FD_RD_DUMP_ENABLE option.
@@ -127,8 +127,8 @@ tu_env_init_once(void)
if (debug_file) {
if (tu_env.debug != tu_env.env_debug) {
mesa_logw("TU_DEBUG_FILE is set (%s), but TU_DEBUG is also set. "
"Any runtime options (0x%x) in TU_DEBUG will be ignored.",
debug_file, tu_env.debug & ~tu_runtime_debug_flags);
"Any runtime options (0x%" PRIx64 ") in TU_DEBUG will be ignored.",
debug_file, tu_env.debug & tu_runtime_debug_flags);
}
if (TU_DEBUG(STARTUP))
+33 -33
View File
@@ -36,43 +36,43 @@
*/
#define TU_DEBUG_ENV(name) unlikely(tu_env.env_debug & TU_DEBUG_##name)
enum tu_debug_flags
enum tu_debug_flags : uint64_t
{
TU_DEBUG_STARTUP = 1 << 0,
TU_DEBUG_NIR = 1 << 1,
TU_DEBUG_NOBIN = 1 << 3,
TU_DEBUG_SYSMEM = 1 << 4,
TU_DEBUG_FORCEBIN = 1 << 5,
TU_DEBUG_NOUBWC = 1 << 6,
TU_DEBUG_NOMULTIPOS = 1 << 7,
TU_DEBUG_NOLRZ = 1 << 8,
TU_DEBUG_PERFC = 1 << 9,
TU_DEBUG_FLUSHALL = 1 << 10,
TU_DEBUG_SYNCDRAW = 1 << 11,
TU_DEBUG_PUSH_CONSTS_PER_STAGE = 1 << 12,
TU_DEBUG_GMEM = 1 << 13,
TU_DEBUG_RAST_ORDER = 1 << 14,
TU_DEBUG_UNALIGNED_STORE = 1 << 15,
TU_DEBUG_LAYOUT = 1 << 16,
TU_DEBUG_LOG_SKIP_GMEM_OPS = 1 << 17,
TU_DEBUG_PERF = 1 << 18,
TU_DEBUG_NOLRZFC = 1 << 19,
TU_DEBUG_DYNAMIC = 1 << 20,
TU_DEBUG_BOS = 1 << 21,
TU_DEBUG_3D_LOAD = 1 << 22,
TU_DEBUG_FDM = 1 << 23,
TU_DEBUG_NOCONFORM = 1 << 24,
TU_DEBUG_RD = 1 << 25,
TU_DEBUG_HIPRIO = 1 << 26,
TU_DEBUG_NO_CONCURRENT_RESOLVES = 1 << 27,
TU_DEBUG_NO_CONCURRENT_UNRESOLVES = 1 << 28,
TU_DEBUG_DUMPAS = 1 << 29,
TU_DEBUG_NO_BIN_MERGING = 1 << 30,
TU_DEBUG_STARTUP = BITFIELD64_BIT(0),
TU_DEBUG_NIR = BITFIELD64_BIT(1),
TU_DEBUG_NOBIN = BITFIELD64_BIT(2),
TU_DEBUG_SYSMEM = BITFIELD64_BIT(3),
TU_DEBUG_FORCEBIN = BITFIELD64_BIT(4),
TU_DEBUG_NOUBWC = BITFIELD64_BIT(5),
TU_DEBUG_NOMULTIPOS = BITFIELD64_BIT(6),
TU_DEBUG_NOLRZ = BITFIELD64_BIT(7),
TU_DEBUG_PERFC = BITFIELD64_BIT(8),
TU_DEBUG_FLUSHALL = BITFIELD64_BIT(9),
TU_DEBUG_SYNCDRAW = BITFIELD64_BIT(10),
TU_DEBUG_PUSH_CONSTS_PER_STAGE = BITFIELD64_BIT(11),
TU_DEBUG_GMEM = BITFIELD64_BIT(12),
TU_DEBUG_RAST_ORDER = BITFIELD64_BIT(13),
TU_DEBUG_UNALIGNED_STORE = BITFIELD64_BIT(14),
TU_DEBUG_LAYOUT = BITFIELD64_BIT(15),
TU_DEBUG_LOG_SKIP_GMEM_OPS = BITFIELD64_BIT(16),
TU_DEBUG_PERF = BITFIELD64_BIT(17),
TU_DEBUG_NOLRZFC = BITFIELD64_BIT(18),
TU_DEBUG_DYNAMIC = BITFIELD64_BIT(19),
TU_DEBUG_BOS = BITFIELD64_BIT(20),
TU_DEBUG_3D_LOAD = BITFIELD64_BIT(21),
TU_DEBUG_FDM = BITFIELD64_BIT(22),
TU_DEBUG_NOCONFORM = BITFIELD64_BIT(23),
TU_DEBUG_RD = BITFIELD64_BIT(24),
TU_DEBUG_HIPRIO = BITFIELD64_BIT(25),
TU_DEBUG_NO_CONCURRENT_RESOLVES = BITFIELD64_BIT(26),
TU_DEBUG_NO_CONCURRENT_UNRESOLVES = BITFIELD64_BIT(27),
TU_DEBUG_DUMPAS = BITFIELD64_BIT(28),
TU_DEBUG_NO_BIN_MERGING = BITFIELD64_BIT(29),
};
struct tu_env {
std::atomic<uint32_t> debug;
uint32_t env_debug;
std::atomic<uint64_t> debug;
uint64_t env_debug;
};
extern struct tu_env tu_env;