[Mesa-dev] [PATCH 1/3] mesa/glthread: pass the function name to _mesa_glthread_restore_dispatch

Marek Olšák maraeo at gmail.com
Sat Nov 10 06:29:46 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

If you insert printf there, you'll know why glthread was disabled.
---
 src/mapi/glapi/gen/gl_marshal.py | 2 +-
 src/mesa/main/glthread.c         | 4 ++--
 src/mesa/main/glthread.h         | 2 +-
 src/mesa/main/marshal.c          | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index 5b35357ac54..4fd2bc2a5b9 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -242,21 +242,21 @@ class PrintCode(gl_XML.gl_print_base):
             out('{0} *cmd;'.format(struct))
 
             out('debug_print_marshal("{0}");'.format(func.name))
 
             need_fallback_sync = self.validate_count_or_fallback(func)
 
             if func.marshal_fail:
                 out('if ({0}) {{'.format(func.marshal_fail))
                 with indent():
                     out('_mesa_glthread_finish(ctx);')
-                    out('_mesa_glthread_restore_dispatch(ctx);')
+                    out('_mesa_glthread_restore_dispatch(ctx, __func__);')
                     self.print_sync_dispatch(func)
                     out('return;')
                 out('}')
 
             out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {')
             with indent():
                 self.print_async_dispatch(func)
                 out('return;')
             out('}')
 
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index 18a83bb9be4..8610d1ef933 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -114,25 +114,25 @@ _mesa_glthread_destroy(struct gl_context *ctx)
 
    _mesa_glthread_finish(ctx);
    util_queue_destroy(&glthread->queue);
 
    for (unsigned i = 0; i < MARSHAL_MAX_BATCHES; i++)
       util_queue_fence_destroy(&glthread->batches[i].fence);
 
    free(glthread);
    ctx->GLThread = NULL;
 
-   _mesa_glthread_restore_dispatch(ctx);
+   _mesa_glthread_restore_dispatch(ctx, "destroy");
 }
 
 void
-_mesa_glthread_restore_dispatch(struct gl_context *ctx)
+_mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func)
 {
    /* Remove ourselves from the dispatch table except if another ctx/thread
     * already installed a new dispatch table.
     *
     * Typically glxMakeCurrent will bind a new context (install new table) then
     * old context might be deleted.
     */
    if (_glapi_get_dispatch() == ctx->MarshalExec) {
        ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
        _glapi_set_dispatch(ctx->CurrentClientDispatch);
diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h
index 8cd5d022674..59cb95feb4a 100644
--- a/src/mesa/main/glthread.h
+++ b/src/mesa/main/glthread.h
@@ -92,15 +92,15 @@ struct glthread_state
    /**
     * Tracks on the main thread side whether the current element array (index
     * buffer) binding is in a VBO.
     */
    bool element_array_is_vbo;
 };
 
 void _mesa_glthread_init(struct gl_context *ctx);
 void _mesa_glthread_destroy(struct gl_context *ctx);
 
-void _mesa_glthread_restore_dispatch(struct gl_context *ctx);
+void _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func);
 void _mesa_glthread_flush_batch(struct gl_context *ctx);
 void _mesa_glthread_finish(struct gl_context *ctx);
 
 #endif /* _GLTHREAD_H*/
diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c
index 8f8e8c78ed2..1827585ef0a 100644
--- a/src/mesa/main/marshal.c
+++ b/src/mesa/main/marshal.c
@@ -82,21 +82,21 @@ _mesa_unmarshal_Enable(struct gl_context *ctx,
 
 void GLAPIENTRY
 _mesa_marshal_Enable(GLenum cap)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct marshal_cmd_Enable *cmd;
    debug_print_marshal("Enable");
 
    if (cap == GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB) {
       _mesa_glthread_finish(ctx);
-      _mesa_glthread_restore_dispatch(ctx);
+      _mesa_glthread_restore_dispatch(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
    } else {
       cmd = _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_Enable,
                                             sizeof(*cmd));
       cmd->cap = cap;
       _mesa_post_marshal_hook(ctx);
       return;
    }
 
    _mesa_glthread_finish(ctx);
    debug_print_sync_fallback("Enable");
-- 
2.17.1



More information about the mesa-dev mailing list