From 760451baaec42bced6ade5026546ed3759495d70 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 21 Aug 2010 11:50:22 +0800 Subject: glapi: Move public function/variable declarations to glapi.h. glapi defines an interface that is used by DRI drivers. It must not be changed in an ABI incompatible way. This commit moves all functions/variables belong to the interface to glapi.h. Instead of including u_current.h from glapi.h, u_current.h now includes glapi.h. --- src/mapi/glapi/glapi.h | 99 ++++++++++++++++++++++++++++++++++++++++------ src/mapi/glapi/glapi_nop.c | 11 +----- src/mapi/glapi/glthread.c | 2 +- src/mapi/glapi/glthread.h | 5 +-- 4 files changed, 90 insertions(+), 27 deletions(-) (limited to 'src/mapi/glapi') diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index a74884d595..1f18bf00fd 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -44,10 +44,11 @@ #ifndef _GLAPI_H #define _GLAPI_H -#ifndef MAPI_GLAPI_CURRENT -#define MAPI_GLAPI_CURRENT -#endif +#define _GLAPI_EXPORT PUBLIC + + +/* Is this needed? It is incomplete anyway. */ #ifdef USE_MGL_NAMESPACE #define _glapi_set_dispatch _mglapi_set_dispatch #define _glapi_get_dispatch _mglapi_get_dispatch @@ -57,32 +58,106 @@ #define _glapi_Context _mglapi_Context #endif -#include "mapi/u_current.h" #include "glapi/glthread.h" typedef void (*_glapi_proc)(void); +struct _glapi_table; + + +#if defined (GLX_USE_TLS) + +_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))); + +_GLAPI_EXPORT extern __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern const void *_glapi_Context; + +# define GET_DISPATCH() _glapi_tls_Dispatch +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context + +#else + +_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern void *_glapi_Context; + +# ifdef THREADS + +# define GET_DISPATCH() \ + (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch()) + +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \ + (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context()) + +# else + +# define GET_DISPATCH() _glapi_Dispatch +# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context + +# endif + +#endif /* defined (GLX_USE_TLS) */ + + +void +_glapi_destroy_multithread(void); -#define GET_DISPATCH() ((struct _glapi_table *) u_current_get()) -#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) u_current_get_user() -PUBLIC unsigned int +_GLAPI_EXPORT void +_glapi_check_multithread(void); + + +_GLAPI_EXPORT void +_glapi_set_context(void *context); + + +_GLAPI_EXPORT void * +_glapi_get_context(void); + + +_GLAPI_EXPORT void +_glapi_set_dispatch(struct _glapi_table *dispatch); + + +_GLAPI_EXPORT struct _glapi_table * +_glapi_get_dispatch(void); + + +_GLAPI_EXPORT unsigned int _glapi_get_dispatch_table_size(void); -PUBLIC int +_GLAPI_EXPORT int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ); -PUBLIC int +_GLAPI_EXPORT int _glapi_get_proc_offset(const char *funcName); -PUBLIC _glapi_proc +_GLAPI_EXPORT _glapi_proc _glapi_get_proc_address(const char *funcName); -PUBLIC const char * +_GLAPI_EXPORT const char * _glapi_get_proc_name(unsigned int offset); -#endif +_GLAPI_EXPORT unsigned long +_glthread_GetID(void); + + +/* + * These stubs are kept so that the old DRI drivers still load. + */ +_GLAPI_EXPORT void +_glapi_noop_enable_warnings(unsigned char enable); + + +_GLAPI_EXPORT void +_glapi_set_warning_func(_glapi_proc func); + + +#endif /* _GLAPI_H */ diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index 9709551ee7..df46ca8c89 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -49,17 +49,8 @@ #include "glapi/glapi.h" -/* - * These stubs are kept so that the old DRI drivers still load. - */ -PUBLIC void -_glapi_noop_enable_warnings(GLboolean enable); - -PUBLIC void -_glapi_set_warning_func(_glapi_proc func); - void -_glapi_noop_enable_warnings(GLboolean enable) +_glapi_noop_enable_warnings(unsigned char enable) { } diff --git a/src/mapi/glapi/glthread.c b/src/mapi/glapi/glthread.c index 9dbc0e9a56..00915380f9 100644 --- a/src/mapi/glapi/glthread.c +++ b/src/mapi/glapi/glthread.c @@ -1,4 +1,4 @@ -#include "glthread.h" +#include "glapi/glapi.h" unsigned long _glthread_GetID(void) diff --git a/src/mapi/glapi/glthread.h b/src/mapi/glapi/glthread.h index 54292706ac..fc4ece7c33 100644 --- a/src/mapi/glapi/glthread.h +++ b/src/mapi/glapi/glthread.h @@ -17,7 +17,4 @@ typedef struct u_tsd _glthread_TSD; typedef u_mutex _glthread_Mutex; -PUBLIC unsigned long -_glthread_GetID(void); - -#endif /* THREADS_H */ +#endif /* GLTHREAD_H */ -- cgit v1.2.3 From e607b67ebc0d15f6709fc8f9c79afeeda8ac1031 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 23 Aug 2010 16:13:12 +0800 Subject: glapi: Clean up header inclusions. Do not rely on PUBLIC being defined in glapi.h. Do not include core mesa headers. --- src/mapi/glapi/glapi.h | 21 ++++++++++++++++++++- src/mapi/glapi/glapi_dispatch.c | 11 +---------- src/mapi/glapi/glapi_entrypoint.c | 9 --------- src/mapi/glapi/glapi_getproc.c | 9 --------- src/mapi/glapi/glapi_nop.c | 10 +--------- src/mapi/glapi/glapi_priv.h | 25 +++++++++++++++++++++++-- 6 files changed, 45 insertions(+), 40 deletions(-) (limited to 'src/mapi/glapi') diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h index 1f18bf00fd..a0bb078106 100644 --- a/src/mapi/glapi/glapi.h +++ b/src/mapi/glapi/glapi.h @@ -45,7 +45,26 @@ #define _GLAPI_H -#define _GLAPI_EXPORT PUBLIC +/* opengl.dll does not export _glapi_* */ +#if defined(_WIN32) +#define _GLAPI_NO_EXPORTS +#endif + +#ifdef _GLAPI_NO_EXPORTS +# define _GLAPI_EXPORT +#else /* _GLAPI_NO_EXPORTS */ +# ifdef _WIN32 +# ifdef _GLAPI_DLL_EXPORTS +# define _GLAPI_EXPORT __declspec(dllexport) +# else +# define _GLAPI_EXPORT __declspec(dllimport) +# endif +# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define _GLAPI_EXPORT __attribute__((visibility("default"))) +# else +# define _GLAPI_EXPORT +# endif +#endif /* _GLAPI_NO_EXPORTS */ /* Is this needed? It is incomplete anyway. */ diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index ae59140ad3..7421a36d35 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -37,18 +37,9 @@ * \author Brian Paul */ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" +#include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapidispatch.h" -#include "glapi/glthread.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c index 82c68c27c8..993ccb94c2 100644 --- a/src/mapi/glapi/glapi_entrypoint.c +++ b/src/mapi/glapi/glapi_entrypoint.c @@ -29,15 +29,6 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" #include "glapi/glapi_priv.h" #include "mapi/u_execmem.h" diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c index 3c134f929d..dc4905b64e 100644 --- a/src/mapi/glapi/glapi_getproc.c +++ b/src/mapi/glapi/glapi_getproc.c @@ -30,15 +30,6 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" #include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapioffsets.h" diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c index df46ca8c89..9b09297150 100644 --- a/src/mapi/glapi/glapi_nop.c +++ b/src/mapi/glapi/glapi_nop.c @@ -38,15 +38,7 @@ -#ifdef HAVE_DIX_CONFIG_H -#include -#include "glapi/mesa.h" -#else -#include "main/compiler.h" -#include "main/glheader.h" -#endif - -#include "glapi/glapi.h" +#include "glapi/glapi_priv.h" void diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h index 1c2a704211..89f81c723e 100644 --- a/src/mapi/glapi/glapi_priv.h +++ b/src/mapi/glapi/glapi_priv.h @@ -26,9 +26,30 @@ #ifndef _GLAPI_PRIV_H #define _GLAPI_PRIV_H -#include "glthread.h" -#include "glapi.h" +#include +#include +#include + +#ifdef HAVE_DIX_CONFIG_H +#include +#include "glapi/mesa.h" +#else /* HAVE_DIX_CONFIG_H */ +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +#ifndef GL_FIXED +typedef int GLfixed; +typedef int GLclampx; +#endif + +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; +#endif + +#endif /* HAVE_DIX_CONFIG_H */ +#include "glapi/glapi.h" /* getproc */ -- cgit v1.2.3 From 699c82e30ce78c3975b3ce1a6fba148c70a9a78a Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Mon, 30 Aug 2010 20:48:49 +0200 Subject: glapi: fix generator which got out of sync with the codebase The __GLapi typedef was removed in c356f5867f2c1fad7155df538b9affa8dbdcf869, but the code generator hasn't been updated. --- src/mapi/glapi/gen/glX_proto_send.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mapi/glapi') diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py index 0ca0ff92a6..bd41c9e667 100644 --- a/src/mapi/glapi/gen/glX_proto_send.py +++ b/src/mapi/glapi/gen/glX_proto_send.py @@ -895,13 +895,13 @@ static int NoOp(void) * Create and initialize a new GL dispatch table. The table is initialized * with GLX indirect rendering protocol functions. */ -__GLapi * __glXNewIndirectAPI( void ) +struct _glapi_table * __glXNewIndirectAPI( void ) { - __GLapi *glAPI; + struct _glapi_table *glAPI; GLuint entries; entries = _glapi_get_dispatch_table_size(); - glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *)); + glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); /* first, set all entries to point to no-op functions */ { -- cgit v1.2.3