From d052612317717d57beb32eb32c2bcd21b683ebf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 30 Nov 2021 08:28:35 -0500 Subject: [PATCH] glthread: disable glthread if the context is lost Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mesa/main/glthread.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index f5e766adfdb..731e6d1554d 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -191,8 +191,13 @@ _mesa_glthread_flush_batch(struct gl_context *ctx) if (!glthread->enabled) return; - if (!glthread->used) + if (ctx->CurrentServerDispatch == ctx->ContextLost) { + _mesa_glthread_destroy(ctx, "context lost"); return; + } + + if (!glthread->used) + return; /* the batch is empty */ /* Pin threads regularly to the same Zen CCX that the main thread is * running on. The main thread can move between CCXs.