summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-10-30 03:17:35 -0400
committerIlia Mirkin <[email protected]>2015-11-05 11:22:18 -0500
commitfc76cc05e39839c0933320f28b4cc9041d4e7770 (patch)
tree7faf5d73ad217de8635396ce8fbed4429c638abf /src/gallium/auxiliary
parente587590a83588133d7a9044e3935585f675bbb30 (diff)
gallium: expose a debug message callback settable by context owner
This will allow gallium drivers to send messages to KHR_debug endpoints Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_debug.c14
-rw-r--r--src/gallium/auxiliary/util/u_debug.h20
2 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 7388a499c74..702953673ba 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -70,6 +70,20 @@ void _debug_vprintf(const char *format, va_list ap)
#endif
}
+void
+_pipe_debug_message(
+ struct pipe_debug_callback *cb,
+ unsigned *id,
+ enum pipe_debug_type type,
+ const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ if (cb && cb->debug_message)
+ cb->debug_message(cb->data, id, type, fmt, args);
+ va_end(args);
+}
+
void
debug_disable_error_message_boxes(void)
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 926063a1918..aaf223c6f68 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -42,6 +42,7 @@
#include "os/os_misc.h"
#include "pipe/p_format.h"
+#include "pipe/p_defines.h"
#ifdef __cplusplus
@@ -262,6 +263,25 @@ void _debug_assert_fail(const char *expr,
_debug_printf("error: %s\n", __msg)
#endif
+/**
+ * Output a debug log message to the debug info callback.
+ */
+#define pipe_debug_message(cb, type, fmt, ...) do { \
+ static unsigned id = 0; \
+ _pipe_debug_message(cb, &id, \
+ PIPE_DEBUG_TYPE_ ## type, \
+ fmt, __VA_ARGS__); \
+} while (0)
+
+struct pipe_debug_callback;
+
+void
+_pipe_debug_message(
+ struct pipe_debug_callback *cb,
+ unsigned *id,
+ enum pipe_debug_type type,
+ const char *fmt, ...) _util_printf_format(4, 5);
+
/**
* Used by debug_dump_enum and debug_dump_flags to describe symbols.