diff options
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 5 | ||||
-rw-r--r-- | src/mesa/main/glthread.h | 14 | ||||
-rw-r--r-- | src/mesa/main/marshal.c | 3 | ||||
-rw-r--r-- | src/mesa/main/marshal.h | 76 |
4 files changed, 68 insertions, 30 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index d73f08b6684..576d42c1263 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -68,6 +68,8 @@ class PrintCode(gl_XML.gl_print_base): print header print '#include <X11/Xlib-xcb.h>' print + print '#ifdef HAVE_PTHREAD' + print print 'static _X_INLINE int safe_mul(int a, int b)' print '{' print ' if (a < 0 || b < 0) return -1;' @@ -78,7 +80,8 @@ class PrintCode(gl_XML.gl_print_base): print def printRealFooter(self): - pass + print + print '#endif' def print_sync_call(self, func): call = 'CALL_{0}(ctx->CurrentServerDispatch, ({1}))'.format( diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 9ba89d10917..50c1db25488 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -24,18 +24,19 @@ #ifndef _GLTHREAD_H #define _GLTHREAD_H +#include "main/mtypes.h" + +/* Command size is a number of bytes stored in a short. */ +#define MARSHAL_MAX_CMD_SIZE 65535 + #ifdef HAVE_PTHREAD #include <inttypes.h> #include <stdbool.h> #include <pthread.h> -#include "main/mtypes.h" enum marshal_dispatch_cmd_id; -/* Command size is a number of bytes stored in a short. */ -#define MARSHAL_MAX_CMD_SIZE 65535 - struct glthread_state { /** The worker thread that asynchronously processes our GL commands. */ @@ -145,5 +146,10 @@ _mesa_glthread_restore_dispatch(struct gl_context *ctx) { } +static inline void +_mesa_glthread_flush_batch(struct gl_context *ctx) +{ +} + #endif /* !HAVE_PTHREAD */ #endif /* _GLTHREAD_H*/ diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index 37c7b1b3dde..f8cad30e201 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -31,6 +31,8 @@ #include "dispatch.h" #include "marshal_generated.h" +#ifdef HAVE_PTHREAD + struct marshal_cmd_Flush { struct marshal_cmd_base cmd_base; @@ -257,3 +259,4 @@ _mesa_marshal_BindBuffer(GLenum target, GLuint buffer) } } +#endif diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h index 23b33002e42..1b4fd515050 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -46,6 +46,7 @@ struct marshal_cmd_base uint16_t cmd_size; }; +#ifdef HAVE_PTHREAD static inline void * _mesa_glthread_allocate_command(struct gl_context *ctx, @@ -66,6 +67,56 @@ _mesa_glthread_allocate_command(struct gl_context *ctx, return cmd_base; } +/** + * Instead of conditionally handling marshaling previously-bound user vertex + * array data in draw calls (deprecated and removed in GL core), we just + * disable threading at the point where the user sets a user vertex array. + */ +static inline bool +_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx) +{ + struct glthread_state *glthread = ctx->GLThread; + + return ctx->API != API_OPENGL_CORE && !glthread->vertex_array_is_vbo; +} + +/** + * Instead of conditionally handling marshaling immediate index data in draw + * calls (deprecated and removed in GL core), we just disable threading. + */ +static inline bool +_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx) +{ + struct glthread_state *glthread = ctx->GLThread; + + return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo; +} + +#else + +/* FIXME: dummy functions for non PTHREAD platforms */ +static inline void * +_mesa_glthread_allocate_command(struct gl_context *ctx, + uint16_t cmd_id, + size_t size) +{ + return NULL; +} + +static inline bool +_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx) +{ + return false; +} + +static inline bool +_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx) +{ + return false; +} + +#endif + #define DEBUG_MARSHAL_PRINT_CALLS 0 static inline void @@ -133,31 +184,6 @@ _mesa_glthread_is_compat_bind_vertex_array(const struct gl_context *ctx) return ctx->API != API_OPENGL_CORE; } -/** - * Instead of conditionally handling marshaling previously-bound user vertex - * array data in draw calls (deprecated and removed in GL core), we just - * disable threading at the point where the user sets a user vertex array. - */ -static inline bool -_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx) -{ - struct glthread_state *glthread = ctx->GLThread; - - return ctx->API != API_OPENGL_CORE && !glthread->vertex_array_is_vbo; -} - -/** - * Instead of conditionally handling marshaling immediate index data in draw - * calls (deprecated and removed in GL core), we just disable threading. - */ -static inline bool -_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx) -{ - struct glthread_state *glthread = ctx->GLThread; - - return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo; -} - struct marshal_cmd_ShaderSource; struct marshal_cmd_Flush; struct marshal_cmd_BindBuffer; |