mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 13:10:10 +01:00
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>
This commit is contained in:
parent
01d6ae536b
commit
7f49abbdc0
5 changed files with 21 additions and 78 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue