mesa: fix glthread marshal build issues on platforms without PTHREAD
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 16 Mar 2017 04:28:47 +0000 (15:28 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 16 Mar 2017 04:33:08 +0000 (15:33 +1100)
src/mapi/glapi/gen/gl_marshal.py
src/mesa/main/glthread.h
src/mesa/main/marshal.c
src/mesa/main/marshal.h

index d73f08b..576d42c 100644 (file)
@@ -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(
index 9ba89d1..50c1db2 100644 (file)
 #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*/
index 37c7b1b..f8cad30 100644 (file)
@@ -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
index 23b3300..1b4fd51 100644 (file)
@@ -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;