[Mesa-dev] [PATCH 2/4] st/mesa: set debug callback async flag

Nicolai Hähnle nhaehnle at gmail.com
Thu Jul 7 07:39:38 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/mesa/state_tracker/st_context.c | 3 ++-
 src/mesa/state_tracker/st_debug.c   | 6 ++++--
 src/mesa/state_tracker/st_debug.h   | 2 +-
 src/mesa/state_tracker/st_manager.c | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 4721215..f1d2084 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -90,7 +90,8 @@ static void st_Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
 
    switch (cap) {
    case GL_DEBUG_OUTPUT:
-      st_enable_debug_output(st, state);
+   case GL_DEBUG_OUTPUT_SYNCHRONOUS:
+      st_update_debug_callback(st);
       break;
    default:
       break;
diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c
index 214e223..b51f350 100644
--- a/src/mesa/state_tracker/st_debug.c
+++ b/src/mesa/state_tracker/st_debug.c
@@ -27,6 +27,7 @@
 
 
 #include "main/context.h"
+#include "main/debug_output.h"
 #include "program/prog_print.h"
 
 #include "pipe/p_state.h"
@@ -164,16 +165,17 @@ st_debug_message(void *data,
 }
 
 void
-st_enable_debug_output(struct st_context *st, boolean enable)
+st_update_debug_callback(struct st_context *st)
 {
    struct pipe_context *pipe = st->pipe;
 
    if (!pipe->set_debug_callback)
       return;
 
-   if (enable) {
+   if (_mesa_get_debug_state_int(st->ctx, GL_DEBUG_OUTPUT)) {
       struct pipe_debug_callback cb;
       memset(&cb, 0, sizeof(cb));
+      cb.async = !_mesa_get_debug_state_int(st->ctx, GL_DEBUG_OUTPUT_SYNCHRONOUS);
       cb.debug_message = st_debug_message;
       cb.data = st;
       pipe->set_debug_callback(pipe, &cb);
diff --git a/src/mesa/state_tracker/st_debug.h b/src/mesa/state_tracker/st_debug.h
index e143609..6c1e915 100644
--- a/src/mesa/state_tracker/st_debug.h
+++ b/src/mesa/state_tracker/st_debug.h
@@ -63,7 +63,7 @@ extern int ST_DEBUG;
 
 void st_debug_init( void );
 
-void st_enable_debug_output(struct st_context *st, boolean enable);
+void st_update_debug_callback(struct st_context *st);
 
 static inline void
 ST_DBG( unsigned flag, const char *fmt, ... )
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 997d428..d323c87 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -681,7 +681,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
 
       st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
 
-      st_enable_debug_output(st, TRUE);
+      st_update_debug_callback(st);
    }
 
    if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE)
-- 
2.7.4



More information about the mesa-dev mailing list