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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8297>
This commit is contained in:
Marek Olšák 2020-12-23 02:42:04 -05:00 committed by Marge Bot
parent a4e8ad9b27
commit 36740aa1f1
6 changed files with 16 additions and 20 deletions

View file

@ -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"/>

View file

@ -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"/>

View file

@ -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>

View file

@ -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

View file

@ -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"/>

View file

@ -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