From cd1c003b18353c220b1b81dcecc9cab2996ce608 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 28 Feb 2013 18:15:58 -0800 Subject: [PATCH] mesa: Add an attribute for conditions to turn off threading. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The threading for GL core is in place, but there are so few applications actually using a core GL context that it would be nice to extend support back. However, some of the features of compat GL (particularly user vertex arrays) would be so expensive to track state for that we want to be able to disable threading when we discover that the app is using them. Acked-by: Timothy Arceri Acked-by: Marek Olšák Tested-by: Dieter Nützel Tested-by: Mike Lothian --- src/mapi/glapi/gen/gl_API.dtd | 7 ++++++- src/mapi/glapi/gen/gl_marshal.py | 8 ++++++++ src/mapi/glapi/gen/marshal_XML.py | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd index 133bc042aa9..dc4a199bb99 100644 --- a/src/mapi/glapi/gen/gl_API.dtd +++ b/src/mapi/glapi/gen/gl_API.dtd @@ -39,7 +39,8 @@ deprecated CDATA "none" exec NMTOKEN #IMPLIED desktop (true | false) "true" - marshal NMTOKEN #IMPLIED> + marshal NMTOKEN #IMPLIED + marshal_fail CDATA #IMPLIED> @@ -129,6 +130,10 @@ param: generated but a custom implementation will be present in marshal.c. If "draw", it will follow the "async" rules except that "indices" are ignored (since they may come from a VBO). + marshal_fail - an expression that, if it evaluates true, causes glthread + to finish and tear down before the Mesa implementation is called + directly. Used to disable glthread for GL compatibility interactions + that we don't want to track state for. glx: rop - Opcode value for "render" commands diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py index 1a633435001..a50d773e27e 100644 --- a/src/mapi/glapi/gen/gl_marshal.py +++ b/src/mapi/glapi/gen/gl_marshal.py @@ -236,6 +236,14 @@ class PrintCode(gl_XML.gl_print_base): self.validate_count_or_return(func) + if func.marshal_fail: + out('if ({0}) {{'.format(func.marshal_fail)) + with indent(): + out('_mesa_glthread_destroy(ctx);') + self.print_sync_dispatch(func) + out('return;') + out('}') + out('if (cmd_size <= MARSHAL_MAX_CMD_SIZE) {') with indent(): self.print_async_dispatch(func) diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py index d56e4dda4af..80f7f542e43 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') def marshal_flavor(self): """Find out how this function should be marshalled between -- 2.30.2