From 47d589e7d4f63db5252f26b82bea3cbdd7d626ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 29 Jan 2024 14:42:18 -0500 Subject: [PATCH] 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 Part-of: --- src/mesa/main/glthread.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index 18c600cf80e..0df187ef3b6 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -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);