diff options
author | Marek Olšák <[email protected]> | 2020-02-20 18:15:42 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-06 01:06:14 +0000 |
commit | d510e652d46f471a93eae5a07f7e7508633d1040 (patch) | |
tree | 2010df30b5c53d7a9cdeab1321bb290bc0413038 /src/mapi | |
parent | 4970199d11907833858bbb2700ba313ae12f3a95 (diff) |
glthread: add marshal_call_after and remove custom glFlush and glEnable code
Instead of implementing marshalling manually, this XML property allows us
to insert additional code into code-generated functions.
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>
Diffstat (limited to 'src/mapi')
-rw-r--r-- | src/mapi/glapi/gen/gl_API.dtd | 2 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_API.xml | 13 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_marshal.py | 10 | ||||
-rw-r--r-- | src/mapi/glapi/gen/marshal_XML.py | 1 |
4 files changed, 15 insertions, 11 deletions
diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd index 1f10e1e012d..787fcbf2675 100644 --- a/src/mapi/glapi/gen/gl_API.dtd +++ b/src/mapi/glapi/gen/gl_API.dtd @@ -42,6 +42,7 @@ marshal NMTOKEN #IMPLIED marshal_fail CDATA #IMPLIED> marshal_count CDATA #IMPLIED> + marshal_call_after CDATA #IMPLIED> <!ATTLIST size name NMTOKEN #REQUIRED count NMTOKEN #IMPLIED mode (get | set) "set"> @@ -137,6 +138,7 @@ param: want to track state for. marshal_count - same as count, but variable_param is ignored. Used by glthread. + marshal_call_after - insert the string at the end of the marshal function glx: rop - Opcode value for "render" commands diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index e9f2713ac9d..256d0f3aa15 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -2377,7 +2377,8 @@ <glx rop="138" handcode="client"/> </function> - <function name="Enable" es1="1.0" es2="2.0" marshal="custom"> + <function name="Enable" es1="1.0" es2="2.0" + marshal_call_after='if (cap == GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB) _mesa_glthread_disable(ctx, "Enable(DEBUG_OUTPUT_SYNCHRONOUS)");'> <param name="cap" type="GLenum"/> <glx rop="139" handcode="client"/> </function> @@ -2386,14 +2387,8 @@ <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="custom"> + <function name="Flush" es1="1.0" es2="2.0" + marshal_call_after="_mesa_glthread_flush_batch(ctx);"> <glx sop="142" handcode="true"/> </function> diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 8e918a095ec..19deba7b3c1 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -78,13 +78,16 @@ class PrintCode(gl_XML.gl_print_base): def printRealFooter(self): pass - def print_sync_call(self, func): + def print_sync_call(self, func, unmarshal = 0): call = 'CALL_{0}(ctx->CurrentServerDispatch, ({1}))'.format( func.name, func.get_called_parameter_string()) if func.return_type == 'void': out('{0};'.format(call)) + if func.marshal_call_after and not unmarshal: + out(func.marshal_call_after); else: out('return {0};'.format(call)) + assert not func.marshal_call_after def print_sync_dispatch(self, func): self.print_sync_call(func) @@ -132,6 +135,9 @@ class PrintCode(gl_XML.gl_print_base): if not func.fixed_params and not func.variable_params: out('(void) cmd;') + if func.marshal_call_after: + out(func.marshal_call_after); + # Uncomment this if you want to call _mesa_glthread_finish for debugging #out('_mesa_glthread_finish(ctx);') @@ -208,7 +214,7 @@ class PrintCode(gl_XML.gl_print_base): out('variable_data += {0};'.format(p.size_string(False, marshal = 1))) i += 1 - self.print_sync_call(func) + self.print_sync_call(func, unmarshal = 1) out('}') def validate_count_or_fallback(self, func): diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index f6103b9e8fe..b673c8535d6 100644 --- a/src/mapi/glapi/gen/marshal_XML.py +++ b/src/mapi/glapi/gen/marshal_XML.py @@ -58,6 +58,7 @@ class marshal_function(gl_XML.gl_function): # Store the "marshal" attribute, if present. self.marshal = element.get('marshal') self.marshal_fail = element.get('marshal_fail') + self.marshal_call_after = element.get('marshal_call_after') def marshal_flavor(self): """Find out how this function should be marshalled between |