X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fx11%2Fglxapi.c;h=a870e94ed4a06e9968d81cca74e85d304f176764;hb=f8ac314cc2353f439e6a917db4e3aeaf47e2093e;hp=309a0008d768cb1ca540ad3b512ea7df0ea77078;hpb=fb9ee9b323bff93973a39560b2bc007aace4bddd;p=mesa.git diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 309a0008d76..a870e94ed4a 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -17,16 +16,17 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ /* - * This is the GLX API dispatcher. Calls to the glX* functions are - * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions. - * See the glxapi.h file for more details. + * This is the GLX API dispatcher. It uses a dispatch table but that's + * not really needed anymore since the table always points to the "fake" + * GLX functions. */ @@ -34,12 +34,12 @@ #include #include #include -#include "glheader.h" -#include "glapi.h" +#include "main/glheader.h" +#include "main/compiler.h" +#include "glapi/glapi.h" #include "glxapi.h" -extern struct _glxapi_table *_real_GetGLXDispatchTable(void); extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); @@ -49,6 +49,36 @@ struct display_dispatch { struct display_dispatch *Next; }; + +/** + * When GLX_INDIRECT_RENDERING is defined, some symbols are missing in + * libglapi.a. We need to define them here. + */ +#ifdef GLX_INDIRECT_RENDERING + +#include "glapi/glapitable.h" + +#define KEYWORD1 PUBLIC + +#if defined(USE_MGL_NAMESPACE) +#define NAME(func) mgl##func +#else +#define NAME(func) gl##func +#endif + +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + GET_DISPATCH()->FUNC ARGS + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + return GET_DISPATCH()->FUNC ARGS + +/* skip normal ones */ +#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS +#include "glapi/glapitemp.h" + +#endif /* GLX_INDIRECT_RENDERING */ + + static struct display_dispatch *DispatchList = NULL; @@ -76,15 +106,13 @@ get_dispatch(Display *dpy) } } - /* A new display, determine if we should use real GLX - * or Mesa's pseudo-GLX. - */ + /* Setup the dispatch table */ { struct _glxapi_table *t = _mesa_GetGLXDispatchTable(); if (t) { struct display_dispatch *d; - d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch)); + d = malloc(sizeof(struct display_dispatch)); if (d) { d->Dpy = dpy; d->Table = t; @@ -99,15 +127,11 @@ get_dispatch(Display *dpy) } } - /* If we get here that means we can't use real GLX on this display - * and the Mesa pseudo-GLX software renderer wasn't compiled in. - * Or, we ran out of memory! - */ return NULL; } -/* Don't use the GET_DISPATCH defined in glthread.h */ +/* Don't use the GET_DISPATCH macro */ #undef GET_DISPATCH #define GET_DISPATCH(DPY, TABLE) \ @@ -122,34 +146,6 @@ get_dispatch(Display *dpy) } - - -/** - * GLX API current context. - */ -#if defined(GLX_USE_TLS) -PUBLIC __thread void * CurrentContext - __attribute__((tls_model("initial-exec"))); -#elif defined(THREADS) -static _glthread_TSD ContextTSD; /**< Per-thread context pointer */ -#else -static GLXContext CurrentContext = 0; -#endif - - -static void -SetCurrentContext(GLXContext c) -{ -#if defined(GLX_USE_TLS) - CurrentContext = c; -#elif defined(THREADS) - _glthread_SetTSD(&ContextTSD, c); -#else - CurrentContext = c; -#endif -} - - /* * GLX API entrypoints */ @@ -207,8 +203,6 @@ glXDestroyContext(Display *dpy, GLXContext ctx) GET_DISPATCH(dpy, t); if (!t) return; - if (glXGetCurrentContext() == ctx) - SetCurrentContext(NULL); (t->DestroyContext)(dpy, ctx); } @@ -235,16 +229,13 @@ glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value) } +/* declare here to avoid including xmesa.h */ +extern void *XMesaGetCurrentContext(void); + GLXContext PUBLIC glXGetCurrentContext(void) { -#if defined(GLX_USE_TLS) - return CurrentContext; -#elif defined(THREADS) - return (GLXContext) _glthread_GetTSD(&ContextTSD); -#else - return CurrentContext; -#endif + return (GLXContext) XMesaGetCurrentContext(); } @@ -277,9 +268,6 @@ glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx) return False; } b = (*t->MakeCurrent)(dpy, drawable, ctx); - if (b) { - SetCurrentContext(ctx); - } return b; } @@ -552,9 +540,6 @@ glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXConte if (!t) return False; b = (t->MakeContextCurrent)(dpy, draw, read, ctx); - if (b) { - SetCurrentContext(ctx); - } return b; } @@ -1079,34 +1064,9 @@ glXGetAGPOffsetMESA( const GLvoid *pointer ) } -/*** GLX_MESA_allocate_memory */ - -void * -glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, - float readfreq, float writefreq, float priority) -{ - /* dummy */ - return NULL; -} - -void -glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) -{ - /* dummy */ -} - - -GLuint -glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer) -{ - /* dummy */ - return 0; -} - - /*** GLX_EXT_texture_from_pixmap */ -void +void PUBLIC glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list) { @@ -1116,7 +1076,7 @@ glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, t->BindTexImageEXT(dpy, drawable, buffer, attrib_list); } -void +void PUBLIC glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer) { struct _glxapi_table *t; @@ -1171,6 +1131,9 @@ _glxapi_get_extensions(void) #endif #ifdef GLX_EXT_texture_from_pixmap "GLX_EXT_texture_from_pixmap", +#endif +#ifdef GLX_INTEL_swap_event + "GLX_INTEL_swap_event", #endif NULL }; @@ -1352,11 +1315,6 @@ static struct name_address_pair GLX_functions[] = { /*** GLX_MESA_agp_offset ***/ { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA }, - /*** GLX_MESA_allocate_memory ***/ - { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA }, - { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA }, - { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA }, - /*** GLX_EXT_texture_from_pixmap ***/ { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT }, { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT }, @@ -1374,7 +1332,12 @@ _glxapi_get_proc_address(const char *funcName) { GLuint i; for (i = 0; GLX_functions[i].Name; i++) { +#ifdef MANGLE + /* skip the "m" prefix on the name */ + if (strcmp(GLX_functions[i].Name, funcName+1) == 0) +#else if (strcmp(GLX_functions[i].Name, funcName) == 0) +#endif return GLX_functions[i].Address; } return NULL; @@ -1386,7 +1349,7 @@ _glxapi_get_proc_address(const char *funcName) * This function does not get dispatched through the dispatch table * since it's really a "meta" function. */ -__GLXextFuncPtr +__GLXextFuncPtr PUBLIC glXGetProcAddressARB(const GLubyte *procName) { __GLXextFuncPtr f; @@ -1402,7 +1365,8 @@ glXGetProcAddressARB(const GLubyte *procName) /* GLX 1.4 */ -void (*glXGetProcAddress(const GLubyte *procName))() +void PUBLIC +(*glXGetProcAddress(const GLubyte *procName))() { return glXGetProcAddressARB(procName); }