diff options
author | Pauli Nieminen <suokkos@gmail.com> | 2009-08-31 20:25:33 +0300 |
---|---|---|
committer | Pauli Nieminen <suokkos@gmail.com> | 2009-08-31 20:39:43 +0300 |
commit | fde929c4fdee2e998542f071ff7165d87f572593 (patch) | |
tree | 0236c7364963100aff87ecd3fbab2095e8d7b6a0 /src/mesa/drivers/dri/radeon/radeon_debug.h | |
parent | 7870edc778338556a65a4d4167d20ad01d6a1995 (diff) |
radeon: Add support for indenting debug output.
Indetion can be used to make it easier to read debug code when sections of debug output are indented.
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_debug.h')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_debug.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_debug.h b/src/mesa/drivers/dri/radeon/radeon_debug.h index 2b35044fb6..3e1481dfa1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_debug.h +++ b/src/mesa/drivers/dri/radeon/radeon_debug.h @@ -71,6 +71,13 @@ typedef enum radeon_debug_types { RADEON_GENERAL = 0x10000 /* Used for errors and warnings */ } radeon_debug_type_t; +#define RADEON_MAX_INDENT 5 + +struct radeon_debug { + size_t indent_depth; + char indent[RADEON_MAX_INDENT]; +}; + extern radeon_debug_type_t radeon_enabled_debug_types; /** @@ -91,6 +98,11 @@ static inline int radeon_is_debug_enabled(const radeon_debug_type_t type, #define __attribute__(x) /*empty*/ #endif + +extern void _radeon_print(const radeon_debug_type_t type, + const radeon_debug_level_t level, + const char* message, + va_list values); /** * Format attribute requires declaration for setting it. Don't ask me why! */ @@ -113,7 +125,7 @@ static inline void radeon_print(const radeon_debug_type_t type, va_list values; va_start( values, message ); - vfprintf(stderr, message, values); + _radeon_print(type, level, message, values); va_end( values ); } } @@ -142,8 +154,22 @@ static inline void radeon_warning(const char* message, ...) va_end( values ); } - extern void radeon_init_debug(void); +extern void _radeon_debug_add_indent(void); +extern void _radeon_debug_remove_indent(void); + +static inline void radeon_debug_add_indent(void) +{ + if (RADEON_DEBUG_LEVEL >= RADEON_VERBOSE) { + _radeon_debug_add_indent(); + } +} +static inline void radeon_debug_remove_indent(void) +{ + if (RADEON_DEBUG_LEVEL >= RADEON_VERBOSE) { + _radeon_debug_remove_indent(); + } +} /* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html . I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble |