glapi: rename exported symbols so as not to conflict with old libglapi

libwaffle 1.7.0 has a hack that dlopen's libglapi with RTLD_GLOBAL, which
was meant to preload libglapi, but with this MR it overwrites libgallium's
own symbols, which breaks libgallium.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Engestrom <None>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32789>
This commit is contained in:
Marek Olšák
2025-01-22 09:44:30 -05:00
committed by Marge Bot
parent 6e3ee3a072
commit e7214b9446
38 changed files with 145 additions and 145 deletions

View File

@@ -78,8 +78,8 @@ The problem with this simple implementation is the large amount of
overhead that it adds to every GL function call. overhead that it adds to every GL function call.
In a multithreaded environment, a naive implementation of In a multithreaded environment, a naive implementation of
``GET_DISPATCH()`` involves a call to ``_glapi_get_dispatch()`` or ``GET_DISPATCH()`` involves a call to ``_mesa_glapi_get_dispatch()`` or
``_glapi_tls_Dispatch``. ``_mesa_glapi_tls_Dispatch``.
3. Optimizations 3. Optimizations
---------------- ----------------
@@ -96,11 +96,11 @@ Starting with the 2.4.20 Linux kernel, each thread is allocated an area
of per-thread, global storage. Variables can be put in this area using of per-thread, global storage. Variables can be put in this area using
some extensions to GCC that called ``ELF TLS``. By storing the dispatch table some extensions to GCC that called ``ELF TLS``. By storing the dispatch table
pointer in this area, the expensive call to ``pthread_getspecific`` and pointer in this area, the expensive call to ``pthread_getspecific`` and
the test of ``_glapi_Dispatch`` can be avoided. As we don't support for the test of ``_mesa_glapi_Dispatch`` can be avoided. As we don't support for
Linux kernel earlier than 2.4.20, so we can always using ``ELF TLS``. Linux kernel earlier than 2.4.20, so we can always using ``ELF TLS``.
The dispatch table pointer is stored in a new variable called The dispatch table pointer is stored in a new variable called
``_glapi_tls_Dispatch``. A new variable name is used so that a single ``_mesa_glapi_tls_Dispatch``. A new variable name is used so that a single
libGL can implement both interfaces. This allows the libGL to operate libGL can implement both interfaces. This allows the libGL to operate
with direct rendering drivers that use either interface. Once the with direct rendering drivers that use either interface. Once the
pointer is properly declared, ``GET_DISPACH`` becomes a simple variable pointer is properly declared, ``GET_DISPACH`` becomes a simple variable
@@ -109,9 +109,9 @@ reference.
.. code-block:: c .. code-block:: c
:caption: TLS ``GET_DISPATCH`` Implementation :caption: TLS ``GET_DISPATCH`` Implementation
extern __THREAD_INITIAL_EXEC struct _glapi_table *_glapi_tls_Dispatch; extern __THREAD_INITIAL_EXEC struct _glapi_table *_mesa_glapi_tls_Dispatch;
#define GET_DISPATCH() _glapi_tls_Dispatch #define GET_DISPATCH() _mesa_glapi_tls_Dispatch
3.2. Assembly Language Dispatch Stubs 3.2. Assembly Language Dispatch Stubs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -129,11 +129,11 @@ The biggest hurdle to creating assembly stubs is handling the various
ways that the dispatch table pointer can be accessed. There are four ways that the dispatch table pointer can be accessed. There are four
different methods that can be used: different methods that can be used:
#. Using ``_glapi_Dispatch`` directly in builds for non-multithreaded #. Using ``_mesa_glapi_Dispatch`` directly in builds for non-multithreaded
environments. environments.
#. Using ``_glapi_Dispatch`` and ``_glapi_get_dispatch`` in #. Using ``_mesa_glapi_Dispatch`` and ``_mesa_glapi_get_dispatch`` in
multithreaded environments. multithreaded environments.
#. Using ``_glapi_tls_Dispatch`` directly in TLS enabled multithreaded #. Using ``_mesa_glapi_tls_Dispatch`` directly in TLS enabled multithreaded
environments. environments.
People wishing to implement assembly stubs for new platforms should People wishing to implement assembly stubs for new platforms should

View File

@@ -150,15 +150,15 @@ Dispatch Management
When a GL context is made current, the driver must install its dispatch When a GL context is made current, the driver must install its dispatch
table as the current dispatch table. This is done by calling table as the current dispatch table. This is done by calling
void _glapi_set_dispatch(struct _glapi_table *dispatch); void _mesa_glapi_set_dispatch(struct _glapi_table *dispatch);
This will install the named dispatch table for the calling thread. This will install the named dispatch table for the calling thread.
The current dispatch table for a thread can be obtained by calling The current dispatch table for a thread can be obtained by calling
struct _glapi_table *_glapi_get_dispatch(void); struct _glapi_table *_mesa_glapi_get_dispatch(void);
For higher performance in the common single-thread case, the global For higher performance in the common single-thread case, the global
variable _glapi_Dispatch will point to the current dispatch table. variable _mesa_glapi_Dispatch will point to the current dispatch table.
This variable will be NULL when in multi-thread mode. This variable will be NULL when in multi-thread mode.

View File

@@ -99,7 +99,7 @@ dri_set_background_context(void *loaderPrivate)
static void static void
dri2_gl_flush_get(_glapi_proc *glFlush) dri2_gl_flush_get(_glapi_proc *glFlush)
{ {
*glFlush = _glapi_get_proc_address("glFlush"); *glFlush = _mesa_glapi_get_proc_address("glFlush");
} }
static void static void

View File

@@ -508,7 +508,7 @@ wgl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
static void static void
wgl_gl_flush_get(_glapi_proc *glFlush) wgl_gl_flush_get(_glapi_proc *glFlush)
{ {
*glFlush = _glapi_get_proc_address("glFlush"); *glFlush = _mesa_glapi_get_proc_address("glFlush");
} }
static void static void

View File

@@ -2870,7 +2870,7 @@ eglGetProcAddress(const char *procname)
} }
if (!ret) if (!ret)
ret = _glapi_get_proc_address(procname); ret = _mesa_glapi_get_proc_address(procname);
RETURN_EGL_SUCCESS(NULL, ret); RETURN_EGL_SUCCESS(NULL, ret);
} }

View File

@@ -199,7 +199,7 @@ glXGetProcAddressARB(const GLubyte *procName)
return f; return f;
} }
f = (__GLXextFuncPtr) _glapi_get_proc_address((const char *) procName); f = (__GLXextFuncPtr) _mesa_glapi_get_proc_address((const char *) procName);
return f; return f;
} }

View File

@@ -991,7 +991,7 @@ OSMesaGetProcAddress(const char *funcName)
if (strcmp(functions[i].Name, funcName) == 0) if (strcmp(functions[i].Name, funcName) == 0)
return functions[i].Function; return functions[i].Function;
} }
return _glapi_get_proc_address(funcName); return _mesa_glapi_get_proc_address(funcName);
} }

View File

@@ -108,7 +108,7 @@ DrvGetProcAddress(
return entry->proc; return entry->proc;
if (lpszProc[0] == 'g' && lpszProc[1] == 'l') { if (lpszProc[0] == 'g' && lpszProc[1] == 'l') {
p = (PROC) _glapi_get_proc_address(lpszProc); p = (PROC) _mesa_glapi_get_proc_address(lpszProc);
if (p) if (p)
return p; return p;
} }

View File

@@ -1,15 +1,15 @@
{ {
global: global:
# shared-glapi exported from libgallium: # shared-glapi exported from libgallium:
_glapi_get_context; _mesa_glapi_get_context;
_glapi_get_dispatch; _mesa_glapi_get_dispatch;
_glapi_get_dispatch_table_size; _mesa_glapi_get_dispatch_table_size;
_glapi_get_proc_address; _mesa_glapi_get_proc_address;
_glapi_get_proc_offset; _mesa_glapi_get_proc_offset;
_glapi_set_context; _mesa_glapi_set_context;
_glapi_set_dispatch; _mesa_glapi_set_dispatch;
_glapi_tls_Context; _mesa_glapi_tls_Context;
_glapi_tls_Dispatch; _mesa_glapi_tls_Dispatch;
ddebug_screen_create; ddebug_screen_create;
noop_screen_create; noop_screen_create;

View File

@@ -1,9 +1,9 @@
{ {
global: global:
_glapi_Dispatch; _mesa_glapi_Dispatch;
_glapi_tls_Dispatch; _mesa_glapi_tls_Dispatch;
_glapi_get_dispatch_table_size; # only for tests _mesa_glapi_get_dispatch_table_size; # only for tests
_glapi_get_proc_offset; # only for tests _mesa_glapi_get_proc_offset; # only for tests
gl*; gl*;
local: local:
*; *;

View File

@@ -66,9 +66,9 @@ static void _apple_glapi_create_table(void) {
_glapi_table_patch(__applegl_api, "Viewport", __applegl_glViewport); _glapi_table_patch(__applegl_api, "Viewport", __applegl_glViewport);
} }
void apple_glapi_set_dispatch(void) { void apple_mesa_glapi_set_dispatch(void) {
_apple_glapi_create_table(); _apple_glapi_create_table();
_glapi_set_dispatch(__applegl_api); _mesa_glapi_set_dispatch(__applegl_api);
} }
void apple_glapi_oglfw_viewport_scissor(GLint x, GLint y, GLsizei width, GLsizei height) { void apple_glapi_oglfw_viewport_scissor(GLint x, GLint y, GLsizei width, GLsizei height) {

View File

@@ -45,7 +45,7 @@ void apple_glx_swap_buffers(void *ptr);
void apple_glx_waitx(Display * dpy, void *ptr); void apple_glx_waitx(Display * dpy, void *ptr);
int apple_get_dri_event_base(void); int apple_get_dri_event_base(void);
void apple_glapi_set_dispatch(void); void apple_mesa_glapi_set_dispatch(void);
void apple_glapi_oglfw_viewport_scissor(GLint x, GLint y, GLsizei width, GLsizei height); void apple_glapi_oglfw_viewport_scissor(GLint x, GLint y, GLsizei width, GLsizei height);
#endif #endif

View File

@@ -63,7 +63,7 @@ applegl_bind_context(
if (error) if (error)
return 1; /* GLXBadContext is the same as Success (0) */ return 1; /* GLXBadContext is the same as Success (0) */
apple_glapi_set_dispatch(); apple_mesa_glapi_set_dispatch();
return Success; return Success;
} }

View File

@@ -2374,7 +2374,7 @@ _GLX_PUBLIC void (*glXGetProcAddressARB(const GLubyte * procName)) (void)
f = (gl_function) get_glx_proc_address((const char *) procName); f = (gl_function) get_glx_proc_address((const char *) procName);
if (f == NULL) if (f == NULL)
f = (gl_function) _glapi_get_proc_address((const char *) procName); f = (gl_function) _mesa_glapi_get_proc_address((const char *) procName);
#ifdef GLX_USE_APPLEGL #ifdef GLX_USE_APPLEGL
if (f == NULL) if (f == NULL)

View File

@@ -64,8 +64,8 @@ __glXSetCurrentContextNull(void)
{ {
__glXSetCurrentContext(&dummyContext); __glXSetCurrentContext(&dummyContext);
#if defined(GLX_DIRECT_RENDERING) #if defined(GLX_DIRECT_RENDERING)
_glapi_set_dispatch(NULL); /* no-op functions */ _mesa_glapi_set_dispatch(NULL); /* no-op functions */
_glapi_set_context(NULL); _mesa_glapi_set_context(NULL);
#endif #endif
} }

View File

@@ -135,7 +135,7 @@ indirect_bind_context(struct glx_context *gc,
if (sent) { if (sent) {
if (!IndirectAPI) if (!IndirectAPI)
IndirectAPI = __glXNewIndirectAPI(); IndirectAPI = __glXNewIndirectAPI();
_glapi_set_dispatch(IndirectAPI); _mesa_glapi_set_dispatch(IndirectAPI);
/* The indirect vertex array state must to be initialised after we /* The indirect vertex array state must to be initialised after we
* have setup the context, as it needs to query server attributes. * have setup the context, as it needs to query server attributes.

View File

@@ -55,10 +55,10 @@ windows_glapi_create_table(void)
assert(windows_api); assert(windows_api);
} }
static void windows_glapi_set_dispatch(void) static void windows_mesa_glapi_set_dispatch(void)
{ {
windows_glapi_create_table(); windows_glapi_create_table();
_glapi_set_dispatch(windows_api); _mesa_glapi_set_dispatch(windows_api);
} }
windowsContext * windowsContext *
@@ -233,7 +233,7 @@ int windows_bind_context(windowsContext *context, windowsDrawable *draw, windows
draw->callbacks->releasedc(draw, drawDc); draw->callbacks->releasedc(draw, drawDc);
windows_glapi_set_dispatch(); windows_mesa_glapi_set_dispatch();
return true; return true;
} }

View File

@@ -55,9 +55,9 @@ __asm__(".text\n"
" .localentry " func ", .-" func "\n\t" " .localentry " func ", .-" func "\n\t"
#define STUB_ASM_CODE(slot) \ #define STUB_ASM_CODE(slot) \
" addis 11, 2, _glapi_tls_Dispatch@got@tprel@ha\n\t" \ " addis 11, 2, _mesa_glapi_tls_Dispatch@got@tprel@ha\n\t" \
" ld 11, _glapi_tls_Dispatch@got@tprel@l(11)\n\t" \ " ld 11, _mesa_glapi_tls_Dispatch@got@tprel@l(11)\n\t" \
" add 11, 11,_glapi_tls_Dispatch@tls\n\t" \ " add 11, 11,_mesa_glapi_tls_Dispatch@tls\n\t" \
" ld 11, 0(11)\n\t" \ " ld 11, 0(11)\n\t" \
" ld 12, " slot "*8(11)\n\t" \ " ld 12, " slot "*8(11)\n\t" \
" mtctr 12\n\t" \ " mtctr 12\n\t" \

View File

@@ -51,7 +51,7 @@ __asm__(".text\n"
#define STUB_ASM_CODE(slot) \ #define STUB_ASM_CODE(slot) \
ENDBR \ ENDBR \
"movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" \ "movq _mesa_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" \
"movq %fs:(%rax), %r11\n\t" \ "movq %fs:(%rax), %r11\n\t" \
"jmp *(8 * " slot ")(%r11)" "jmp *(8 * " slot ")(%r11)"
@@ -59,7 +59,7 @@ __asm__(".text\n"
#define STUB_ASM_CODE(slot) \ #define STUB_ASM_CODE(slot) \
ENDBR \ ENDBR \
"movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" \ "movq _mesa_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax\n\t" \
"movl %fs:(%rax), %r11d\n\t" \ "movl %fs:(%rax), %r11d\n\t" \
"movl 4*" slot "(%r11d), %r11d\n\t" \ "movl 4*" slot "(%r11d), %r11d\n\t" \
"jmp *%r11" "jmp *%r11"

View File

@@ -48,7 +48,7 @@ __asm__("x86_current_tls:\n\t"
"1:\n\t" "1:\n\t"
"popl %eax\n\t" "popl %eax\n\t"
"addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t"
"movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax\n\t" "movl _mesa_glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax\n\t"
"ret"); "ret");
#ifndef GLX_X86_READONLY_TEXT #ifndef GLX_X86_READONLY_TEXT
@@ -70,7 +70,7 @@ __asm__(".balign 16\n"
"1:\n\t" \ "1:\n\t" \
"popl %eax\n\t" \ "popl %eax\n\t" \
"addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \ "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
"movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax\n\t" \ "movl _mesa_glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax\n\t" \
"movl %gs:(%eax), %eax\n\t" \ "movl %gs:(%eax), %eax\n\t" \
"jmp *(4 * " slot ")(%eax)" "jmp *(4 * " slot ")(%eax)"

View File

@@ -949,7 +949,7 @@ struct _glapi_table * __glXNewIndirectAPI( void )
unsigned entries; unsigned entries;
unsigned i; unsigned i;
entries = _glapi_get_dispatch_table_size(); entries = _mesa_glapi_get_dispatch_table_size();
table = malloc(entries * sizeof(_glapi_proc)); table = malloc(entries * sizeof(_glapi_proc));
if (table == NULL) if (table == NULL)
return NULL; return NULL;

View File

@@ -84,17 +84,17 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('\tcall\t__glapi_sparc_get_pc') print('\tcall\t__glapi_sparc_get_pc')
print('\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2') print('\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2')
print('\tmov\t%g1, %o7') print('\tmov\t%g1, %o7')
print('\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1') print('\tsethi\t%tie_hi22(_mesa_glapi_tls_Dispatch), %g1')
print('\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1') print('\tadd\t%g1, %tie_lo10(_mesa_glapi_tls_Dispatch), %g1')
print('\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)') print('\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_mesa_glapi_tls_Dispatch)')
print('\tretl') print('\tretl')
print('\t mov\t%g2, %o0') print('\t mov\t%g2, %o0')
print('') print('')
print('\t.data') print('\t.data')
print('\t.align\t32') print('\t.align\t32')
print('') print('')
print('\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */') print('\t/* --> sethi %hi(_mesa_glapi_tls_Dispatch), %g1 */')
print('\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */') print('\t/* --> or %g1, %lo(_mesa_glapi_tls_Dispatch), %g1 */')
print('\tGLOBL_FN(__glapi_sparc_tls_stub)') print('\tGLOBL_FN(__glapi_sparc_tls_stub)')
print('\tHIDDEN(__glapi_sparc_tls_stub)') print('\tHIDDEN(__glapi_sparc_tls_stub)')
print('__glapi_sparc_tls_stub: /* Call offset in %g3 */') print('__glapi_sparc_tls_stub: /* Call offset in %g3 */')
@@ -104,9 +104,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2') print('\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2')
print('\tmov\t%g1, %o7') print('\tmov\t%g1, %o7')
print('\tsrl\t%g3, 10, %g3') print('\tsrl\t%g3, 10, %g3')
print('\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1') print('\tsethi\t%tie_hi22(_mesa_glapi_tls_Dispatch), %g1')
print('\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1') print('\tadd\t%g1, %tie_lo10(_mesa_glapi_tls_Dispatch), %g1')
print('\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)') print('\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_mesa_glapi_tls_Dispatch)')
print('\tGL_LL\t[%g7+%g2], %g1') print('\tGL_LL\t[%g7+%g2], %g1')
print('\tGL_LL\t[%g1 + %g3], %g1') print('\tGL_LL\t[%g1 + %g3], %g1')
print('\tjmp\t%g1') print('\tjmp\t%g1')

View File

@@ -67,7 +67,7 @@ __glapi_gentable_NoOp(void) {
static void static void
__glapi_gentable_set_remaining_noop(struct _glapi_table *disp) { __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
GLuint entries = _glapi_get_dispatch_table_size(); GLuint entries = _mesa_glapi_get_dispatch_table_size();
void **dispatch = (void **) disp; void **dispatch = (void **) disp;
unsigned i; unsigned i;
@@ -86,7 +86,7 @@ footer = """
#if defined(GLX_USE_APPLEGL) || defined(GLX_USE_WINDOWSGL) #if defined(GLX_USE_APPLEGL) || defined(GLX_USE_WINDOWSGL)
struct _glapi_table * struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) { _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
struct _glapi_table *disp = calloc(_glapi_get_dispatch_table_size(), sizeof(_glapi_proc)); struct _glapi_table *disp = calloc(_mesa_glapi_get_dispatch_table_size(), sizeof(_glapi_proc));
char symboln[512]; char symboln[512];
if(!disp) if(!disp)

View File

@@ -137,7 +137,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('\t.text') print('\t.text')
print('') print('')
print('_x86_64_get_dispatch:') print('_x86_64_get_dispatch:')
print('\tmovq\t_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax') print('\tmovq\t_mesa_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax')
print('\tmovq\t%fs:(%rax), %rax') print('\tmovq\t%fs:(%rax), %rax')
print('\tret') print('\tret')
print('\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch') print('\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch')

View File

@@ -91,11 +91,11 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('ALIGNTEXT16;\t\t\t\t\t\t\\') print('ALIGNTEXT16;\t\t\t\t\t\t\\')
print('GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\') print('GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\')
print('GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\') print('GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\')
print('\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\') print('\tMOV_L(CONTENT(GLNAME(_mesa_glapi_Dispatch)), EAX) ;\t\\')
print('\tTEST_L(EAX, EAX) ;\t\t\t\t\\') print('\tTEST_L(EAX, EAX) ;\t\t\t\t\\')
print('\tJE(1f) ;\t\t\t\t\t\\') print('\tJE(1f) ;\t\t\t\t\t\\')
print('\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\') print('\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\')
print('1:\tCALL(_glapi_get_dispatch) ;\t\t\t\\') print('1:\tCALL(_mesa_glapi_get_dispatch) ;\t\t\t\\')
print('\tJMP(GL_OFFSET(off))') print('\tJMP(GL_OFFSET(off))')
print('#endif') print('#endif')
print('') print('')
@@ -119,12 +119,12 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print('\tcall 1f') print('\tcall 1f')
print('1:\tpopl %eax') print('1:\tpopl %eax')
print('\taddl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax') print('\taddl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax')
print('\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax') print('\tmovl _mesa_glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax')
print('\tret') print('\tret')
print('') print('')
print('#else') print('#else')
print('EXTERN GLNAME(_glapi_Dispatch)') print('EXTERN GLNAME(_mesa_glapi_Dispatch)')
print('EXTERN GLNAME(_glapi_get_dispatch)') print('EXTERN GLNAME(_mesa_glapi_get_dispatch)')
print('#endif') print('#endif')
print('') print('')

View File

@@ -29,11 +29,11 @@
#include "u_current.h" #include "u_current.h"
/* /*
* _glapi_Dispatch, _glapi_Context * _mesa_glapi_Dispatch, _glapi_Context
* _glapi_tls_Dispatch, _glapi_tls_Context, * _mesa_glapi_tls_Dispatch, _mesa_glapi_tls_Context,
* _glapi_set_context, _glapi_get_context, * _mesa_glapi_set_context, _mesa_glapi_get_context,
* _glapi_destroy_multithread, _glapi_check_multithread * _glapi_destroy_multithread, _glapi_check_multithread
* _glapi_set_dispatch, and _glapi_get_dispatch * _mesa_glapi_set_dispatch, and _mesa_glapi_get_dispatch
* are defined in u_current.c. * are defined in u_current.c.
*/ */

View File

@@ -78,22 +78,22 @@ typedef void (*_glapi_nop_handler_proc)(const char *name);
struct _glapi_table; struct _glapi_table;
#if DETECT_OS_WINDOWS #if DETECT_OS_WINDOWS
extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch; extern __THREAD_INITIAL_EXEC struct _glapi_table * _mesa_glapi_tls_Dispatch;
extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context; extern __THREAD_INITIAL_EXEC void * _mesa_glapi_tls_Context;
#else #else
_GLAPI_EXPORT extern __THREAD_INITIAL_EXEC struct _glapi_table * _glapi_tls_Dispatch; _GLAPI_EXPORT extern __THREAD_INITIAL_EXEC struct _glapi_table * _mesa_glapi_tls_Dispatch;
_GLAPI_EXPORT extern __THREAD_INITIAL_EXEC void * _glapi_tls_Context; _GLAPI_EXPORT extern __THREAD_INITIAL_EXEC void * _mesa_glapi_tls_Context;
#endif #endif
_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; _GLAPI_EXPORT extern const struct _glapi_table *_mesa_glapi_Dispatch;
_GLAPI_EXPORT extern const void *_glapi_Context; _GLAPI_EXPORT extern const void *_glapi_Context;
#if DETECT_OS_WINDOWS && !defined(MAPI_MODE_UTIL) && !defined(MAPI_MODE_GLAPI) #if DETECT_OS_WINDOWS && !defined(MAPI_MODE_UTIL) && !defined(MAPI_MODE_GLAPI)
# define GET_DISPATCH() _glapi_get_dispatch() # define GET_DISPATCH() _mesa_glapi_get_dispatch()
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_get_context() # define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _mesa_glapi_get_context()
#else #else
# define GET_DISPATCH() _glapi_tls_Dispatch # define GET_DISPATCH() _mesa_glapi_tls_Dispatch
# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context # define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _mesa_glapi_tls_Context
#endif #endif
_GLAPI_EXPORT void _GLAPI_EXPORT void
@@ -105,34 +105,34 @@ _glapi_check_multithread(void);
_GLAPI_EXPORT void _GLAPI_EXPORT void
_glapi_set_context(void *context); _mesa_glapi_set_context(void *context);
_GLAPI_EXPORT void * _GLAPI_EXPORT void *
_glapi_get_context(void); _mesa_glapi_get_context(void);
_GLAPI_EXPORT void _GLAPI_EXPORT void
_glapi_set_dispatch(struct _glapi_table *dispatch); _mesa_glapi_set_dispatch(struct _glapi_table *dispatch);
_GLAPI_EXPORT struct _glapi_table * _GLAPI_EXPORT struct _glapi_table *
_glapi_get_dispatch(void); _mesa_glapi_get_dispatch(void);
_GLAPI_EXPORT unsigned int _GLAPI_EXPORT unsigned int
_glapi_get_dispatch_table_size(void); _mesa_glapi_get_dispatch_table_size(void);
_GLAPI_EXPORT int _GLAPI_EXPORT int
_glapi_add_dispatch( const char * function_name ); _glapi_add_dispatch( const char * function_name );
_GLAPI_EXPORT int _GLAPI_EXPORT int
_glapi_get_proc_offset(const char *funcName); _mesa_glapi_get_proc_offset(const char *funcName);
_GLAPI_EXPORT _glapi_proc _GLAPI_EXPORT _glapi_proc
_glapi_get_proc_address(const char *funcName); _mesa_glapi_get_proc_address(const char *funcName);
_GLAPI_EXPORT const char * _GLAPI_EXPORT const char *

View File

@@ -88,9 +88,9 @@ static void
init_glapi_relocs( void ) init_glapi_relocs( void )
{ {
static const unsigned int template[] = { static const unsigned int template[] = {
0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */ 0x05000000, /* sethi %hi(_mesa_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(_mesa_glapi_tls_Dispatch), %g2 */
#ifdef __arch64__ #ifdef __arch64__
0xc259c002, /* ldx [%g7 + %g2], %g1 */ 0xc259c002, /* ldx [%g7 + %g2], %g1 */
0xc2584003, /* ldx [%g1 + %g3], %g1 */ 0xc2584003, /* ldx [%g1 + %g3], %g1 */

View File

@@ -103,7 +103,7 @@ _glapi_add_dispatch(const char *funcName)
* Return offset of entrypoint for named function within dispatch table. * Return offset of entrypoint for named function within dispatch table.
*/ */
GLint GLint
_glapi_get_proc_offset(const char *funcName) _mesa_glapi_get_proc_offset(const char *funcName)
{ {
/* search static functions */ /* search static functions */
return get_static_proc_offset(funcName); return get_static_proc_offset(funcName);
@@ -116,7 +116,7 @@ _glapi_get_proc_offset(const char *funcName)
* Return NULL if function not found. * Return NULL if function not found.
*/ */
_glapi_proc _glapi_proc
_glapi_get_proc_address(const char *funcName) _mesa_glapi_get_proc_address(const char *funcName)
{ {
init_glapi_relocs_once(); init_glapi_relocs_once();
@@ -169,7 +169,7 @@ _glapi_get_proc_name(GLuint offset)
* slots). * slots).
*/ */
GLuint GLuint
_glapi_get_dispatch_table_size(void) _mesa_glapi_get_dispatch_table_size(void)
{ {
return sizeof(struct _glapi_table) / sizeof(void *); return sizeof(struct _glapi_table) / sizeof(void *);
} }

View File

@@ -42,7 +42,7 @@ TEST(GetProcAddress, ABIOffsetByName)
*/ */
for (unsigned i = 0; linux_gl_abi[i].name != NULL; i++) { for (unsigned i = 0; linux_gl_abi[i].name != NULL; i++) {
EXPECT_EQ(linux_gl_abi[i].offset, EXPECT_EQ(linux_gl_abi[i].offset,
_glapi_get_proc_offset(linux_gl_abi[i].name)) _mesa_glapi_get_proc_offset(linux_gl_abi[i].name))
<< "function name: " << linux_gl_abi[i].name; << "function name: " << linux_gl_abi[i].name;
} }
} }
@@ -104,11 +104,11 @@ TEST(GetProcAddress, QueriedDispatchSizeBigEnough)
{ {
const unsigned table_entries = sizeof(struct _glapi_table) / sizeof(void *); const unsigned table_entries = sizeof(struct _glapi_table) / sizeof(void *);
/* _glapi_get_dispatch_table_size returns the size of the extended dispatch /* _mesa_glapi_get_dispatch_table_size returns the size of the extended dispatch
* table. This is the size of the static table with some extra entries for * table. This is the size of the static table with some extra entries for
* drivers to use for extensions that the core does not know about. * drivers to use for extensions that the core does not know about.
*/ */
EXPECT_EQ(table_entries, _glapi_get_dispatch_table_size()); EXPECT_EQ(table_entries, _mesa_glapi_get_dispatch_table_size());
} }
TEST(GetProcAddress, KnownDispatchOffsetsAreConsistent) TEST(GetProcAddress, KnownDispatchOffsetsAreConsistent)
@@ -123,7 +123,7 @@ TEST(GetProcAddress, KnownDispatchOffsetsAreConsistent)
*/ */
for (unsigned i = 0; known_dispatch[i].name != NULL; i++) { for (unsigned i = 0; known_dispatch[i].name != NULL; i++) {
EXPECT_EQ(known_dispatch[i].offset, EXPECT_EQ(known_dispatch[i].offset,
_glapi_get_proc_offset(known_dispatch[i].name)) _mesa_glapi_get_proc_offset(known_dispatch[i].name))
<< "function name: " << known_dispatch[i].name; << "function name: " << known_dispatch[i].name;
} }
} }

View File

@@ -34,11 +34,11 @@
#include "stub.h" #include "stub.h"
/* /*
* _glapi_Dispatch, _glapi_Context * _mesa_glapi_Dispatch, _glapi_Context
* _glapi_tls_Dispatch, _glapi_tls_Context, * _mesa_glapi_tls_Dispatch, _mesa_glapi_tls_Context,
* _glapi_set_context, _glapi_get_context, * _mesa_glapi_set_context, _mesa_glapi_get_context,
* _glapi_destroy_multithread, _glapi_check_multithread * _glapi_destroy_multithread, _glapi_check_multithread
* _glapi_set_dispatch, and _glapi_get_dispatch * _mesa_glapi_set_dispatch, and _mesa_glapi_get_dispatch
* are defined in u_current.c. * are defined in u_current.c.
*/ */
@@ -47,7 +47,7 @@
* slots). * slots).
*/ */
unsigned int unsigned int
_glapi_get_dispatch_table_size(void) _mesa_glapi_get_dispatch_table_size(void)
{ {
return MAPI_TABLE_NUM_SLOTS; return MAPI_TABLE_NUM_SLOTS;
} }
@@ -82,7 +82,7 @@ _glapi_get_stub(const char *name)
* Return offset of entrypoint for named function within dispatch table. * Return offset of entrypoint for named function within dispatch table.
*/ */
int int
_glapi_get_proc_offset(const char *funcName) _mesa_glapi_get_proc_offset(const char *funcName)
{ {
const struct mapi_stub *stub = _glapi_get_stub(funcName); const struct mapi_stub *stub = _glapi_get_stub(funcName);
return (stub) ? stub_get_slot(stub) : -1; return (stub) ? stub_get_slot(stub) : -1;
@@ -94,7 +94,7 @@ _glapi_get_proc_offset(const char *funcName)
* the fly with assembly language. * the fly with assembly language.
*/ */
_glapi_proc _glapi_proc
_glapi_get_proc_address(const char *funcName) _mesa_glapi_get_proc_address(const char *funcName)
{ {
const struct mapi_stub *stub = _glapi_get_stub(funcName); const struct mapi_stub *stub = _glapi_get_stub(funcName);
return (stub) ? (_glapi_proc) stub_get_addr(stub) : NULL; return (stub) ? (_glapi_proc) stub_get_addr(stub) : NULL;

View File

@@ -41,7 +41,7 @@ TEST(GetProcAddress, ABIOffsetByName)
*/ */
for (unsigned i = 0; linux_gl_abi[i].name != NULL; i++) { for (unsigned i = 0; linux_gl_abi[i].name != NULL; i++) {
EXPECT_EQ(linux_gl_abi[i].offset, EXPECT_EQ(linux_gl_abi[i].offset,
_glapi_get_proc_offset(linux_gl_abi[i].name)) _mesa_glapi_get_proc_offset(linux_gl_abi[i].name))
<< "function name: " << linux_gl_abi[i].name; << "function name: " << linux_gl_abi[i].name;
} }
} }
@@ -52,7 +52,7 @@ TEST(GetProcAddress, TableBigEnoughForABI)
* FINISHME: hold all of the unique functions for OpenGL 1.2, OpenGL ES * FINISHME: hold all of the unique functions for OpenGL 1.2, OpenGL ES
* FINISHME: 1.1, and OpenGL ES 2.0. * FINISHME: 1.1, and OpenGL ES 2.0.
*/ */
EXPECT_LT(408u, _glapi_get_dispatch_table_size()); EXPECT_LT(408u, _mesa_glapi_get_dispatch_table_size());
} }
const struct name_offset linux_gl_abi[] = { const struct name_offset linux_gl_abi[] = {

View File

@@ -41,7 +41,7 @@
* 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0 * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0
* 2001/01/16 - added dispatch override feature for Mesa 3.5 * 2001/01/16 - added dispatch override feature for Mesa 3.5
* 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1. * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1.
* 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints * 2002/10/01 - _mesa_glapi_get_proc_address() will now generate new entrypoints
* itself (using offset ~0). _glapi_add_entrypoint() can be * itself (using offset ~0). _glapi_add_entrypoint() can be
* called afterward and it'll fill in the correct dispatch * called afterward and it'll fill in the correct dispatch
* offset. This allows DRI libGL to avoid probing for DRI * offset. This allows DRI libGL to avoid probing for DRI
@@ -73,26 +73,26 @@ extern void (*__glapi_noop_table[])(void);
* Depending on whether or not multithreading is support, and the type of * Depending on whether or not multithreading is support, and the type of
* support available, several variables are used to store the current context * support available, several variables are used to store the current context
* pointer and the current dispatch table pointer. In the non-threaded case, * pointer and the current dispatch table pointer. In the non-threaded case,
* the variables \c _glapi_Dispatch and \c _glapi_Context are used for this * the variables \c _mesa_glapi_Dispatch and \c _glapi_Context are used for this
* purpose. * purpose.
* *
* In multi threaded case, The TLS variables \c _glapi_tls_Dispatch and * In multi threaded case, The TLS variables \c _mesa_glapi_tls_Dispatch and
* \c _glapi_tls_Context are used. Having \c _glapi_Dispatch and \c _glapi_Context * \c _mesa_glapi_tls_Context are used. Having \c _mesa_glapi_Dispatch and \c _glapi_Context
* be hardcoded to \c NULL maintains binary compatability between TLS enabled * be hardcoded to \c NULL maintains binary compatability between TLS enabled
* loaders and non-TLS DRI drivers. When \c _glapi_Dispatch and \c _glapi_Context * loaders and non-TLS DRI drivers. When \c _mesa_glapi_Dispatch and \c _glapi_Context
* are \c NULL, the thread state data \c ContextTSD are used. Drivers and the * are \c NULL, the thread state data \c ContextTSD are used. Drivers and the
* static dispatch functions access these variables via \c _glapi_get_dispatch * static dispatch functions access these variables via \c _mesa_glapi_get_dispatch
* and \c _glapi_get_context. * and \c _mesa_glapi_get_context.
*/ */
/*@{*/ /*@{*/
__THREAD_INITIAL_EXEC struct _glapi_table *_glapi_tls_Dispatch __THREAD_INITIAL_EXEC struct _glapi_table *_mesa_glapi_tls_Dispatch
= (struct _glapi_table *) table_noop_array; = (struct _glapi_table *) table_noop_array;
__THREAD_INITIAL_EXEC void *_glapi_tls_Context; __THREAD_INITIAL_EXEC void *_mesa_glapi_tls_Context;
/* not used, but defined for compatibility */ /* not used, but defined for compatibility */
const struct _glapi_table *_glapi_Dispatch; const struct _glapi_table *_mesa_glapi_Dispatch;
const void *_glapi_Context; const void *_glapi_Context;
/*@}*/ /*@}*/
@@ -115,9 +115,9 @@ _glapi_check_multithread(void)
* void from the real context pointer type. * void from the real context pointer type.
*/ */
void void
_glapi_set_context(void *ptr) _mesa_glapi_set_context(void *ptr)
{ {
_glapi_tls_Context = ptr; _mesa_glapi_tls_Context = ptr;
} }
/** /**
@@ -126,9 +126,9 @@ _glapi_set_context(void *ptr)
* void to the real context pointer type. * void to the real context pointer type.
*/ */
void * void *
_glapi_get_context(void) _mesa_glapi_get_context(void)
{ {
return _glapi_tls_Context; return _mesa_glapi_tls_Context;
} }
/** /**
@@ -137,21 +137,21 @@ _glapi_get_context(void)
* table (__glapi_noop_table). * table (__glapi_noop_table).
*/ */
void void
_glapi_set_dispatch(struct _glapi_table *tbl) _mesa_glapi_set_dispatch(struct _glapi_table *tbl)
{ {
stub_init_once(); stub_init_once();
if (!tbl) if (!tbl)
tbl = (struct _glapi_table *) table_noop_array; tbl = (struct _glapi_table *) table_noop_array;
_glapi_tls_Dispatch = tbl; _mesa_glapi_tls_Dispatch = tbl;
} }
/** /**
* Return pointer to current dispatch table for calling thread. * Return pointer to current dispatch table for calling thread.
*/ */
struct _glapi_table * struct _glapi_table *
_glapi_get_dispatch(void) _mesa_glapi_get_dispatch(void)
{ {
return _glapi_tls_Dispatch; return _mesa_glapi_tls_Dispatch;
} }

View File

@@ -851,7 +851,7 @@ _mesa_alloc_dispatch_table(bool glthread)
* Mesa we do this to accommodate different versions of libGL and various * Mesa we do this to accommodate different versions of libGL and various
* DRI drivers. * DRI drivers.
*/ */
int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); int numEntries = MAX2(_mesa_glapi_get_dispatch_table_size(), _gloffset_COUNT);
struct _glapi_table *table = _mesa_new_nop_table(numEntries, glthread); struct _glapi_table *table = _mesa_new_nop_table(numEntries, glthread);
@@ -1491,7 +1491,7 @@ _mesa_make_current( struct gl_context *newCtx,
} }
if (!newCtx) { if (!newCtx) {
_glapi_set_dispatch(NULL); /* none current */ _mesa_glapi_set_dispatch(NULL); /* none current */
/* We need old ctx to correctly release Draw/ReadBuffer /* We need old ctx to correctly release Draw/ReadBuffer
* and avoid a surface leak in st_renderbuffer_delete. * and avoid a surface leak in st_renderbuffer_delete.
* Therefore, first drop buffers then set new ctx to NULL. * Therefore, first drop buffers then set new ctx to NULL.
@@ -1500,13 +1500,13 @@ _mesa_make_current( struct gl_context *newCtx,
_mesa_reference_framebuffer(&curCtx->WinSysDrawBuffer, NULL); _mesa_reference_framebuffer(&curCtx->WinSysDrawBuffer, NULL);
_mesa_reference_framebuffer(&curCtx->WinSysReadBuffer, NULL); _mesa_reference_framebuffer(&curCtx->WinSysReadBuffer, NULL);
} }
_glapi_set_context(NULL); _mesa_glapi_set_context(NULL);
assert(_mesa_get_current_context() == NULL); assert(_mesa_get_current_context() == NULL);
} }
else { else {
_glapi_set_context((void *) newCtx); _mesa_glapi_set_context((void *) newCtx);
assert(_mesa_get_current_context() == newCtx); assert(_mesa_get_current_context() == newCtx);
_glapi_set_dispatch(newCtx->GLApi); _mesa_glapi_set_dispatch(newCtx->GLApi);
if (drawBuffer && readBuffer) { if (drawBuffer && readBuffer) {
assert(_mesa_is_winsys_fbo(drawBuffer)); assert(_mesa_is_winsys_fbo(drawBuffer));
@@ -1595,14 +1595,14 @@ _mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare)
/** /**
* \return pointer to the current GL context for this thread. * \return pointer to the current GL context for this thread.
* *
* Calls _glapi_get_context(). This isn't the fastest way to get the current * Calls _mesa_glapi_get_context(). This isn't the fastest way to get the current
* context. If you need speed, see the #GET_CURRENT_CONTEXT macro in * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in
* context.h. * context.h.
*/ */
struct gl_context * struct gl_context *
_mesa_get_current_context( void ) _mesa_get_current_context( void )
{ {
return (struct gl_context *) _glapi_get_context(); return (struct gl_context *) _mesa_glapi_get_context();
} }
/*@}*/ /*@}*/

View File

@@ -13204,7 +13204,7 @@ _mesa_NewList(GLuint name, GLenum mode)
vbo_save_NewList(ctx, name, mode); vbo_save_NewList(ctx, name, mode);
ctx->Dispatch.Current = ctx->Dispatch.Save; ctx->Dispatch.Current = ctx->Dispatch.Save;
_glapi_set_dispatch(ctx->Dispatch.Current); _mesa_glapi_set_dispatch(ctx->Dispatch.Current);
if (!ctx->GLThread.enabled) { if (!ctx->GLThread.enabled) {
ctx->GLApi = ctx->Dispatch.Current; ctx->GLApi = ctx->Dispatch.Current;
} }
@@ -13416,7 +13416,7 @@ _mesa_EndList(void)
ctx->CompileFlag = GL_FALSE; ctx->CompileFlag = GL_FALSE;
ctx->Dispatch.Current = ctx->Dispatch.Exec; ctx->Dispatch.Current = ctx->Dispatch.Exec;
_glapi_set_dispatch(ctx->Dispatch.Current); _mesa_glapi_set_dispatch(ctx->Dispatch.Current);
if (!ctx->GLThread.enabled) { if (!ctx->GLThread.enabled) {
ctx->GLApi = ctx->Dispatch.Current; ctx->GLApi = ctx->Dispatch.Current;
} }
@@ -13608,7 +13608,7 @@ void
_mesa_init_dispatch_save(const struct gl_context *ctx) _mesa_init_dispatch_save(const struct gl_context *ctx)
{ {
struct _glapi_table *table = ctx->Dispatch.Save; struct _glapi_table *table = ctx->Dispatch.Save;
int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size()); int numEntries = MAX2(_gloffset_COUNT, _mesa_glapi_get_dispatch_table_size());
/* Initially populate the dispatch table with the contents of the /* Initially populate the dispatch table with the contents of the
* normal-execution dispatch table. This lets us skip populating functions * normal-execution dispatch table. This lets us skip populating functions

View File

@@ -121,7 +121,7 @@ glthread_unmarshal_batch(void *job, void *gdata, int thread_index)
glthread_update_global_locking(ctx); glthread_update_global_locking(ctx);
/* Execute the GL calls. */ /* Execute the GL calls. */
_glapi_set_dispatch(ctx->Dispatch.Current); _mesa_glapi_set_dispatch(ctx->Dispatch.Current);
/* Here we lock the mutexes once globally if possible. If not, we just /* Here we lock the mutexes once globally if possible. If not, we just
* fallback to the individual API calls doing it. * fallback to the individual API calls doing it.
@@ -190,7 +190,7 @@ glthread_thread_initialization(void *job, void *gdata, int thread_index)
struct gl_context *ctx = (struct gl_context*)job; struct gl_context *ctx = (struct gl_context*)job;
st_set_background_context(ctx, &ctx->GLThread.stats); st_set_background_context(ctx, &ctx->GLThread.stats);
_glapi_set_context(ctx); _mesa_glapi_set_context(ctx);
} }
static void static void
@@ -302,8 +302,8 @@ void _mesa_glthread_enable(struct gl_context *ctx)
ctx->st->pin_thread_counter = ST_THREAD_SCHEDULER_DISABLED; ctx->st->pin_thread_counter = ST_THREAD_SCHEDULER_DISABLED;
/* Update the dispatch only if the dispatch is current. */ /* Update the dispatch only if the dispatch is current. */
if (_glapi_get_dispatch() == ctx->Dispatch.Current) { if (_mesa_glapi_get_dispatch() == ctx->Dispatch.Current) {
_glapi_set_dispatch(ctx->GLApi); _mesa_glapi_set_dispatch(ctx->GLApi);
} }
} }
@@ -322,8 +322,8 @@ void _mesa_glthread_disable(struct gl_context *ctx)
ctx->st->pin_thread_counter = 0; ctx->st->pin_thread_counter = 0;
/* Update the dispatch only if the dispatch is current. */ /* Update the dispatch only if the dispatch is current. */
if (_glapi_get_dispatch() == ctx->MarshalExec) { if (_mesa_glapi_get_dispatch() == ctx->MarshalExec) {
_glapi_set_dispatch(ctx->GLApi); _mesa_glapi_set_dispatch(ctx->GLApi);
} }
/* Unbind VBOs in all VAOs that glthread bound for non-VBO vertex uploads /* Unbind VBOs in all VAOs that glthread bound for non-VBO vertex uploads
@@ -418,9 +418,9 @@ _mesa_glthread_finish(struct gl_context *ctx)
/* Since glthread_unmarshal_batch changes the dispatch to direct, /* Since glthread_unmarshal_batch changes the dispatch to direct,
* restore it after it's done. * restore it after it's done.
*/ */
struct _glapi_table *dispatch = _glapi_get_dispatch(); struct _glapi_table *dispatch = _mesa_glapi_get_dispatch();
glthread_unmarshal_batch(next, NULL, 0); glthread_unmarshal_batch(next, NULL, 0);
_glapi_set_dispatch(dispatch); _mesa_glapi_set_dispatch(dispatch);
/* It's not a sync because we don't enqueue partial batches, but /* It's not a sync because we don't enqueue partial batches, but
* it would be a sync if we did. So count it anyway. * it would be a sync if we did. So count it anyway.

View File

@@ -68,7 +68,7 @@ void
_mesa_set_context_lost_dispatch(struct gl_context *ctx) _mesa_set_context_lost_dispatch(struct gl_context *ctx)
{ {
if (ctx->Dispatch.ContextLost == NULL) { if (ctx->Dispatch.ContextLost == NULL) {
int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT); int numEntries = MAX2(_mesa_glapi_get_dispatch_table_size(), _gloffset_COUNT);
ctx->Dispatch.ContextLost = malloc(numEntries * sizeof(_glapi_proc)); ctx->Dispatch.ContextLost = malloc(numEntries * sizeof(_glapi_proc));
if (!ctx->Dispatch.ContextLost) if (!ctx->Dispatch.ContextLost)
@@ -104,7 +104,7 @@ _mesa_set_context_lost_dispatch(struct gl_context *ctx)
} }
ctx->Dispatch.Current = ctx->Dispatch.ContextLost; ctx->Dispatch.Current = ctx->Dispatch.ContextLost;
_glapi_set_dispatch(ctx->Dispatch.Current); _mesa_glapi_set_dispatch(ctx->Dispatch.Current);
} }
/** /**

View File

@@ -863,7 +863,7 @@ _mesa_Begin(GLenum mode)
ctx->Dispatch.Current = ctx->Dispatch.Exec; ctx->Dispatch.Current = ctx->Dispatch.Exec;
} else if (ctx->GLApi == ctx->Dispatch.OutsideBeginEnd) { } else if (ctx->GLApi == ctx->Dispatch.OutsideBeginEnd) {
ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec; ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec;
_glapi_set_dispatch(ctx->GLApi); _mesa_glapi_set_dispatch(ctx->GLApi);
} else { } else {
assert(ctx->GLApi == ctx->Dispatch.Save); assert(ctx->GLApi == ctx->Dispatch.Save);
} }
@@ -926,7 +926,7 @@ _mesa_End(void)
} else if (ctx->GLApi == ctx->Dispatch.BeginEnd || } else if (ctx->GLApi == ctx->Dispatch.BeginEnd ||
ctx->GLApi == ctx->Dispatch.HWSelectModeBeginEnd) { ctx->GLApi == ctx->Dispatch.HWSelectModeBeginEnd) {
ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec; ctx->GLApi = ctx->Dispatch.Current = ctx->Dispatch.Exec;
_glapi_set_dispatch(ctx->GLApi); _mesa_glapi_set_dispatch(ctx->GLApi);
} }
if (exec->vtx.prim_count > 0) { if (exec->vtx.prim_count > 0) {
@@ -1262,7 +1262,7 @@ _es_Materialf(GLenum face, GLenum pname, GLfloat param)
void void
vbo_init_dispatch_hw_select_begin_end(struct gl_context *ctx) vbo_init_dispatch_hw_select_begin_end(struct gl_context *ctx)
{ {
int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size()); int numEntries = MAX2(_gloffset_COUNT, _mesa_glapi_get_dispatch_table_size());
memcpy(ctx->Dispatch.HWSelectModeBeginEnd, ctx->Dispatch.BeginEnd, numEntries * sizeof(_glapi_proc)); memcpy(ctx->Dispatch.HWSelectModeBeginEnd, ctx->Dispatch.BeginEnd, numEntries * sizeof(_glapi_proc));
#undef NAME #undef NAME