mesa: Custom thread marshalling for Flush.
authorPaul Berry <stereotype441@gmail.com>
Fri, 16 Nov 2012 19:43:08 +0000 (11:43 -0800)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 16 Mar 2017 03:14:18 +0000 (14:14 +1100)
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
src/mapi/glapi/gen/gl_API.xml
src/mesa/main/marshal.c
src/mesa/main/marshal.h

index c7a7253119ea7eabba88640b86a13e8a38b48665..0da1589da7e14d3e1cf3966225e6a80a588da1f8 100644 (file)
     specially to ensure that it causes all previous commands to get
     delivered to the server thread.
     -->
-
-    <function name="Flush" es1="1.0" es2="2.0" marshal="sync">
+    <function name="Flush" es1="1.0" es2="2.0" marshal="custom">
         <glx sop="142" handcode="true"/>
     </function>
 
index c0760d25518669080bfa49262a26de2e10add7b1..14577dd4cb4ed39231a285b0603eff5fd7114eb2 100644 (file)
 #include "dispatch.h"
 #include "marshal_generated.h"
 
+struct marshal_cmd_Flush
+{
+   struct marshal_cmd_base cmd_base;
+};
+
+
+void
+_mesa_unmarshal_Flush(struct gl_context *ctx,
+                      const struct marshal_cmd_Flush *cmd)
+{
+   CALL_Flush(ctx->CurrentServerDispatch, ());
+}
+
+
+void GLAPIENTRY
+_mesa_marshal_Flush(void)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct marshal_cmd_Flush *cmd =
+      _mesa_glthread_allocate_command(ctx, DISPATCH_CMD_Flush,
+                                      sizeof(struct marshal_cmd_Flush));
+   (void) cmd;
+   _mesa_post_marshal_hook(ctx);
+
+   /* Flush() needs to be handled specially.  In addition to telling the
+    * background thread to flush, we need to ensure that our own buffer is
+    * submitted to the background thread so that it will complete in a finite
+    * amount of time.
+    */
+   _mesa_glthread_flush_batch(ctx);
+}
+
+
 struct marshal_cmd_ShaderSource
 {
    struct marshal_cmd_base cmd_base;
index 0b69d66d9af34c799f126bc46c4acb89f0ea7243..0e0e9b280c6204002e1a7694207d49167fe0ef20 100644 (file)
@@ -110,6 +110,7 @@ _mesa_post_marshal_hook(struct gl_context *ctx)
 }
 
 struct marshal_cmd_ShaderSource;
+struct marshal_cmd_Flush;
 
 void GLAPIENTRY
 _mesa_marshal_ShaderSource(GLuint shader, GLsizei count,
@@ -119,4 +120,11 @@ void
 _mesa_unmarshal_ShaderSource(struct gl_context *ctx,
                              const struct marshal_cmd_ShaderSource *cmd);
 
+void GLAPIENTRY
+_mesa_marshal_Flush(void);
+
+void
+_mesa_unmarshal_Flush(struct gl_context *ctx,
+                      const struct marshal_cmd_Flush *cmd);
+
 #endif /* MARSHAL_H */