From 3dd4b6420f686b0147d5b8136268cc63196e253b Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 9 Mar 2014 21:32:55 +0100 Subject: fontconfig mesa xserver git update 9 Mar 2014 xserver commit 1c61d38528a573caadee2468ee59ea558c822e09 fontconfig commit f8ccf379eb1092592ae0b65deb563c5491f69de9 mesa commit 897f40f25d21af678b1b67c1a68c4a6722d19983 --- mesalib/src/mapi/entry.c | 4 +- mesalib/src/mapi/glapi/gen/ARB_debug_output.xml | 8 +- mesalib/src/mapi/glapi/gen/GL4x.xml | 2 +- mesalib/src/mapi/glapi/gen/KHR_debug.xml | 150 ++++++++++++++++++++++++ mesalib/src/mapi/glapi/gen/gl_API.xml | 144 +---------------------- mesalib/src/mapi/glapi/glapi.c | 4 +- mesalib/src/mapi/glapi/glapi.h | 4 - mesalib/src/mapi/mapi.c | 12 +- mesalib/src/mapi/mapi_glapi.c | 10 +- mesalib/src/mapi/stub.c | 6 +- mesalib/src/mapi/u_current.c | 44 +++---- mesalib/src/mapi/u_current.h | 30 ++--- mesalib/src/mapi/u_execmem.c | 6 +- mesalib/src/mapi/u_thread.h | 32 +++-- 14 files changed, 231 insertions(+), 225 deletions(-) create mode 100644 mesalib/src/mapi/glapi/gen/KHR_debug.xml (limited to 'mesalib/src/mapi') diff --git a/mesalib/src/mapi/entry.c b/mesalib/src/mapi/entry.c index 128f0115d..b6e8db28d 100644 --- a/mesalib/src/mapi/entry.c +++ b/mesalib/src/mapi/entry.c @@ -36,7 +36,7 @@ #ifdef MAPI_MODE_BRIDGE #define ENTRY_CURRENT_TABLE_GET "_glapi_get_dispatch" #else -#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_internal) +#define ENTRY_CURRENT_TABLE_GET U_STRINGIFY(u_current_get_table_internal) #endif #if defined(USE_X86_ASM) && defined(__GNUC__) @@ -57,7 +57,7 @@ entry_current_get(void) #ifdef MAPI_MODE_BRIDGE return GET_DISPATCH(); #else - return u_current_get(); + return u_current_get_table(); #endif } diff --git a/mesalib/src/mapi/glapi/gen/ARB_debug_output.xml b/mesalib/src/mapi/glapi/gen/ARB_debug_output.xml index 11f268dc6..0468d570c 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_debug_output.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_debug_output.xml @@ -52,7 +52,7 @@ - + @@ -61,7 +61,7 @@ - + @@ -70,12 +70,12 @@ - + - + diff --git a/mesalib/src/mapi/glapi/gen/GL4x.xml b/mesalib/src/mapi/glapi/gen/GL4x.xml index 6706278ce..8efef0b91 100644 --- a/mesalib/src/mapi/glapi/gen/GL4x.xml +++ b/mesalib/src/mapi/glapi/gen/GL4x.xml @@ -15,7 +15,7 @@ - + diff --git a/mesalib/src/mapi/glapi/gen/KHR_debug.xml b/mesalib/src/mapi/glapi/gen/KHR_debug.xml new file mode 100644 index 000000000..48f7fa762 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/KHR_debug.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 7e1946e22..9129d5790 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8324,149 +8324,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/mesalib/src/mapi/glapi/glapi.c b/mesalib/src/mapi/glapi/glapi.c index 3a0b638f7..194b9ee86 100644 --- a/mesalib/src/mapi/glapi/glapi.c +++ b/mesalib/src/mapi/glapi/glapi.c @@ -54,11 +54,11 @@ _glapi_check_multithread(void) void _glapi_set_context(void *context) { - u_current_set_user((const void *) context); + u_current_set_context((const void *) context); } void _glapi_set_dispatch(struct _glapi_table *dispatch) { - u_current_set((const struct mapi_table *) dispatch); + u_current_set_table((const struct mapi_table *) dispatch); } diff --git a/mesalib/src/mapi/glapi/glapi.h b/mesalib/src/mapi/glapi/glapi.h index dcf91a7f3..7c22985ec 100644 --- a/mesalib/src/mapi/glapi/glapi.h +++ b/mesalib/src/mapi/glapi/glapi.h @@ -168,10 +168,6 @@ _GLAPI_EXPORT struct _glapi_table * _glapi_create_table_from_handle(void *handle, const char *symbol_prefix); -_GLAPI_EXPORT unsigned long -_glthread_GetID(void); - - /* * These stubs are kept so that the old DRI drivers still load. */ diff --git a/mesalib/src/mapi/mapi.c b/mesalib/src/mapi/mapi.c index 56f209bfa..aa6b91b42 100644 --- a/mesalib/src/mapi/mapi.c +++ b/mesalib/src/mapi/mapi.c @@ -72,15 +72,15 @@ get_stub(const char *name, const struct mapi_stub *alias) void mapi_init(const char *spec) { - u_mutex_declare_static(mutex); + static mtx_t mutex = _MTX_INITIALIZER_NP; const char *p; int ver, count; - u_mutex_lock(mutex); + mtx_lock(&mutex); /* already initialized */ if (mapi_num_stubs) { - u_mutex_unlock(mutex); + mtx_unlock(&mutex); return; } @@ -90,7 +90,7 @@ mapi_init(const char *spec) /* parse version string */ ver = atoi(p); if (ver != 1) { - u_mutex_unlock(mutex); + mtx_unlock(&mutex); return; } p += strlen(p) + 1; @@ -115,7 +115,7 @@ mapi_init(const char *spec) mapi_num_stubs = count; - u_mutex_unlock(mutex); + mtx_unlock(&mutex); } /** @@ -186,5 +186,5 @@ mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs) void mapi_table_make_current(const struct mapi_table *tbl) { - u_current_set(tbl); + u_current_set_table(tbl); } diff --git a/mesalib/src/mapi/mapi_glapi.c b/mesalib/src/mapi/mapi_glapi.c index 7b9f1aee4..7b0903be9 100644 --- a/mesalib/src/mapi/mapi_glapi.c +++ b/mesalib/src/mapi/mapi_glapi.c @@ -58,13 +58,13 @@ _glapi_check_multithread(void) void _glapi_set_context(void *context) { - u_current_set_user((const void *) context); + u_current_set_context((const void *) context); } void _glapi_set_dispatch(struct _glapi_table *dispatch) { - u_current_set((const struct mapi_table *) dispatch); + u_current_set_table((const struct mapi_table *) dispatch); } /** @@ -222,12 +222,6 @@ _glapi_get_proc_name(unsigned int offset) return stub ? stub_get_name(stub) : NULL; } -unsigned long -_glthread_GetID(void) -{ - return u_thread_self(); -} - void _glapi_noop_enable_warnings(unsigned char enable) { diff --git a/mesalib/src/mapi/stub.c b/mesalib/src/mapi/stub.c index acd2c0a79..dfadbe1a5 100644 --- a/mesalib/src/mapi/stub.c +++ b/mesalib/src/mapi/stub.c @@ -126,11 +126,11 @@ stub_add_dynamic(const char *name) struct mapi_stub * stub_find_dynamic(const char *name, int generate) { - u_mutex_declare_static(dynamic_mutex); + static mtx_t dynamic_mutex = _MTX_INITIALIZER_NP; struct mapi_stub *stub = NULL; int count, i; - u_mutex_lock(dynamic_mutex); + mtx_lock(&dynamic_mutex); if (generate) assert(!stub_find_public(name)); @@ -147,7 +147,7 @@ stub_find_dynamic(const char *name, int generate) if (generate && !stub) stub = stub_add_dynamic(name); - u_mutex_unlock(dynamic_mutex); + mtx_unlock(&dynamic_mutex); return stub; } diff --git a/mesalib/src/mapi/u_current.c b/mesalib/src/mapi/u_current.c index 07213380d..afa887e06 100644 --- a/mesalib/src/mapi/u_current.c +++ b/mesalib/src/mapi/u_current.c @@ -103,18 +103,18 @@ __thread struct mapi_table *u_current_table __attribute__((tls_model("initial-exec"))) = (struct mapi_table *) table_noop_array; -__thread void *u_current_user +__thread void *u_current_context __attribute__((tls_model("initial-exec"))); #else struct mapi_table *u_current_table = (struct mapi_table *) table_noop_array; -void *u_current_user; +void *u_current_context; #ifdef THREADS struct u_tsd u_current_table_tsd; -static struct u_tsd u_current_user_tsd; +static struct u_tsd u_current_context_tsd; static int ThreadSafe; #endif /* THREADS */ @@ -127,7 +127,7 @@ u_current_destroy(void) { #if defined(THREADS) && defined(_WIN32) u_tsd_destroy(&u_current_table_tsd); - u_tsd_destroy(&u_current_user_tsd); + u_tsd_destroy(&u_current_context_tsd); #endif } @@ -138,13 +138,13 @@ static void u_current_init_tsd(void) { u_tsd_init(&u_current_table_tsd); - u_tsd_init(&u_current_user_tsd); + u_tsd_init(&u_current_context_tsd); } /** * Mutex for multithread check. */ -u_mutex_declare_static(ThreadCheckMutex); +static mtx_t ThreadCheckMutex = _MTX_INITIALIZER_NP; /** * We should call this periodically from a function such as glXMakeCurrent @@ -159,7 +159,7 @@ u_current_init(void) if (ThreadSafe) return; - u_mutex_lock(ThreadCheckMutex); + mtx_lock(&ThreadCheckMutex); if (firstCall) { u_current_init_tsd(); @@ -168,10 +168,10 @@ u_current_init(void) } else if (knownID != u_thread_self()) { ThreadSafe = 1; - u_current_set(NULL); - u_current_set_user(NULL); + u_current_set_table(NULL); + u_current_set_context(NULL); } - u_mutex_unlock(ThreadCheckMutex); + mtx_unlock(&ThreadCheckMutex); } #else @@ -191,17 +191,17 @@ u_current_init(void) * void from the real context pointer type. */ void -u_current_set_user(const void *ptr) +u_current_set_context(const void *ptr) { u_current_init(); #if defined(GLX_USE_TLS) - u_current_user = (void *) ptr; + u_current_context = (void *) ptr; #elif defined(THREADS) - u_tsd_set(&u_current_user_tsd, (void *) ptr); - u_current_user = (ThreadSafe) ? NULL : (void *) ptr; + u_tsd_set(&u_current_context_tsd, (void *) ptr); + u_current_context = (ThreadSafe) ? NULL : (void *) ptr; #else - u_current_user = (void *) ptr; + u_current_context = (void *) ptr; #endif } @@ -211,16 +211,16 @@ u_current_set_user(const void *ptr) * void to the real context pointer type. */ void * -u_current_get_user_internal(void) +u_current_get_context_internal(void) { #if defined(GLX_USE_TLS) - return u_current_user; + return u_current_context; #elif defined(THREADS) return (ThreadSafe) - ? u_tsd_get(&u_current_user_tsd) - : u_current_user; + ? u_tsd_get(&u_current_context_tsd) + : u_current_context; #else - return u_current_user; + return u_current_context; #endif } @@ -230,7 +230,7 @@ u_current_get_user_internal(void) * table (__glapi_noop_table). */ void -u_current_set(const struct mapi_table *tbl) +u_current_set_table(const struct mapi_table *tbl) { u_current_init(); @@ -253,7 +253,7 @@ u_current_set(const struct mapi_table *tbl) * Return pointer to current dispatch table for calling thread. */ struct mapi_table * -u_current_get_internal(void) +u_current_get_table_internal(void) { #if defined(GLX_USE_TLS) return u_current_table; diff --git a/mesalib/src/mapi/u_current.h b/mesalib/src/mapi/u_current.h index f9cffd8c3..72708d433 100644 --- a/mesalib/src/mapi/u_current.h +++ b/mesalib/src/mapi/u_current.h @@ -11,14 +11,14 @@ #ifdef GLX_USE_TLS #define u_current_table _glapi_tls_Dispatch -#define u_current_user _glapi_tls_Context +#define u_current_context _glapi_tls_Context #else #define u_current_table _glapi_Dispatch -#define u_current_user _glapi_Context +#define u_current_context _glapi_Context #endif -#define u_current_get_internal _glapi_get_dispatch -#define u_current_get_user_internal _glapi_get_context +#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 @@ -33,13 +33,13 @@ struct mapi_table; extern __thread struct mapi_table *u_current_table __attribute__((tls_model("initial-exec"))); -extern __thread void *u_current_user +extern __thread void *u_current_context __attribute__((tls_model("initial-exec"))); #else /* GLX_USE_TLS */ extern struct mapi_table *u_current_table; -extern void *u_current_user; +extern void *u_current_context; #endif /* GLX_USE_TLS */ @@ -52,35 +52,35 @@ void u_current_destroy(void); void -u_current_set(const struct mapi_table *tbl); +u_current_set_table(const struct mapi_table *tbl); struct mapi_table * -u_current_get_internal(void); +u_current_get_table_internal(void); void -u_current_set_user(const void *ptr); +u_current_set_context(const void *ptr); void * -u_current_get_user_internal(void); +u_current_get_context_internal(void); static INLINE const struct mapi_table * -u_current_get(void) +u_current_get_table(void) { #ifdef GLX_USE_TLS return u_current_table; #else return (likely(u_current_table) ? - u_current_table : u_current_get_internal()); + u_current_table : u_current_get_table_internal()); #endif } static INLINE const void * -u_current_get_user(void) +u_current_get_context(void) { #ifdef GLX_USE_TLS - return u_current_user; + return u_current_context; #else - return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); + return likely(u_current_context) ? u_current_context : u_current_get_context_internal(); #endif } diff --git a/mesalib/src/mapi/u_execmem.c b/mesalib/src/mapi/u_execmem.c index 357365263..ac1cae093 100644 --- a/mesalib/src/mapi/u_execmem.c +++ b/mesalib/src/mapi/u_execmem.c @@ -39,7 +39,7 @@ #define EXEC_MAP_SIZE (4*1024) -u_mutex_declare_static(exec_mutex); +static mtx_t exec_mutex = _MTX_INITIALIZER_NP; static unsigned int head = 0; @@ -123,7 +123,7 @@ u_execmem_alloc(unsigned int size) { void *addr = NULL; - u_mutex_lock(exec_mutex); + mtx_lock(&exec_mutex); if (!init_map()) goto bail; @@ -137,7 +137,7 @@ u_execmem_alloc(unsigned int size) head += size; bail: - u_mutex_unlock(exec_mutex); + mtx_unlock(&exec_mutex); return addr; } diff --git a/mesalib/src/mapi/u_thread.h b/mesalib/src/mapi/u_thread.h index ba5d98ea9..57c3b076a 100644 --- a/mesalib/src/mapi/u_thread.h +++ b/mesalib/src/mapi/u_thread.h @@ -57,9 +57,9 @@ /* * Error messages */ -#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" -#define GET_TSD_ERROR "_glthread_: failed to get thread specific data" -#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" +#define INIT_TSD_ERROR "Mesa: failed to allocate key for thread specific data" +#define GET_TSD_ERROR "Mesa: failed to get thread specific data" +#define SET_TSD_ERROR "Mesa: thread failed to set thread specific data" /* @@ -79,20 +79,28 @@ struct u_tsd { unsigned initMagic; }; -typedef mtx_t u_mutex; - -#define u_mutex_declare_static(name) \ - static u_mutex name = _MTX_INITIALIZER_NP - -#define u_mutex_init(name) mtx_init(&(name), mtx_plain) -#define u_mutex_destroy(name) mtx_destroy(&(name)) -#define u_mutex_lock(name) (void) mtx_lock(&(name)) -#define u_mutex_unlock(name) (void) mtx_unlock(&(name)) static INLINE unsigned long u_thread_self(void) { + /* + * XXX: Callers of u_thread_self assume it is a lightweight function, + * returning a numeric value. But unfortunately C11's thrd_current() gives + * no such guarantees. In fact, it's pretty hard to have a compliant + * implementation of thrd_current() on Windows with such characteristics. + * So for now, we side-step this mess and use Windows thread primitives + * directly here. + * + * FIXME: On the other hand, u_thread_self() is a bad + * abstraction. Even with pthreads, there is no guarantee that + * pthread_self() will return numeric IDs -- we should be using + * pthread_equal() instead of assuming we can compare thread ids... + */ +#ifdef _WIN32 + return GetCurrentThreadId(); +#else return (unsigned long) (uintptr_t) thrd_current(); +#endif } -- cgit v1.2.3