diff options
author | Patrick Rudolph <[email protected]> | 2016-10-28 18:04:10 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:44:23 +0100 |
commit | 0fd57306134b9f4e57e544ecc11971a94d7a90df (patch) | |
tree | 42c18aad87419d62a311639f7ad3606e6b716ebe | |
parent | 3098bf03a6cdfdfec181f89da6f10ab7a3121515 (diff) |
st/nine: Add NINE_DEBUG=tid to turn threadid on or off
To ease debugging.
Signed-off-by: Patrick Rudolph <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/nine/nine_debug.c | 14 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_debug.h | 1 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/nine/nine_debug.c b/src/gallium/state_trackers/nine/nine_debug.c index 4f841e1afb0..1dcbca45854 100644 --- a/src/gallium/state_trackers/nine/nine_debug.c +++ b/src/gallium/state_trackers/nine/nine_debug.c @@ -53,6 +53,7 @@ static const struct debug_named_value nine_debug_flags[] = { { "user", DBG_USER, "User errors, both fixable and unfixable." }, { "error", DBG_ERROR, "Driver errors, always visible." }, { "warn", DBG_WARN, "Driver warnings, always visible in debug builds." }, + { "tid", DBG_TID, "Display thread-ids." }, DEBUG_NAMED_VALUE_END }; @@ -65,17 +66,20 @@ _nine_debug_printf( unsigned long flag, static boolean first = TRUE; static unsigned long dbg_flags = DBG_ERROR | DBG_WARN; unsigned long tid = 0; + + if (first) { + first = FALSE; + dbg_flags |= debug_get_flags_option("NINE_DEBUG", nine_debug_flags, 0); + } + #if defined(HAVE_PTHREAD) # if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) - tid = pthread_self(); + if (dbg_flags & DBG_TID) + tid = pthread_self(); # endif #endif - if (first) { - first = FALSE; - dbg_flags |= debug_get_flags_option("NINE_DEBUG", nine_debug_flags, 0); - } if (dbg_flags & flag) { const char *f = func ? strrchr(func, '_') : NULL; va_list ap; diff --git a/src/gallium/state_trackers/nine/nine_debug.h b/src/gallium/state_trackers/nine/nine_debug.h index 4c017eaac7e..841438a66f8 100644 --- a/src/gallium/state_trackers/nine/nine_debug.h +++ b/src/gallium/state_trackers/nine/nine_debug.h @@ -83,6 +83,7 @@ _nine_debug_printf( unsigned long flag, #define DBG_USER (1<<24) #define DBG_ERROR (1<<25) #define DBG_WARN (1<<26) +#define DBG_TID (1<<27) void _nine_stub( const char *file, |