summaryrefslogtreecommitdiff
path: root/src/mesa/glapi/glthread.h
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2004-06-29 19:08:20 +0000
committerIan Romanick <idr@us.ibm.com>2004-06-29 19:08:20 +0000
commit8e77da1cd7d63af5e7ffcf7ea220cdaf1bdc8162 (patch)
tree0c4880d81a752b0ded4c75374cba6caa77e971da /src/mesa/glapi/glthread.h
parentc61c7cb8e4100476d5feb976c39a23b1ed7b564a (diff)
First phase of TLS work. At this point SPARC assembly dispatch is
broken, but it will be fixed "shortly." This is pretty much the same as the patch I sent to the dri-devel list on 22-Jun-2004.
Diffstat (limited to 'src/mesa/glapi/glthread.h')
-rw-r--r--src/mesa/glapi/glthread.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/mesa/glapi/glthread.h b/src/mesa/glapi/glthread.h
index 4391ed4f9a..283d549df0 100644
--- a/src/mesa/glapi/glthread.h
+++ b/src/mesa/glapi/glthread.h
@@ -109,6 +109,20 @@ typedef pthread_mutex_t _glthread_Mutex;
#define _glthread_UNLOCK_MUTEX(name) \
(void) pthread_mutex_unlock(&(name))
+/* This is temporarilly removed because driver binaries cannot count on
+ * the existance of _gl_DispatchTSD in libGL. It only exists in "new"
+ * libGL. We may be able to ressurect this optimization at some point
+ * for DRI driver or for software Mesa.
+ */
+#if 0
+extern struct _glapi_table * _glapi_DispatchTSD;
+extern _glthread_TSD _gl_DispatchTSD;
+
+#define GL_CALL(name) \
+ (((__builtin_expect( _glapi_DispatchTSD != NULL, 1 )) \
+ ? _glapi_DispatchTSD : (struct _glapi_table *) pthread_getspecific(_gl_DispatchTSD.key))-> name)
+#endif
+
#endif /* PTHREADS */
@@ -291,8 +305,15 @@ extern void
_glthread_SetTSD(_glthread_TSD *, void *);
#ifndef GL_CALL
-# define GL_CALL(name) (*(_glapi_Dispatch-> name))
-#endif
+# if defined(THREADS)
+extern struct _glapi_table * _glapi_DispatchTSD;
+# define GL_CALL(name) \
+ (((__builtin_expect( _glapi_DispatchTSD != NULL, 1 )) \
+ ? _glapi_DispatchTSD : _glapi_get_dispatch())-> name)
+# else
+# define GL_CALL(name) (*(_glapi_Dispatch-> name))
+# endif /* defined(THREADS) */
+#endif /* ndef GL_CALL */
#endif /* THREADS_H */