mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 17:50:12 +01:00
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:
parent
7b123ad16a
commit
670759a208
4 changed files with 6 additions and 22 deletions
|
|
@ -157,13 +157,15 @@ free_vao(void *data, UNUSED void *userData)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_glthread_destroy(struct gl_context *ctx)
|
_mesa_glthread_destroy(struct gl_context *ctx, const char *reason)
|
||||||
{
|
{
|
||||||
struct glthread_state *glthread = &ctx->GLThread;
|
struct glthread_state *glthread = &ctx->GLThread;
|
||||||
|
|
||||||
if (!glthread->enabled)
|
if (!glthread->enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_mesa_debug(ctx, "glthread destroy reason: %s\n", reason);
|
||||||
|
|
||||||
_mesa_glthread_finish(ctx);
|
_mesa_glthread_finish(ctx);
|
||||||
util_queue_destroy(&glthread->queue);
|
util_queue_destroy(&glthread->queue);
|
||||||
|
|
||||||
|
|
@ -175,12 +177,6 @@ _mesa_glthread_destroy(struct gl_context *ctx)
|
||||||
|
|
||||||
ctx->GLThread.enabled = false;
|
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
|
/* Remove ourselves from the dispatch table except if another ctx/thread
|
||||||
* already installed a new dispatch table.
|
* 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) {
|
if (_glapi_get_dispatch() == ctx->MarshalExec) {
|
||||||
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
|
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
|
||||||
_glapi_set_dispatch(ctx->CurrentClientDispatch);
|
_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
|
void
|
||||||
_mesa_glthread_flush_batch(struct gl_context *ctx)
|
_mesa_glthread_flush_batch(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -237,10 +237,8 @@ struct glthread_state
|
||||||
};
|
};
|
||||||
|
|
||||||
void _mesa_glthread_init(struct gl_context *ctx);
|
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_flush_batch(struct gl_context *ctx);
|
||||||
void _mesa_glthread_finish(struct gl_context *ctx);
|
void _mesa_glthread_finish(struct gl_context *ctx);
|
||||||
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
|
void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func);
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,7 @@ _mesa_glthread_Enable(struct gl_context *ctx, GLenum cap)
|
||||||
_mesa_glthread_set_prim_restart(ctx, cap, true);
|
_mesa_glthread_set_prim_restart(ctx, cap, true);
|
||||||
break;
|
break;
|
||||||
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
|
case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
|
||||||
_mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
_mesa_glthread_destroy(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");
|
||||||
break;
|
break;
|
||||||
case GL_CULL_FACE:
|
case GL_CULL_FACE:
|
||||||
ctx->GLThread.CullFace = true;
|
ctx->GLThread.CullFace = true;
|
||||||
|
|
|
||||||
|
|
@ -1057,7 +1057,7 @@ st_destroy_context(struct st_context *st)
|
||||||
_mesa_make_current(ctx, NULL, NULL);
|
_mesa_make_current(ctx, NULL, NULL);
|
||||||
|
|
||||||
/* This must be called first so that glthread has a chance to finish */
|
/* 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);
|
_mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue