glthread: re-enable thread scheduling in st/mesa when glthread is disabled

This happens when GL_DEBUG_OUTPUT_SYNCHRONOUS is enabled.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27350>
This commit is contained in:
Marek Olšák 2024-01-29 14:42:18 -05:00 committed by Marge Bot
parent c3ceec6cd8
commit 47d589e7d4

View file

@ -246,9 +246,6 @@ _mesa_glthread_init(struct gl_context *ctx)
_mesa_glthread_init_call_fence(&glthread->LastProgramChangeBatch);
_mesa_glthread_init_call_fence(&glthread->LastDListChangeBatchIndex);
/* glthread takes over all L3 pinning */
ctx->st->pin_thread_counter = ST_THREAD_SCHEDULER_DISABLED;
_mesa_glthread_enable(ctx);
/* Execute the thread initialization function in the thread. */
@ -299,6 +296,9 @@ void _mesa_glthread_enable(struct gl_context *ctx)
ctx->GLThread.enabled = true;
ctx->GLApi = ctx->MarshalExec;
/* glthread takes over all thread scheduling. */
ctx->st->pin_thread_counter = ST_THREAD_SCHEDULER_DISABLED;
/* Update the dispatch only if the dispatch is current. */
if (_glapi_get_dispatch() == ctx->Dispatch.Current) {
_glapi_set_dispatch(ctx->GLApi);
@ -315,6 +315,10 @@ void _mesa_glthread_disable(struct gl_context *ctx)
ctx->GLThread.enabled = false;
ctx->GLApi = ctx->Dispatch.Current;
/* Re-enable thread scheduling in st/mesa when glthread is disabled. */
if (ctx->pipe->set_context_param && util_thread_scheduler_enabled())
ctx->st->pin_thread_counter = 0;
/* Update the dispatch only if the dispatch is current. */
if (_glapi_get_dispatch() == ctx->MarshalExec) {
_glapi_set_dispatch(ctx->GLApi);