summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_legacy.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_legacy.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_debug.c35
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_debug.h30
5 files changed, 67 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index d17060d5cc..0309345393 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -467,6 +467,8 @@ struct radeon_context {
struct radeon_cmdbuf cmdbuf;
+ struct radeon_debug debug;
+
drm_clip_rect_t fboRect;
GLboolean constant_cliprect; /* use for FBO or DRI2 rendering */
GLboolean front_cliprects;
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
index 587e2acf91..f1addb299e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
@@ -32,6 +32,7 @@
#include <errno.h>
#include "radeon_bocs_wrapper.h"
+#include "radeon_common.h"
struct cs_manager_legacy {
struct radeon_cs_manager base;
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h
index e177b4bafe..cafbc9e576 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.h
@@ -32,7 +32,7 @@
#ifndef RADEON_CS_LEGACY_H
#define RADEON_CS_LEGACY_H
-#include "radeon_common.h"
+struct radeon_context;
struct radeon_cs_manager *radeon_cs_manager_legacy_ctor(struct radeon_context *ctx);
void radeon_cs_manager_legacy_dtor(struct radeon_cs_manager *csm);
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);
+}
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