diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-03-10 04:15:09 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-03-10 04:15:09 +0000 |
commit | 602f8c7f6f47624df1ff30957c65299861b5e190 (patch) | |
tree | 69af7ec44b4bf0fb6b30f6eb6df9ebe1ccd68d4a /lib/mesa/src/mapi/u_current.h | |
parent | f48bdcc559295c4d58e4aa8042d571fe9586498d (diff) |
revert upstream Mesa changes to remove non-TLS paths
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17814
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17213
Emulated TLS isn't enough when many shared libraries are involved.
This caused problems with some ports: kitty, calibre, qutebrowser.
reported by tb@ and others
Diffstat (limited to 'lib/mesa/src/mapi/u_current.h')
-rw-r--r-- | lib/mesa/src/mapi/u_current.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/mesa/src/mapi/u_current.h b/lib/mesa/src/mapi/u_current.h index 15ef61ce8..a21a0779a 100644 --- a/lib/mesa/src/mapi/u_current.h +++ b/lib/mesa/src/mapi/u_current.h @@ -1,6 +1,61 @@ #ifndef _U_CURRENT_H_ #define _U_CURRENT_H_ +#include "util/macros.h" + + +#if defined(MAPI_MODE_UTIL) || defined(MAPI_MODE_GLAPI) || \ + defined(MAPI_MODE_BRIDGE) + #include "glapi/glapi.h" +#ifdef USE_ELF_TLS +#define u_current_table _glapi_tls_Dispatch +#define u_current_context _glapi_tls_Context +#else +#define u_current_table _glapi_Dispatch +#define u_current_context _glapi_Context +#endif + +#define u_current_get_table_internal _glapi_get_dispatch +#define u_current_get_context_internal _glapi_get_context + +#define u_current_table_tsd _gl_DispatchTSD + +#else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */ + +struct _glapi_table; + +#ifdef USE_ELF_TLS + +extern __THREAD_INITIAL_EXEC struct _glapi_table *u_current_table; +extern __THREAD_INITIAL_EXEC void *u_current_context; + +#else /* USE_ELF_TLS */ + +extern struct _glapi_table *u_current_table; +extern void *u_current_context; + +#endif /* USE_ELF_TLS */ + +#endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */ + +void +u_current_init(void); + +void +u_current_destroy(void); + +void +u_current_set_table(const struct _glapi_table *tbl); + +_GLAPI_EXPORT struct _glapi_table * +u_current_get_table_internal(void); + +void +u_current_set_context(const void *ptr); + +_GLAPI_EXPORT void * +u_current_get_context_internal(void); + #endif /* _U_CURRENT_H_ */ |