summaryrefslogtreecommitdiff
path: root/src/mapi
diff options
context:
space:
mode:
authorYonggang Luo <luoyonggang@gmail.com>2022-07-27 15:54:59 +0800
committerMarge Bot <emma+marge@anholt.net>2022-08-22 21:32:09 +0000
commit7f49abbdc0a1ceb7ea4f31938f7eaa9bb41ae891 (patch)
tree4ba8edfcde33415e0efd9203104b2f3adabb1503 /src/mapi
parent01d6ae536b0a0d1cd6a11e883e0dba7abfeecd11 (diff)
mapi: Move shared _glapi_set_context and _glapi_set_dispatch into u_current.c
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17814>
Diffstat (limited to 'src/mapi')
-rw-r--r--src/mapi/entry.c6
-rw-r--r--src/mapi/glapi/glapi.c18
-rw-r--r--src/mapi/mapi_glapi.c18
-rw-r--r--src/mapi/u_current.c24
-rw-r--r--src/mapi/u_current.h33
5 files changed, 21 insertions, 78 deletions
diff --git a/src/mapi/entry.c b/src/mapi/entry.c
index a4f97906c79..5405336f9dd 100644
--- a/src/mapi/entry.c
+++ b/src/mapi/entry.c
@@ -37,7 +37,7 @@
#define U_STRINGIFY(x) _U_STRINGIFY(x)
/* define macros for use by assembly dispatchers */
-#define ENTRY_CURRENT_TABLE U_STRINGIFY(u_current_table)
+#define ENTRY_CURRENT_TABLE U_STRINGIFY(_glapi_tls_Dispatch)
/* REALLY_INITIAL_EXEC implies __GLIBC__ */
#if defined(USE_X86_ASM) && defined(REALLY_INITIAL_EXEC)
@@ -51,11 +51,7 @@
static inline const struct _glapi_table *
entry_current_get(void)
{
-#ifdef MAPI_MODE_BRIDGE
return GET_DISPATCH();
-#else
- return u_current_get_table_internal();
-#endif
}
/* C version of the public entries */
diff --git a/src/mapi/glapi/glapi.c b/src/mapi/glapi/glapi.c
index 1c0a75a8b1c..44af484a377 100644
--- a/src/mapi/glapi/glapi.c
+++ b/src/mapi/glapi/glapi.c
@@ -29,8 +29,10 @@
#include "u_current.h"
/*
- * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in
- * u_current.c.
+ * _glapi_tls_Dispatch, _glapi_tls_Context,
+ * _glapi_set_context, _glapi_get_context,
+ * _glapi_set_dispatch, and _glapi_get_dispatch
+ * are defined in u_current.c.
*/
/* not used, but defined for compatibility */
@@ -46,15 +48,3 @@ void
_glapi_check_multithread(void)
{
}
-
-void
-_glapi_set_context(void *context)
-{
- u_current_set_context((const void *) context);
-}
-
-void
-_glapi_set_dispatch(struct _glapi_table *dispatch)
-{
- u_current_set_table((const struct _glapi_table *) dispatch);
-}
diff --git a/src/mapi/mapi_glapi.c b/src/mapi/mapi_glapi.c
index b44c64b018f..d89c94d9547 100644
--- a/src/mapi/mapi_glapi.c
+++ b/src/mapi/mapi_glapi.c
@@ -34,8 +34,10 @@
#include "stub.h"
/*
- * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in
- * u_current.c.
+ * _glapi_tls_Dispatch, _glapi_tls_Context,
+ * _glapi_set_context, _glapi_get_context,
+ * _glapi_set_dispatch, and _glapi_get_dispatch
+ * are defined in u_current.c.
*/
/* not used, but defined for compatibility */
@@ -52,18 +54,6 @@ _glapi_check_multithread(void)
{
}
-void
-_glapi_set_context(void *context)
-{
- u_current_set_context((const void *) context);
-}
-
-void
-_glapi_set_dispatch(struct _glapi_table *dispatch)
-{
- u_current_set_table((const struct _glapi_table *) dispatch);
-}
-
/**
* Return size of dispatch table struct as number of functions (or
* slots).
diff --git a/src/mapi/u_current.c b/src/mapi/u_current.c
index 39db11b54df..ac7b8ab6789 100644
--- a/src/mapi/u_current.c
+++ b/src/mapi/u_current.c
@@ -94,10 +94,10 @@ extern void (*__glapi_noop_table[])(void);
*/
/*@{*/
-__THREAD_INITIAL_EXEC struct _glapi_table *u_current_table
- = (struct _glapi_table *) table_noop_array;
+__THREAD_INITIAL_EXEC struct _glapi_table *_glapi_tls_Dispatch
+ = (struct _glapi_table *) table_noop_array;
-__THREAD_INITIAL_EXEC void *u_current_context;
+__THREAD_INITIAL_EXEC void *_glapi_tls_Context;
/*@}*/
@@ -107,9 +107,9 @@ __THREAD_INITIAL_EXEC void *u_current_context;
* void from the real context pointer type.
*/
void
-u_current_set_context(const void *ptr)
+_glapi_set_context(void *ptr)
{
- u_current_context = (void *) ptr;
+ _glapi_tls_Context = ptr;
}
/**
@@ -118,9 +118,9 @@ u_current_set_context(const void *ptr)
* void to the real context pointer type.
*/
void *
-u_current_get_context_internal(void)
+_glapi_get_context(void)
{
- return u_current_context;
+ return _glapi_tls_Context;
}
/**
@@ -129,21 +129,21 @@ u_current_get_context_internal(void)
* table (__glapi_noop_table).
*/
void
-u_current_set_table(const struct _glapi_table *tbl)
+_glapi_set_dispatch(struct _glapi_table *tbl)
{
stub_init_once();
if (!tbl)
- tbl = (const struct _glapi_table *) table_noop_array;
+ tbl = (struct _glapi_table *) table_noop_array;
- u_current_table = (struct _glapi_table *) tbl;
+ _glapi_tls_Dispatch = tbl;
}
/**
* Return pointer to current dispatch table for calling thread.
*/
struct _glapi_table *
-u_current_get_table_internal(void)
+_glapi_get_dispatch(void)
{
- return u_current_table;
+ return _glapi_tls_Dispatch;
}
diff --git a/src/mapi/u_current.h b/src/mapi/u_current.h
index bcabdc966f3..15ef61ce821 100644
--- a/src/mapi/u_current.h
+++ b/src/mapi/u_current.h
@@ -1,39 +1,6 @@
#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"
-#define u_current_table _glapi_tls_Dispatch
-#define u_current_context _glapi_tls_Context
-
-#define u_current_get_table_internal _glapi_get_dispatch
-#define u_current_get_context_internal _glapi_get_context
-
-#else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
-
-struct _glapi_table;
-
-extern __THREAD_INITIAL_EXEC struct _glapi_table *u_current_table;
-extern __THREAD_INITIAL_EXEC void *u_current_context;
-
-#endif /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
-
-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_ */