From a4a5de6f18feba0a3dd439163f3505f2ba20fa0c Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Fri, 16 Nov 2012 11:43:08 -0800 Subject: [PATCH] mesa: Custom thread marshalling for Flush. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Acked-by: Timothy Arceri Acked-by: Marek Olšák Tested-by: Dieter Nützel Tested-by: Mike Lothian --- 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 @@ -2377,8 +2377,7 @@ specially to ensure that it causes all previous commands to get delivered to the server thread. --> - - + 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 @@ -31,6 +31,39 @@ #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; 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 @@ -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 */ -- 2.7.4