Mesa (main): glx: Remove usage of USE_ELF_TLS

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jul 30 02:03:35 UTC 2022


Module: Mesa
Branch: main
Commit: aa0b8575440fdb40891d3d666607dbe957c0294a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa0b8575440fdb40891d3d666607dbe957c0294a

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Sat Jun 25 13:31:52 2022 +0800

glx: Remove usage of USE_ELF_TLS

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213>

---

 src/glx/glxclient.h               |  8 ------
 src/glx/glxcurrent.c              | 52 ---------------------------------------
 src/glx/tests/fake_glx_screen.cpp |  8 ------
 3 files changed, 68 deletions(-)

diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 179b4ddff4d..b793bd2e275 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -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);
 
 
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 5f0a5fae627..b59de799467 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -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)
 {
diff --git a/src/glx/tests/fake_glx_screen.cpp b/src/glx/tests/fake_glx_screen.cpp
index 9ccbd64f23b..c8428d413a8 100644
--- a/src/glx/tests/fake_glx_screen.cpp
+++ b/src/glx/tests/fake_glx_screen.cpp
@@ -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



More information about the mesa-commit mailing list