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 <eric.engestrom@intel.com>
This commit is contained in:
@@ -166,8 +166,8 @@ extern __thread struct _glapi_table *_glapi_tls_Dispatch
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<p>Use of this path is controlled by the preprocessor define
|
<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
|
<code>USE_ELF_TLS</code>. Any platform capable of using ELF TLS should use this
|
||||||
the default dispatch method.</p>
|
as the default dispatch method.</p>
|
||||||
|
|
||||||
<h3>3.3. Assembly Language Dispatch Stubs</h3>
|
<h3>3.3. Assembly Language Dispatch Stubs</h3>
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ terribly relevant.</p>
|
|||||||
few preprocessor defines.</p>
|
few preprocessor defines.</p>
|
||||||
|
|
||||||
<ul>
|
<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 <code>HAVE_PTHREAD</code> is defined, method #2 is used.</li>
|
||||||
<li>If none of the preceding are defined, method #1 is used.</li>
|
<li>If none of the preceding are defined, method #1 is used.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -375,9 +375,9 @@ if with_egl and not (with_platform_drm or with_platform_surfaceless or with_plat
|
|||||||
endif
|
endif
|
||||||
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
|
if not with_platform_android or get_option('platform-sdk-version') >= 29
|
||||||
pre_args += '-DGLX_USE_TLS'
|
pre_args += '-DUSE_ELF_TLS'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if with_glx != 'disabled'
|
if with_glx != 'disabled'
|
||||||
|
@@ -44,7 +44,7 @@ static EGLBoolean _egl_TSDInitialized;
|
|||||||
static tss_t _egl_TSD;
|
static tss_t _egl_TSD;
|
||||||
static void _eglDestroyThreadInfo(_EGLThreadInfo *t);
|
static void _eglDestroyThreadInfo(_EGLThreadInfo *t);
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
static __thread const _EGLThreadInfo *_egl_TLS
|
static __thread const _EGLThreadInfo *_egl_TLS
|
||||||
__attribute__ ((tls_model("initial-exec")));
|
__attribute__ ((tls_model("initial-exec")));
|
||||||
#endif
|
#endif
|
||||||
@@ -52,14 +52,14 @@ static __thread const _EGLThreadInfo *_egl_TLS
|
|||||||
static inline void _eglSetTSD(const _EGLThreadInfo *t)
|
static inline void _eglSetTSD(const _EGLThreadInfo *t)
|
||||||
{
|
{
|
||||||
tss_set(_egl_TSD, (void *) t);
|
tss_set(_egl_TSD, (void *) t);
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
_egl_TLS = t;
|
_egl_TLS = t;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline _EGLThreadInfo *_eglGetTSD(void)
|
static inline _EGLThreadInfo *_eglGetTSD(void)
|
||||||
{
|
{
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
return (_EGLThreadInfo *) _egl_TLS;
|
return (_EGLThreadInfo *) _egl_TLS;
|
||||||
#else
|
#else
|
||||||
return (_EGLThreadInfo *) tss_get(_egl_TSD);
|
return (_EGLThreadInfo *) tss_get(_egl_TSD);
|
||||||
|
@@ -660,7 +660,7 @@ extern int __glXDebug;
|
|||||||
|
|
||||||
extern void __glXSetCurrentContext(struct glx_context * c);
|
extern void __glXSetCurrentContext(struct glx_context * c);
|
||||||
|
|
||||||
# if defined( GLX_USE_TLS )
|
# if defined( USE_ELF_TLS )
|
||||||
|
|
||||||
extern __thread void *__glX_tls_Context
|
extern __thread void *__glX_tls_Context
|
||||||
__attribute__ ((tls_model("initial-exec")));
|
__attribute__ ((tls_model("initial-exec")));
|
||||||
@@ -671,7 +671,7 @@ extern __thread void *__glX_tls_Context
|
|||||||
|
|
||||||
extern struct glx_context *__glXGetCurrentContext(void);
|
extern struct glx_context *__glXGetCurrentContext(void);
|
||||||
|
|
||||||
# endif /* defined( GLX_USE_TLS ) */
|
# endif /* defined( USE_ELF_TLS ) */
|
||||||
|
|
||||||
extern void __glXSetCurrentContextNull(void);
|
extern void __glXSetCurrentContextNull(void);
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ struct glx_context dummyContext = {
|
|||||||
|
|
||||||
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
|
_X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
# if defined( GLX_USE_TLS )
|
# if defined( USE_ELF_TLS )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Per-thread GLX context pointer.
|
* Per-thread GLX context pointer.
|
||||||
@@ -132,7 +132,7 @@ __glXGetCurrentContext(void)
|
|||||||
return (v == NULL) ? &dummyContext : (struct glx_context *) v;
|
return (v == NULL) ? &dummyContext : (struct glx_context *) v;
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif /* defined( GLX_USE_TLS ) */
|
# endif /* defined( USE_ELF_TLS ) */
|
||||||
|
|
||||||
|
|
||||||
_X_HIDDEN void
|
_X_HIDDEN void
|
||||||
|
@@ -102,7 +102,7 @@ struct glx_context dummyContext = {
|
|||||||
};
|
};
|
||||||
__thread void *__glX_tls_Context = &dummyContext;
|
__thread void *__glX_tls_Context = &dummyContext;
|
||||||
|
|
||||||
#if !defined(GLX_USE_TLS)
|
#if !defined(USE_ELF_TLS)
|
||||||
extern "C" struct glx_context *
|
extern "C" struct glx_context *
|
||||||
__glXGetCurrentContext()
|
__glXGetCurrentContext()
|
||||||
{
|
{
|
||||||
|
@@ -552,7 +552,7 @@ loader_open_driver(const char *driver_name,
|
|||||||
next = end;
|
next = end;
|
||||||
|
|
||||||
len = next - p;
|
len = next - p;
|
||||||
#if GLX_USE_TLS
|
#if USE_ELF_TLS
|
||||||
snprintf(path, sizeof(path), "%.*s/tls/%s_dri.so", len, p, driver_name);
|
snprintf(path, sizeof(path), "%.*s/tls/%s_dri.so", len, p, driver_name);
|
||||||
driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
|
driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -46,15 +46,15 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_X86_ASM) && defined(__GNUC__)
|
#if defined(USE_X86_ASM) && defined(__GNUC__)
|
||||||
# ifdef GLX_USE_TLS
|
# ifdef USE_ELF_TLS
|
||||||
# include "entry_x86_tls.h"
|
# include "entry_x86_tls.h"
|
||||||
# else
|
# else
|
||||||
# include "entry_x86_tsd.h"
|
# include "entry_x86_tsd.h"
|
||||||
# endif
|
# 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"
|
# include "entry_x86-64_tls.h"
|
||||||
#elif defined(USE_PPC64LE_ASM) && defined(__GNUC__) && defined(PIPE_ARCH_LITTLE_ENDIAN)
|
#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"
|
# include "entry_ppc64le_tls.h"
|
||||||
# else
|
# else
|
||||||
# include "entry_ppc64le_tsd.h"
|
# include "entry_ppc64le_tsd.h"
|
||||||
|
@@ -77,7 +77,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
|
|||||||
print('\t add\t%o7, %g2, %g2')
|
print('\t add\t%o7, %g2, %g2')
|
||||||
print('\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc')
|
print('\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc')
|
||||||
print('')
|
print('')
|
||||||
print('#ifdef GLX_USE_TLS')
|
print('#ifdef USE_ELF_TLS')
|
||||||
print('')
|
print('')
|
||||||
print('\tGLOBL_FN(__glapi_sparc_get_dispatch)')
|
print('\tGLOBL_FN(__glapi_sparc_get_dispatch)')
|
||||||
print('\tHIDDEN(__glapi_sparc_get_dispatch)')
|
print('\tHIDDEN(__glapi_sparc_get_dispatch)')
|
||||||
|
@@ -143,7 +143,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
|
|||||||
print('')
|
print('')
|
||||||
print('\t.text')
|
print('\t.text')
|
||||||
print('')
|
print('')
|
||||||
print('#ifdef GLX_USE_TLS')
|
print('#ifdef USE_ELF_TLS')
|
||||||
print('')
|
print('')
|
||||||
print('_x86_64_get_dispatch:')
|
print('_x86_64_get_dispatch:')
|
||||||
print('\tmovq\t_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax')
|
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):
|
if not f.is_static_entry_point(f.name):
|
||||||
print('\tHIDDEN(GL_PREFIX(%s))' % (name))
|
print('\tHIDDEN(GL_PREFIX(%s))' % (name))
|
||||||
print('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('\tcall\t_x86_64_get_dispatch@PLT')
|
||||||
print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
|
print('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
|
||||||
print('\tjmp\t*%r11')
|
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('\tmovq\t%u(%%rax), %%r11' % (f.offset * 8))
|
||||||
print('\tjmp\t*%r11')
|
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('\t.size\tGL_PREFIX(%s), .-GL_PREFIX(%s)' % (name, name))
|
||||||
print('')
|
print('')
|
||||||
|
@@ -81,7 +81,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
|
|||||||
print('#endif')
|
print('#endif')
|
||||||
print('')
|
print('')
|
||||||
print('')
|
print('')
|
||||||
print('#ifdef GLX_USE_TLS')
|
print('#ifdef USE_ELF_TLS')
|
||||||
print('')
|
print('')
|
||||||
print('#ifdef GLX_X86_READONLY_TEXT')
|
print('#ifdef GLX_X86_READONLY_TEXT')
|
||||||
print('# define CTX_INSNS MOV_L(GS:(EAX), EAX)')
|
print('# define CTX_INSNS MOV_L(GS:(EAX), EAX)')
|
||||||
@@ -132,7 +132,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
|
|||||||
print('')
|
print('')
|
||||||
print('SEG_TEXT')
|
print('SEG_TEXT')
|
||||||
print('')
|
print('')
|
||||||
print('#ifdef GLX_USE_TLS')
|
print('#ifdef USE_ELF_TLS')
|
||||||
print('')
|
print('')
|
||||||
print('\tGLOBL\tGLNAME(_x86_get_dispatch)')
|
print('\tGLOBL\tGLNAME(_x86_get_dispatch)')
|
||||||
print('\tHIDDEN(GLNAME(_x86_get_dispatch))')
|
print('\tHIDDEN(GLNAME(_x86_get_dispatch))')
|
||||||
@@ -161,9 +161,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
|
|||||||
print('#endif')
|
print('#endif')
|
||||||
print('')
|
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('\t\t.section\twtext, "awx", @progbits')
|
||||||
print('#endif /* defined( GLX_USE_TLS ) */')
|
print('#endif /* defined( USE_ELF_TLS ) */')
|
||||||
|
|
||||||
print('')
|
print('')
|
||||||
print('\t\tALIGNTEXT16')
|
print('\t\tALIGNTEXT16')
|
||||||
|
@@ -33,11 +33,11 @@
|
|||||||
* u_current.c.
|
* u_current.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
/* not used, but defined for compatibility */
|
/* not used, but defined for compatibility */
|
||||||
const struct _glapi_table *_glapi_Dispatch;
|
const struct _glapi_table *_glapi_Dispatch;
|
||||||
const void *_glapi_Context;
|
const void *_glapi_Context;
|
||||||
#endif /* GLX_USE_TLS */
|
#endif /* USE_ELF_TLS */
|
||||||
|
|
||||||
void
|
void
|
||||||
_glapi_destroy_multithread(void)
|
_glapi_destroy_multithread(void)
|
||||||
|
@@ -86,7 +86,7 @@ typedef void (*_glapi_nop_handler_proc)(const char *name);
|
|||||||
struct _glapi_table;
|
struct _glapi_table;
|
||||||
|
|
||||||
|
|
||||||
#if defined (GLX_USE_TLS)
|
#if defined (USE_ELF_TLS)
|
||||||
|
|
||||||
_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch
|
_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch
|
||||||
__attribute__((tls_model("initial-exec")));
|
__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 *) \
|
#define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
|
||||||
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
|
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
|
||||||
|
|
||||||
#endif /* defined (GLX_USE_TLS) */
|
#endif /* defined (USE_ELF_TLS) */
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#ifdef USE_X86_ASM
|
#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_start[];
|
||||||
extern GLubyte gl_dispatch_functions_end[];
|
extern GLubyte gl_dispatch_functions_end[];
|
||||||
#else
|
#else
|
||||||
@@ -68,7 +68,7 @@ get_entrypoint_address(unsigned int functionOffset)
|
|||||||
static void
|
static void
|
||||||
init_glapi_relocs( 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);
|
extern unsigned long _x86_get_dispatch(void);
|
||||||
char run_time_patch[] = {
|
char run_time_patch[] = {
|
||||||
0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
|
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;
|
GLubyte * const code = (GLubyte *) entrypoint;
|
||||||
|
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(USE_ELF_TLS)
|
||||||
*((unsigned int *)(code + 8)) = 4 * offset;
|
*((unsigned int *)(code + 8)) = 4 * offset;
|
||||||
#else
|
#else
|
||||||
*((unsigned int *)(code + 11)) = 4 * offset;
|
*((unsigned int *)(code + 11)) = 4 * offset;
|
||||||
@@ -137,9 +137,9 @@ extern void __glapi_sparc_icache_flush(unsigned int *);
|
|||||||
static void
|
static void
|
||||||
init_glapi_relocs( 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[] = {
|
static const unsigned int template[] = {
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
|
0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
|
||||||
0x8730e00a, /* srl %g3, 10, %g3 */
|
0x8730e00a, /* srl %g3, 10, %g3 */
|
||||||
0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
|
0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
|
||||||
@@ -190,7 +190,7 @@ init_glapi_relocs( void )
|
|||||||
0x81e80000, /* --> restore */
|
0x81e80000, /* --> restore */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
extern unsigned int __glapi_sparc_tls_stub;
|
extern unsigned int __glapi_sparc_tls_stub;
|
||||||
extern unsigned long __glapi_sparc_get_dispatch(void);
|
extern unsigned long __glapi_sparc_get_dispatch(void);
|
||||||
unsigned int *code = &__glapi_sparc_tls_stub;
|
unsigned int *code = &__glapi_sparc_tls_stub;
|
||||||
@@ -203,7 +203,7 @@ init_glapi_relocs( void )
|
|||||||
int idx;
|
int idx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
code[0] = template[0] | (dispatch >> 10);
|
code[0] = template[0] | (dispatch >> 10);
|
||||||
code[1] = template[1];
|
code[1] = template[1];
|
||||||
__glapi_sparc_icache_flush(&code[0]);
|
__glapi_sparc_icache_flush(&code[0]);
|
||||||
@@ -267,14 +267,14 @@ init_glapi_relocs( void )
|
|||||||
_glapi_proc
|
_glapi_proc
|
||||||
generate_entrypoint(GLuint functionOffset)
|
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[] = {
|
static const unsigned int template[] = {
|
||||||
0x07000000, /* sethi %hi(0), %g3 */
|
0x07000000, /* sethi %hi(0), %g3 */
|
||||||
0x8210000f, /* mov %o7, %g1 */
|
0x8210000f, /* mov %o7, %g1 */
|
||||||
0x40000000, /* call */
|
0x40000000, /* call */
|
||||||
0x9e100001, /* mov %g1, %o7 */
|
0x9e100001, /* mov %g1, %o7 */
|
||||||
};
|
};
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
extern unsigned int __glapi_sparc_tls_stub;
|
extern unsigned int __glapi_sparc_tls_stub;
|
||||||
unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
|
unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
|
||||||
#else
|
#else
|
||||||
@@ -338,7 +338,7 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
|
|||||||
void
|
void
|
||||||
init_glapi_relocs_once( 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;
|
static once_flag flag = ONCE_FLAG_INIT;
|
||||||
call_once(&flag, init_glapi_relocs);
|
call_once(&flag, init_glapi_relocs);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -62,7 +62,7 @@ get_entrypoint_address(unsigned int functionOffset);
|
|||||||
* Size (in bytes) of dispatch function (entrypoint).
|
* Size (in bytes) of dispatch function (entrypoint).
|
||||||
*/
|
*/
|
||||||
#if defined(USE_X86_ASM)
|
#if defined(USE_X86_ASM)
|
||||||
# if defined(GLX_USE_TLS)
|
# if defined(USE_ELF_TLS)
|
||||||
# define DISPATCH_FUNCTION_SIZE 16
|
# define DISPATCH_FUNCTION_SIZE 16
|
||||||
# else
|
# else
|
||||||
# define DISPATCH_FUNCTION_SIZE 32
|
# define DISPATCH_FUNCTION_SIZE 32
|
||||||
@@ -70,7 +70,7 @@ get_entrypoint_address(unsigned int functionOffset);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_X64_64_ASM)
|
#if defined(USE_X64_64_ASM)
|
||||||
# if defined(GLX_USE_TLS)
|
# if defined(USE_ELF_TLS)
|
||||||
# define DISPATCH_FUNCTION_SIZE 16
|
# define DISPATCH_FUNCTION_SIZE 16
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -38,11 +38,11 @@
|
|||||||
* u_current.c.
|
* u_current.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
/* not used, but defined for compatibility */
|
/* not used, but defined for compatibility */
|
||||||
const struct _glapi_table *_glapi_Dispatch;
|
const struct _glapi_table *_glapi_Dispatch;
|
||||||
const void *_glapi_Context;
|
const void *_glapi_Context;
|
||||||
#endif /* GLX_USE_TLS */
|
#endif /* USE_ELF_TLS */
|
||||||
|
|
||||||
void
|
void
|
||||||
_glapi_destroy_multithread(void)
|
_glapi_destroy_multithread(void)
|
||||||
|
@@ -97,7 +97,7 @@ extern void (*__glapi_noop_table[])(void);
|
|||||||
* between TLS enabled loaders and non-TLS DRI drivers.
|
* 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
|
__thread struct _glapi_table *u_current_table
|
||||||
__attribute__((tls_model("initial-exec")))
|
__attribute__((tls_model("initial-exec")))
|
||||||
@@ -116,21 +116,21 @@ tss_t u_current_table_tsd;
|
|||||||
static tss_t u_current_context_tsd;
|
static tss_t u_current_context_tsd;
|
||||||
static int ThreadSafe;
|
static int ThreadSafe;
|
||||||
|
|
||||||
#endif /* defined(GLX_USE_TLS) */
|
#endif /* defined(USE_ELF_TLS) */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
u_current_destroy(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_table_tsd);
|
||||||
tss_delete(u_current_context_tsd);
|
tss_delete(u_current_context_tsd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !defined(GLX_USE_TLS)
|
#if !defined(USE_ELF_TLS)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
u_current_init_tsd(void)
|
u_current_init_tsd(void)
|
||||||
@@ -230,7 +230,7 @@ u_current_set_context(const void *ptr)
|
|||||||
{
|
{
|
||||||
u_current_init();
|
u_current_init();
|
||||||
|
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(USE_ELF_TLS)
|
||||||
u_current_context = (void *) ptr;
|
u_current_context = (void *) ptr;
|
||||||
#else
|
#else
|
||||||
tss_set(u_current_context_tsd, (void *) ptr);
|
tss_set(u_current_context_tsd, (void *) ptr);
|
||||||
@@ -246,7 +246,7 @@ u_current_set_context(const void *ptr)
|
|||||||
void *
|
void *
|
||||||
u_current_get_context_internal(void)
|
u_current_get_context_internal(void)
|
||||||
{
|
{
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(USE_ELF_TLS)
|
||||||
return u_current_context;
|
return u_current_context;
|
||||||
#else
|
#else
|
||||||
return ThreadSafe ? tss_get(u_current_context_tsd) : u_current_context;
|
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)
|
if (!tbl)
|
||||||
tbl = (const struct _glapi_table *) table_noop_array;
|
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;
|
u_current_table = (struct _glapi_table *) tbl;
|
||||||
#else
|
#else
|
||||||
tss_set(u_current_table_tsd, (void *) tbl);
|
tss_set(u_current_table_tsd, (void *) tbl);
|
||||||
@@ -282,7 +282,7 @@ u_current_set_table(const struct _glapi_table *tbl)
|
|||||||
struct _glapi_table *
|
struct _glapi_table *
|
||||||
u_current_get_table_internal(void)
|
u_current_get_table_internal(void)
|
||||||
{
|
{
|
||||||
#if defined(GLX_USE_TLS)
|
#if defined(USE_ELF_TLS)
|
||||||
return u_current_table;
|
return u_current_table;
|
||||||
#else
|
#else
|
||||||
if (ThreadSafe)
|
if (ThreadSafe)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "glapi/glapi.h"
|
#include "glapi/glapi.h"
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
#define u_current_table _glapi_tls_Dispatch
|
#define u_current_table _glapi_tls_Dispatch
|
||||||
#define u_current_context _glapi_tls_Context
|
#define u_current_context _glapi_tls_Context
|
||||||
#else
|
#else
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
struct _glapi_table;
|
struct _glapi_table;
|
||||||
|
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
|
|
||||||
extern __thread struct _glapi_table *u_current_table
|
extern __thread struct _glapi_table *u_current_table
|
||||||
__attribute__((tls_model("initial-exec")));
|
__attribute__((tls_model("initial-exec")));
|
||||||
@@ -35,12 +35,12 @@ extern __thread struct _glapi_table *u_current_table
|
|||||||
extern __thread void *u_current_context
|
extern __thread void *u_current_context
|
||||||
__attribute__((tls_model("initial-exec")));
|
__attribute__((tls_model("initial-exec")));
|
||||||
|
|
||||||
#else /* GLX_USE_TLS */
|
#else /* USE_ELF_TLS */
|
||||||
|
|
||||||
extern struct _glapi_table *u_current_table;
|
extern struct _glapi_table *u_current_table;
|
||||||
extern void *u_current_context;
|
extern void *u_current_context;
|
||||||
|
|
||||||
#endif /* GLX_USE_TLS */
|
#endif /* USE_ELF_TLS */
|
||||||
|
|
||||||
#endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
|
#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 *
|
static inline const struct _glapi_table *
|
||||||
u_current_get_table(void)
|
u_current_get_table(void)
|
||||||
{
|
{
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
return u_current_table;
|
return u_current_table;
|
||||||
#else
|
#else
|
||||||
return (likely(u_current_table) ?
|
return (likely(u_current_table) ?
|
||||||
@@ -76,7 +76,7 @@ u_current_get_table(void)
|
|||||||
static inline const void *
|
static inline const void *
|
||||||
u_current_get_context(void)
|
u_current_get_context(void)
|
||||||
{
|
{
|
||||||
#ifdef GLX_USE_TLS
|
#ifdef USE_ELF_TLS
|
||||||
return u_current_context;
|
return u_current_context;
|
||||||
#else
|
#else
|
||||||
return likely(u_current_context) ? u_current_context : u_current_get_context_internal();
|
return likely(u_current_context) ? u_current_context : u_current_get_context_internal();
|
||||||
|
Reference in New Issue
Block a user