From: Bas Nieuwenhuizen
Date: Sat, 3 Aug 2019 16:44:44 +0000 (+0200)
Subject: mesa: Rename GLX_USE_TLS to USE_ELF_TLS.
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9f37c9903b87f86a533bfaffa72f0ecb285b02b2;p=mesa.git
mesa: Rename GLX_USE_TLS to USE_ELF_TLS.
These days it is not GLX only and it does not work with all TLS
implementations.
Reviewed-by: Eric Engestrom
---
diff --git a/docs/dispatch.html b/docs/dispatch.html
index 7860f2833a8..1e6377ad818 100644
--- a/docs/dispatch.html
+++ b/docs/dispatch.html
@@ -166,8 +166,8 @@ extern __thread struct _glapi_table *_glapi_tls_Dispatch
Use of this path is controlled by the preprocessor define
-GLX_USE_TLS
. Any platform capable of using TLS should use this as
-the default dispatch method.
+USE_ELF_TLS
. Any platform capable of using ELF TLS should use this
+as the default dispatch method.
3.3. Assembly Language Dispatch Stubs
@@ -204,7 +204,7 @@ terribly relevant.
few preprocessor defines.
-- If
GLX_USE_TLS
is defined, method #3 is used.
+- If
USE_ELF_TLS
is defined, method #3 is used.
- If
HAVE_PTHREAD
is defined, method #2 is used.
- If none of the preceding are defined, method #1 is used.
diff --git a/meson.build b/meson.build
index 2ca672e492f..61fc8649d55 100644
--- a/meson.build
+++ b/meson.build
@@ -375,9 +375,9 @@ if with_egl and not (with_platform_drm or with_platform_surfaceless or with_plat
endif
endif
-# Android uses emutls for versions <= P/28. For GLX_USE_TLS we need ELF TLS.
+# Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
if not with_platform_android or get_option('platform-sdk-version') >= 29
- pre_args += '-DGLX_USE_TLS'
+ pre_args += '-DUSE_ELF_TLS'
endif
if with_glx != 'disabled'
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index 2e7d164bce1..29be4268025 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -44,7 +44,7 @@ static EGLBoolean _egl_TSDInitialized;
static tss_t _egl_TSD;
static void _eglDestroyThreadInfo(_EGLThreadInfo *t);
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
static __thread const _EGLThreadInfo *_egl_TLS
__attribute__ ((tls_model("initial-exec")));
#endif
@@ -52,14 +52,14 @@ static __thread const _EGLThreadInfo *_egl_TLS
static inline void _eglSetTSD(const _EGLThreadInfo *t)
{
tss_set(_egl_TSD, (void *) t);
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
_egl_TLS = t;
#endif
}
static inline _EGLThreadInfo *_eglGetTSD(void)
{
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
return (_EGLThreadInfo *) _egl_TLS;
#else
return (_EGLThreadInfo *) tss_get(_egl_TSD);
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 3e8274e1c3a..2a7437fcd1b 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -660,7 +660,7 @@ extern int __glXDebug;
extern void __glXSetCurrentContext(struct glx_context * c);
-# if defined( GLX_USE_TLS )
+# if defined( USE_ELF_TLS )
extern __thread void *__glX_tls_Context
__attribute__ ((tls_model("initial-exec")));
@@ -671,7 +671,7 @@ extern __thread void *__glX_tls_Context
extern struct glx_context *__glXGetCurrentContext(void);
-# endif /* defined( GLX_USE_TLS ) */
+# endif /* defined( USE_ELF_TLS ) */
extern void __glXSetCurrentContextNull(void);
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 2b9c708c3ee..9c5d2af8956 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -67,7 +67,7 @@ struct glx_context dummyContext = {
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
-# if defined( GLX_USE_TLS )
+# if defined( USE_ELF_TLS )
/**
* Per-thread GLX context pointer.
@@ -132,7 +132,7 @@ __glXGetCurrentContext(void)
return (v == NULL) ? &dummyContext : (struct glx_context *) v;
}
-# endif /* defined( GLX_USE_TLS ) */
+# endif /* defined( USE_ELF_TLS ) */
_X_HIDDEN void
diff --git a/src/glx/tests/fake_glx_screen.cpp b/src/glx/tests/fake_glx_screen.cpp
index ca0ca368053..e0f0b7c0db0 100644
--- a/src/glx/tests/fake_glx_screen.cpp
+++ b/src/glx/tests/fake_glx_screen.cpp
@@ -102,7 +102,7 @@ struct glx_context dummyContext = {
};
__thread void *__glX_tls_Context = &dummyContext;
-#if !defined(GLX_USE_TLS)
+#if !defined(USE_ELF_TLS)
extern "C" struct glx_context *
__glXGetCurrentContext()
{
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 3112af4be60..d8d71c30200 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -552,7 +552,7 @@ loader_open_driver(const char *driver_name,
next = end;
len = next - p;
-#if GLX_USE_TLS
+#if USE_ELF_TLS
snprintf(path, sizeof(path), "%.*s/tls/%s_dri.so", len, p, driver_name);
driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
#endif
diff --git a/src/mapi/entry.c b/src/mapi/entry.c
index 1e250122c4a..b5126ade4cb 100644
--- a/src/mapi/entry.c
+++ b/src/mapi/entry.c
@@ -46,15 +46,15 @@
#endif
#if defined(USE_X86_ASM) && defined(__GNUC__)
-# ifdef GLX_USE_TLS
+# ifdef USE_ELF_TLS
# include "entry_x86_tls.h"
# else
# include "entry_x86_tsd.h"
# endif
-#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS)
+#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(USE_ELF_TLS)
# include "entry_x86-64_tls.h"
#elif defined(USE_PPC64LE_ASM) && defined(__GNUC__) && defined(PIPE_ARCH_LITTLE_ENDIAN)
-# ifdef GLX_USE_TLS
+# ifdef USE_ELF_TLS
# include "entry_ppc64le_tls.h"
# else
# include "entry_ppc64le_tsd.h"
diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py b/src/mapi/glapi/gen/gl_SPARC_asm.py
index 0152958a8b9..34e83adaeca 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -77,7 +77,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('\t add\t%o7, %g2, %g2')
print('\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc')
print('')
- print('#ifdef GLX_USE_TLS')
+ print('#ifdef USE_ELF_TLS')
print('')
print('\tGLOBL_FN(__glapi_sparc_get_dispatch)')
print('\tHIDDEN(__glapi_sparc_get_dispatch)')
diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
index 36d3ecdde92..f51f513c5ed 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -143,7 +143,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('')
print('\t.text')
print('')
- print('#ifdef GLX_USE_TLS')
+ print('#ifdef USE_ELF_TLS')
print('')
print('_x86_64_get_dispatch:')
print('\tmovq\t_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax')
@@ -227,7 +227,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
if not f.is_static_entry_point(f.name):
print('\tHIDDEN(GL_PREFIX(%s))' % (name))
print('GL_PREFIX(%s):' % (name))
- print('#if defined(GLX_USE_TLS)')
+ print('#if defined(USE_ELF_TLS)')
print('\tcall\t_x86_64_get_dispatch@PLT')
print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
print('\tjmp\t*%r11')
@@ -258,7 +258,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
print('\tjmp\t*%r11')
- print('#endif /* defined(GLX_USE_TLS) */')
+ print('#endif /* defined(USE_ELF_TLS) */')
print('\t.size\tGL_PREFIX(%s), .-GL_PREFIX(%s)' % (name, name))
print('')
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index ada849f35e9..f373d15db4a 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -81,7 +81,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('#endif')
print('')
print('')
- print('#ifdef GLX_USE_TLS')
+ print('#ifdef USE_ELF_TLS')
print('')
print('#ifdef GLX_X86_READONLY_TEXT')
print('# define CTX_INSNS MOV_L(GS:(EAX), EAX)')
@@ -132,7 +132,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('')
print('SEG_TEXT')
print('')
- print('#ifdef GLX_USE_TLS')
+ print('#ifdef USE_ELF_TLS')
print('')
print('\tGLOBL\tGLNAME(_x86_get_dispatch)')
print('\tHIDDEN(GLNAME(_x86_get_dispatch))')
@@ -161,9 +161,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('#endif')
print('')
- print('#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT )')
+ print('#if defined( USE_ELF_TLS ) && !defined( GLX_X86_READONLY_TEXT )')
print('\t\t.section\twtext, "awx", @progbits')
- print('#endif /* defined( GLX_USE_TLS ) */')
+ print('#endif /* defined( USE_ELF_TLS ) */')
print('')
print('\t\tALIGNTEXT16')
diff --git a/src/mapi/glapi/glapi.c b/src/mapi/glapi/glapi.c
index 55258a476c7..53cfd7f087a 100644
--- a/src/mapi/glapi/glapi.c
+++ b/src/mapi/glapi/glapi.c
@@ -33,11 +33,11 @@
* u_current.c.
*/
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
/* not used, but defined for compatibility */
const struct _glapi_table *_glapi_Dispatch;
const void *_glapi_Context;
-#endif /* GLX_USE_TLS */
+#endif /* USE_ELF_TLS */
void
_glapi_destroy_multithread(void)
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index d5d4e0a03a6..3e852a935bc 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -86,7 +86,7 @@ typedef void (*_glapi_nop_handler_proc)(const char *name);
struct _glapi_table;
-#if defined (GLX_USE_TLS)
+#if defined (USE_ELF_TLS)
_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch
__attribute__((tls_model("initial-exec")));
@@ -111,7 +111,7 @@ _GLAPI_EXPORT extern void *_glapi_Context;
#define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
-#endif /* defined (GLX_USE_TLS) */
+#endif /* defined (USE_ELF_TLS) */
void
diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c
index f1f7f5e5955..ff20bac4810 100644
--- a/src/mapi/glapi/glapi_entrypoint.c
+++ b/src/mapi/glapi/glapi_entrypoint.c
@@ -38,7 +38,7 @@
#ifdef USE_X86_ASM
-#if defined( GLX_USE_TLS )
+#if defined( USE_ELF_TLS )
extern GLubyte gl_dispatch_functions_start[];
extern GLubyte gl_dispatch_functions_end[];
#else
@@ -68,7 +68,7 @@ get_entrypoint_address(unsigned int functionOffset)
static void
init_glapi_relocs( void )
{
-#if defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
+#if defined(USE_ELF_TLS) && !defined(GLX_X86_READONLY_TEXT)
extern unsigned long _x86_get_dispatch(void);
char run_time_patch[] = {
0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
@@ -121,7 +121,7 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset)
{
GLubyte * const code = (GLubyte *) entrypoint;
-#if defined(GLX_USE_TLS)
+#if defined(USE_ELF_TLS)
*((unsigned int *)(code + 8)) = 4 * offset;
#else
*((unsigned int *)(code + 11)) = 4 * offset;
@@ -137,9 +137,9 @@ extern void __glapi_sparc_icache_flush(unsigned int *);
static void
init_glapi_relocs( void )
{
-#if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
+#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
static const unsigned int template[] = {
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
0x8730e00a, /* srl %g3, 10, %g3 */
0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
@@ -190,7 +190,7 @@ init_glapi_relocs( void )
0x81e80000, /* --> restore */
#endif
};
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
extern unsigned int __glapi_sparc_tls_stub;
extern unsigned long __glapi_sparc_get_dispatch(void);
unsigned int *code = &__glapi_sparc_tls_stub;
@@ -203,7 +203,7 @@ init_glapi_relocs( void )
int idx;
#endif
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
code[0] = template[0] | (dispatch >> 10);
code[1] = template[1];
__glapi_sparc_icache_flush(&code[0]);
@@ -267,14 +267,14 @@ init_glapi_relocs( void )
_glapi_proc
generate_entrypoint(GLuint functionOffset)
{
-#if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
+#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
static const unsigned int template[] = {
0x07000000, /* sethi %hi(0), %g3 */
0x8210000f, /* mov %o7, %g1 */
0x40000000, /* call */
0x9e100001, /* mov %g1, %o7 */
};
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
extern unsigned int __glapi_sparc_tls_stub;
unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
#else
@@ -338,7 +338,7 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
void
init_glapi_relocs_once( void )
{
-#if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
+#if defined(HAVE_PTHREAD) || defined(USE_ELF_TLS)
static once_flag flag = ONCE_FLAG_INIT;
call_once(&flag, init_glapi_relocs);
#endif
diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index ddfc594a979..ad37c8bfdf3 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -62,7 +62,7 @@ get_entrypoint_address(unsigned int functionOffset);
* Size (in bytes) of dispatch function (entrypoint).
*/
#if defined(USE_X86_ASM)
-# if defined(GLX_USE_TLS)
+# if defined(USE_ELF_TLS)
# define DISPATCH_FUNCTION_SIZE 16
# else
# define DISPATCH_FUNCTION_SIZE 32
@@ -70,7 +70,7 @@ get_entrypoint_address(unsigned int functionOffset);
#endif
#if defined(USE_X64_64_ASM)
-# if defined(GLX_USE_TLS)
+# if defined(USE_ELF_TLS)
# define DISPATCH_FUNCTION_SIZE 16
# endif
#endif
diff --git a/src/mapi/mapi_glapi.c b/src/mapi/mapi_glapi.c
index 3a376e81bdd..f25c81a4ae6 100644
--- a/src/mapi/mapi_glapi.c
+++ b/src/mapi/mapi_glapi.c
@@ -38,11 +38,11 @@
* u_current.c.
*/
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
/* not used, but defined for compatibility */
const struct _glapi_table *_glapi_Dispatch;
const void *_glapi_Context;
-#endif /* GLX_USE_TLS */
+#endif /* USE_ELF_TLS */
void
_glapi_destroy_multithread(void)
diff --git a/src/mapi/u_current.c b/src/mapi/u_current.c
index 1402cea45d5..554c9740477 100644
--- a/src/mapi/u_current.c
+++ b/src/mapi/u_current.c
@@ -97,7 +97,7 @@ extern void (*__glapi_noop_table[])(void);
* between TLS enabled loaders and non-TLS DRI drivers.
*/
/*@{*/
-#if defined(GLX_USE_TLS)
+#if defined(USE_ELF_TLS)
__thread struct _glapi_table *u_current_table
__attribute__((tls_model("initial-exec")))
@@ -116,21 +116,21 @@ tss_t u_current_table_tsd;
static tss_t u_current_context_tsd;
static int ThreadSafe;
-#endif /* defined(GLX_USE_TLS) */
+#endif /* defined(USE_ELF_TLS) */
/*@}*/
void
u_current_destroy(void)
{
-#if !defined(GLX_USE_TLS)
+#if !defined(USE_ELF_TLS)
tss_delete(u_current_table_tsd);
tss_delete(u_current_context_tsd);
#endif
}
-#if !defined(GLX_USE_TLS)
+#if !defined(USE_ELF_TLS)
static void
u_current_init_tsd(void)
@@ -230,7 +230,7 @@ u_current_set_context(const void *ptr)
{
u_current_init();
-#if defined(GLX_USE_TLS)
+#if defined(USE_ELF_TLS)
u_current_context = (void *) ptr;
#else
tss_set(u_current_context_tsd, (void *) ptr);
@@ -246,7 +246,7 @@ u_current_set_context(const void *ptr)
void *
u_current_get_context_internal(void)
{
-#if defined(GLX_USE_TLS)
+#if defined(USE_ELF_TLS)
return u_current_context;
#else
return ThreadSafe ? tss_get(u_current_context_tsd) : u_current_context;
@@ -268,7 +268,7 @@ u_current_set_table(const struct _glapi_table *tbl)
if (!tbl)
tbl = (const struct _glapi_table *) table_noop_array;
-#if defined(GLX_USE_TLS)
+#if defined(USE_ELF_TLS)
u_current_table = (struct _glapi_table *) tbl;
#else
tss_set(u_current_table_tsd, (void *) tbl);
@@ -282,7 +282,7 @@ u_current_set_table(const struct _glapi_table *tbl)
struct _glapi_table *
u_current_get_table_internal(void)
{
-#if defined(GLX_USE_TLS)
+#if defined(USE_ELF_TLS)
return u_current_table;
#else
if (ThreadSafe)
diff --git a/src/mapi/u_current.h b/src/mapi/u_current.h
index 3c9a414ee84..9a79f0bf93a 100644
--- a/src/mapi/u_current.h
+++ b/src/mapi/u_current.h
@@ -10,7 +10,7 @@
#include "glapi/glapi.h"
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
#define u_current_table _glapi_tls_Dispatch
#define u_current_context _glapi_tls_Context
#else
@@ -27,7 +27,7 @@
struct _glapi_table;
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
extern __thread struct _glapi_table *u_current_table
__attribute__((tls_model("initial-exec")));
@@ -35,12 +35,12 @@ extern __thread struct _glapi_table *u_current_table
extern __thread void *u_current_context
__attribute__((tls_model("initial-exec")));
-#else /* GLX_USE_TLS */
+#else /* USE_ELF_TLS */
extern struct _glapi_table *u_current_table;
extern void *u_current_context;
-#endif /* GLX_USE_TLS */
+#endif /* USE_ELF_TLS */
#endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
@@ -65,7 +65,7 @@ u_current_get_context_internal(void);
static inline const struct _glapi_table *
u_current_get_table(void)
{
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
return u_current_table;
#else
return (likely(u_current_table) ?
@@ -76,7 +76,7 @@ u_current_get_table(void)
static inline const void *
u_current_get_context(void)
{
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
return u_current_context;
#else
return likely(u_current_context) ? u_current_context : u_current_get_context_internal();