diff options
author | Marek Olšák <[email protected]> | 2020-02-19 15:58:34 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-06 01:06:14 +0000 |
commit | 19151e2605c95498f9dbc85fa85e10e851df374d (patch) | |
tree | 0484bba36c7c38198f44c2ac6113f0c638723469 /src/mesa | |
parent | 245f9593b7967521bd6661d7059096c528cc7f0d (diff) |
glthread: inline _mesa_unmarshal_dispatch_cmd and convert the switch to a table
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/glthread.c | 10 | ||||
-rw-r--r-- | src/mesa/main/marshal.c | 1 | ||||
-rw-r--r-- | src/mesa/main/marshal.h | 15 |
3 files changed, 11 insertions, 15 deletions
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c index 82baad597f9..3b605183483 100644 --- a/src/mesa/main/glthread.c +++ b/src/mesa/main/glthread.c @@ -35,7 +35,6 @@ #include "main/mtypes.h" #include "main/glthread.h" #include "main/marshal.h" -#include "main/marshal_generated.h" #include "util/u_atomic.h" #include "util/u_thread.h" @@ -49,8 +48,13 @@ glthread_unmarshal_batch(void *job, int thread_index) _glapi_set_dispatch(ctx->CurrentServerDispatch); - while (pos < batch->used) - pos += _mesa_unmarshal_dispatch_cmd(ctx, &batch->buffer[pos]); + while (pos < batch->used) { + const struct marshal_cmd_base *cmd = + (const struct marshal_cmd_base *)&batch->buffer[pos]; + + _mesa_unmarshal_dispatch[cmd->cmd_id](ctx, cmd); + pos += cmd->cmd_size; + } assert(pos == batch->used); batch->used = 0; diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index 43deafb2c80..b2428e5e7cd 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -31,7 +31,6 @@ #include "main/macros.h" #include "marshal.h" #include "dispatch.h" -#include "marshal_generated.h" struct marshal_cmd_Flush { diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h index 63e0295576e..b2556ca9841 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -33,6 +33,7 @@ #include "main/glthread.h" #include "main/context.h" #include "main/macros.h" +#include "marshal_generated.h" struct marshal_cmd_base { @@ -47,6 +48,9 @@ struct marshal_cmd_base uint16_t cmd_size; }; +typedef void (*_mesa_unmarshal_func)(struct gl_context *ctx, const void *cmd); +extern const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD]; + static inline void * _mesa_glthread_allocate_command(struct gl_context *ctx, uint16_t cmd_id, @@ -125,20 +129,9 @@ debug_print_marshal(const char *func) #endif } -static inline void -debug_print_unmarshal(const char *func) -{ -#if DEBUG_MARSHAL_PRINT_CALLS - printf("unmarshal: %s\n", func); -#endif -} - struct _glapi_table * _mesa_create_marshal_table(const struct gl_context *ctx); -size_t -_mesa_unmarshal_dispatch_cmd(struct gl_context *ctx, const void *cmd); - static inline void _mesa_post_marshal_hook(struct gl_context *ctx) { |