xref: /linux/drivers/gpu/drm/vmwgfx/device_include/svga3d_cmd.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /*
3  * Copyright 2012-2021 VMware, Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without
8  * restriction, including without limitation the rights to use, copy,
9  * modify, merge, publish, distribute, sublicense, and/or sell copies
10  * of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  *
25  */
26 
27 /*
28  * svga3d_cmd.h --
29  *
30  *    SVGA 3d hardware cmd definitions
31  */
32 
33 
34 
35 #ifndef _SVGA3D_CMD_H_
36 #define _SVGA3D_CMD_H_
37 
38 #include "svga3d_types.h"
39 #include "svga3d_limits.h"
40 #include "svga_reg.h"
41 
42 typedef enum SVGAFifo3dCmdId {
43 	SVGA_3D_CMD_LEGACY_BASE = 1000,
44 	SVGA_3D_CMD_BASE = 1040,
45 
46 	SVGA_3D_CMD_SURFACE_DEFINE = 1040,
47 	SVGA_3D_CMD_SURFACE_DESTROY = 1041,
48 	SVGA_3D_CMD_SURFACE_COPY = 1042,
49 	SVGA_3D_CMD_SURFACE_STRETCHBLT = 1043,
50 	SVGA_3D_CMD_SURFACE_DMA = 1044,
51 	SVGA_3D_CMD_CONTEXT_DEFINE = 1045,
52 	SVGA_3D_CMD_CONTEXT_DESTROY = 1046,
53 	SVGA_3D_CMD_SETTRANSFORM = 1047,
54 	SVGA_3D_CMD_SETZRANGE = 1048,
55 	SVGA_3D_CMD_SETRENDERSTATE = 1049,
56 	SVGA_3D_CMD_SETRENDERTARGET = 1050,
57 	SVGA_3D_CMD_SETTEXTURESTATE = 1051,
58 	SVGA_3D_CMD_SETMATERIAL = 1052,
59 	SVGA_3D_CMD_SETLIGHTDATA = 1053,
60 	SVGA_3D_CMD_SETLIGHTENABLED = 1054,
61 	SVGA_3D_CMD_SETVIEWPORT = 1055,
62 	SVGA_3D_CMD_SETCLIPPLANE = 1056,
63 	SVGA_3D_CMD_CLEAR = 1057,
64 	SVGA_3D_CMD_PRESENT = 1058,
65 	SVGA_3D_CMD_SHADER_DEFINE = 1059,
66 	SVGA_3D_CMD_SHADER_DESTROY = 1060,
67 	SVGA_3D_CMD_SET_SHADER = 1061,
68 	SVGA_3D_CMD_SET_SHADER_CONST = 1062,
69 	SVGA_3D_CMD_DRAW_PRIMITIVES = 1063,
70 	SVGA_3D_CMD_SETSCISSORRECT = 1064,
71 	SVGA_3D_CMD_BEGIN_QUERY = 1065,
72 	SVGA_3D_CMD_END_QUERY = 1066,
73 	SVGA_3D_CMD_WAIT_FOR_QUERY = 1067,
74 	SVGA_3D_CMD_PRESENT_READBACK = 1068,
75 	SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN = 1069,
76 	SVGA_3D_CMD_SURFACE_DEFINE_V2 = 1070,
77 	SVGA_3D_CMD_GENERATE_MIPMAPS = 1071,
78 	SVGA_3D_CMD_DEAD4 = 1072,
79 	SVGA_3D_CMD_DEAD5 = 1073,
80 	SVGA_3D_CMD_DEAD6 = 1074,
81 	SVGA_3D_CMD_DEAD7 = 1075,
82 	SVGA_3D_CMD_DEAD8 = 1076,
83 	SVGA_3D_CMD_DEAD9 = 1077,
84 	SVGA_3D_CMD_DEAD10 = 1078,
85 	SVGA_3D_CMD_DEAD11 = 1079,
86 	SVGA_3D_CMD_ACTIVATE_SURFACE = 1080,
87 	SVGA_3D_CMD_DEACTIVATE_SURFACE = 1081,
88 	SVGA_3D_CMD_SCREEN_DMA = 1082,
89 	SVGA_3D_CMD_DEAD1 = 1083,
90 	SVGA_3D_CMD_DEAD2 = 1084,
91 
92 	SVGA_3D_CMD_DEAD12 = 1085,
93 	SVGA_3D_CMD_DEAD13 = 1086,
94 	SVGA_3D_CMD_DEAD14 = 1087,
95 	SVGA_3D_CMD_DEAD15 = 1088,
96 	SVGA_3D_CMD_DEAD16 = 1089,
97 	SVGA_3D_CMD_DEAD17 = 1090,
98 
99 	SVGA_3D_CMD_SET_OTABLE_BASE = 1091,
100 	SVGA_3D_CMD_READBACK_OTABLE = 1092,
101 
102 	SVGA_3D_CMD_DEFINE_GB_MOB = 1093,
103 	SVGA_3D_CMD_DESTROY_GB_MOB = 1094,
104 	SVGA_3D_CMD_DEAD3 = 1095,
105 	SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING = 1096,
106 
107 	SVGA_3D_CMD_DEFINE_GB_SURFACE = 1097,
108 	SVGA_3D_CMD_DESTROY_GB_SURFACE = 1098,
109 	SVGA_3D_CMD_BIND_GB_SURFACE = 1099,
110 	SVGA_3D_CMD_COND_BIND_GB_SURFACE = 1100,
111 	SVGA_3D_CMD_UPDATE_GB_IMAGE = 1101,
112 	SVGA_3D_CMD_UPDATE_GB_SURFACE = 1102,
113 	SVGA_3D_CMD_READBACK_GB_IMAGE = 1103,
114 	SVGA_3D_CMD_READBACK_GB_SURFACE = 1104,
115 	SVGA_3D_CMD_INVALIDATE_GB_IMAGE = 1105,
116 	SVGA_3D_CMD_INVALIDATE_GB_SURFACE = 1106,
117 
118 	SVGA_3D_CMD_DEFINE_GB_CONTEXT = 1107,
119 	SVGA_3D_CMD_DESTROY_GB_CONTEXT = 1108,
120 	SVGA_3D_CMD_BIND_GB_CONTEXT = 1109,
121 	SVGA_3D_CMD_READBACK_GB_CONTEXT = 1110,
122 	SVGA_3D_CMD_INVALIDATE_GB_CONTEXT = 1111,
123 
124 	SVGA_3D_CMD_DEFINE_GB_SHADER = 1112,
125 	SVGA_3D_CMD_DESTROY_GB_SHADER = 1113,
126 	SVGA_3D_CMD_BIND_GB_SHADER = 1114,
127 
128 	SVGA_3D_CMD_SET_OTABLE_BASE64 = 1115,
129 
130 	SVGA_3D_CMD_BEGIN_GB_QUERY = 1116,
131 	SVGA_3D_CMD_END_GB_QUERY = 1117,
132 	SVGA_3D_CMD_WAIT_FOR_GB_QUERY = 1118,
133 
134 	SVGA_3D_CMD_NOP = 1119,
135 
136 	SVGA_3D_CMD_ENABLE_GART = 1120,
137 	SVGA_3D_CMD_DISABLE_GART = 1121,
138 	SVGA_3D_CMD_MAP_MOB_INTO_GART = 1122,
139 	SVGA_3D_CMD_UNMAP_GART_RANGE = 1123,
140 
141 	SVGA_3D_CMD_DEFINE_GB_SCREENTARGET = 1124,
142 	SVGA_3D_CMD_DESTROY_GB_SCREENTARGET = 1125,
143 	SVGA_3D_CMD_BIND_GB_SCREENTARGET = 1126,
144 	SVGA_3D_CMD_UPDATE_GB_SCREENTARGET = 1127,
145 
146 	SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL = 1128,
147 	SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL = 1129,
148 
149 	SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE = 1130,
150 
151 	SVGA_3D_CMD_GB_SCREEN_DMA = 1131,
152 	SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH = 1132,
153 	SVGA_3D_CMD_GB_MOB_FENCE = 1133,
154 	SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 = 1134,
155 	SVGA_3D_CMD_DEFINE_GB_MOB64 = 1135,
156 	SVGA_3D_CMD_REDEFINE_GB_MOB64 = 1136,
157 	SVGA_3D_CMD_NOP_ERROR = 1137,
158 
159 	SVGA_3D_CMD_SET_VERTEX_STREAMS = 1138,
160 	SVGA_3D_CMD_SET_VERTEX_DECLS = 1139,
161 	SVGA_3D_CMD_SET_VERTEX_DIVISORS = 1140,
162 	SVGA_3D_CMD_DRAW = 1141,
163 	SVGA_3D_CMD_DRAW_INDEXED = 1142,
164 
165 	SVGA_3D_CMD_DX_MIN = 1143,
166 	SVGA_3D_CMD_DX_DEFINE_CONTEXT = 1143,
167 	SVGA_3D_CMD_DX_DESTROY_CONTEXT = 1144,
168 	SVGA_3D_CMD_DX_BIND_CONTEXT = 1145,
169 	SVGA_3D_CMD_DX_READBACK_CONTEXT = 1146,
170 	SVGA_3D_CMD_DX_INVALIDATE_CONTEXT = 1147,
171 	SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER = 1148,
172 	SVGA_3D_CMD_DX_SET_SHADER_RESOURCES = 1149,
173 	SVGA_3D_CMD_DX_SET_SHADER = 1150,
174 	SVGA_3D_CMD_DX_SET_SAMPLERS = 1151,
175 	SVGA_3D_CMD_DX_DRAW = 1152,
176 	SVGA_3D_CMD_DX_DRAW_INDEXED = 1153,
177 	SVGA_3D_CMD_DX_DRAW_INSTANCED = 1154,
178 	SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED = 1155,
179 	SVGA_3D_CMD_DX_DRAW_AUTO = 1156,
180 	SVGA_3D_CMD_DX_SET_INPUT_LAYOUT = 1157,
181 	SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS = 1158,
182 	SVGA_3D_CMD_DX_SET_INDEX_BUFFER = 1159,
183 	SVGA_3D_CMD_DX_SET_TOPOLOGY = 1160,
184 	SVGA_3D_CMD_DX_SET_RENDERTARGETS = 1161,
185 	SVGA_3D_CMD_DX_SET_BLEND_STATE = 1162,
186 	SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE = 1163,
187 	SVGA_3D_CMD_DX_SET_RASTERIZER_STATE = 1164,
188 	SVGA_3D_CMD_DX_DEFINE_QUERY = 1165,
189 	SVGA_3D_CMD_DX_DESTROY_QUERY = 1166,
190 	SVGA_3D_CMD_DX_BIND_QUERY = 1167,
191 	SVGA_3D_CMD_DX_SET_QUERY_OFFSET = 1168,
192 	SVGA_3D_CMD_DX_BEGIN_QUERY = 1169,
193 	SVGA_3D_CMD_DX_END_QUERY = 1170,
194 	SVGA_3D_CMD_DX_READBACK_QUERY = 1171,
195 	SVGA_3D_CMD_DX_SET_PREDICATION = 1172,
196 	SVGA_3D_CMD_DX_SET_SOTARGETS = 1173,
197 	SVGA_3D_CMD_DX_SET_VIEWPORTS = 1174,
198 	SVGA_3D_CMD_DX_SET_SCISSORRECTS = 1175,
199 	SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW = 1176,
200 	SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW = 1177,
201 	SVGA_3D_CMD_DX_PRED_COPY_REGION = 1178,
202 	SVGA_3D_CMD_DX_PRED_COPY = 1179,
203 	SVGA_3D_CMD_DX_PRESENTBLT = 1180,
204 	SVGA_3D_CMD_DX_GENMIPS = 1181,
205 	SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE = 1182,
206 	SVGA_3D_CMD_DX_READBACK_SUBRESOURCE = 1183,
207 	SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE = 1184,
208 	SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW = 1185,
209 	SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW = 1186,
210 	SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW = 1187,
211 	SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW = 1188,
212 	SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW = 1189,
213 	SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW = 1190,
214 	SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT = 1191,
215 	SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT = 1192,
216 	SVGA_3D_CMD_DX_DEFINE_BLEND_STATE = 1193,
217 	SVGA_3D_CMD_DX_DESTROY_BLEND_STATE = 1194,
218 	SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE = 1195,
219 	SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE = 1196,
220 	SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE = 1197,
221 	SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE = 1198,
222 	SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE = 1199,
223 	SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE = 1200,
224 	SVGA_3D_CMD_DX_DEFINE_SHADER = 1201,
225 	SVGA_3D_CMD_DX_DESTROY_SHADER = 1202,
226 	SVGA_3D_CMD_DX_BIND_SHADER = 1203,
227 	SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT = 1204,
228 	SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT = 1205,
229 	SVGA_3D_CMD_DX_SET_STREAMOUTPUT = 1206,
230 	SVGA_3D_CMD_DX_SET_COTABLE = 1207,
231 	SVGA_3D_CMD_DX_READBACK_COTABLE = 1208,
232 	SVGA_3D_CMD_DX_BUFFER_COPY = 1209,
233 	SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER = 1210,
234 	SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK = 1211,
235 	SVGA_3D_CMD_DX_MOVE_QUERY = 1212,
236 	SVGA_3D_CMD_DX_BIND_ALL_QUERY = 1213,
237 	SVGA_3D_CMD_DX_READBACK_ALL_QUERY = 1214,
238 	SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER = 1215,
239 	SVGA_3D_CMD_DX_MOB_FENCE_64 = 1216,
240 	SVGA_3D_CMD_DX_BIND_ALL_SHADER = 1217,
241 	SVGA_3D_CMD_DX_HINT = 1218,
242 	SVGA_3D_CMD_DX_BUFFER_UPDATE = 1219,
243 	SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET = 1220,
244 	SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET = 1221,
245 	SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET = 1222,
246 	SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET = 1223,
247 	SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET = 1224,
248 	SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET = 1225,
249 
250 	SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER = 1226,
251 	SVGA_3D_CMD_DX_MAX = 1227,
252 
253 	SVGA_3D_CMD_SCREEN_COPY = 1227,
254 
255 	SVGA_3D_CMD_RESERVED1 = 1228,
256 	SVGA_3D_CMD_RESERVED2 = 1229,
257 	SVGA_3D_CMD_RESERVED3 = 1230,
258 	SVGA_3D_CMD_RESERVED4 = 1231,
259 	SVGA_3D_CMD_RESERVED5 = 1232,
260 	SVGA_3D_CMD_RESERVED6 = 1233,
261 	SVGA_3D_CMD_RESERVED7 = 1234,
262 	SVGA_3D_CMD_RESERVED8 = 1235,
263 
264 	SVGA_3D_CMD_GROW_OTABLE = 1236,
265 	SVGA_3D_CMD_DX_GROW_COTABLE = 1237,
266 	SVGA_3D_CMD_INTRA_SURFACE_COPY = 1238,
267 
268 	SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 = 1239,
269 
270 	SVGA_3D_CMD_DX_RESOLVE_COPY = 1240,
271 	SVGA_3D_CMD_DX_PRED_RESOLVE_COPY = 1241,
272 	SVGA_3D_CMD_DX_PRED_CONVERT_REGION = 1242,
273 	SVGA_3D_CMD_DX_PRED_CONVERT = 1243,
274 	SVGA_3D_CMD_WHOLE_SURFACE_COPY = 1244,
275 
276 	SVGA_3D_CMD_DX_DEFINE_UA_VIEW = 1245,
277 	SVGA_3D_CMD_DX_DESTROY_UA_VIEW = 1246,
278 	SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT = 1247,
279 	SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT = 1248,
280 	SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT = 1249,
281 	SVGA_3D_CMD_DX_SET_UA_VIEWS = 1250,
282 
283 	SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT = 1251,
284 	SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT = 1252,
285 	SVGA_3D_CMD_DX_DISPATCH = 1253,
286 	SVGA_3D_CMD_DX_DISPATCH_INDIRECT = 1254,
287 
288 	SVGA_3D_CMD_WRITE_ZERO_SURFACE = 1255,
289 	SVGA_3D_CMD_UPDATE_ZERO_SURFACE = 1256,
290 	SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER = 1257,
291 	SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT = 1258,
292 
293 	SVGA_3D_CMD_LOGICOPS_BITBLT = 1259,
294 	SVGA_3D_CMD_LOGICOPS_TRANSBLT = 1260,
295 	SVGA_3D_CMD_LOGICOPS_STRETCHBLT = 1261,
296 	SVGA_3D_CMD_LOGICOPS_COLORFILL = 1262,
297 	SVGA_3D_CMD_LOGICOPS_ALPHABLEND = 1263,
298 	SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND = 1264,
299 
300 	SVGA_3D_CMD_DX_COPY_COTABLE_INTO_MOB = 1265,
301 
302 	SVGA_3D_CMD_UPDATE_GB_SCREENTARGET_V2 = 1266,
303 
304 	SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 = 1267,
305 	SVGA_3D_CMD_DX_SET_CS_UA_VIEWS = 1268,
306 	SVGA_3D_CMD_DX_SET_MIN_LOD = 1269,
307 
308 	SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 = 1272,
309 	SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB = 1273,
310 	SVGA_3D_CMD_DX_SET_SHADER_IFACE = 1274,
311 	SVGA_3D_CMD_DX_BIND_STREAMOUTPUT = 1275,
312 	SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS = 1276,
313 	SVGA_3D_CMD_DX_BIND_SHADER_IFACE = 1277,
314 
315 	SVGA_3D_CMD_UPDATE_GB_SCREENTARGET_MOVE = 1278,
316 
317 	SVGA_3D_CMD_DX_PRED_STAGING_COPY = 1281,
318 	SVGA_3D_CMD_DX_STAGING_COPY = 1282,
319 	SVGA_3D_CMD_DX_PRED_STAGING_COPY_REGION = 1283,
320 	SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS_V2 = 1284,
321 	SVGA_3D_CMD_DX_SET_INDEX_BUFFER_V2 = 1285,
322 	SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS_OFFSET_AND_SIZE = 1286,
323 	SVGA_3D_CMD_DX_SET_INDEX_BUFFER_OFFSET_AND_SIZE = 1287,
324 	SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE_V2 = 1288,
325 	SVGA_3D_CMD_DX_PRED_STAGING_CONVERT_REGION = 1289,
326 	SVGA_3D_CMD_DX_PRED_STAGING_CONVERT = 1290,
327 	SVGA_3D_CMD_DX_STAGING_BUFFER_COPY = 1291,
328 
329 	SVGA_3D_CMD_MAX = 1303,
330 	SVGA_3D_CMD_FUTURE_MAX = 3000
331 } SVGAFifo3dCmdId;
332 
333 #define SVGA_NUM_3D_CMD (SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE)
334 
335 #pragma pack(push, 1)
336 typedef struct {
337 	uint32 id;
338 	uint32 size;
339 } SVGA3dCmdHeader;
340 #pragma pack(pop)
341 
342 #pragma pack(push, 1)
343 typedef struct {
344 	uint32 numMipLevels;
345 } SVGA3dSurfaceFace;
346 #pragma pack(pop)
347 
348 #pragma pack(push, 1)
349 typedef struct {
350 	uint32 sid;
351 	SVGA3dSurface1Flags surfaceFlags;
352 	SVGA3dSurfaceFormat format;
353 
354 	SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];
355 
356 } SVGA3dCmdDefineSurface;
357 #pragma pack(pop)
358 
359 #pragma pack(push, 1)
360 typedef struct {
361 	uint32 sid;
362 	SVGA3dSurface1Flags surfaceFlags;
363 	SVGA3dSurfaceFormat format;
364 
365 	SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];
366 	uint32 multisampleCount;
367 	SVGA3dTextureFilter autogenFilter;
368 
369 } SVGA3dCmdDefineSurface_v2;
370 #pragma pack(pop)
371 
372 #pragma pack(push, 1)
373 typedef struct {
374 	uint32 sid;
375 } SVGA3dCmdDestroySurface;
376 #pragma pack(pop)
377 
378 #pragma pack(push, 1)
379 typedef struct {
380 	uint32 cid;
381 } SVGA3dCmdDefineContext;
382 #pragma pack(pop)
383 
384 #pragma pack(push, 1)
385 typedef struct {
386 	uint32 cid;
387 } SVGA3dCmdDestroyContext;
388 #pragma pack(pop)
389 
390 #pragma pack(push, 1)
391 typedef struct {
392 	uint32 cid;
393 	SVGA3dClearFlag clearFlag;
394 	uint32 color;
395 	float depth;
396 	uint32 stencil;
397 
398 } SVGA3dCmdClear;
399 #pragma pack(pop)
400 
401 #pragma pack(push, 1)
402 typedef struct {
403 	SVGA3dLightType type;
404 	SVGA3dBool inWorldSpace;
405 	float diffuse[4];
406 	float specular[4];
407 	float ambient[4];
408 	float position[4];
409 	float direction[4];
410 	float range;
411 	float falloff;
412 	float attenuation0;
413 	float attenuation1;
414 	float attenuation2;
415 	float theta;
416 	float phi;
417 } SVGA3dLightData;
418 #pragma pack(pop)
419 
420 #pragma pack(push, 1)
421 typedef struct {
422 	uint32 sid;
423 
424 } SVGA3dCmdPresent;
425 #pragma pack(pop)
426 
427 #pragma pack(push, 1)
428 typedef struct {
429 	SVGA3dRenderStateName state;
430 	union {
431 		uint32 uintValue;
432 		float floatValue;
433 	};
434 } SVGA3dRenderState;
435 #pragma pack(pop)
436 
437 #pragma pack(push, 1)
438 typedef struct {
439 	uint32 cid;
440 
441 } SVGA3dCmdSetRenderState;
442 #pragma pack(pop)
443 
444 #pragma pack(push, 1)
445 typedef struct {
446 	uint32 cid;
447 	SVGA3dRenderTargetType type;
448 	SVGA3dSurfaceImageId target;
449 } SVGA3dCmdSetRenderTarget;
450 #pragma pack(pop)
451 
452 #pragma pack(push, 1)
453 typedef struct {
454 	SVGA3dSurfaceImageId src;
455 	SVGA3dSurfaceImageId dest;
456 
457 } SVGA3dCmdSurfaceCopy;
458 #pragma pack(pop)
459 
460 #pragma pack(push, 1)
461 typedef struct {
462 	SVGA3dSurfaceImageId surface;
463 	SVGA3dCopyBox box;
464 } SVGA3dCmdIntraSurfaceCopy;
465 #pragma pack(pop)
466 
467 #pragma pack(push, 1)
468 typedef struct {
469 	uint32 srcSid;
470 	uint32 destSid;
471 } SVGA3dCmdWholeSurfaceCopy;
472 #pragma pack(pop)
473 
474 #pragma pack(push, 1)
475 typedef struct {
476 	SVGA3dSurfaceImageId src;
477 	SVGA3dSurfaceImageId dest;
478 	SVGA3dBox boxSrc;
479 	SVGA3dBox boxDest;
480 } SVGA3dCmdSurfaceStretchBltNonMSToMS;
481 #pragma pack(pop)
482 
483 #pragma pack(push, 1)
484 typedef struct {
485 	SVGA3dSurfaceImageId src;
486 	SVGA3dSurfaceImageId dest;
487 	SVGA3dBox boxSrc;
488 	SVGA3dBox boxDest;
489 	SVGA3dStretchBltMode mode;
490 } SVGA3dCmdSurfaceStretchBlt;
491 #pragma pack(pop)
492 
493 #pragma pack(push, 1)
494 typedef struct {
495 	uint32 discard : 1;
496 
497 	uint32 unsynchronized : 1;
498 
499 	uint32 reserved : 30;
500 } SVGA3dSurfaceDMAFlags;
501 #pragma pack(pop)
502 
503 #pragma pack(push, 1)
504 typedef struct {
505 	SVGAGuestImage guest;
506 	SVGA3dSurfaceImageId host;
507 	SVGA3dTransferType transfer;
508 
509 } SVGA3dCmdSurfaceDMA;
510 #pragma pack(pop)
511 
512 #pragma pack(push, 1)
513 typedef struct {
514 	uint32 suffixSize;
515 
516 	uint32 maximumOffset;
517 
518 	SVGA3dSurfaceDMAFlags flags;
519 } SVGA3dCmdSurfaceDMASuffix;
520 #pragma pack(pop)
521 
522 #pragma pack(push, 1)
523 typedef struct {
524 	uint32 first;
525 	uint32 last;
526 } SVGA3dArrayRangeHint;
527 #pragma pack(pop)
528 
529 #pragma pack(push, 1)
530 typedef struct {
531 	uint32 surfaceId;
532 	uint32 offset;
533 	uint32 stride;
534 } SVGA3dArray;
535 #pragma pack(pop)
536 
537 #pragma pack(push, 1)
538 typedef struct {
539 	SVGA3dDeclType type;
540 	SVGA3dDeclMethod method;
541 	SVGA3dDeclUsage usage;
542 	uint32 usageIndex;
543 } SVGA3dVertexArrayIdentity;
544 #pragma pack(pop)
545 
546 #pragma pack(push, 1)
547 typedef struct SVGA3dVertexDecl {
548 	SVGA3dVertexArrayIdentity identity;
549 	SVGA3dArray array;
550 	SVGA3dArrayRangeHint rangeHint;
551 } SVGA3dVertexDecl;
552 #pragma pack(pop)
553 
554 #pragma pack(push, 1)
555 typedef struct SVGA3dPrimitiveRange {
556 	SVGA3dPrimitiveType primType;
557 	uint32 primitiveCount;
558 
559 	SVGA3dArray indexArray;
560 	uint32 indexWidth;
561 
562 	int32 indexBias;
563 } SVGA3dPrimitiveRange;
564 #pragma pack(pop)
565 
566 #pragma pack(push, 1)
567 typedef struct {
568 	uint32 cid;
569 	uint32 numVertexDecls;
570 	uint32 numRanges;
571 
572 } SVGA3dCmdDrawPrimitives;
573 #pragma pack(pop)
574 
575 #pragma pack(push, 1)
576 typedef struct {
577 	uint32 cid;
578 
579 	uint32 primitiveCount;
580 	uint32 startVertexLocation;
581 
582 	uint8 primitiveType;
583 	uint8 padding[3];
584 } SVGA3dCmdDraw;
585 #pragma pack(pop)
586 
587 #pragma pack(push, 1)
588 typedef struct {
589 	uint32 cid;
590 
591 	uint8 primitiveType;
592 
593 	uint32 indexBufferSid;
594 	uint32 indexBufferOffset;
595 
596 	uint8 indexBufferStride;
597 
598 	int32 baseVertexLocation;
599 
600 	uint32 primitiveCount;
601 	uint32 pad0;
602 	uint16 pad1;
603 } SVGA3dCmdDrawIndexed;
604 #pragma pack(pop)
605 
606 #pragma pack(push, 1)
607 typedef struct {
608 	uint16 streamOffset;
609 	uint8 stream;
610 	uint8 type;
611 	uint8 method;
612 	uint8 usage;
613 	uint8 usageIndex;
614 	uint8 padding;
615 
616 } SVGA3dVertexElement;
617 #pragma pack(pop)
618 
619 #define SVGA3D_VERTEX_ELEMENT_RESPECT_STREAM (1 << 7)
620 
621 #pragma pack(push, 1)
622 typedef struct {
623 	uint32 cid;
624 
625 	uint32 numElements;
626 
627 } SVGA3dCmdSetVertexDecls;
628 #pragma pack(pop)
629 
630 #pragma pack(push, 1)
631 typedef struct {
632 	uint32 sid;
633 	uint32 stride;
634 	uint32 offset;
635 } SVGA3dVertexStream;
636 #pragma pack(pop)
637 
638 #pragma pack(push, 1)
639 typedef struct {
640 	uint32 cid;
641 
642 	uint32 numStreams;
643 
644 } SVGA3dCmdSetVertexStreams;
645 #pragma pack(pop)
646 
647 #pragma pack(push, 1)
648 typedef struct {
649 	uint32 cid;
650 	uint32 numDivisors;
651 } SVGA3dCmdSetVertexDivisors;
652 #pragma pack(pop)
653 
654 #pragma pack(push, 1)
655 typedef struct {
656 	uint32 stage;
657 	SVGA3dTextureStateName name;
658 	union {
659 		uint32 value;
660 		float floatValue;
661 	};
662 } SVGA3dTextureState;
663 #pragma pack(pop)
664 
665 #pragma pack(push, 1)
666 typedef struct {
667 	uint32 cid;
668 
669 } SVGA3dCmdSetTextureState;
670 #pragma pack(pop)
671 
672 #pragma pack(push, 1)
673 typedef struct {
674 	uint32 cid;
675 	SVGA3dTransformType type;
676 	float matrix[16];
677 } SVGA3dCmdSetTransform;
678 #pragma pack(pop)
679 
680 #pragma pack(push, 1)
681 typedef struct {
682 	float min;
683 	float max;
684 } SVGA3dZRange;
685 #pragma pack(pop)
686 
687 #pragma pack(push, 1)
688 typedef struct {
689 	uint32 cid;
690 	SVGA3dZRange zRange;
691 } SVGA3dCmdSetZRange;
692 #pragma pack(pop)
693 
694 #pragma pack(push, 1)
695 typedef struct {
696 	float diffuse[4];
697 	float ambient[4];
698 	float specular[4];
699 	float emissive[4];
700 	float shininess;
701 } SVGA3dMaterial;
702 #pragma pack(pop)
703 
704 #pragma pack(push, 1)
705 typedef struct {
706 	uint32 cid;
707 	SVGA3dFace face;
708 	SVGA3dMaterial material;
709 } SVGA3dCmdSetMaterial;
710 #pragma pack(pop)
711 
712 #pragma pack(push, 1)
713 typedef struct {
714 	uint32 cid;
715 	uint32 index;
716 	SVGA3dLightData data;
717 } SVGA3dCmdSetLightData;
718 #pragma pack(pop)
719 
720 #pragma pack(push, 1)
721 typedef struct {
722 	uint32 cid;
723 	uint32 index;
724 	uint32 enabled;
725 } SVGA3dCmdSetLightEnabled;
726 #pragma pack(pop)
727 
728 #pragma pack(push, 1)
729 typedef struct {
730 	uint32 cid;
731 	SVGA3dRect rect;
732 } SVGA3dCmdSetViewport;
733 #pragma pack(pop)
734 
735 #pragma pack(push, 1)
736 typedef struct {
737 	uint32 cid;
738 	SVGA3dRect rect;
739 } SVGA3dCmdSetScissorRect;
740 #pragma pack(pop)
741 
742 #pragma pack(push, 1)
743 typedef struct {
744 	uint32 cid;
745 	uint32 index;
746 	float plane[4];
747 } SVGA3dCmdSetClipPlane;
748 #pragma pack(pop)
749 
750 #pragma pack(push, 1)
751 typedef struct {
752 	uint32 cid;
753 	uint32 shid;
754 	SVGA3dShaderType type;
755 
756 } SVGA3dCmdDefineShader;
757 #pragma pack(pop)
758 
759 #pragma pack(push, 1)
760 typedef struct {
761 	uint32 cid;
762 	uint32 shid;
763 	SVGA3dShaderType type;
764 } SVGA3dCmdDestroyShader;
765 #pragma pack(pop)
766 
767 #pragma pack(push, 1)
768 typedef struct {
769 	uint32 cid;
770 	uint32 reg;
771 	SVGA3dShaderType type;
772 	SVGA3dShaderConstType ctype;
773 	uint32 values[4];
774 
775 } SVGA3dCmdSetShaderConst;
776 #pragma pack(pop)
777 
778 #pragma pack(push, 1)
779 typedef struct {
780 	uint32 cid;
781 	SVGA3dShaderType type;
782 	uint32 shid;
783 } SVGA3dCmdSetShader;
784 #pragma pack(pop)
785 
786 #pragma pack(push, 1)
787 typedef struct {
788 	uint32 cid;
789 	SVGA3dQueryType type;
790 } SVGA3dCmdBeginQuery;
791 #pragma pack(pop)
792 
793 #pragma pack(push, 1)
794 typedef struct {
795 	uint32 cid;
796 	SVGA3dQueryType type;
797 	SVGAGuestPtr guestResult;
798 } SVGA3dCmdEndQuery;
799 #pragma pack(pop)
800 
801 #pragma pack(push, 1)
802 typedef struct {
803 	uint32 cid;
804 	SVGA3dQueryType type;
805 	SVGAGuestPtr guestResult;
806 } SVGA3dCmdWaitForQuery;
807 #pragma pack(pop)
808 
809 #pragma pack(push, 1)
810 typedef struct {
811 	uint32 totalSize;
812 	SVGA3dQueryState state;
813 	union {
814 		uint32 result32;
815 		uint32 queryCookie;
816 	};
817 } SVGA3dQueryResult;
818 #pragma pack(pop)
819 
820 #pragma pack(push, 1)
821 typedef struct {
822 	SVGA3dSurfaceImageId srcImage;
823 	SVGASignedRect srcRect;
824 	uint32 destScreenId;
825 	SVGASignedRect destRect;
826 
827 } SVGA3dCmdBlitSurfaceToScreen;
828 #pragma pack(pop)
829 
830 #pragma pack(push, 1)
831 typedef struct {
832 	uint32 sid;
833 	SVGA3dTextureFilter filter;
834 } SVGA3dCmdGenerateMipmaps;
835 #pragma pack(pop)
836 
837 #pragma pack(push, 1)
838 typedef struct {
839 	uint32 sid;
840 } SVGA3dCmdActivateSurface;
841 #pragma pack(pop)
842 
843 #pragma pack(push, 1)
844 typedef struct {
845 	uint32 sid;
846 } SVGA3dCmdDeactivateSurface;
847 #pragma pack(pop)
848 
849 #pragma pack(push, 1)
850 typedef struct SVGA3dCmdScreenDMA {
851 	uint32 screenId;
852 	SVGAGuestImage refBuffer;
853 	SVGAGuestImage destBuffer;
854 	SVGAGuestImage changeMap;
855 } SVGA3dCmdScreenDMA;
856 #pragma pack(pop)
857 
858 #define SVGA3D_LOTRANSBLT_HONORALPHA (0x01)
859 #define SVGA3D_LOSTRETCHBLT_MIRRORX (0x01)
860 #define SVGA3D_LOSTRETCHBLT_MIRRORY (0x02)
861 #define SVGA3D_LOALPHABLEND_SRCHASALPHA (0x01)
862 
863 #pragma pack(push, 1)
864 typedef struct SVGA3dCmdLogicOpsBitBlt {
865 	SVGA3dSurfaceImageId src;
866 	SVGA3dSurfaceImageId dst;
867 	SVGA3dLogicOp logicOp;
868 	SVGA3dLogicOpRop3 logicOpRop3;
869 
870 } SVGA3dCmdLogicOpsBitBlt;
871 #pragma pack(pop)
872 
873 #pragma pack(push, 1)
874 typedef struct SVGA3dCmdLogicOpsTransBlt {
875 	SVGA3dSurfaceImageId src;
876 	SVGA3dSurfaceImageId dst;
877 	uint32 color;
878 	uint32 flags;
879 	SVGA3dBox srcBox;
880 	SVGA3dSignedBox dstBox;
881 	SVGA3dBox clipBox;
882 } SVGA3dCmdLogicOpsTransBlt;
883 #pragma pack(pop)
884 
885 #pragma pack(push, 1)
886 typedef struct SVGA3dCmdLogicOpsStretchBlt {
887 	SVGA3dSurfaceImageId src;
888 	SVGA3dSurfaceImageId dst;
889 	uint16 mode;
890 	uint16 flags;
891 	SVGA3dBox srcBox;
892 	SVGA3dSignedBox dstBox;
893 	SVGA3dBox clipBox;
894 } SVGA3dCmdLogicOpsStretchBlt;
895 #pragma pack(pop)
896 
897 #pragma pack(push, 1)
898 typedef struct SVGA3dCmdLogicOpsColorFill {
899 	SVGA3dSurfaceImageId dst;
900 	uint32 color;
901 	SVGA3dLogicOp logicOp;
902 	SVGA3dLogicOpRop3 logicOpRop3;
903 
904 } SVGA3dCmdLogicOpsColorFill;
905 #pragma pack(pop)
906 
907 #pragma pack(push, 1)
908 typedef struct SVGA3dCmdLogicOpsAlphaBlend {
909 	SVGA3dSurfaceImageId src;
910 	SVGA3dSurfaceImageId dst;
911 	uint32 alphaVal;
912 	uint32 flags;
913 	SVGA3dBox srcBox;
914 	SVGA3dSignedBox dstBox;
915 	SVGA3dBox clipBox;
916 } SVGA3dCmdLogicOpsAlphaBlend;
917 #pragma pack(pop)
918 
919 #define SVGA3D_CLEARTYPE_INVALID_GAMMA_INDEX 0xFFFFFFFF
920 
921 #define SVGA3D_CLEARTYPE_GAMMA_WIDTH 512
922 #define SVGA3D_CLEARTYPE_GAMMA_HEIGHT 16
923 
924 #pragma pack(push, 1)
925 typedef struct SVGA3dCmdLogicOpsClearTypeBlend {
926 	SVGA3dSurfaceImageId tmp;
927 	SVGA3dSurfaceImageId dst;
928 	SVGA3dSurfaceImageId gammaSurf;
929 	SVGA3dSurfaceImageId alphaSurf;
930 	uint32 gamma;
931 	uint32 color;
932 	uint32 color2;
933 	int32 alphaOffsetX;
934 	int32 alphaOffsetY;
935 
936 } SVGA3dCmdLogicOpsClearTypeBlend;
937 #pragma pack(pop)
938 
939 #pragma pack(push, 1)
940 typedef struct {
941 	SVGAMobFormat ptDepth;
942 	uint32 sizeInBytes;
943 	PPN64 base;
944 } SVGAOTableMobEntry;
945 #pragma pack(pop)
946 
947 #pragma pack(push, 1)
948 typedef struct {
949 	SVGA3dSurfaceFormat format;
950 	SVGA3dSurface1Flags surface1Flags;
951 	uint32 numMipLevels;
952 	uint32 multisampleCount;
953 	SVGA3dTextureFilter autogenFilter;
954 	SVGA3dSize size;
955 	SVGAMobId mobid;
956 	uint32 arraySize;
957 	uint32 mobPitch;
958 	SVGA3dSurface2Flags surface2Flags;
959 	uint8 multisamplePattern;
960 	uint8 qualityLevel;
961 	uint16 bufferByteStride;
962 	float minLOD;
963 	uint32 pad0[2];
964 } SVGAOTableSurfaceEntry;
965 #pragma pack(pop)
966 
967 #pragma pack(push, 1)
968 typedef struct {
969 	uint32 cid;
970 	SVGAMobId mobid;
971 } SVGAOTableContextEntry;
972 #pragma pack(pop)
973 
974 #pragma pack(push, 1)
975 typedef struct {
976 	SVGA3dShaderType type;
977 	uint32 sizeInBytes;
978 	uint32 offsetInBytes;
979 	SVGAMobId mobid;
980 } SVGAOTableShaderEntry;
981 #pragma pack(pop)
982 
983 #define SVGA_STFLAG_PRIMARY (1 << 0)
984 #define SVGA_STFLAG_RESERVED (1 << 1)
985 typedef uint32 SVGAScreenTargetFlags;
986 
987 #pragma pack(push, 1)
988 typedef struct {
989 	SVGA3dSurfaceImageId image;
990 	uint32 width;
991 	uint32 height;
992 	int32 xRoot;
993 	int32 yRoot;
994 	SVGAScreenTargetFlags flags;
995 	uint32 dpi;
996 	uint32 pad[7];
997 } SVGAOTableScreenTargetEntry;
998 #pragma pack(pop)
999 
1000 #pragma pack(push, 1)
1001 typedef struct {
1002 	float value[4];
1003 } SVGA3dShaderConstFloat;
1004 #pragma pack(pop)
1005 
1006 #pragma pack(push, 1)
1007 typedef struct {
1008 	int32 value[4];
1009 } SVGA3dShaderConstInt;
1010 #pragma pack(pop)
1011 
1012 #pragma pack(push, 1)
1013 typedef struct {
1014 	uint32 value;
1015 } SVGA3dShaderConstBool;
1016 #pragma pack(pop)
1017 
1018 #pragma pack(push, 1)
1019 typedef struct {
1020 	uint16 streamOffset;
1021 	uint8 stream;
1022 	uint8 type;
1023 	uint8 methodUsage;
1024 	uint8 usageIndex;
1025 } SVGAGBVertexElement;
1026 #pragma pack(pop)
1027 
1028 #pragma pack(push, 1)
1029 typedef struct {
1030 	uint32 sid;
1031 	uint16 stride;
1032 	uint32 offset;
1033 } SVGAGBVertexStream;
1034 #pragma pack(pop)
1035 #pragma pack(push, 1)
1036 typedef struct {
1037 	SVGA3dRect viewport;
1038 	SVGA3dRect scissorRect;
1039 	SVGA3dZRange zRange;
1040 
1041 	SVGA3dSurfaceImageId renderTargets[SVGA3D_RT_MAX];
1042 	SVGAGBVertexElement decl1[4];
1043 
1044 	uint32 renderStates[SVGA3D_RS_MAX];
1045 	SVGAGBVertexElement decl2[18];
1046 	uint32 pad0[2];
1047 
1048 	struct {
1049 		SVGA3dFace face;
1050 		SVGA3dMaterial material;
1051 	} material;
1052 
1053 	float clipPlanes[SVGA3D_MAX_CLIP_PLANES][4];
1054 	float matrices[SVGA3D_TRANSFORM_MAX][16];
1055 
1056 	SVGA3dBool lightEnabled[SVGA3D_NUM_LIGHTS];
1057 	SVGA3dLightData lightData[SVGA3D_NUM_LIGHTS];
1058 
1059 	uint32 shaders[SVGA3D_NUM_SHADERTYPE_PREDX];
1060 	SVGAGBVertexElement decl3[10];
1061 	uint32 pad1[3];
1062 
1063 	uint32 occQueryActive;
1064 	uint32 occQueryValue;
1065 
1066 	SVGA3dShaderConstInt pShaderIValues[SVGA3D_CONSTINTREG_MAX];
1067 	SVGA3dShaderConstInt vShaderIValues[SVGA3D_CONSTINTREG_MAX];
1068 	uint16 pShaderBValues;
1069 	uint16 vShaderBValues;
1070 
1071 	SVGAGBVertexStream streams[SVGA3D_MAX_VERTEX_ARRAYS];
1072 	SVGA3dVertexDivisor divisors[SVGA3D_MAX_VERTEX_ARRAYS];
1073 	uint32 numVertexDecls;
1074 	uint32 numVertexStreams;
1075 	uint32 numVertexDivisors;
1076 	uint32 pad2[30];
1077 
1078 	uint32 tsColorKey[SVGA3D_NUM_TEXTURE_UNITS];
1079 	uint32 textureStages[SVGA3D_NUM_TEXTURE_UNITS][SVGA3D_TS_CONSTANT + 1];
1080 	uint32 tsColorKeyEnable[SVGA3D_NUM_TEXTURE_UNITS];
1081 
1082 	SVGA3dShaderConstFloat pShaderFValues[SVGA3D_CONSTREG_MAX];
1083 	SVGA3dShaderConstFloat vShaderFValues[SVGA3D_CONSTREG_MAX];
1084 } SVGAGBContextData;
1085 #pragma pack(pop)
1086 
1087 #pragma pack(push, 1)
1088 typedef struct {
1089 	SVGAOTableType type;
1090 	PPN32 baseAddress;
1091 	uint32 sizeInBytes;
1092 	uint32 validSizeInBytes;
1093 	SVGAMobFormat ptDepth;
1094 } SVGA3dCmdSetOTableBase;
1095 #pragma pack(pop)
1096 
1097 #pragma pack(push, 1)
1098 typedef struct {
1099 	SVGAOTableType type;
1100 	PPN64 baseAddress;
1101 	uint32 sizeInBytes;
1102 	uint32 validSizeInBytes;
1103 	SVGAMobFormat ptDepth;
1104 } SVGA3dCmdSetOTableBase64;
1105 #pragma pack(pop)
1106 
1107 #pragma pack(push, 1)
1108 typedef struct {
1109 	SVGAOTableType type;
1110 	PPN64 baseAddress;
1111 	uint32 sizeInBytes;
1112 	uint32 validSizeInBytes;
1113 	SVGAMobFormat ptDepth;
1114 } SVGA3dCmdGrowOTable;
1115 #pragma pack(pop)
1116 
1117 #pragma pack(push, 1)
1118 typedef struct {
1119 	SVGAOTableType type;
1120 } SVGA3dCmdReadbackOTable;
1121 #pragma pack(pop)
1122 
1123 #pragma pack(push, 1)
1124 typedef struct SVGA3dCmdDefineGBMob {
1125 	SVGAMobId mobid;
1126 	SVGAMobFormat ptDepth;
1127 	PPN32 base;
1128 	uint32 sizeInBytes;
1129 } SVGA3dCmdDefineGBMob;
1130 #pragma pack(pop)
1131 
1132 #pragma pack(push, 1)
1133 typedef struct SVGA3dCmdDestroyGBMob {
1134 	SVGAMobId mobid;
1135 } SVGA3dCmdDestroyGBMob;
1136 #pragma pack(pop)
1137 
1138 #pragma pack(push, 1)
1139 typedef struct SVGA3dCmdDefineGBMob64 {
1140 	SVGAMobId mobid;
1141 	SVGAMobFormat ptDepth;
1142 	PPN64 base;
1143 	uint32 sizeInBytes;
1144 } SVGA3dCmdDefineGBMob64;
1145 #pragma pack(pop)
1146 
1147 #pragma pack(push, 1)
1148 typedef struct SVGA3dCmdRedefineGBMob64 {
1149 	SVGAMobId mobid;
1150 	SVGAMobFormat ptDepth;
1151 	PPN64 base;
1152 	uint32 sizeInBytes;
1153 } SVGA3dCmdRedefineGBMob64;
1154 #pragma pack(pop)
1155 
1156 #pragma pack(push, 1)
1157 typedef struct SVGA3dCmdUpdateGBMobMapping {
1158 	SVGAMobId mobid;
1159 } SVGA3dCmdUpdateGBMobMapping;
1160 #pragma pack(pop)
1161 
1162 #pragma pack(push, 1)
1163 typedef struct SVGA3dCmdDefineGBSurface {
1164 	uint32 sid;
1165 	SVGA3dSurface1Flags surfaceFlags;
1166 	SVGA3dSurfaceFormat format;
1167 	uint32 numMipLevels;
1168 	uint32 multisampleCount;
1169 	SVGA3dTextureFilter autogenFilter;
1170 	SVGA3dSize size;
1171 } SVGA3dCmdDefineGBSurface;
1172 #pragma pack(pop)
1173 
1174 #pragma pack(push, 1)
1175 typedef struct SVGA3dCmdDefineGBSurface_v2 {
1176 	uint32 sid;
1177 	SVGA3dSurface1Flags surfaceFlags;
1178 	SVGA3dSurfaceFormat format;
1179 	uint32 numMipLevels;
1180 	uint32 multisampleCount;
1181 	SVGA3dTextureFilter autogenFilter;
1182 	SVGA3dSize size;
1183 	uint32 arraySize;
1184 	uint32 pad;
1185 } SVGA3dCmdDefineGBSurface_v2;
1186 #pragma pack(pop)
1187 
1188 #pragma pack(push, 1)
1189 typedef struct SVGA3dCmdDefineGBSurface_v3 {
1190 	uint32 sid;
1191 	SVGA3dSurfaceAllFlags surfaceFlags;
1192 	SVGA3dSurfaceFormat format;
1193 	uint32 numMipLevels;
1194 	uint32 multisampleCount;
1195 	SVGA3dMSPattern multisamplePattern;
1196 	SVGA3dMSQualityLevel qualityLevel;
1197 	SVGA3dTextureFilter autogenFilter;
1198 	SVGA3dSize size;
1199 	uint32 arraySize;
1200 } SVGA3dCmdDefineGBSurface_v3;
1201 #pragma pack(pop)
1202 
1203 #pragma pack(push, 1)
1204 typedef struct SVGA3dCmdDefineGBSurface_v4 {
1205 	uint32 sid;
1206 	SVGA3dSurfaceAllFlags surfaceFlags;
1207 	SVGA3dSurfaceFormat format;
1208 	uint32 numMipLevels;
1209 	uint32 multisampleCount;
1210 	SVGA3dMSPattern multisamplePattern;
1211 	SVGA3dMSQualityLevel qualityLevel;
1212 	SVGA3dTextureFilter autogenFilter;
1213 	SVGA3dSize size;
1214 	uint32 arraySize;
1215 	uint32 bufferByteStride;
1216 } SVGA3dCmdDefineGBSurface_v4;
1217 #pragma pack(pop)
1218 
1219 #pragma pack(push, 1)
1220 typedef struct SVGA3dCmdDestroyGBSurface {
1221 	uint32 sid;
1222 } SVGA3dCmdDestroyGBSurface;
1223 #pragma pack(pop)
1224 
1225 #pragma pack(push, 1)
1226 typedef struct SVGA3dCmdBindGBSurface {
1227 	uint32 sid;
1228 	SVGAMobId mobid;
1229 } SVGA3dCmdBindGBSurface;
1230 #pragma pack(pop)
1231 
1232 #pragma pack(push, 1)
1233 typedef struct SVGA3dCmdBindGBSurfaceWithPitch {
1234 	uint32 sid;
1235 	SVGAMobId mobid;
1236 	uint32 baseLevelPitch;
1237 } SVGA3dCmdBindGBSurfaceWithPitch;
1238 #pragma pack(pop)
1239 
1240 #define SVGA3D_COND_BIND_GB_SURFACE_FLAG_READBACK (1 << 0)
1241 #define SVGA3D_COND_BIND_GB_SURFACE_FLAG_UPDATE (1 << 1)
1242 
1243 #pragma pack(push, 1)
1244 typedef struct SVGA3dCmdCondBindGBSurface {
1245 	uint32 sid;
1246 	SVGAMobId testMobid;
1247 	SVGAMobId mobid;
1248 	uint32 flags;
1249 } SVGA3dCmdCondBindGBSurface;
1250 #pragma pack(pop)
1251 
1252 #pragma pack(push, 1)
1253 typedef struct SVGA3dCmdUpdateGBImage {
1254 	SVGA3dSurfaceImageId image;
1255 	SVGA3dBox box;
1256 } SVGA3dCmdUpdateGBImage;
1257 #pragma pack(pop)
1258 
1259 #pragma pack(push, 1)
1260 typedef struct SVGA3dCmdUpdateGBSurface {
1261 	uint32 sid;
1262 } SVGA3dCmdUpdateGBSurface;
1263 #pragma pack(pop)
1264 
1265 #pragma pack(push, 1)
1266 typedef struct SVGA3dCmdReadbackGBImage {
1267 	SVGA3dSurfaceImageId image;
1268 } SVGA3dCmdReadbackGBImage;
1269 #pragma pack(pop)
1270 
1271 #pragma pack(push, 1)
1272 typedef struct SVGA3dCmdReadbackGBSurface {
1273 	uint32 sid;
1274 } SVGA3dCmdReadbackGBSurface;
1275 #pragma pack(pop)
1276 
1277 #pragma pack(push, 1)
1278 typedef struct SVGA3dCmdReadbackGBImagePartial {
1279 	SVGA3dSurfaceImageId image;
1280 	SVGA3dBox box;
1281 	uint32 invertBox;
1282 } SVGA3dCmdReadbackGBImagePartial;
1283 #pragma pack(pop)
1284 
1285 #pragma pack(push, 1)
1286 typedef struct SVGA3dCmdInvalidateGBImage {
1287 	SVGA3dSurfaceImageId image;
1288 } SVGA3dCmdInvalidateGBImage;
1289 #pragma pack(pop)
1290 
1291 #pragma pack(push, 1)
1292 typedef struct SVGA3dCmdInvalidateGBSurface {
1293 	uint32 sid;
1294 } SVGA3dCmdInvalidateGBSurface;
1295 #pragma pack(pop)
1296 
1297 #pragma pack(push, 1)
1298 typedef struct SVGA3dCmdInvalidateGBImagePartial {
1299 	SVGA3dSurfaceImageId image;
1300 	SVGA3dBox box;
1301 	uint32 invertBox;
1302 } SVGA3dCmdInvalidateGBImagePartial;
1303 #pragma pack(pop)
1304 
1305 #pragma pack(push, 1)
1306 typedef struct SVGA3dCmdDefineGBContext {
1307 	uint32 cid;
1308 } SVGA3dCmdDefineGBContext;
1309 #pragma pack(pop)
1310 
1311 #pragma pack(push, 1)
1312 typedef struct SVGA3dCmdDestroyGBContext {
1313 	uint32 cid;
1314 } SVGA3dCmdDestroyGBContext;
1315 #pragma pack(pop)
1316 
1317 #pragma pack(push, 1)
1318 typedef struct SVGA3dCmdBindGBContext {
1319 	uint32 cid;
1320 	SVGAMobId mobid;
1321 	uint32 validContents;
1322 } SVGA3dCmdBindGBContext;
1323 #pragma pack(pop)
1324 
1325 #pragma pack(push, 1)
1326 typedef struct SVGA3dCmdReadbackGBContext {
1327 	uint32 cid;
1328 } SVGA3dCmdReadbackGBContext;
1329 #pragma pack(pop)
1330 
1331 #pragma pack(push, 1)
1332 typedef struct SVGA3dCmdInvalidateGBContext {
1333 	uint32 cid;
1334 } SVGA3dCmdInvalidateGBContext;
1335 #pragma pack(pop)
1336 
1337 #pragma pack(push, 1)
1338 typedef struct SVGA3dCmdDefineGBShader {
1339 	uint32 shid;
1340 	SVGA3dShaderType type;
1341 	uint32 sizeInBytes;
1342 } SVGA3dCmdDefineGBShader;
1343 #pragma pack(pop)
1344 
1345 #pragma pack(push, 1)
1346 typedef struct SVGA3dCmdBindGBShader {
1347 	uint32 shid;
1348 	SVGAMobId mobid;
1349 	uint32 offsetInBytes;
1350 } SVGA3dCmdBindGBShader;
1351 #pragma pack(pop)
1352 
1353 #pragma pack(push, 1)
1354 typedef struct SVGA3dCmdDestroyGBShader {
1355 	uint32 shid;
1356 } SVGA3dCmdDestroyGBShader;
1357 #pragma pack(pop)
1358 
1359 #pragma pack(push, 1)
1360 typedef struct {
1361 	uint32 cid;
1362 	uint32 regStart;
1363 	SVGA3dShaderType shaderType;
1364 	SVGA3dShaderConstType constType;
1365 
1366 } SVGA3dCmdSetGBShaderConstInline;
1367 #pragma pack(pop)
1368 
1369 #pragma pack(push, 1)
1370 typedef struct {
1371 	uint32 cid;
1372 	SVGA3dQueryType type;
1373 } SVGA3dCmdBeginGBQuery;
1374 #pragma pack(pop)
1375 
1376 #pragma pack(push, 1)
1377 typedef struct {
1378 	uint32 cid;
1379 	SVGA3dQueryType type;
1380 	SVGAMobId mobid;
1381 	uint32 offset;
1382 } SVGA3dCmdEndGBQuery;
1383 #pragma pack(pop)
1384 
1385 #pragma pack(push, 1)
1386 typedef struct {
1387 	uint32 cid;
1388 	SVGA3dQueryType type;
1389 	SVGAMobId mobid;
1390 	uint32 offset;
1391 } SVGA3dCmdWaitForGBQuery;
1392 #pragma pack(pop)
1393 
1394 #pragma pack(push, 1)
1395 typedef struct {
1396 	SVGAMobId mobid;
1397 	uint32 mustBeZero;
1398 	uint32 initialized;
1399 } SVGA3dCmdEnableGart;
1400 #pragma pack(pop)
1401 
1402 #pragma pack(push, 1)
1403 typedef struct {
1404 	SVGAMobId mobid;
1405 	uint32 gartOffset;
1406 } SVGA3dCmdMapMobIntoGart;
1407 #pragma pack(pop)
1408 
1409 #pragma pack(push, 1)
1410 typedef struct {
1411 	uint32 gartOffset;
1412 	uint32 numPages;
1413 } SVGA3dCmdUnmapGartRange;
1414 #pragma pack(pop)
1415 
1416 #pragma pack(push, 1)
1417 typedef struct {
1418 	uint32 stid;
1419 	uint32 width;
1420 	uint32 height;
1421 	int32 xRoot;
1422 	int32 yRoot;
1423 	SVGAScreenTargetFlags flags;
1424 
1425 	uint32 dpi;
1426 } SVGA3dCmdDefineGBScreenTarget;
1427 #pragma pack(pop)
1428 
1429 #pragma pack(push, 1)
1430 typedef struct {
1431 	uint32 stid;
1432 } SVGA3dCmdDestroyGBScreenTarget;
1433 #pragma pack(pop)
1434 
1435 #pragma pack(push, 1)
1436 typedef struct {
1437 	uint32 stid;
1438 	SVGA3dSurfaceImageId image;
1439 } SVGA3dCmdBindGBScreenTarget;
1440 #pragma pack(pop)
1441 
1442 #pragma pack(push, 1)
1443 typedef struct {
1444 	uint32 stid;
1445 	SVGA3dRect rect;
1446 } SVGA3dCmdUpdateGBScreenTarget;
1447 #pragma pack(pop)
1448 
1449 #pragma pack(push, 1)
1450 typedef struct {
1451 	uint32 stid;
1452 	SVGA3dRect rect;
1453 	SVGA3dFrameUpdateType type;
1454 } SVGA3dCmdUpdateGBScreenTarget_v2;
1455 #pragma pack(pop)
1456 
1457 #pragma pack(push, 1)
1458 typedef struct {
1459 	uint32 stid;
1460 	SVGA3dRect rect;
1461 	SVGA3dFrameUpdateType type;
1462 	SVGAUnsignedPoint srcPoint;
1463 } SVGA3dCmdUpdateGBScreenTargetMove;
1464 #pragma pack(pop)
1465 
1466 #pragma pack(push, 1)
1467 typedef struct SVGA3dCmdGBScreenDMA {
1468 	uint32 screenId;
1469 	uint32 dead;
1470 	SVGAMobId destMobID;
1471 	uint32 destPitch;
1472 	SVGAMobId changeMapMobID;
1473 } SVGA3dCmdGBScreenDMA;
1474 #pragma pack(pop)
1475 
1476 #pragma pack(push, 1)
1477 typedef struct {
1478 	uint32 value;
1479 	uint32 mobId;
1480 	uint32 mobOffset;
1481 } SVGA3dCmdGBMobFence;
1482 #pragma pack(pop)
1483 
1484 #pragma pack(push, 1)
1485 typedef struct {
1486 	uint32 stid;
1487 	SVGA3dSurfaceImageId dest;
1488 
1489 	uint32 statusMobId;
1490 	uint32 statusMobOffset;
1491 
1492 	uint32 mustBeInvalidId;
1493 	uint32 mustBeZero;
1494 } SVGA3dCmdScreenCopy;
1495 #pragma pack(pop)
1496 
1497 #define SVGA_SCREEN_COPY_STATUS_FAILURE 0x00
1498 #define SVGA_SCREEN_COPY_STATUS_SUCCESS 0x01
1499 #define SVGA_SCREEN_COPY_STATUS_INVALID 0xFFFFFFFF
1500 
1501 #pragma pack(push, 1)
1502 typedef struct {
1503 	uint32 sid;
1504 } SVGA3dCmdWriteZeroSurface;
1505 #pragma pack(pop)
1506 
1507 #pragma pack(push, 1)
1508 typedef struct {
1509 	uint32 sid;
1510 } SVGA3dCmdUpdateZeroSurface;
1511 #pragma pack(pop)
1512 
1513 #endif
1514