summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-23 17:59:35 +0100
committerwm4 <wm4@nowhere>2015-12-23 17:59:35 +0100
commit1a6f3c56ea6e7bf9928fc99469f8f5da4578f035 (patch)
treee421aeb1dcaa8c7f271899e97d9457b8e838845b
parentaf958221a1846f28d2f730a0efbc5c3d6ef701e0 (diff)
downloadmpv-1a6f3c56ea6e7bf9928fc99469f8f5da4578f035.tar.bz2
mpv-1a6f3c56ea6e7bf9928fc99469f8f5da4578f035.tar.xz
vo_opengl: fall back to gcc thread local storage
gcc 4.8 does not support C11 thread local storage. This is a bit annoying, so add a hack to use the gcc specific __thread extension if C11 TLS is not available. (This is used for the extremely silly mpv-internal way hwdec modules access some platform specific handles. Disabling it simply made hwdec_vaegl.c always fail initialization.) Fixes #2631.
-rw-r--r--video/out/opengl/context.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c
index c863334306..9dbabd16a3 100644
--- a/video/out/opengl/context.c
+++ b/video/out/opengl/context.c
@@ -111,7 +111,13 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt,
}
#if HAVE_C11_TLS
-static _Thread_local MPGLContext *current_context;
+#define MP_TLS _Thread_local
+#elif defined(__GNU__)
+#define MP_TLS __thread
+#endif
+
+#ifdef MP_TLS
+static MP_TLS MPGLContext *current_context;
static void * GLAPIENTRY get_native_display(const char *name)
{