</blockquote>
<p>Use of this path is controlled by the preprocessor define
-<code>GLX_USE_TLS</code>. Any platform capable of using TLS should use this as
-the default dispatch method.</p>
+<code>USE_ELF_TLS</code>. Any platform capable of using ELF TLS should use this
+as the default dispatch method.</p>
<h3>3.3. Assembly Language Dispatch Stubs</h3>
few preprocessor defines.</p>
<ul>
-<li>If <code>GLX_USE_TLS</code> is defined, method #3 is used.</li>
+<li>If <code>USE_ELF_TLS</code> is defined, method #3 is used.</li>
<li>If <code>HAVE_PTHREAD</code> is defined, method #2 is used.</li>
<li>If none of the preceding are defined, method #1 is used.</li>
</ul>
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'
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
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);
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")));
extern struct glx_context *__glXGetCurrentContext(void);
-# endif /* defined( GLX_USE_TLS ) */
+# endif /* defined( USE_ELF_TLS ) */
extern void __glXSetCurrentContextNull(void);
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
-# if defined( GLX_USE_TLS )
+# if defined( USE_ELF_TLS )
/**
* Per-thread GLX context pointer.
return (v == NULL) ? &dummyContext : (struct glx_context *) v;
}
-# endif /* defined( GLX_USE_TLS ) */
+# endif /* defined( USE_ELF_TLS ) */
_X_HIDDEN void
};
__thread void *__glX_tls_Context = &dummyContext;
-#if !defined(GLX_USE_TLS)
+#if !defined(USE_ELF_TLS)
extern "C" struct glx_context *
__glXGetCurrentContext()
{
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
#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"
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)')
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')
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')
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('')
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)')
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))')
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')
* 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)
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")));
#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
#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
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 */
{
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;
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 */
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;
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]);
_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
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
* 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
#endif
#if defined(USE_X64_64_ASM)
-# if defined(GLX_USE_TLS)
+# if defined(USE_ELF_TLS)
# define DISPATCH_FUNCTION_SIZE 16
# endif
#endif
* 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)
* 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")))
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)
{
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);
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;
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);
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)
#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
struct _glapi_table;
-#ifdef GLX_USE_TLS
+#ifdef USE_ELF_TLS
extern __thread struct _glapi_table *u_current_table
__attribute__((tls_model("initial-exec")));
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 */
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) ?
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();