Mesa (master): glthread: remove marshal="draw" because it doesn't do much

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 21 00:30:49 UTC 2021


Module: Mesa
Branch: master
Commit: 36740aa1f1ac438a2b221ea89c50d798149f6078
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=36740aa1f1ac438a2b221ea89c50d798149f6078

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed Dec 23 02:42:04 2020 -0500

glthread: remove marshal="draw" because it doesn't do much

It only checked whether the pointer was indices or indirect, but we can
just determine the same thing manually for each draw call.

Simplify it as follows:
- if a call contains a pointer without count and it's either indirect or
  indices, set marshal="async". The marshal_sync attribute still determines
  when it syncs.
- if a call doesn't contain any pointer without count, remove the marshal
  attribute

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>

---

 src/mapi/glapi/gen/ARB_draw_indirect.xml       |  8 ++++----
 src/mapi/glapi/gen/ARB_indirect_parameters.xml |  4 ++--
 src/mapi/glapi/gen/EXT_transform_feedback.xml  |  2 +-
 src/mapi/glapi/gen/gl_API.dtd                  |  4 +---
 src/mapi/glapi/gen/gl_API.xml                  | 12 ++++++------
 src/mapi/glapi/gen/marshal_XML.py              |  6 ++----
 6 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_draw_indirect.xml b/src/mapi/glapi/gen/ARB_draw_indirect.xml
index 6dc1d6feeec..541647a0c38 100644
--- a/src/mapi/glapi/gen/ARB_draw_indirect.xml
+++ b/src/mapi/glapi/gen/ARB_draw_indirect.xml
@@ -9,14 +9,14 @@
     <enum name="DRAW_INDIRECT_BUFFER_BINDING"           value="0x8F43"/>
 
     <function name="DrawArraysIndirect" es2="3.1"
-              marshal="draw"
+              marshal="async"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices_or_indirect(ctx)">
         <param name="mode" type="GLenum"/>
         <param name="indirect" type="const GLvoid *"/>
     </function>
 
     <function name="DrawElementsIndirect" es2="3.1"
-              marshal="draw"
+              marshal="async"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices_or_indices_or_indirect(ctx)">
         <param name="mode" type="GLenum"/>
         <param name="type" type="GLenum"/>
@@ -28,7 +28,7 @@
 
 <category name="GL_ARB_multi_draw_indirect" number="133">
 
-    <function name="MultiDrawArraysIndirect" marshal="draw"
+    <function name="MultiDrawArraysIndirect" marshal="async"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices_or_indirect(ctx)">
         <param name="mode" type="GLenum"/>
         <param name="indirect" type="const GLvoid *"/>
@@ -36,7 +36,7 @@
         <param name="stride" type="GLsizei"/>
     </function>
 
-    <function name="MultiDrawElementsIndirect" marshal="draw"
+    <function name="MultiDrawElementsIndirect" marshal="async"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices_or_indices_or_indirect(ctx)">
         <param name="mode" type="GLenum"/>
         <param name="type" type="GLenum"/>
diff --git a/src/mapi/glapi/gen/ARB_indirect_parameters.xml b/src/mapi/glapi/gen/ARB_indirect_parameters.xml
index 2739f153875..f08201d4a22 100644
--- a/src/mapi/glapi/gen/ARB_indirect_parameters.xml
+++ b/src/mapi/glapi/gen/ARB_indirect_parameters.xml
@@ -8,7 +8,7 @@
     <enum name="PARAMETER_BUFFER_ARB"                   value="0x80EE"/>
     <enum name="PARAMETER_BUFFER_BINDING_ARB"           value="0x80EF"/>
 
-    <function name="MultiDrawArraysIndirectCountARB" marshal="draw"
+    <function name="MultiDrawArraysIndirectCountARB"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices(ctx)">
         <param name="mode" type="GLenum"/>
         <param name="indirect" type="GLintptr"/>
@@ -18,7 +18,7 @@
     </function>
 
     <!-- Use "...has_non_vbo_vertices", because indices always come from a buffer object. -->
-    <function name="MultiDrawElementsIndirectCountARB" marshal="draw"
+    <function name="MultiDrawElementsIndirectCountARB"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices(ctx)">
         <param name="mode" type="GLenum"/>
         <param name="type" type="GLenum"/>
diff --git a/src/mapi/glapi/gen/EXT_transform_feedback.xml b/src/mapi/glapi/gen/EXT_transform_feedback.xml
index 604ab7cd0d5..01aa2a364ec 100644
--- a/src/mapi/glapi/gen/EXT_transform_feedback.xml
+++ b/src/mapi/glapi/gen/EXT_transform_feedback.xml
@@ -108,7 +108,7 @@
   <function name="ResumeTransformFeedback" es2="3.0" no_error="true">
   </function>
 
-  <function name="DrawTransformFeedback" marshal="draw">
+  <function name="DrawTransformFeedback">
     <param name="mode" type="GLenum"/>
     <param name="id" type="GLuint"/>
   </function>
diff --git a/src/mapi/glapi/gen/gl_API.dtd b/src/mapi/glapi/gen/gl_API.dtd
index aceb69c07f6..3d1801ad2b5 100644
--- a/src/mapi/glapi/gen/gl_API.dtd
+++ b/src/mapi/glapi/gen/gl_API.dtd
@@ -124,14 +124,12 @@ param:
         offset data should be padded to the next even number of dimensions.
         For example, this will insert an empty "height" field after the
         "width" field in the protocol for TexImage1D.
-     marshal - One of "sync", "async", "draw", or "custom", defaulting to
+     marshal - One of "sync", "async", or "custom", defaulting to
         async unless one of the arguments is something we know we can't
         codegen for.  If "sync", we finish any queued glthread work and call
         the Mesa implementation directly.  If "async", we queue the function
         call to be performed by glthread.  If "custom", the prototype will be
         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_sync - an expression that, if it evaluates true, causes glthread
         to sync and execute the call directly.
      marshal_count - same as count, but variable_param is ignored. Used by
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index dcdbe80290c..7aab5c5d828 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -3169,7 +3169,7 @@
     <enum name="CLIENT_VERTEX_ARRAY_BIT"                  value="0x00000002"/>
     <enum name="CLIENT_ALL_ATTRIB_BITS"                   value="0xFFFFFFFF"/>
 
-    <function name="ArrayElement" deprecated="3.1" exec="dynamic" marshal="draw">
+    <function name="ArrayElement" deprecated="3.1" exec="dynamic">
         <param name="i" type="GLint"/>
         <glx handcode="true"/>
     </function>
@@ -8156,7 +8156,7 @@
   <enum name="MAX_TRANSFORM_FEEDBACK_BUFFERS" value="0x8E70"/>
   <enum name="MAX_VERTEX_STREAMS"             value="0x8E71"/>
 
-  <function name="DrawTransformFeedbackStream" marshal="draw">
+  <function name="DrawTransformFeedbackStream">
     <param name="mode" type="GLenum"/>
     <param name="id" type="GLuint"/>
     <param name="stream" type="GLuint"/>
@@ -8204,13 +8204,13 @@
 <xi:include href="ARB_base_instance.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
 <category name="GL_ARB_transform_feedback_instanced" number="109">
-  <function name="DrawTransformFeedbackInstanced" marshal="draw">
+  <function name="DrawTransformFeedbackInstanced">
     <param name="mode" type="GLenum"/>
     <param name="id" type="GLuint"/>
     <param name="primcount" type="GLsizei"/>
   </function>
 
-  <function name="DrawTransformFeedbackStreamInstanced" marshal="draw">
+  <function name="DrawTransformFeedbackStreamInstanced">
     <param name="mode" type="GLenum"/>
     <param name="id" type="GLuint"/>
     <param name="stream" type="GLuint"/>
@@ -11409,7 +11409,7 @@
 </category>
 
 <category name="GL_IBM_multimode_draw_arrays" number="200">
-    <function name="MultiModeDrawArraysIBM" marshal="draw"
+    <function name="MultiModeDrawArraysIBM"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices(ctx)">
         <param name="mode" type="const GLenum *" count="primcount"/>
         <param name="first" type="const GLint *" count="primcount"/>
@@ -11419,7 +11419,7 @@
         <glx handcode="true" ignore="true"/>
     </function>
 
-    <function name="MultiModeDrawElementsIBM" marshal="draw"
+    <function name="MultiModeDrawElementsIBM"
               marshal_sync="_mesa_glthread_has_non_vbo_vertices_or_indices(ctx)">
         <param name="mode" type="const GLenum *" count="primcount"/>
         <param name="count" type="const GLsizei *" count="primcount"/>
diff --git a/src/mapi/glapi/gen/marshal_XML.py b/src/mapi/glapi/gen/marshal_XML.py
index 42c82c15e68..d1c0bca7938 100644
--- a/src/mapi/glapi/gen/marshal_XML.py
+++ b/src/mapi/glapi/gen/marshal_XML.py
@@ -65,7 +65,7 @@ class marshal_function(gl_XML.gl_function):
         client and server threads."""
         # If a "marshal" attribute was present, that overrides any
         # determination that would otherwise be made by this function.
-        if self.marshal not in (None, 'draw'):
+        if self.marshal is not None:
             return self.marshal
 
         if self.exec_flavor == 'skip':
@@ -78,9 +78,7 @@ class marshal_function(gl_XML.gl_function):
         for p in self.parameters:
             if p.is_output:
                 return 'sync'
-            if (p.is_pointer() and not (p.count or p.counter or p.marshal_count)
-                and not (self.marshal == 'draw'
-                         and (p.name == 'indices' or p.name == 'indirect'))):
+            if (p.is_pointer() and not (p.count or p.counter or p.marshal_count)):
                 return 'sync'
             if p.count_parameter_list and not p.marshal_count:
                 # Parameter size is determined by enums; haven't



More information about the mesa-commit mailing list