From: Timothy Arceri Date: Fri, 31 Mar 2017 00:45:34 +0000 (+1100) Subject: mesa: disable glthread when DEBUG_OUTPUT_SYNCHRONOUS is enabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dbdd7231c252cbed52a196c86725730c07cd8006;p=mesa.git mesa: disable glthread when DEBUG_OUTPUT_SYNCHRONOUS is enabled We could re-enable it also but I haven't tested that yet, and I'm not sure we care much anyway. V2: don't disable it from with the call itself. We need a custom marshalling function or we get stuck waiting for thread to finish. V3: tidy up redundant code copied from generated version. Reviewed-by: Nicolai Hähnle --- diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 8392e3a520b..af482707d03 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -2361,7 +2361,7 @@ - + diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index b01c0739972..ae32d257e93 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -67,6 +67,43 @@ _mesa_marshal_Flush(void) _mesa_glthread_flush_batch(ctx); } +/* Enable: marshalled asynchronously */ +struct marshal_cmd_Enable +{ + struct marshal_cmd_base cmd_base; + GLenum cap; +}; + +void +_mesa_unmarshal_Enable(struct gl_context *ctx, + const struct marshal_cmd_Enable *cmd) +{ + const GLenum cap = cmd->cap; + CALL_Enable(ctx->CurrentServerDispatch, (cap)); +} + +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); + } 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"); + CALL_Enable(ctx->CurrentServerDispatch, (cap)); +} struct marshal_cmd_ShaderSource { diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h index 3d104240afe..2f1509b2d55 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -197,6 +197,7 @@ _mesa_glthread_is_compat_bind_vertex_array(const struct gl_context *ctx) return ctx->API != API_OPENGL_CORE; } +struct marshal_cmd_Enable; struct marshal_cmd_ShaderSource; struct marshal_cmd_Flush; struct marshal_cmd_BindBuffer; @@ -204,6 +205,13 @@ struct marshal_cmd_BufferData; struct marshal_cmd_BufferSubData; struct marshal_cmd_ClearBufferfv; +void +_mesa_unmarshal_Enable(struct gl_context *ctx, + const struct marshal_cmd_Enable *cmd); + +void GLAPIENTRY +_mesa_marshal_Enable(GLenum cap); + void GLAPIENTRY _mesa_marshal_ShaderSource(GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length);