summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/radeon/radeon_debug.c
diff options
context:
space:
mode:
authorPauli Nieminen <suokkos@gmail.com>2009-08-31 20:25:33 +0300
committerPauli Nieminen <suokkos@gmail.com>2009-08-31 20:39:43 +0300
commitfde929c4fdee2e998542f071ff7165d87f572593 (patch)
tree0236c7364963100aff87ecd3fbab2095e8d7b6a0 /src/mesa/drivers/dri/radeon/radeon_debug.c
parent7870edc778338556a65a4d4167d20ad01d6a1995 (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.c')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_debug.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_debug.c b/src/mesa/drivers/dri/radeon/radeon_debug.c
index cb1fd63cf7..691680e956 100644
--- a/src/mesa/drivers/dri/radeon/radeon_debug.c
+++ b/src/mesa/drivers/dri/radeon/radeon_debug.c
@@ -30,6 +30,7 @@
#include "utils.h"
#include "radeon_debug.h"
+#include "radeon_common_context.h"
static const struct dri_debug_control debug_control[] = {
{"fall", RADEON_FALLBACKS},
@@ -61,3 +62,37 @@ void radeon_init_debug(void)
radeon_enabled_debug_types |= RADEON_GENERAL;
}
+
+void _radeon_debug_add_indent(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ const size_t length = sizeof(radeon->debug.indent)
+ / sizeof(radeon->debug.indent[0]);
+ if (radeon->debug.indent_depth < length - 1) {
+ radeon->debug.indent[radeon->debug.indent_depth] = '\t';
+ ++radeon->debug.indent_depth;
+ };
+}
+
+void _radeon_debug_remove_indent(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ if (radeon->debug.indent_depth > 0) {
+ radeon->debug.indent[radeon->debug.indent_depth] = '\0';
+ --radeon->debug.indent_depth;
+ }
+}
+
+extern void _radeon_print(const radeon_debug_type_t type,
+ const radeon_debug_level_t level,
+ const char* message,
+ va_list values)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ // FIXME: Make this multi thread safe
+ fprintf(stderr, "%s", radeon->debug.indent);
+ vfprintf(stderr, message, values);
+}