From: Paul Berry <stereotype...@gmail.com> --- src/mapi/glapi/gen/gl_API.xml | 3 +-- src/mesa/main/marshal.c | 33 +++++++++++++++++++++++++++++++++ src/mesa/main/marshal.h | 8 ++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index c7a7253..0da1589 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -2370,22 +2370,21 @@ <glx sop="108" handcode="true"/> </function> <!-- TODO: Flush is marshalled synchronously as a temporary hack since we don't yet have a hook into SwapBuffers. NOTE: when we remove this hack, we'll still have to handle Flush 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> <function name="PopAttrib" deprecated="3.1"> <glx rop="141"/> </function> <function name="PushAttrib" deprecated="3.1"> <param name="mask" type="GLbitfield"/> <glx rop="142"/> diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index c0760d2..14577dd 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -24,20 +24,53 @@ /** \file marshal.c * * Custom functions for marshalling GL calls from the main thread to a worker * thread when automatic code generation isn't appropriate. */ #include "marshal.h" #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; GLuint shader; GLsizei count; /* Followed by GLint length[count], then the contents of all strings, * concatenated. */ }; diff --git a/src/mesa/main/marshal.h b/src/mesa/main/marshal.h index 0b69d66..0e0e9b2 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -103,20 +103,28 @@ _mesa_post_marshal_hook(struct gl_context *ctx) { /* This can be enabled for debugging whether a failure is a synchronization * problem between the main thread and the worker thread, or a failure in * how we actually marshal. */ if (false) _mesa_glthread_finish(ctx); } struct marshal_cmd_ShaderSource; +struct marshal_cmd_Flush; void GLAPIENTRY _mesa_marshal_ShaderSource(GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length); 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 */ -- 2.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev