diff options
author | Paul Berry <stereotype441@gmail.com> | 2012-11-16 11:43:08 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-01-03 11:58:22 -0800 |
commit | df668bb5a2c3c4701ed9f2be8506132fab80890e (patch) | |
tree | 917fdbd427d7e7d659effff136584269483392ee | |
parent | 0ba366a3a83c604eb93eb15481accbd7b4a14c0c (diff) |
mesa: Custom thread marshalling for Flush.
-rw-r--r-- | src/mapi/glapi/gen/gl_API.xml | 2 | ||||
-rw-r--r-- | src/mesa/main/marshal.c | 33 | ||||
-rw-r--r-- | src/mesa/main/marshal.h | 8 |
3 files changed, 42 insertions, 1 deletions
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index d9fe724304e..0ff374be152 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -2435,7 +2435,7 @@ specially to ensure that it causes all previous commands to get delivered to the server thread. --> - <function name="Flush" offset="217" es1="1.0" es2="2.0" marshal="sync"> + <function name="Flush" offset="217" es1="1.0" es2="2.0" marshal="custom"> <glx sop="142" handcode="true"/> </function> diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index 55032095aa6..c788e39f0d3 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 447e3230c60..62437dbaa18 100644 --- a/src/mesa/main/marshal.h +++ b/src/mesa/main/marshal.h @@ -90,6 +90,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, @@ -99,4 +100,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 */ |