summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mapi/glapi/glapi.h99
-rw-r--r--src/mapi/glapi/glapi_nop.c11
-rw-r--r--src/mapi/glapi/glthread.c2
-rw-r--r--src/mapi/glapi/glthread.h5
-rw-r--r--src/mapi/mapi/u_current.h37
5 files changed, 107 insertions, 47 deletions
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 */
diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h
index a6256f5b51..a6bd9f0838 100644
--- a/src/mapi/mapi/u_current.h
+++ b/src/mapi/mapi/u_current.h
@@ -4,49 +4,44 @@
#include "u_compiler.h"
#ifdef MAPI_GLAPI_CURRENT
-#define GLAPI_EXPORT PUBLIC
-#else
-#define GLAPI_EXPORT
-#endif
-/*
- * Unlike other utility functions, we need to keep the old names (_glapi_*) for
- * ABI compatibility. The desired functions are wrappers to the old ones.
- */
+#include "glapi/glapi.h"
+
+#else /* MAPI_GLAPI_CURRENT */
struct _glapi_table;
#ifdef GLX_USE_TLS
-GLAPI_EXPORT extern __thread struct _glapi_table *_glapi_tls_Dispatch
+extern __thread struct _glapi_table *_glapi_tls_Dispatch
__attribute__((tls_model("initial-exec")));
-GLAPI_EXPORT extern __thread void *_glapi_tls_Context
+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;
+extern const struct _glapi_table *_glapi_Dispatch;
+extern const void *_glapi_Context;
#else /* GLX_USE_TLS */
-GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
-GLAPI_EXPORT extern void *_glapi_Context;
+extern struct _glapi_table *_glapi_Dispatch;
+extern void *_glapi_Context;
#endif /* GLX_USE_TLS */
-GLAPI_EXPORT void
+void
_glapi_check_multithread(void);
-GLAPI_EXPORT void
+void
_glapi_set_context(void *context);
-GLAPI_EXPORT void *
+void *
_glapi_get_context(void);
-GLAPI_EXPORT void
+void
_glapi_set_dispatch(struct _glapi_table *dispatch);
-GLAPI_EXPORT struct _glapi_table *
+struct _glapi_table *
_glapi_get_dispatch(void);
void
@@ -90,4 +85,6 @@ u_current_get_user(void)
#endif
}
-#endif /* GLX_USE_TLS */
+#endif /* MAPI_GLAPI_CURRENT */
+
+#endif /* _U_CURRENT_H_ */