glthread: inline _mesa_glthread_restore_dispatch and merge disable & destroy

No change in behavior.

This fixes ctx->GLThread.enabled, which was only set to false by destroy.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14000>
This commit is contained in:
Marek Olšák 2021-11-29 13:58:59 -05:00
parent 7b123ad16a
commit 670759a208
4 changed files with 6 additions and 22 deletions

View file

@ -157,13 +157,15 @@ free_vao(void *data, UNUSED void *userData)
}
void
_mesa_glthread_destroy(struct gl_context *ctx)
_mesa_glthread_destroy(struct gl_context *ctx, const char *reason)
{
struct glthread_state *glthread = &ctx->GLThread;
if (!glthread->enabled)
return;
_mesa_debug(ctx, "glthread destroy reason: %s\n", reason);
_mesa_glthread_finish(ctx);
util_queue_destroy(&glthread->queue);
@ -175,12 +177,6 @@ _mesa_glthread_destroy(struct gl_context *ctx)
ctx->GLThread.enabled = false;
_mesa_glthread_restore_dispatch(ctx, "destroy");
}
void
_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.
*
@ -190,19 +186,9 @@ _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func)
if (_glapi_get_dispatch() == ctx->MarshalExec) {
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
_glapi_set_dispatch(ctx->CurrentClientDispatch);
#if 0
printf("glthread disabled: %s\n", func);
#endif
}
}
void
_mesa_glthread_disable(struct gl_context *ctx, const char *func)
{
_mesa_glthread_finish_before(ctx, func);
_mesa_glthread_restore_dispatch(ctx, func);
}
void
_mesa_glthread_flush_batch(struct gl_context *ctx)
{

View file

@ -237,10 +237,8 @@ struct glthread_state
};
void _mesa_glthread_init(struct gl_context *ctx);
void _mesa_glthread_destroy(struct gl_context *ctx);
void _mesa_glthread_destroy(struct gl_context *ctx, const char *reason);
void _mesa_glthread_restore_dispatch(struct gl_context *ctx, const char *func);
void _mesa_glthread_disable(struct gl_context *ctx, const char *func);
void _mesa_glthread_flush_batch(struct gl_context *ctx);
void _mesa_glthread_finish(struct gl_context *ctx);
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);

View file

@ -448,7 +448,7 @@ _mesa_glthread_Enable(struct gl_context *ctx, GLenum cap)
_mesa_glthread_set_prim_restart(ctx, cap, true);
break;
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
_mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
_mesa_glthread_destroy(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
break;
case GL_CULL_FACE:
ctx->GLThread.CullFace = true;

View file

@ -1057,7 +1057,7 @@ st_destroy_context(struct st_context *st)
_mesa_make_current(ctx, NULL, NULL);
/* This must be called first so that glthread has a chance to finish */
_mesa_glthread_destroy(ctx);
_mesa_glthread_destroy(ctx, NULL);
_mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st);