glapi: Annotate functions with "marshal" attribute.

Several API functions require special treatment in order to be marshalled
to a background thread.  Others can't be safely executed in a background
thread and need to be executed synchronously (e.g. since they return data
through a pointer argument).

This annotation will be used when code generating thread marshalling code,
to ensure that each function is marshalled in the correct way.

Note that PixelMap functions are marked as synchronous for now since
their pointer may be relative to buffer on the GPU, so we'll need
special logic to marshal them properly.

v2: Move description of attribute types to a comment in the dtd file.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
This commit is contained in:
Paul Berry
2012-11-07 13:04:40 -08:00
committed by Timothy Arceri
parent 3b7b6adf3a
commit f5052f45a2
6 changed files with 44 additions and 27 deletions

View File

@@ -8,7 +8,7 @@
<category name="GL_ARB_base_instance" number="107">
<function name="DrawArraysInstancedBaseInstance" exec="dynamic">
<function name="DrawArraysInstancedBaseInstance" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="first" type="GLint"/>
<param name="count" type="GLsizei"/>
@@ -16,7 +16,7 @@
<param name="baseinstance" type="GLuint"/>
</function>
<function name="DrawElementsInstancedBaseInstance" exec="dynamic">
<function name="DrawElementsInstancedBaseInstance" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>
@@ -25,7 +25,7 @@
<param name="baseinstance" type="GLuint"/>
</function>
<function name="DrawElementsInstancedBaseVertexBaseInstance" exec="dynamic">
<function name="DrawElementsInstancedBaseVertexBaseInstance" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>

View File

@@ -8,7 +8,7 @@
<category name="GL_ARB_draw_elements_base_vertex" number="62">
<function name="DrawElementsBaseVertex" es2="3.2" exec="dynamic">
<function name="DrawElementsBaseVertex" es2="3.2" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>
@@ -16,7 +16,7 @@
<param name="basevertex" type="GLint"/>
</function>
<function name="DrawRangeElementsBaseVertex" es2="3.2" exec="dynamic">
<function name="DrawRangeElementsBaseVertex" es2="3.2" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="start" type="GLuint"/>
<param name="end" type="GLuint"/>
@@ -26,7 +26,7 @@
<param name="basevertex" type="GLint"/>
</function>
<function name="MultiDrawElementsBaseVertex" exec="dynamic">
<function name="MultiDrawElementsBaseVertex" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="const GLsizei *"/>
<param name="type" type="GLenum"/>
@@ -35,7 +35,7 @@
<param name="basevertex" type="const GLint *"/>
</function>
<function name="DrawElementsInstancedBaseVertex" es2="3.2" exec="dynamic">
<function name="DrawElementsInstancedBaseVertex" es2="3.2" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>

View File

@@ -8,14 +8,14 @@
<category name="GL_ARB_draw_instanced" number="44">
<function name="DrawArraysInstancedARB" exec="dynamic">
<function name="DrawArraysInstancedARB" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="first" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="primcount" type="GLsizei"/>
</function>
<function name="DrawElementsInstancedARB" exec="dynamic">
<function name="DrawElementsInstancedARB" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>

View File

@@ -108,7 +108,7 @@
<function name="ResumeTransformFeedback" es2="3.0">
</function>
<function name="DrawTransformFeedback" exec="dynamic">
<function name="DrawTransformFeedback" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="id" type="GLuint"/>
</function>

View File

@@ -38,7 +38,8 @@
es2 CDATA "none"
deprecated CDATA "none"
exec NMTOKEN #IMPLIED
desktop (true | false) "true">
desktop (true | false) "true"
marshal NMTOKEN #IMPLIED>
<!ATTLIST size name NMTOKEN #REQUIRED
count NMTOKEN #IMPLIED
mode (get | set) "set">
@@ -120,6 +121,14 @@ 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
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).
glx:
rop - Opcode value for "render" commands

View File

@@ -2366,11 +2366,19 @@
<glx rop="139" handcode="client"/>
</function>
<function name="Finish" es1="1.0" es2="2.0">
<function name="Finish" es1="1.0" es2="2.0" marshal="sync">
<glx sop="108" handcode="true"/>
</function>
<function name="Flush" es1="1.0" es2="2.0">
<!-- 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="sync">
<glx sop="142" handcode="true"/>
</function>
@@ -2598,21 +2606,21 @@
<glx sop="110" handcode="client"/>
</function>
<function name="PixelMapfv" deprecated="3.1">
<function name="PixelMapfv" deprecated="3.1" marshal="sync">
<param name="map" type="GLenum"/>
<param name="mapsize" type="GLsizei" counter="true"/>
<param name="values" type="const GLfloat *" count="mapsize"/>
<glx rop="168" large="true"/>
</function>
<function name="PixelMapuiv" deprecated="3.1">
<function name="PixelMapuiv" deprecated="3.1" marshal="sync">
<param name="map" type="GLenum"/>
<param name="mapsize" type="GLsizei" counter="true"/>
<param name="values" type="const GLuint *" count="mapsize"/>
<glx rop="169" large="true"/>
</function>
<function name="PixelMapusv" deprecated="3.1">
<function name="PixelMapusv" deprecated="3.1" marshal="sync">
<param name="map" type="GLenum"/>
<param name="mapsize" type="GLsizei" counter="true"/>
<param name="values" type="const GLushort *" count="mapsize"/>
@@ -3141,7 +3149,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">
<function name="ArrayElement" deprecated="3.1" exec="dynamic" marshal="draw">
<param name="i" type="GLint"/>
<glx handcode="true"/>
</function>
@@ -3159,14 +3167,14 @@
<glx handcode="true"/>
</function>
<function name="DrawArrays" es1="1.0" es2="2.0" exec="dynamic">
<function name="DrawArrays" es1="1.0" es2="2.0" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="first" type="GLint"/>
<param name="count" type="GLsizei"/>
<glx rop="193" handcode="true"/>
</function>
<function name="DrawElements" es1="1.0" es2="2.0" exec="dynamic">
<function name="DrawElements" es1="1.0" es2="2.0" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>
@@ -3723,7 +3731,7 @@
<glx rop="4097"/>
</function>
<function name="DrawRangeElements" es2="3.0" exec="dynamic">
<function name="DrawRangeElements" es2="3.0" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="start" type="GLuint"/>
<param name="end" type="GLuint"/>
@@ -4716,7 +4724,7 @@
<glx handcode="true"/>
</function>
<function name="MultiDrawArrays">
<function name="MultiDrawArrays" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="first" type="const GLint *"/>
<param name="count" type="const GLsizei *"/>
@@ -8089,7 +8097,7 @@
<enum name="MAX_TRANSFORM_FEEDBACK_BUFFERS" value="0x8E70"/>
<enum name="MAX_VERTEX_STREAMS" value="0x8E71"/>
<function name="DrawTransformFeedbackStream" exec="dynamic">
<function name="DrawTransformFeedbackStream" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="stream" type="GLuint"/>
@@ -8137,13 +8145,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" exec="dynamic">
<function name="DrawTransformFeedbackInstanced" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="primcount" type="GLsizei"/>
</function>
<function name="DrawTransformFeedbackStreamInstanced" exec="dynamic">
<function name="DrawTransformFeedbackStreamInstanced" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="id" type="GLuint"/>
<param name="stream" type="GLuint"/>
@@ -10199,7 +10207,7 @@
<param name="primcount" type="GLsizei"/>
</function>
<function name="MultiDrawElementsEXT" es1="1.0" es2="2.0" exec="dynamic">
<function name="MultiDrawElementsEXT" es1="1.0" es2="2.0" exec="dynamic" marshal="draw">
<param name="mode" type="GLenum"/>
<param name="count" type="const GLsizei *"/>
<param name="type" type="GLenum"/>
@@ -11209,7 +11217,7 @@
</category>
<category name="GL_IBM_multimode_draw_arrays" number="200">
<function name="MultiModeDrawArraysIBM">
<function name="MultiModeDrawArraysIBM" marshal="draw">
<param name="mode" type="const GLenum *"/>
<param name="first" type="const GLint *"/>
<param name="count" type="const GLsizei *"/>
@@ -11218,7 +11226,7 @@
<glx handcode="true" ignore="true"/>
</function>
<function name="MultiModeDrawElementsIBM">
<function name="MultiModeDrawElementsIBM" marshal="draw">
<param name="mode" type="const GLenum *"/>
<param name="count" type="const GLsizei *"/>
<param name="type" type="GLenum"/>