summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorGregory Hainaut <[email protected]>2017-02-12 15:21:47 +0100
committerTimothy Arceri <[email protected]>2017-03-16 14:14:19 +1100
commit93bdad3253cfa353cadf4444711c70f39e9baf09 (patch)
tree5cc6ae9e3bf0b7df89f61d5b0eda3a97da8b1352 /src/mesa/main
parent70e715eea618f31a1b84a99b063c371af3513754 (diff)
mesa/glthread: restore the dispatch table when incompatible gl calls are detected
While a context only has a single glthread, the context itself can be attached to several threads. Therefore the dispatch table must be updated in all threads before the destruction of glthread. In others words, glthread can only be destroyed safely when the context is deleted. Fixes remaining crashes in the glx-multithread-makecurrent* tests. V2: (Timothy Arceri) updated gl_API.dtd marshal_fail description. Signed-off-by: Gregory Hainaut <[email protected]> Acked-by: Timothy Arceri <[email protected]> Acked-by: Marek Olšák <[email protected]> Tested-by: Dieter Nützel <[email protected]> Tested-by: Mike Lothian <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/glthread.c6
-rw-r--r--src/mesa/main/glthread.h7
2 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index 8ee7d8dadac..623266f484b 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -173,6 +173,12 @@ _mesa_glthread_destroy(struct gl_context *ctx)
free(glthread);
ctx->GLThread = NULL;
+ _mesa_glthread_restore_dispatch(ctx);
+}
+
+void
+_mesa_glthread_restore_dispatch(struct gl_context *ctx)
+{
/* Remove ourselves from the dispatch table except if another ctx/thread
* already installed a new dispatch table.
*
diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h
index 04eb5ffabc4..327c549858c 100644
--- a/src/mesa/main/glthread.h
+++ b/src/mesa/main/glthread.h
@@ -119,6 +119,7 @@ struct glthread_batch
void _mesa_glthread_init(struct gl_context *ctx);
void _mesa_glthread_destroy(struct gl_context *ctx);
+void _mesa_glthread_restore_dispatch(struct gl_context *ctx);
void _mesa_glthread_flush_batch(struct gl_context *ctx);
void _mesa_glthread_finish(struct gl_context *ctx);
@@ -138,5 +139,11 @@ static inline void
_mesa_glthread_finish(struct gl_context *ctx)
{
}
+
+static inline void
+_mesa_glthread_restore_dispatch(struct gl_context *ctx);
+{
+}
+
#endif /* !HAVE_PTHREAD */
#endif /* _GLTHREAD_H*/