mapi: replace mapi_table abstraction

Replace all instances of mapi_table with the actual struct _glapi_table.
The former may have been needed when the OpenVG was around. But since
that one is long gone, there' no point in having the current confusing
mix of the two.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
Emil Velikov
2017-04-13 18:23:50 +01:00
committed by Emil Velikov
parent 424cb9d3ea
commit 4562d88c1d
7 changed files with 25 additions and 28 deletions

View File

@@ -53,7 +53,7 @@
#include <stdlib.h> #include <stdlib.h>
static inline const struct mapi_table * static inline const struct _glapi_table *
entry_current_get(void) entry_current_get(void)
{ {
#ifdef MAPI_MODE_BRIDGE #ifdef MAPI_MODE_BRIDGE

View File

@@ -60,5 +60,5 @@ _glapi_set_context(void *context)
void void
_glapi_set_dispatch(struct _glapi_table *dispatch) _glapi_set_dispatch(struct _glapi_table *dispatch)
{ {
u_current_set_table((const struct mapi_table *) dispatch); u_current_set_table((const struct _glapi_table *) dispatch);
} }

View File

@@ -437,7 +437,7 @@ class ABIPrinter(object):
if ent.ret: if ent.ret:
ret = 'return ' ret = 'return '
stmt1 = self.indent stmt1 = self.indent
stmt1 += 'const struct mapi_table *_tbl = %s();' % ( stmt1 += 'const struct _glapi_table *_tbl = %s();' % (
self.current_get) self.current_get)
stmt2 = self.indent stmt2 = self.indent
stmt2 += 'mapi_func _func = ((const mapi_func *) _tbl)[%d];' % ( stmt2 += 'mapi_func _func = ((const mapi_func *) _tbl)[%d];' % (

View File

@@ -65,7 +65,7 @@ _glapi_set_context(void *context)
void void
_glapi_set_dispatch(struct _glapi_table *dispatch) _glapi_set_dispatch(struct _glapi_table *dispatch)
{ {
u_current_set_table((const struct mapi_table *) dispatch); u_current_set_table((const struct _glapi_table *) dispatch);
} }
/** /**

View File

@@ -37,7 +37,7 @@
#define MAPI_TABLE_NUM_SLOTS (MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC) #define MAPI_TABLE_NUM_SLOTS (MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC)
#define MAPI_TABLE_SIZE (MAPI_TABLE_NUM_SLOTS * sizeof(mapi_func)) #define MAPI_TABLE_SIZE (MAPI_TABLE_NUM_SLOTS * sizeof(mapi_func))
struct mapi_table; struct _glapi_table;
extern const mapi_func table_noop_array[]; extern const mapi_func table_noop_array[];
@@ -52,17 +52,17 @@ table_set_noop_handler(nop_handler_proc func);
/** /**
* Get the no-op dispatch table. * Get the no-op dispatch table.
*/ */
static inline const struct mapi_table * static inline const struct _glapi_table *
table_get_noop(void) table_get_noop(void)
{ {
return (const struct mapi_table *) table_noop_array; return (const struct _glapi_table *) table_noop_array;
} }
/** /**
* Set the function of a slot. * Set the function of a slot.
*/ */
static inline void static inline void
table_set_func(struct mapi_table *tbl, int slot, mapi_func func) table_set_func(struct _glapi_table *tbl, int slot, mapi_func func)
{ {
mapi_func *funcs = (mapi_func *) tbl; mapi_func *funcs = (mapi_func *) tbl;
funcs[slot] = func; funcs[slot] = func;
@@ -72,7 +72,7 @@ table_set_func(struct mapi_table *tbl, int slot, mapi_func func)
* Return the function of a slot. * Return the function of a slot.
*/ */
static inline mapi_func static inline mapi_func
table_get_func(const struct mapi_table *tbl, int slot) table_get_func(const struct _glapi_table *tbl, int slot)
{ {
const mapi_func *funcs = (const mapi_func *) tbl; const mapi_func *funcs = (const mapi_func *) tbl;
return funcs[slot]; return funcs[slot];

View File

@@ -99,17 +99,17 @@ extern void (*__glapi_noop_table[])(void);
/*@{*/ /*@{*/
#if defined(GLX_USE_TLS) #if defined(GLX_USE_TLS)
__thread struct mapi_table *u_current_table __thread struct _glapi_table *u_current_table
__attribute__((tls_model("initial-exec"))) __attribute__((tls_model("initial-exec")))
= (struct mapi_table *) table_noop_array; = (struct _glapi_table *) table_noop_array;
__thread void *u_current_context __thread void *u_current_context
__attribute__((tls_model("initial-exec"))); __attribute__((tls_model("initial-exec")));
#else #else
struct mapi_table *u_current_table = struct _glapi_table *u_current_table =
(struct mapi_table *) table_noop_array; (struct _glapi_table *) table_noop_array;
void *u_current_context; void *u_current_context;
tss_t u_current_table_tsd; tss_t u_current_table_tsd;
@@ -259,17 +259,17 @@ u_current_get_context_internal(void)
* table (__glapi_noop_table). * table (__glapi_noop_table).
*/ */
void void
u_current_set_table(const struct mapi_table *tbl) u_current_set_table(const struct _glapi_table *tbl)
{ {
u_current_init(); u_current_init();
stub_init_once(); stub_init_once();
if (!tbl) if (!tbl)
tbl = (const struct mapi_table *) table_noop_array; tbl = (const struct _glapi_table *) table_noop_array;
#if defined(GLX_USE_TLS) #if defined(GLX_USE_TLS)
u_current_table = (struct mapi_table *) tbl; u_current_table = (struct _glapi_table *) tbl;
#else #else
tss_set(u_current_table_tsd, (void *) tbl); tss_set(u_current_table_tsd, (void *) tbl);
u_current_table = (ThreadSafe) ? NULL : (void *) tbl; u_current_table = (ThreadSafe) ? NULL : (void *) tbl;
@@ -279,15 +279,15 @@ u_current_set_table(const struct mapi_table *tbl)
/** /**
* Return pointer to current dispatch table for calling thread. * Return pointer to current dispatch table for calling thread.
*/ */
struct mapi_table * struct _glapi_table *
u_current_get_table_internal(void) u_current_get_table_internal(void)
{ {
#if defined(GLX_USE_TLS) #if defined(GLX_USE_TLS)
return u_current_table; return u_current_table;
#else #else
if (ThreadSafe) if (ThreadSafe)
return (struct mapi_table *) tss_get(u_current_table_tsd); return (struct _glapi_table *) tss_get(u_current_table_tsd);
else else
return (struct mapi_table *) u_current_table; return (struct _glapi_table *) u_current_table;
#endif #endif
} }

View File

@@ -10,9 +10,6 @@
#include "glapi/glapi.h" #include "glapi/glapi.h"
/* ugly renames to match glapi.h */
#define mapi_table _glapi_table
#ifdef GLX_USE_TLS #ifdef GLX_USE_TLS
#define u_current_table _glapi_tls_Dispatch #define u_current_table _glapi_tls_Dispatch
#define u_current_context _glapi_tls_Context #define u_current_context _glapi_tls_Context
@@ -28,11 +25,11 @@
#else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */ #else /* MAPI_MODE_UTIL || MAPI_MODE_GLAPI || MAPI_MODE_BRIDGE */
struct mapi_table; struct _glapi_table;
#ifdef GLX_USE_TLS #ifdef GLX_USE_TLS
extern __thread struct mapi_table *u_current_table extern __thread struct _glapi_table *u_current_table
__attribute__((tls_model("initial-exec"))); __attribute__((tls_model("initial-exec")));
extern __thread void *u_current_context extern __thread void *u_current_context
@@ -40,7 +37,7 @@ extern __thread void *u_current_context
#else /* GLX_USE_TLS */ #else /* GLX_USE_TLS */
extern struct mapi_table *u_current_table; extern struct _glapi_table *u_current_table;
extern void *u_current_context; extern void *u_current_context;
#endif /* GLX_USE_TLS */ #endif /* GLX_USE_TLS */
@@ -54,9 +51,9 @@ void
u_current_destroy(void); u_current_destroy(void);
void void
u_current_set_table(const struct mapi_table *tbl); u_current_set_table(const struct _glapi_table *tbl);
struct mapi_table * struct _glapi_table *
u_current_get_table_internal(void); u_current_get_table_internal(void);
void void
@@ -65,7 +62,7 @@ u_current_set_context(const void *ptr);
void * void *
u_current_get_context_internal(void); u_current_get_context_internal(void);
static inline const struct mapi_table * static inline const struct _glapi_table *
u_current_get_table(void) u_current_get_table(void)
{ {
#ifdef GLX_USE_TLS #ifdef GLX_USE_TLS