glx: Remove usage of USE_ELF_TLS
authorYonggang Luo <luoyonggang@gmail.com>
Sat, 25 Jun 2022 05:31:52 +0000 (13:31 +0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 29 Jul 2022 23:59:12 +0000 (23:59 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>

src/glx/glxclient.h
src/glx/glxcurrent.c
src/glx/tests/fake_glx_screen.cpp

index 179b4dd..b793bd2 100644 (file)
@@ -650,18 +650,10 @@ extern int __glXDebug;
 
 extern void __glXSetCurrentContext(struct glx_context * c);
 
-# if defined( USE_ELF_TLS )
-
 extern __THREAD_INITIAL_EXEC void *__glX_tls_Context;
 
 #  define __glXGetCurrentContext() __glX_tls_Context
 
-# else
-
-extern struct glx_context *__glXGetCurrentContext(void);
-
-# endif /* defined( USE_ELF_TLS ) */
-
 extern void __glXSetCurrentContextNull(void);
 
 
index 5f0a5fa..b59de79 100644 (file)
@@ -67,8 +67,6 @@ struct glx_context dummyContext = {
 
 _X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
 
-# if defined( USE_ELF_TLS )
-
 /**
  * Per-thread GLX context pointer.
  *
@@ -84,56 +82,6 @@ __glXSetCurrentContext(struct glx_context * c)
    __glX_tls_Context = (c != NULL) ? c : &dummyContext;
 }
 
-# else
-
-static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
-/**
- * Per-thread data key.
- *
- * Once \c init_thread_data has been called, the per-thread data key will
- * take a value of \c NULL.  As each new thread is created the default
- * value, in that thread, will be \c NULL.
- */
-static pthread_key_t ContextTSD;
-
-/**
- * Initialize the per-thread data key.
- *
- * This function is called \b exactly once per-process (not per-thread!) to
- * initialize the per-thread data key.  This is ideally done using the
- * \c pthread_once mechanism.
- */
-static void
-init_thread_data(void)
-{
-   if (pthread_key_create(&ContextTSD, NULL) != 0) {
-      perror("pthread_key_create");
-      exit(-1);
-   }
-}
-
-_X_HIDDEN void
-__glXSetCurrentContext(struct glx_context * c)
-{
-   pthread_once(&once_control, init_thread_data);
-   pthread_setspecific(ContextTSD, c);
-}
-
-_X_HIDDEN struct glx_context *
-__glXGetCurrentContext(void)
-{
-   void *v;
-
-   pthread_once(&once_control, init_thread_data);
-
-   v = pthread_getspecific(ContextTSD);
-   return (v == NULL) ? &dummyContext : (struct glx_context *) v;
-}
-
-# endif /* defined( USE_ELF_TLS ) */
-
-
 _X_HIDDEN void
 __glXSetCurrentContextNull(void)
 {
index 9ccbd64..c8428d4 100644 (file)
@@ -99,11 +99,3 @@ struct glx_context dummyContext = {
    &dummyVtable
 };
 __THREAD_INITIAL_EXEC void *__glX_tls_Context = &dummyContext;
-
-#if !defined(USE_ELF_TLS)
-extern "C" struct glx_context *
-__glXGetCurrentContext()
-{
- return (struct glx_context *) __glX_tls_Context;
-}
-#endif