xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/svga/include/svga3d_cmd.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright (c) 2012-2024 Broadcom. All Rights Reserved.
3  * The term “Broadcom” refers to Broadcom Inc.
4  * and/or its subsidiaries.
5  * SPDX-License-Identifier: GPL-2.0 OR MIT
6  */
7 
8 /*
9  * svga3d_cmd.h --
10  *
11  *       SVGA 3d hardware cmd definitions
12  */
13 
14 #ifndef _SVGA3D_CMD_H_
15 #define _SVGA3D_CMD_H_
16 
17 #define INCLUDE_ALLOW_MODULE
18 #define INCLUDE_ALLOW_USERLEVEL
19 #define INCLUDE_ALLOW_VMCORE
20 
21 #include "includeCheck.h"
22 #include "svga3d_types.h"
23 #include "svga3d_limits.h"
24 
25 /*
26  * Identifiers for commands in the command FIFO.
27  *
28  * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of
29  * the SVGA3D protocol and remain reserved; they should not be used in the
30  * future.
31  *
32  * IDs between 1040 and 2999 (inclusive) are available for use by the
33  * current SVGA3D protocol.
34  *
35  * FIFO clients other than SVGA3D should stay below 1000, or at 3000
36  * and up.
37  */
38 
39 typedef enum {
40    SVGA_3D_CMD_LEGACY_BASE                                = 1000,
41    SVGA_3D_CMD_BASE                                       = 1040,
42 
43    SVGA_3D_CMD_SURFACE_DEFINE                             = 1040,
44    SVGA_3D_CMD_SURFACE_DESTROY                            = 1041,
45    SVGA_3D_CMD_SURFACE_COPY                               = 1042,
46    SVGA_3D_CMD_SURFACE_STRETCHBLT                         = 1043,
47    SVGA_3D_CMD_SURFACE_DMA                                = 1044,
48    SVGA_3D_CMD_CONTEXT_DEFINE                             = 1045,
49    SVGA_3D_CMD_CONTEXT_DESTROY                            = 1046,
50    SVGA_3D_CMD_SETTRANSFORM                               = 1047,
51    SVGA_3D_CMD_SETZRANGE                                  = 1048,
52    SVGA_3D_CMD_SETRENDERSTATE                             = 1049,
53    SVGA_3D_CMD_SETRENDERTARGET                            = 1050,
54    SVGA_3D_CMD_SETTEXTURESTATE                            = 1051,
55    SVGA_3D_CMD_SETMATERIAL                                = 1052,
56    SVGA_3D_CMD_SETLIGHTDATA                               = 1053,
57    SVGA_3D_CMD_SETLIGHTENABLED                            = 1054,
58    SVGA_3D_CMD_SETVIEWPORT                                = 1055,
59    SVGA_3D_CMD_SETCLIPPLANE                               = 1056,
60    SVGA_3D_CMD_CLEAR                                      = 1057,
61    SVGA_3D_CMD_PRESENT                                    = 1058,
62    SVGA_3D_CMD_SHADER_DEFINE                              = 1059,
63    SVGA_3D_CMD_SHADER_DESTROY                             = 1060,
64    SVGA_3D_CMD_SET_SHADER                                 = 1061,
65    SVGA_3D_CMD_SET_SHADER_CONST                           = 1062,
66    SVGA_3D_CMD_DRAW_PRIMITIVES                            = 1063,
67    SVGA_3D_CMD_SETSCISSORRECT                             = 1064,
68    SVGA_3D_CMD_BEGIN_QUERY                                = 1065,
69    SVGA_3D_CMD_END_QUERY                                  = 1066,
70    SVGA_3D_CMD_WAIT_FOR_QUERY                             = 1067,
71    SVGA_3D_CMD_PRESENT_READBACK                           = 1068,
72    SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN                     = 1069,
73    SVGA_3D_CMD_SURFACE_DEFINE_V2                          = 1070,
74    SVGA_3D_CMD_GENERATE_MIPMAPS                           = 1071,
75    SVGA_3D_CMD_DEAD4                                      = 1072,
76    SVGA_3D_CMD_DEAD5                                      = 1073,
77    SVGA_3D_CMD_DEAD6                                      = 1074,
78    SVGA_3D_CMD_DEAD7                                      = 1075,
79    SVGA_3D_CMD_DEAD8                                      = 1076,
80    SVGA_3D_CMD_DEAD9                                      = 1077,
81    SVGA_3D_CMD_DEAD10                                     = 1078,
82    SVGA_3D_CMD_DEAD11                                     = 1079,
83    SVGA_3D_CMD_ACTIVATE_SURFACE                           = 1080,
84    SVGA_3D_CMD_DEACTIVATE_SURFACE                         = 1081,
85    SVGA_3D_CMD_SCREEN_DMA                                 = 1082,
86    SVGA_3D_CMD_DEAD1                                      = 1083,
87    SVGA_3D_CMD_DEAD2                                      = 1084,
88 
89    SVGA_3D_CMD_DEAD12                                     = 1085,
90    SVGA_3D_CMD_DEAD13                                     = 1086,
91    SVGA_3D_CMD_DEAD14                                     = 1087,
92    SVGA_3D_CMD_DEAD15                                     = 1088,
93    SVGA_3D_CMD_DEAD16                                     = 1089,
94    SVGA_3D_CMD_DEAD17                                     = 1090,
95 
96    SVGA_3D_CMD_SET_OTABLE_BASE                            = 1091,
97    SVGA_3D_CMD_READBACK_OTABLE                            = 1092,
98 
99    SVGA_3D_CMD_DEFINE_GB_MOB                              = 1093,
100    SVGA_3D_CMD_DESTROY_GB_MOB                             = 1094,
101    SVGA_3D_CMD_DEAD3                                      = 1095,
102    SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING                      = 1096,
103 
104    SVGA_3D_CMD_DEFINE_GB_SURFACE                          = 1097,
105    SVGA_3D_CMD_DESTROY_GB_SURFACE                         = 1098,
106    SVGA_3D_CMD_BIND_GB_SURFACE                            = 1099,
107    SVGA_3D_CMD_COND_BIND_GB_SURFACE                       = 1100,
108    SVGA_3D_CMD_UPDATE_GB_IMAGE                            = 1101,
109    SVGA_3D_CMD_UPDATE_GB_SURFACE                          = 1102,
110    SVGA_3D_CMD_READBACK_GB_IMAGE                          = 1103,
111    SVGA_3D_CMD_READBACK_GB_SURFACE                        = 1104,
112    SVGA_3D_CMD_INVALIDATE_GB_IMAGE                        = 1105,
113    SVGA_3D_CMD_INVALIDATE_GB_SURFACE                      = 1106,
114 
115    SVGA_3D_CMD_DEFINE_GB_CONTEXT                          = 1107,
116    SVGA_3D_CMD_DESTROY_GB_CONTEXT                         = 1108,
117    SVGA_3D_CMD_BIND_GB_CONTEXT                            = 1109,
118    SVGA_3D_CMD_READBACK_GB_CONTEXT                        = 1110,
119    SVGA_3D_CMD_INVALIDATE_GB_CONTEXT                      = 1111,
120 
121    SVGA_3D_CMD_DEFINE_GB_SHADER                           = 1112,
122    SVGA_3D_CMD_DESTROY_GB_SHADER                          = 1113,
123    SVGA_3D_CMD_BIND_GB_SHADER                             = 1114,
124 
125    SVGA_3D_CMD_SET_OTABLE_BASE64                          = 1115,
126 
127    SVGA_3D_CMD_BEGIN_GB_QUERY                             = 1116,
128    SVGA_3D_CMD_END_GB_QUERY                               = 1117,
129    SVGA_3D_CMD_WAIT_FOR_GB_QUERY                          = 1118,
130 
131    SVGA_3D_CMD_NOP                                        = 1119,
132 
133    SVGA_3D_CMD_ENABLE_GART                                = 1120,
134    SVGA_3D_CMD_DISABLE_GART                               = 1121,
135    SVGA_3D_CMD_MAP_MOB_INTO_GART                          = 1122,
136    SVGA_3D_CMD_UNMAP_GART_RANGE                           = 1123,
137 
138    SVGA_3D_CMD_DEFINE_GB_SCREENTARGET                     = 1124,
139    SVGA_3D_CMD_DESTROY_GB_SCREENTARGET                    = 1125,
140    SVGA_3D_CMD_BIND_GB_SCREENTARGET                       = 1126,
141    SVGA_3D_CMD_UPDATE_GB_SCREENTARGET                     = 1127,
142 
143    SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL                  = 1128,
144    SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL                = 1129,
145 
146    SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE                 = 1130,
147 
148    SVGA_3D_CMD_GB_SCREEN_DMA                              = 1131,
149    SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH                 = 1132,
150    SVGA_3D_CMD_GB_MOB_FENCE                               = 1133,
151    SVGA_3D_CMD_DEFINE_GB_SURFACE_V2                       = 1134,
152    SVGA_3D_CMD_DEFINE_GB_MOB64                            = 1135,
153    SVGA_3D_CMD_REDEFINE_GB_MOB64                          = 1136,
154    SVGA_3D_CMD_NOP_ERROR                                  = 1137,
155 
156    SVGA_3D_CMD_SET_VERTEX_STREAMS                         = 1138,
157    SVGA_3D_CMD_SET_VERTEX_DECLS                           = 1139,
158    SVGA_3D_CMD_SET_VERTEX_DIVISORS                        = 1140,
159    SVGA_3D_CMD_DRAW                                       = 1141,
160    SVGA_3D_CMD_DRAW_INDEXED                               = 1142,
161 
162    /*
163     * DX10 Commands
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_VIDEO_DEFINE_DECODER                       = 1228,
256    SVGA_3D_CMD_VIDEO_DESTROY_DECODER                      = 1229,
257    SVGA_3D_CMD_VIDEO_DEFINE_PROCESSOR                     = 1230,
258    SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR                    = 1231,
259    SVGA_3D_CMD_VIDEO_DECODE_FRAME                         = 1232,
260    SVGA_3D_CMD_VIDEO_PROCESS_FRAME                        = 1233,
261    SVGA_3D_CMD_VIDEO_BIND_DECODER_MOB                     = 1234,
262    SVGA_3D_CMD_VIDEO_READBACK_DECODER_MOB                 = 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_HINT_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    SVGA_3D_CMD_DEFINE_GB_SURFACE_V4                       = 1267,
304    SVGA_3D_CMD_DX_SET_CS_UA_VIEWS                         = 1268,
305    SVGA_3D_CMD_DX_SET_MIN_LOD                             = 1269,
306 
307 
308 
309    SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2             = 1272,
310    SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB            = 1273,
311    SVGA_3D_CMD_DX_SET_SHADER_IFACE                        = 1274,
312    SVGA_3D_CMD_DX_BIND_STREAMOUTPUT                       = 1275,
313    SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS            = 1276,
314    SVGA_3D_CMD_DX_BIND_SHADER_IFACE                       = 1277,
315 
316    SVGA_3D_CMD_UPDATE_GB_SCREENTARGET_MOVE                = 1278,
317 
318 
319 
320    SVGA_3D_CMD_DX_PRED_STAGING_COPY                       = 1281,
321    SVGA_3D_CMD_DX_STAGING_COPY                            = 1282,
322    SVGA_3D_CMD_DX_PRED_STAGING_COPY_REGION                = 1283,
323    SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS_V2                   = 1284,
324    SVGA_3D_CMD_DX_SET_INDEX_BUFFER_V2                     = 1285,
325    SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS_OFFSET_AND_SIZE      = 1286,
326    SVGA_3D_CMD_DX_SET_INDEX_BUFFER_OFFSET_AND_SIZE        = 1287,
327    SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE_V2              = 1288,
328    SVGA_3D_CMD_DX_PRED_STAGING_CONVERT_REGION             = 1289,
329    SVGA_3D_CMD_DX_PRED_STAGING_CONVERT                    = 1290,
330    SVGA_3D_CMD_DX_STAGING_BUFFER_COPY                     = 1291,
331 
332 
333 
334 
335 
336    SVGA_3D_CMD_MAX                                        = 1303,
337    SVGA_3D_CMD_FUTURE_MAX                                 = 3000
338 } SVGAFifo3dCmdId;
339 
340 #define SVGA_NUM_3D_CMD (SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE)
341 
342 
343 
344 /*
345  * The data size header following cmdNum for every 3d command
346  */
347 typedef
348 #include "vmware_pack_begin.h"
349 struct {
350    uint32               id;
351    uint32               size;
352 }
353 #include "vmware_pack_end.h"
354 SVGA3dCmdHeader;
355 
356 typedef
357 #include "vmware_pack_begin.h"
358 struct {
359    uint32               numMipLevels;
360 }
361 #include "vmware_pack_end.h"
362 SVGA3dSurfaceFace;
363 
364 typedef
365 #include "vmware_pack_begin.h"
366 struct {
367    uint32                      sid;
368    SVGA3dSurface1Flags         surfaceFlags;
369    SVGA3dSurfaceFormat         format;
370 
371    /*
372     * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace
373     * structures must have the same value of numMipLevels field.
374     * Otherwise, all but the first SVGA3dSurfaceFace structures must have the
375     * numMipLevels set to 0.
376     */
377    SVGA3dSurfaceFace           face[SVGA3D_MAX_SURFACE_FACES];
378 
379    /*
380     * Followed by an SVGA3dSize structure for each mip level in each face.
381     *
382     * A note on surface sizes: Sizes are always specified in pixels,
383     * even if the true surface size is not a multiple of the minimum
384     * block size of the surface's format. For example, a 3x3x1 DXT1
385     * compressed texture would actually be stored as a 4x4x1 image in
386     * memory.
387     */
388 }
389 #include "vmware_pack_end.h"
390 SVGA3dCmdDefineSurface;       /* SVGA_3D_CMD_SURFACE_DEFINE */
391 
392 typedef
393 #include "vmware_pack_begin.h"
394 struct {
395    uint32                      sid;
396    SVGA3dSurface1Flags         surfaceFlags;
397    SVGA3dSurfaceFormat         format;
398 
399    /*
400     * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace
401     * structures must have the same value of numMipLevels field.
402     * Otherwise, all but the first SVGA3dSurfaceFace structures must have the
403     * numMipLevels set to 0.
404     */
405    SVGA3dSurfaceFace           face[SVGA3D_MAX_SURFACE_FACES];
406    uint32                      multisampleCount;
407    SVGA3dTextureFilter         autogenFilter;
408 
409    /*
410     * Followed by an SVGA3dSize structure for each mip level in each face.
411     *
412     * A note on surface sizes: Sizes are always specified in pixels,
413     * even if the true surface size is not a multiple of the minimum
414     * block size of the surface's format. For example, a 3x3x1 DXT1
415     * compressed texture would actually be stored as a 4x4x1 image in
416     * memory.
417     */
418 }
419 #include "vmware_pack_end.h"
420 SVGA3dCmdDefineSurface_v2;     /* SVGA_3D_CMD_SURFACE_DEFINE_V2 */
421 
422 typedef
423 #include "vmware_pack_begin.h"
424 struct {
425    uint32               sid;
426 }
427 #include "vmware_pack_end.h"
428 SVGA3dCmdDestroySurface;      /* SVGA_3D_CMD_SURFACE_DESTROY */
429 
430 typedef
431 #include "vmware_pack_begin.h"
432 struct {
433    uint32               cid;
434 }
435 #include "vmware_pack_end.h"
436 SVGA3dCmdDefineContext;       /* SVGA_3D_CMD_CONTEXT_DEFINE */
437 
438 typedef
439 #include "vmware_pack_begin.h"
440 struct {
441    uint32               cid;
442 }
443 #include "vmware_pack_end.h"
444 SVGA3dCmdDestroyContext;      /* SVGA_3D_CMD_CONTEXT_DESTROY */
445 
446 typedef
447 #include "vmware_pack_begin.h"
448 struct {
449    uint32               cid;
450    SVGA3dClearFlag      clearFlag;
451    uint32               color;
452    float                depth;
453    uint32               stencil;
454    /* Followed by variable number of SVGA3dRect structures */
455 }
456 #include "vmware_pack_end.h"
457 SVGA3dCmdClear;               /* SVGA_3D_CMD_CLEAR */
458 
459 typedef
460 #include "vmware_pack_begin.h"
461 struct {
462    SVGA3dLightType      type;
463    SVGA3dBool           inWorldSpace;
464    float                diffuse[4];
465    float                specular[4];
466    float                ambient[4];
467    float                position[4];
468    float                direction[4];
469    float                range;
470    float                falloff;
471    float                attenuation0;
472    float                attenuation1;
473    float                attenuation2;
474    float                theta;
475    float                phi;
476 }
477 #include "vmware_pack_end.h"
478 SVGA3dLightData;
479 
480 typedef
481 #include "vmware_pack_begin.h"
482 struct {
483    uint32               sid;
484    /* Followed by variable number of SVGA3dCopyRect structures */
485 }
486 #include "vmware_pack_end.h"
487 SVGA3dCmdPresent;             /* SVGA_3D_CMD_PRESENT */
488 
489 typedef
490 #include "vmware_pack_begin.h"
491 struct {
492    SVGA3dRenderStateName   state;
493    union {
494       uint32               uintValue;
495       float                floatValue;
496    };
497 }
498 #include "vmware_pack_end.h"
499 SVGA3dRenderState;
500 
501 typedef
502 #include "vmware_pack_begin.h"
503 struct {
504    uint32               cid;
505    /* Followed by variable number of SVGA3dRenderState structures */
506 }
507 #include "vmware_pack_end.h"
508 SVGA3dCmdSetRenderState;      /* SVGA_3D_CMD_SETRENDERSTATE */
509 
510 typedef
511 #include "vmware_pack_begin.h"
512 struct {
513    uint32                 cid;
514    SVGA3dRenderTargetType type;
515    SVGA3dSurfaceImageId   target;
516 }
517 #include "vmware_pack_end.h"
518 SVGA3dCmdSetRenderTarget;     /* SVGA_3D_CMD_SETRENDERTARGET */
519 
520 typedef
521 #include "vmware_pack_begin.h"
522 struct {
523    SVGA3dSurfaceImageId  src;
524    SVGA3dSurfaceImageId  dest;
525    /* Followed by variable number of SVGA3dCopyBox structures */
526 }
527 #include "vmware_pack_end.h"
528 SVGA3dCmdSurfaceCopy;               /* SVGA_3D_CMD_SURFACE_COPY */
529 
530 /*
531  * Perform a surface copy within the same image.
532  * The src/dest boxes are allowed to overlap.
533  */
534 typedef
535 #include "vmware_pack_begin.h"
536 struct {
537    SVGA3dSurfaceImageId  surface;
538    SVGA3dCopyBox box;
539 }
540 #include "vmware_pack_end.h"
541 SVGA3dCmdIntraSurfaceCopy;               /* SVGA_3D_CMD_INTRA_SURFACE_COPY */
542 
543 typedef
544 #include "vmware_pack_begin.h"
545 struct {
546    SVGA3dSurfaceImageId  src;
547    SVGA3dSurfaceImageId  dest;
548    SVGA3dBox             boxSrc;
549    SVGA3dBox             boxDest;
550    SVGA3dStretchBltMode  mode;
551 }
552 #include "vmware_pack_end.h"
553 SVGA3dCmdSurfaceStretchBlt;         /* SVGA_3D_CMD_SURFACE_STRETCHBLT */
554 
555 typedef
556 #include "vmware_pack_begin.h"
557 struct {
558    /*
559     * If the discard flag is present in a surface DMA operation, the host may
560     * discard the contents of the current mipmap level and face of the target
561     * surface before applying the surface DMA contents.
562     */
563    uint32 discard : 1;
564 
565    /*
566     * If the unsynchronized flag is present, the host may perform this upload
567     * without syncing to pending reads on this surface.
568     */
569    uint32 unsynchronized : 1;
570 
571    /*
572     * Guests *MUST* set the reserved bits to 0 before submitting the command
573     * suffix as future flags may occupy these bits.
574     */
575    uint32 reserved : 30;
576 }
577 #include "vmware_pack_end.h"
578 SVGA3dSurfaceDMAFlags;
579 
580 typedef
581 #include "vmware_pack_begin.h"
582 struct {
583    SVGAGuestImage guest;
584    SVGA3dSurfaceImageId host;
585    SVGA3dTransferType transfer;
586 
587    /*
588     * Followed by variable number of SVGA3dCopyBox structures. For consistency
589     * in all clipping logic and coordinate translation, we define the
590     * "source" in each copyBox as the guest image and the
591     * "destination" as the host image, regardless of transfer
592     * direction.
593     *
594     * For efficiency, the SVGA3D device is free to copy more data than
595     * specified. For example, it may round copy boxes outwards such
596     * that they lie on particular alignment boundaries.
597     */
598 }
599 #include "vmware_pack_end.h"
600 SVGA3dCmdSurfaceDMA;                /* SVGA_3D_CMD_SURFACE_DMA */
601 
602 /*
603  * SVGA3dCmdSurfaceDMASuffix --
604  *
605  *    This is a command suffix that will appear after a SurfaceDMA command in
606  *    the FIFO.  It contains some extra information that hosts may use to
607  *    optimize performance or protect the guest.  This suffix exists to preserve
608  *    backwards compatibility while also allowing for new functionality to be
609  *    implemented.
610  */
611 
612 typedef
613 #include "vmware_pack_begin.h"
614 struct {
615    uint32 suffixSize;
616 
617    /*
618     * The maximum offset is used to determine the maximum offset from the
619     * guestPtr base address that will be accessed or written to during this
620     * surfaceDMA.  If the suffix is supported, the host will respect this
621     * boundary while performing surface DMAs.
622     *
623     * Defaults to MAX_UINT32
624     */
625    uint32 maximumOffset;
626 
627    /*
628     * A set of flags that describes optimizations that the host may perform
629     * while performing this surface DMA operation.  The guest should never rely
630     * on behaviour that is different when these flags are set for correctness.
631     *
632     * Defaults to 0
633     */
634    SVGA3dSurfaceDMAFlags flags;
635 }
636 #include "vmware_pack_end.h"
637 SVGA3dCmdSurfaceDMASuffix;
638 
639 /*
640  * SVGA_3D_CMD_DRAW_PRIMITIVES --
641  *
642  *   This command is the SVGA3D device's generic drawing entry point.
643  *   It can draw multiple ranges of primitives, optionally using an
644  *   index buffer, using an arbitrary collection of vertex buffers.
645  *
646  *   Each SVGA3dVertexDecl defines a distinct vertex array to bind
647  *   during this draw call. The declarations specify which surface
648  *   the vertex data lives in, what that vertex data is used for,
649  *   and how to interpret it.
650  *
651  *   Each SVGA3dPrimitiveRange defines a collection of primitives
652  *   to render using the same vertex arrays. An index buffer is
653  *   optional.
654  */
655 
656 typedef
657 #include "vmware_pack_begin.h"
658 struct {
659    /*
660     * A range hint is an optional specification for the range of indices
661     * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed
662     * that the entire array will be used.
663     *
664     * These are only hints. The SVGA3D device may use them for
665     * performance optimization if possible, but it's also allowed to
666     * ignore these values.
667     */
668    uint32               first;
669    uint32               last;
670 }
671 #include "vmware_pack_end.h"
672 SVGA3dArrayRangeHint;
673 
674 typedef
675 #include "vmware_pack_begin.h"
676 struct {
677    /*
678     * Define the origin and shape of a vertex or index array. Both
679     * 'offset' and 'stride' are in bytes. The provided surface will be
680     * reinterpreted as a flat array of bytes in the same format used
681     * by surface DMA operations. To avoid unnecessary conversions, the
682     * surface should be created with the SVGA3D_BUFFER format.
683     *
684     * Index 0 in the array starts 'offset' bytes into the surface.
685     * Index 1 begins at byte 'offset + stride', etc. Array indices may
686     * not be negative.
687     */
688    uint32               surfaceId;
689    uint32               offset;
690    uint32               stride;
691 }
692 #include "vmware_pack_end.h"
693 SVGA3dArray;
694 
695 typedef
696 #include "vmware_pack_begin.h"
697 struct {
698    /*
699     * Describe a vertex array's data type, and define how it is to be
700     * used by the fixed function pipeline or the vertex shader. It
701     * isn't useful to have two VertexDecls with the same
702     * VertexArrayIdentity in one draw call.
703     */
704    SVGA3dDeclType       type;
705    SVGA3dDeclMethod     method;
706    SVGA3dDeclUsage      usage;
707    uint32               usageIndex;
708 }
709 #include "vmware_pack_end.h"
710 SVGA3dVertexArrayIdentity;
711 
712 typedef
713 #include "vmware_pack_begin.h"
714 struct SVGA3dVertexDecl {
715    SVGA3dVertexArrayIdentity  identity;
716    SVGA3dArray                array;
717    SVGA3dArrayRangeHint       rangeHint;
718 }
719 #include "vmware_pack_end.h"
720 SVGA3dVertexDecl;
721 
722 typedef
723 #include "vmware_pack_begin.h"
724 struct SVGA3dPrimitiveRange {
725    /*
726     * Define a group of primitives to render, from sequential indices.
727     *
728     * The value of 'primitiveType' and 'primitiveCount' imply the
729     * total number of vertices that will be rendered.
730     */
731    SVGA3dPrimitiveType  primType;
732    uint32               primitiveCount;
733 
734    /*
735     * Optional index buffer. If indexArray.surfaceId is
736     * SVGA3D_INVALID_ID, we render without an index buffer. Rendering
737     * without an index buffer is identical to rendering with an index
738     * buffer containing the sequence [0, 1, 2, 3, ...].
739     *
740     * If an index buffer is in use, indexWidth specifies the width in
741     * bytes of each index value. It must be less than or equal to
742     * indexArray.stride.
743     *
744     * (Currently, the SVGA3D device requires index buffers to be tightly
745     * packed. In other words, indexWidth == indexArray.stride)
746     */
747    SVGA3dArray          indexArray;
748    uint32               indexWidth;
749 
750    /*
751     * Optional index bias. This number is added to all indices from
752     * indexArray before they are used as vertex array indices. This
753     * can be used in multiple ways:
754     *
755     *  - When not using an indexArray, this bias can be used to
756     *    specify where in the vertex arrays to begin rendering.
757     *
758     *  - A positive number here is equivalent to increasing the
759     *    offset in each vertex array.
760     *
761     *  - A negative number can be used to render using a small
762     *    vertex array and an index buffer that contains large
763     *    values. This may be used by some applications that
764     *    crop a vertex buffer without modifying their index
765     *    buffer.
766     *
767     * Note that rendering with a negative bias value may be slower and
768     * use more memory than rendering with a positive or zero bias.
769     */
770    int32                indexBias;
771 }
772 #include "vmware_pack_end.h"
773 SVGA3dPrimitiveRange;
774 
775 typedef
776 #include "vmware_pack_begin.h"
777 struct {
778    uint32               cid;
779    uint32               numVertexDecls;
780    uint32               numRanges;
781 
782    /*
783     * There are two variable size arrays after the
784     * SVGA3dCmdDrawPrimitives structure. In order,
785     * they are:
786     *
787     * 1. SVGA3dVertexDecl, quantity 'numVertexDecls', but no more than
788     *    SVGA3D_MAX_VERTEX_ARRAYS;
789     * 2. SVGA3dPrimitiveRange, quantity 'numRanges', but no more than
790     *    SVGA3D_MAX_DRAW_PRIMITIVE_RANGES;
791     * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains
792     *    the frequency divisor for the corresponding vertex decl).
793     */
794 }
795 #include "vmware_pack_end.h"
796 SVGA3dCmdDrawPrimitives;      /* SVGA_3D_CMD_DRAWPRIMITIVES */
797 
798 typedef
799 #include "vmware_pack_begin.h"
800 struct {
801    uint32 cid;
802 
803    uint32 primitiveCount;        // How many primitives to render
804    uint32 startVertexLocation;   // Which vertex do we start rendering at.
805 
806    uint8 primitiveType;          // SVGA3dPrimitiveType
807    uint8 padding[3];
808 }
809 #include "vmware_pack_end.h"
810 SVGA3dCmdDraw;
811 
812 typedef
813 #include "vmware_pack_begin.h"
814 struct {
815    uint32 cid;
816 
817    uint8 primitiveType;       // SVGA3dPrimitiveType
818 
819    uint32 indexBufferSid;     // Valid index buffer sid.
820    uint32 indexBufferOffset;  // Byte offset into the vertex buffer, almost
821                               // always 0 for DX9 guests, non-zero for OpenGL
822                               // guests.  We can't represent non-multiple of
823                               // stride offsets in D3D9Renderer...
824    uint8 indexBufferStride;   // Allowable values = 1, 2, or 4
825 
826    int32 baseVertexLocation;  // Bias applied to the index when selecting a
827                               // vertex from the streams, may be negative
828 
829    uint32 primitiveCount;     // How many primitives to render
830    uint32 pad0;
831    uint16 pad1;
832 }
833 #include "vmware_pack_end.h"
834 SVGA3dCmdDrawIndexed;
835 
836 typedef
837 #include "vmware_pack_begin.h"
838 struct {
839    /*
840     * Describe a vertex array's data type, and define how it is to be
841     * used by the fixed function pipeline or the vertex shader. It
842     * isn't useful to have two VertexDecls with the same
843     * VertexArrayIdentity in one draw call.
844     */
845    uint16 streamOffset;
846    uint8 stream;
847    uint8 type;          // SVGA3dDeclType
848    uint8 method;        // SVGA3dDeclMethod
849    uint8 usage;         // SVGA3dDeclUsage
850    uint8 usageIndex;
851    uint8 padding;
852 
853 }
854 #include "vmware_pack_end.h"
855 SVGA3dVertexElement;
856 
857 /*
858  * Should the vertex element respect the stream value?  The high bit of the
859  * stream should be set to indicate that the stream should be respected.  If
860  * the high bit is not set, the stream will be ignored and replaced by the index
861  * of the position of the currently considered vertex element.
862  *
863  * All guests should set this bit and correctly specify the stream going
864  * forward.
865  */
866 #define SVGA3D_VERTEX_ELEMENT_RESPECT_STREAM (1 << 7)
867 
868 typedef
869 #include "vmware_pack_begin.h"
870 struct {
871    uint32 cid;
872 
873    uint32 numElements;
874 
875    /*
876     * Followed by numElements SVGA3dVertexElement structures.
877     *
878     * If numElements < SVGA3D_MAX_VERTEX_ARRAYS, the remaining elements
879     * are cleared and will not be used by following draws.
880     */
881 }
882 #include "vmware_pack_end.h"
883 SVGA3dCmdSetVertexDecls;
884 
885 typedef
886 #include "vmware_pack_begin.h"
887 struct {
888    uint32 sid;
889    uint32 stride;
890    uint32 offset;
891 }
892 #include "vmware_pack_end.h"
893 SVGA3dVertexStream;
894 
895 typedef
896 #include "vmware_pack_begin.h"
897 struct {
898    uint32 cid;
899 
900    uint32 numStreams;
901    /*
902     * Followed by numStream SVGA3dVertexStream structures.
903     *
904     * If numStreams < SVGA3D_MAX_VERTEX_ARRAYS, the remaining streams
905     * are cleared and will not be used by following draws.
906     */
907 }
908 #include "vmware_pack_end.h"
909 SVGA3dCmdSetVertexStreams;
910 
911 typedef
912 #include "vmware_pack_begin.h"
913 struct {
914    uint32 cid;
915    uint32 numDivisors;
916 }
917 #include "vmware_pack_end.h"
918 SVGA3dCmdSetVertexDivisors;
919 
920 typedef
921 #include "vmware_pack_begin.h"
922 struct {
923    uint32                   stage;
924    SVGA3dTextureStateName   name;
925    union {
926       uint32                value;
927       float                 floatValue;
928    };
929 }
930 #include "vmware_pack_end.h"
931 SVGA3dTextureState;
932 
933 typedef
934 #include "vmware_pack_begin.h"
935 struct {
936    uint32               cid;
937    /* Followed by variable number of SVGA3dTextureState structures */
938 }
939 #include "vmware_pack_end.h"
940 SVGA3dCmdSetTextureState;      /* SVGA_3D_CMD_SETTEXTURESTATE */
941 
942 typedef
943 #include "vmware_pack_begin.h"
944 struct {
945    uint32                   cid;
946    SVGA3dTransformType      type;
947    float                    matrix[16];
948 }
949 #include "vmware_pack_end.h"
950 SVGA3dCmdSetTransform;          /* SVGA_3D_CMD_SETTRANSFORM */
951 
952 typedef
953 #include "vmware_pack_begin.h"
954 struct {
955    float                min;
956    float                max;
957 }
958 #include "vmware_pack_end.h"
959 SVGA3dZRange;
960 
961 typedef
962 #include "vmware_pack_begin.h"
963 struct {
964    uint32               cid;
965    SVGA3dZRange         zRange;
966 }
967 #include "vmware_pack_end.h"
968 SVGA3dCmdSetZRange;             /* SVGA_3D_CMD_SETZRANGE */
969 
970 typedef
971 #include "vmware_pack_begin.h"
972 struct {
973    float                diffuse[4];
974    float                ambient[4];
975    float                specular[4];
976    float                emissive[4];
977    float                shininess;
978 }
979 #include "vmware_pack_end.h"
980 SVGA3dMaterial;
981 
982 typedef
983 #include "vmware_pack_begin.h"
984 struct {
985    uint32               cid;
986    SVGA3dFace           face;
987    SVGA3dMaterial       material;
988 }
989 #include "vmware_pack_end.h"
990 SVGA3dCmdSetMaterial;           /* SVGA_3D_CMD_SETMATERIAL */
991 
992 typedef
993 #include "vmware_pack_begin.h"
994 struct {
995    uint32               cid;
996    uint32               index;
997    SVGA3dLightData      data;
998 }
999 #include "vmware_pack_end.h"
1000 SVGA3dCmdSetLightData;           /* SVGA_3D_CMD_SETLIGHTDATA */
1001 
1002 typedef
1003 #include "vmware_pack_begin.h"
1004 struct {
1005    uint32               cid;
1006    uint32               index;
1007    uint32               enabled;
1008 }
1009 #include "vmware_pack_end.h"
1010 SVGA3dCmdSetLightEnabled;      /* SVGA_3D_CMD_SETLIGHTENABLED */
1011 
1012 typedef
1013 #include "vmware_pack_begin.h"
1014 struct {
1015    uint32               cid;
1016    SVGA3dRect           rect;
1017 }
1018 #include "vmware_pack_end.h"
1019 SVGA3dCmdSetViewport;           /* SVGA_3D_CMD_SETVIEWPORT */
1020 
1021 typedef
1022 #include "vmware_pack_begin.h"
1023 struct {
1024    uint32               cid;
1025    SVGA3dRect           rect;
1026 }
1027 #include "vmware_pack_end.h"
1028 SVGA3dCmdSetScissorRect;         /* SVGA_3D_CMD_SETSCISSORRECT */
1029 
1030 typedef
1031 #include "vmware_pack_begin.h"
1032 struct {
1033    uint32               cid;
1034    uint32               index;
1035    float                plane[4];
1036 }
1037 #include "vmware_pack_end.h"
1038 SVGA3dCmdSetClipPlane;           /* SVGA_3D_CMD_SETCLIPPLANE */
1039 
1040 typedef
1041 #include "vmware_pack_begin.h"
1042 struct {
1043    uint32               cid;
1044    uint32               shid;
1045    SVGA3dShaderType     type;
1046    /* Followed by variable number of DWORDs for shader bycode */
1047 }
1048 #include "vmware_pack_end.h"
1049 SVGA3dCmdDefineShader;           /* SVGA_3D_CMD_SHADER_DEFINE */
1050 
1051 typedef
1052 #include "vmware_pack_begin.h"
1053 struct {
1054    uint32               cid;
1055    uint32               shid;
1056    SVGA3dShaderType     type;
1057 }
1058 #include "vmware_pack_end.h"
1059 SVGA3dCmdDestroyShader;         /* SVGA_3D_CMD_SHADER_DESTROY */
1060 
1061 typedef
1062 #include "vmware_pack_begin.h"
1063 struct {
1064    uint32                  cid;
1065    uint32                  reg;     /* register number */
1066    SVGA3dShaderType        type;
1067    SVGA3dShaderConstType   ctype;
1068    uint32                  values[4];
1069 
1070    /*
1071     * Followed by a variable number of additional values.
1072     */
1073 }
1074 #include "vmware_pack_end.h"
1075 SVGA3dCmdSetShaderConst;        /* SVGA_3D_CMD_SET_SHADER_CONST */
1076 
1077 typedef
1078 #include "vmware_pack_begin.h"
1079 struct {
1080    uint32               cid;
1081    SVGA3dShaderType     type;
1082    uint32               shid;
1083 }
1084 #include "vmware_pack_end.h"
1085 SVGA3dCmdSetShader;       /* SVGA_3D_CMD_SET_SHADER */
1086 
1087 typedef
1088 #include "vmware_pack_begin.h"
1089 struct {
1090    uint32               cid;
1091    SVGA3dQueryType      type;
1092 }
1093 #include "vmware_pack_end.h"
1094 SVGA3dCmdBeginQuery;           /* SVGA_3D_CMD_BEGIN_QUERY */
1095 
1096 typedef
1097 #include "vmware_pack_begin.h"
1098 struct {
1099    uint32               cid;
1100    SVGA3dQueryType      type;
1101    SVGAGuestPtr         guestResult;   /* Points to an SVGA3dQueryResult structure */
1102 }
1103 #include "vmware_pack_end.h"
1104 SVGA3dCmdEndQuery;                  /* SVGA_3D_CMD_END_QUERY */
1105 
1106 
1107 /*
1108  * SVGA3D_CMD_WAIT_FOR_QUERY --
1109  *
1110  *    Will read the SVGA3dQueryResult structure pointed to by guestResult,
1111  *    and if the state member is set to anything else than
1112  *    SVGA3D_QUERYSTATE_PENDING, this command will always be a no-op.
1113  *
1114  *    Otherwise, in addition to the query explicitly waited for,
1115  *    All queries with the same type and issued with the same cid, for which
1116  *    an SVGA_3D_CMD_END_QUERY command has previously been sent, will
1117  *    be finished after execution of this command.
1118  *
1119  *    A query will be identified by the gmrId and offset of the guestResult
1120  *    member. If the device can't find an SVGA_3D_CMD_END_QUERY that has
1121  *    been sent previously with an identical gmrId and offset, it will
1122  *    effectively end all queries with an identical type issued with the
1123  *    same cid, and the SVGA3dQueryResult structure pointed to by
1124  *    guestResult will not be written to. This property can be used to
1125  *    implement a query barrier for a given cid and query type.
1126  */
1127 
1128 typedef
1129 #include "vmware_pack_begin.h"
1130 struct {
1131    uint32               cid;        /* Same parameters passed to END_QUERY */
1132    SVGA3dQueryType      type;
1133    SVGAGuestPtr         guestResult;
1134 }
1135 #include "vmware_pack_end.h"
1136 SVGA3dCmdWaitForQuery;              /* SVGA_3D_CMD_WAIT_FOR_QUERY */
1137 
1138 typedef
1139 #include "vmware_pack_begin.h"
1140 struct {
1141    uint32               totalSize;    /* Set by guest before query is ended. */
1142    SVGA3dQueryState     state;        /* Set by host or guest. See SVGA3dQueryState. */
1143    union {                            /* Set by host on exit from PENDING state */
1144       uint32            result32;
1145       uint32            queryCookie; /* May be used to identify which QueryGetData this
1146                                         result corresponds to. */
1147    };
1148 }
1149 #include "vmware_pack_end.h"
1150 SVGA3dQueryResult;
1151 
1152 
1153 /*
1154  * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN --
1155  *
1156  *    This is a blit from an SVGA3D surface to a Screen Object.
1157  *    This blit must be directed at a specific screen.
1158  *
1159  *    The blit copies from a rectangular region of an SVGA3D surface
1160  *    image to a rectangular region of a screen.
1161  *
1162  *    This command takes an optional variable-length list of clipping
1163  *    rectangles after the body of the command. If no rectangles are
1164  *    specified, there is no clipping region. The entire destRect is
1165  *    drawn to. If one or more rectangles are included, they describe
1166  *    a clipping region. The clip rectangle coordinates are measured
1167  *    relative to the top-left corner of destRect.
1168  *
1169  *    The srcImage must be from mip=0 face=0.
1170  *
1171  *    This supports scaling if the src and dest are of different sizes.
1172  *
1173  * Availability:
1174  *    SVGA_FIFO_CAP_SCREEN_OBJECT
1175  */
1176 
1177 typedef
1178 #include "vmware_pack_begin.h"
1179 struct {
1180    SVGA3dSurfaceImageId srcImage;
1181    SVGASignedRect       srcRect;
1182    uint32               destScreenId; /* Screen Object ID */
1183    SVGASignedRect       destRect;
1184    /* Clipping: zero or more SVGASignedRects follow */
1185 }
1186 #include "vmware_pack_end.h"
1187 SVGA3dCmdBlitSurfaceToScreen;         /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */
1188 
1189 typedef
1190 #include "vmware_pack_begin.h"
1191 struct {
1192    uint32               sid;
1193    SVGA3dTextureFilter  filter;
1194 }
1195 #include "vmware_pack_end.h"
1196 SVGA3dCmdGenerateMipmaps;             /* SVGA_3D_CMD_GENERATE_MIPMAPS */
1197 
1198 typedef
1199 #include "vmware_pack_begin.h"
1200 struct {
1201    uint32 sid;
1202 }
1203 #include "vmware_pack_end.h"
1204 SVGA3dCmdActivateSurface;               /* SVGA_3D_CMD_ACTIVATE_SURFACE */
1205 
1206 typedef
1207 #include "vmware_pack_begin.h"
1208 struct {
1209    uint32 sid;
1210 }
1211 #include "vmware_pack_end.h"
1212 SVGA3dCmdDeactivateSurface;             /* SVGA_3D_CMD_DEACTIVATE_SURFACE */
1213 
1214 /*
1215  * Screen DMA command
1216  *
1217  * Available with SVGA_FIFO_CAP_SCREEN_OBJECT_2.  The SVGA_CAP_3D device
1218  * cap bit is not required.
1219  *
1220  * - refBuffer and destBuffer are 32bit BGRX; refBuffer and destBuffer could
1221  *   be different, but it is required that guest makes sure refBuffer has
1222  *   exactly the same contents that were written to when last time screen DMA
1223  *   command is received by host.
1224  *
1225  * - changemap is generated by lib/blit, and it has the changes from last
1226  *   received screen DMA or more.
1227  */
1228 
1229 typedef
1230 #include "vmware_pack_begin.h"
1231 struct SVGA3dCmdScreenDMA {
1232    uint32 screenId;
1233    SVGAGuestImage refBuffer;
1234    SVGAGuestImage destBuffer;
1235    SVGAGuestImage changeMap;
1236 }
1237 #include "vmware_pack_end.h"
1238 SVGA3dCmdScreenDMA;        /* SVGA_3D_CMD_SCREEN_DMA */
1239 
1240 /*
1241  * Logic ops
1242  */
1243 
1244 #define SVGA3D_LOTRANSBLT_HONORALPHA     (0x01)
1245 #define SVGA3D_LOSTRETCHBLT_MIRRORX      (0x01)
1246 #define SVGA3D_LOSTRETCHBLT_MIRRORY      (0x02)
1247 #define SVGA3D_LOALPHABLEND_SRCHASALPHA  (0x01)
1248 
1249 typedef
1250 #include "vmware_pack_begin.h"
1251 struct SVGA3dCmdLogicOpsBitBlt {
1252    /*
1253     * All LogicOps surfaces are one-level
1254     * surfaces so mipmap & face should always
1255     * be zero.
1256     */
1257    SVGA3dSurfaceImageId src;
1258    SVGA3dSurfaceImageId dst;
1259    SVGA3dLogicOp logicOp;
1260    /* Followed by variable number of SVGA3dCopyBox structures */
1261 }
1262 #include "vmware_pack_end.h"
1263 SVGA3dCmdLogicOpsBitBlt;   /* SVGA_3D_CMD_LOGICOPS_BITBLT */
1264 
1265 
1266 typedef
1267 #include "vmware_pack_begin.h"
1268 struct SVGA3dCmdLogicOpsTransBlt {
1269    /*
1270     * All LogicOps surfaces are one-level
1271     * surfaces so mipmap & face should always
1272     * be zero.
1273     */
1274    SVGA3dSurfaceImageId src;
1275    SVGA3dSurfaceImageId dst;
1276    uint32 color;
1277    uint32 flags;
1278    SVGA3dBox srcBox;
1279    SVGA3dBox dstBox;
1280 }
1281 #include "vmware_pack_end.h"
1282 SVGA3dCmdLogicOpsTransBlt;   /* SVGA_3D_CMD_LOGICOPS_TRANSBLT */
1283 
1284 
1285 typedef
1286 #include "vmware_pack_begin.h"
1287 struct SVGA3dCmdLogicOpsStretchBlt {
1288    /*
1289     * All LogicOps surfaces are one-level
1290     * surfaces so mipmap & face should always
1291     * be zero.
1292     */
1293    SVGA3dSurfaceImageId src;
1294    SVGA3dSurfaceImageId dst;
1295    uint16 mode;
1296    uint16 flags;
1297    SVGA3dBox srcBox;
1298    SVGA3dBox dstBox;
1299 }
1300 #include "vmware_pack_end.h"
1301 SVGA3dCmdLogicOpsStretchBlt;   /* SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
1302 
1303 
1304 typedef
1305 #include "vmware_pack_begin.h"
1306 struct SVGA3dCmdLogicOpsColorFill {
1307    /*
1308     * All LogicOps surfaces are one-level
1309     * surfaces so mipmap & face should always
1310     * be zero.
1311     */
1312    SVGA3dSurfaceImageId dst;
1313    uint32 color;
1314    SVGA3dLogicOp logicOp;
1315    /* Followed by variable number of SVGA3dRect structures. */
1316 }
1317 #include "vmware_pack_end.h"
1318 SVGA3dCmdLogicOpsColorFill;   /* SVGA_3D_CMD_LOGICOPS_COLORFILL */
1319 
1320 
1321 typedef
1322 #include "vmware_pack_begin.h"
1323 struct SVGA3dCmdLogicOpsAlphaBlend {
1324    /*
1325     * All LogicOps surfaces are one-level
1326     * surfaces so mipmap & face should always
1327     * be zero.
1328     */
1329    SVGA3dSurfaceImageId src;
1330    SVGA3dSurfaceImageId dst;
1331    uint32 alphaVal;
1332    uint32 flags;
1333    SVGA3dBox srcBox;
1334    SVGA3dBox dstBox;
1335 }
1336 #include "vmware_pack_end.h"
1337 SVGA3dCmdLogicOpsAlphaBlend;   /* SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
1338 
1339 #define SVGA3D_CLEARTYPE_INVALID_GAMMA_INDEX 0xFFFFFFFF
1340 
1341 #define SVGA3D_CLEARTYPE_GAMMA_WIDTH  512
1342 #define SVGA3D_CLEARTYPE_GAMMA_HEIGHT 16
1343 
1344 typedef
1345 #include "vmware_pack_begin.h"
1346 struct SVGA3dCmdLogicOpsClearTypeBlend {
1347    /*
1348     * All LogicOps surfaces are one-level
1349     * surfaces so mipmap & face should always
1350     * be zero.
1351     */
1352    SVGA3dSurfaceImageId tmp;
1353    SVGA3dSurfaceImageId dst;
1354    SVGA3dSurfaceImageId gammaSurf;
1355    SVGA3dSurfaceImageId alphaSurf;
1356    uint32 gamma;
1357    uint32 color;
1358    uint32 color2;
1359    int32 alphaOffsetX;
1360    int32 alphaOffsetY;
1361    /* Followed by variable number of SVGA3dBox structures */
1362 }
1363 #include "vmware_pack_end.h"
1364 SVGA3dCmdLogicOpsClearTypeBlend;   /* SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
1365 
1366 
1367 /*
1368  * Guest-backed objects definitions.
1369  */
1370 
1371 typedef
1372 #include "vmware_pack_begin.h"
1373 struct {
1374    SVGAMobFormat ptDepth;
1375    uint32 sizeInBytes;
1376    PPN64 base;
1377 }
1378 #include "vmware_pack_end.h"
1379 SVGAOTableMobEntry;
1380 
1381 typedef
1382 #include "vmware_pack_begin.h"
1383 struct {
1384    SVGA3dSurfaceFormat format;
1385    SVGA3dSurface1Flags surface1Flags;
1386    uint32 numMipLevels;
1387    uint32 multisampleCount;
1388    SVGA3dTextureFilter autogenFilter;
1389    SVGA3dSize size;
1390    SVGAMobId mobid;
1391    uint32 arraySize;
1392    uint32 mobPitch;
1393    SVGA3dSurface2Flags surface2Flags;
1394    uint8 multisamplePattern;
1395    uint8  pad0[3];
1396    uint32 pad1[3];
1397 }
1398 #include "vmware_pack_end.h"
1399 SVGAOTableSurfaceEntry;
1400 
1401 typedef
1402 #include "vmware_pack_begin.h"
1403 struct {
1404    uint32 cid;
1405    SVGAMobId mobid;
1406 }
1407 #include "vmware_pack_end.h"
1408 SVGAOTableContextEntry;
1409 
1410 typedef
1411 #include "vmware_pack_begin.h"
1412 struct {
1413    SVGA3dShaderType type;
1414    uint32 sizeInBytes;
1415    uint32 offsetInBytes;
1416    SVGAMobId mobid;
1417 }
1418 #include "vmware_pack_end.h"
1419 SVGAOTableShaderEntry;
1420 
1421 #define SVGA_STFLAG_PRIMARY  (1 << 0)
1422 #define SVGA_STFLAG_RESERVED (1 << 1) /* Added with cap SVGA_CAP_HP_CMD_QUEUE */
1423 typedef uint32 SVGAScreenTargetFlags;
1424 
1425 typedef
1426 #include "vmware_pack_begin.h"
1427 struct {
1428    SVGA3dSurfaceImageId image;
1429    uint32 width;
1430    uint32 height;
1431    int32 xRoot;
1432    int32 yRoot;
1433    SVGAScreenTargetFlags flags;
1434    uint32 dpi;
1435    uint32 pad[7];
1436 }
1437 #include "vmware_pack_end.h"
1438 SVGAOTableScreenTargetEntry;
1439 
1440 typedef
1441 #include "vmware_pack_begin.h"
1442 struct {
1443    float value[4];
1444 }
1445 #include "vmware_pack_end.h"
1446 SVGA3dShaderConstFloat;
1447 
1448 typedef
1449 #include "vmware_pack_begin.h"
1450 struct {
1451    int32 value[4];
1452 }
1453 #include "vmware_pack_end.h"
1454 SVGA3dShaderConstInt;
1455 
1456 typedef
1457 #include "vmware_pack_begin.h"
1458 struct {
1459    uint32 value;
1460 }
1461 #include "vmware_pack_end.h"
1462 SVGA3dShaderConstBool;
1463 
1464 typedef
1465 #include "vmware_pack_begin.h"
1466 struct {
1467    uint16 streamOffset;
1468    uint8 stream;
1469    uint8 type;
1470    uint8 methodUsage;
1471    uint8 usageIndex;
1472 }
1473 #include "vmware_pack_end.h"
1474 SVGAGBVertexElement;
1475 
1476 typedef
1477 #include "vmware_pack_begin.h"
1478 struct {
1479    uint32 sid;
1480    uint16 stride;
1481    uint32 offset;
1482 }
1483 #include "vmware_pack_end.h"
1484 SVGAGBVertexStream;
1485 typedef
1486 #include "vmware_pack_begin.h"
1487 struct {
1488    SVGA3dRect viewport;
1489    SVGA3dRect scissorRect;
1490    SVGA3dZRange zRange;
1491 
1492    SVGA3dSurfaceImageId renderTargets[SVGA3D_RT_MAX];
1493    SVGAGBVertexElement decl1[4];
1494 
1495    uint32 renderStates[SVGA3D_RS_MAX];
1496    SVGAGBVertexElement decl2[18];
1497    uint32 pad0[2];
1498 
1499    struct {
1500       SVGA3dFace face;
1501       SVGA3dMaterial material;
1502    } material;
1503 
1504    float clipPlanes[SVGA3D_NUM_CLIPPLANES][4];
1505    float matrices[SVGA3D_TRANSFORM_MAX][16];
1506 
1507    SVGA3dBool lightEnabled[SVGA3D_NUM_LIGHTS];
1508    SVGA3dLightData lightData[SVGA3D_NUM_LIGHTS];
1509 
1510    /*
1511     * Shaders currently bound
1512     */
1513    uint32 shaders[SVGA3D_NUM_SHADERTYPE_PREDX];
1514    SVGAGBVertexElement decl3[10];
1515    uint32 pad1[3];
1516 
1517    uint32 occQueryActive;
1518    uint32 occQueryValue;
1519 
1520    /*
1521     * Int/Bool Shader constants
1522     */
1523    SVGA3dShaderConstInt pShaderIValues[SVGA3D_CONSTINTREG_MAX];
1524    SVGA3dShaderConstInt vShaderIValues[SVGA3D_CONSTINTREG_MAX];
1525    uint16 pShaderBValues;
1526    uint16 vShaderBValues;
1527 
1528 
1529    SVGAGBVertexStream streams[SVGA3D_MAX_VERTEX_ARRAYS];
1530    SVGA3dVertexDivisor divisors[SVGA3D_MAX_VERTEX_ARRAYS];
1531    uint32 numVertexDecls;
1532    uint32 numVertexStreams;
1533    uint32 numVertexDivisors;
1534    uint32 pad2[30];
1535 
1536    /*
1537     * Texture Stages
1538     *
1539     * SVGA3D_TS_INVALID through SVGA3D_TS_CONSTANT are in the
1540     * textureStages array.
1541     * SVGA3D_TS_COLOR_KEY is in tsColorKey.
1542     */
1543    uint32 tsColorKey[SVGA3D_NUM_TEXTURE_UNITS];
1544    uint32 textureStages[SVGA3D_NUM_TEXTURE_UNITS][SVGA3D_TS_CONSTANT + 1];
1545    uint32 tsColorKeyEnable[SVGA3D_NUM_TEXTURE_UNITS];
1546 
1547    /*
1548     * Float Shader constants.
1549     */
1550    SVGA3dShaderConstFloat pShaderFValues[SVGA3D_CONSTREG_MAX];
1551    SVGA3dShaderConstFloat vShaderFValues[SVGA3D_CONSTREG_MAX];
1552 }
1553 #include "vmware_pack_end.h"
1554 SVGAGBContextData;
1555 #define SVGA3D_CONTEXT_DATA_SIZE (sizeof(SVGAGBContextData))
1556 
1557 /*
1558  * SVGA3dCmdSetOTableBase --
1559  *
1560  * This command allows the guest to specify the base PPN of the
1561  * specified object table.
1562  */
1563 
1564 typedef
1565 #include "vmware_pack_begin.h"
1566 struct {
1567    SVGAOTableType type;
1568    PPN baseAddress;
1569    uint32 sizeInBytes;
1570    uint32 validSizeInBytes;
1571    SVGAMobFormat ptDepth;
1572 }
1573 #include "vmware_pack_end.h"
1574 SVGA3dCmdSetOTableBase;  /* SVGA_3D_CMD_SET_OTABLE_BASE */
1575 
1576 typedef
1577 #include "vmware_pack_begin.h"
1578 struct {
1579    SVGAOTableType type;
1580    PPN64 baseAddress;
1581    uint32 sizeInBytes;
1582    uint32 validSizeInBytes;
1583    SVGAMobFormat ptDepth;
1584 }
1585 #include "vmware_pack_end.h"
1586 SVGA3dCmdSetOTableBase64;  /* SVGA_3D_CMD_SET_OTABLE_BASE64 */
1587 
1588 /*
1589  * Guests using SVGA_3D_CMD_GROW_OTABLE are promising that
1590  * the new OTable contains the same contents as the old one, except possibly
1591  * for some new invalid entries at the end.
1592  *
1593  * (Otherwise, guests should use one of the SetOTableBase commands.)
1594  */
1595 typedef
1596 #include "vmware_pack_begin.h"
1597 struct {
1598    SVGAOTableType type;
1599    PPN64 baseAddress;
1600    uint32 sizeInBytes;
1601    uint32 validSizeInBytes;
1602    SVGAMobFormat ptDepth;
1603 }
1604 #include "vmware_pack_end.h"
1605 SVGA3dCmdGrowOTable;  /* SVGA_3D_CMD_GROW_OTABLE */
1606 
1607 typedef
1608 #include "vmware_pack_begin.h"
1609 struct {
1610    SVGAOTableType type;
1611 }
1612 #include "vmware_pack_end.h"
1613 SVGA3dCmdReadbackOTable;  /* SVGA_3D_CMD_READBACK_OTABLE */
1614 
1615 /*
1616  * Define a memory object (Mob) in the OTable.
1617  */
1618 
1619 typedef
1620 #include "vmware_pack_begin.h"
1621 struct SVGA3dCmdDefineGBMob {
1622    SVGAMobId mobid;
1623    SVGAMobFormat ptDepth;
1624    PPN base;
1625    uint32 sizeInBytes;
1626 }
1627 #include "vmware_pack_end.h"
1628 SVGA3dCmdDefineGBMob;   /* SVGA_3D_CMD_DEFINE_GB_MOB */
1629 
1630 
1631 /*
1632  * Destroys an object in the OTable.
1633  */
1634 
1635 typedef
1636 #include "vmware_pack_begin.h"
1637 struct SVGA3dCmdDestroyGBMob {
1638    SVGAMobId mobid;
1639 }
1640 #include "vmware_pack_end.h"
1641 SVGA3dCmdDestroyGBMob;   /* SVGA_3D_CMD_DESTROY_GB_MOB */
1642 
1643 /*
1644  * Define a memory object (Mob) in the OTable with a PPN64 base.
1645  */
1646 
1647 typedef
1648 #include "vmware_pack_begin.h"
1649 struct SVGA3dCmdDefineGBMob64 {
1650    SVGAMobId mobid;
1651    SVGAMobFormat ptDepth;
1652    PPN64 base;
1653    uint32 sizeInBytes;
1654 }
1655 #include "vmware_pack_end.h"
1656 SVGA3dCmdDefineGBMob64;   /* SVGA_3D_CMD_DEFINE_GB_MOB64 */
1657 
1658 /*
1659  * Redefine an object in the OTable with PPN64 base.
1660  */
1661 
1662 typedef
1663 #include "vmware_pack_begin.h"
1664 struct SVGA3dCmdRedefineGBMob64 {
1665    SVGAMobId mobid;
1666    SVGAMobFormat ptDepth;
1667    PPN64 base;
1668    uint32 sizeInBytes;
1669 }
1670 #include "vmware_pack_end.h"
1671 SVGA3dCmdRedefineGBMob64;   /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */
1672 
1673 /*
1674  * Notification that the page tables have been modified.
1675  */
1676 
1677 typedef
1678 #include "vmware_pack_begin.h"
1679 struct SVGA3dCmdUpdateGBMobMapping {
1680    SVGAMobId mobid;
1681 }
1682 #include "vmware_pack_end.h"
1683 SVGA3dCmdUpdateGBMobMapping;   /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */
1684 
1685 /*
1686  * Define a guest-backed surface.
1687  */
1688 
1689 typedef
1690 #include "vmware_pack_begin.h"
1691 struct SVGA3dCmdDefineGBSurface {
1692    uint32 sid;
1693    SVGA3dSurface1Flags surfaceFlags;
1694    SVGA3dSurfaceFormat format;
1695    uint32 numMipLevels;
1696    uint32 multisampleCount;
1697    SVGA3dTextureFilter autogenFilter;
1698    SVGA3dSize size;
1699 }
1700 #include "vmware_pack_end.h"
1701 SVGA3dCmdDefineGBSurface;   /* SVGA_3D_CMD_DEFINE_GB_SURFACE */
1702 
1703 /*
1704  * Defines a guest-backed surface, adding the arraySize field.
1705  *
1706  * See also:
1707  * http://msdn.microsoft.com/en-us/library/ff541697%28v=VS.85%29.aspx
1708  */
1709 typedef
1710 #include "vmware_pack_begin.h"
1711 struct SVGA3dCmdDefineGBSurface_v2 {
1712    uint32 sid;
1713    SVGA3dSurface1Flags surfaceFlags;
1714    SVGA3dSurfaceFormat format;
1715    uint32 numMipLevels;
1716    uint32 multisampleCount;
1717    SVGA3dTextureFilter autogenFilter;
1718    SVGA3dSize size;
1719    uint32 arraySize;
1720    uint32 pad;
1721 }
1722 #include "vmware_pack_end.h"
1723 SVGA3dCmdDefineGBSurface_v2;   /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 */
1724 
1725 /*
1726  * Defines a guest-backed surface, adding the larger flags.
1727  */
1728 typedef
1729 #include "vmware_pack_begin.h"
1730 struct SVGA3dCmdDefineGBSurface_v3 {
1731    uint32 sid;
1732    SVGA3dSurfaceAllFlags surfaceFlags;
1733    SVGA3dSurfaceFormat format;
1734    uint32 numMipLevels;
1735    uint32 multisampleCount;
1736    SVGA3dMSPattern multisamplePattern;
1737    SVGA3dTextureFilter autogenFilter;
1738    SVGA3dSize size;
1739    uint32 arraySize;
1740 }
1741 #include "vmware_pack_end.h"
1742 SVGA3dCmdDefineGBSurface_v3;   /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 */
1743 
1744 /*
1745  * Destroy a guest-backed surface.
1746  */
1747 
1748 typedef
1749 #include "vmware_pack_begin.h"
1750 struct SVGA3dCmdDestroyGBSurface {
1751    uint32 sid;
1752 }
1753 #include "vmware_pack_end.h"
1754 SVGA3dCmdDestroyGBSurface;   /* SVGA_3D_CMD_DESTROY_GB_SURFACE */
1755 
1756 /*
1757  * Bind a guest-backed surface to a mob.
1758  */
1759 
1760 typedef
1761 #include "vmware_pack_begin.h"
1762 struct SVGA3dCmdBindGBSurface {
1763    uint32 sid;
1764    SVGAMobId mobid;
1765 }
1766 #include "vmware_pack_end.h"
1767 SVGA3dCmdBindGBSurface;   /* SVGA_3D_CMD_BIND_GB_SURFACE */
1768 
1769 typedef
1770 #include "vmware_pack_begin.h"
1771 struct SVGA3dCmdBindGBSurfaceWithPitch {
1772    uint32 sid;
1773    SVGAMobId mobid;
1774    uint32 baseLevelPitch;
1775 }
1776 #include "vmware_pack_end.h"
1777 SVGA3dCmdBindGBSurfaceWithPitch;   /* SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH */
1778 
1779 /*
1780  * Conditionally bind a mob to a guest-backed surface if testMobid
1781  * matches the currently bound mob.  Optionally issue a
1782  * readback/update on the surface while it is still bound to the old
1783  * mobid if the mobid is changed by this command.
1784  */
1785 
1786 #define SVGA3D_COND_BIND_GB_SURFACE_FLAG_READBACK (1 << 0)
1787 #define SVGA3D_COND_BIND_GB_SURFACE_FLAG_UPDATE   (1 << 1)
1788 
1789 typedef
1790 #include "vmware_pack_begin.h"
1791 struct SVGA3dCmdCondBindGBSurface {
1792    uint32 sid;
1793    SVGAMobId testMobid;
1794    SVGAMobId mobid;
1795    uint32 flags;
1796 }
1797 #include "vmware_pack_end.h"
1798 SVGA3dCmdCondBindGBSurface;          /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */
1799 
1800 /*
1801  * Update an image in a guest-backed surface.
1802  * (Inform the device that the guest-contents have been updated.)
1803  */
1804 
1805 typedef
1806 #include "vmware_pack_begin.h"
1807 struct SVGA3dCmdUpdateGBImage {
1808    SVGA3dSurfaceImageId image;
1809    SVGA3dBox box;
1810 }
1811 #include "vmware_pack_end.h"
1812 SVGA3dCmdUpdateGBImage;   /* SVGA_3D_CMD_UPDATE_GB_IMAGE */
1813 
1814 /*
1815  * Update an entire guest-backed surface.
1816  * (Inform the device that the guest-contents have been updated.)
1817  */
1818 
1819 typedef
1820 #include "vmware_pack_begin.h"
1821 struct SVGA3dCmdUpdateGBSurface {
1822    uint32 sid;
1823 }
1824 #include "vmware_pack_end.h"
1825 SVGA3dCmdUpdateGBSurface;   /* SVGA_3D_CMD_UPDATE_GB_SURFACE */
1826 
1827 /*
1828  * Readback an image in a guest-backed surface.
1829  * (Request the device to flush the dirty contents into the guest.)
1830  */
1831 
1832 typedef
1833 #include "vmware_pack_begin.h"
1834 struct SVGA3dCmdReadbackGBImage {
1835    SVGA3dSurfaceImageId image;
1836 }
1837 #include "vmware_pack_end.h"
1838 SVGA3dCmdReadbackGBImage;   /* SVGA_3D_CMD_READBACK_GB_IMAGE */
1839 
1840 /*
1841  * Readback an entire guest-backed surface.
1842  * (Request the device to flush the dirty contents into the guest.)
1843  */
1844 
1845 typedef
1846 #include "vmware_pack_begin.h"
1847 struct SVGA3dCmdReadbackGBSurface {
1848    uint32 sid;
1849 }
1850 #include "vmware_pack_end.h"
1851 SVGA3dCmdReadbackGBSurface;   /* SVGA_3D_CMD_READBACK_GB_SURFACE */
1852 
1853 /*
1854  * Readback a sub rect of an image in a guest-backed surface.  After
1855  * issuing this command the driver is required to issue an update call
1856  * of the same region before issuing any other commands that reference
1857  * this surface or rendering is not guaranteed.
1858  */
1859 
1860 typedef
1861 #include "vmware_pack_begin.h"
1862 struct SVGA3dCmdReadbackGBImagePartial {
1863    SVGA3dSurfaceImageId image;
1864    SVGA3dBox box;
1865    uint32 invertBox;
1866 }
1867 #include "vmware_pack_end.h"
1868 SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
1869 
1870 
1871 /*
1872  * Invalidate an image in a guest-backed surface.
1873  * (Notify the device that the contents can be lost.)
1874  */
1875 
1876 typedef
1877 #include "vmware_pack_begin.h"
1878 struct SVGA3dCmdInvalidateGBImage {
1879    SVGA3dSurfaceImageId image;
1880 }
1881 #include "vmware_pack_end.h"
1882 SVGA3dCmdInvalidateGBImage;   /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */
1883 
1884 /*
1885  * Invalidate an entire guest-backed surface.
1886  * (Notify the device that the contents if all images can be lost.)
1887  */
1888 
1889 typedef
1890 #include "vmware_pack_begin.h"
1891 struct SVGA3dCmdInvalidateGBSurface {
1892    uint32 sid;
1893 }
1894 #include "vmware_pack_end.h"
1895 SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */
1896 
1897 /*
1898  * Invalidate a sub rect of an image in a guest-backed surface.  After
1899  * issuing this command the driver is required to issue an update call
1900  * of the same region before issuing any other commands that reference
1901  * this surface or rendering is not guaranteed.
1902  */
1903 
1904 typedef
1905 #include "vmware_pack_begin.h"
1906 struct SVGA3dCmdInvalidateGBImagePartial {
1907    SVGA3dSurfaceImageId image;
1908    SVGA3dBox box;
1909    uint32 invertBox;
1910 }
1911 #include "vmware_pack_end.h"
1912 SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
1913 
1914 
1915 /*
1916  * Define a guest-backed context.
1917  */
1918 
1919 typedef
1920 #include "vmware_pack_begin.h"
1921 struct SVGA3dCmdDefineGBContext {
1922    uint32 cid;
1923 }
1924 #include "vmware_pack_end.h"
1925 SVGA3dCmdDefineGBContext;   /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */
1926 
1927 /*
1928  * Destroy a guest-backed context.
1929  */
1930 
1931 typedef
1932 #include "vmware_pack_begin.h"
1933 struct SVGA3dCmdDestroyGBContext {
1934    uint32 cid;
1935 }
1936 #include "vmware_pack_end.h"
1937 SVGA3dCmdDestroyGBContext;   /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */
1938 
1939 /*
1940  * Bind a guest-backed context.
1941  *
1942  * validContents should be set to 0 for new contexts,
1943  * and 1 if this is an old context which is getting paged
1944  * back on to the device.
1945  *
1946  * For new contexts, it is recommended that the driver
1947  * issue commands to initialize all interesting state
1948  * prior to rendering.
1949  */
1950 
1951 typedef
1952 #include "vmware_pack_begin.h"
1953 struct SVGA3dCmdBindGBContext {
1954    uint32 cid;
1955    SVGAMobId mobid;
1956    uint32 validContents;
1957 }
1958 #include "vmware_pack_end.h"
1959 SVGA3dCmdBindGBContext;   /* SVGA_3D_CMD_BIND_GB_CONTEXT */
1960 
1961 /*
1962  * Readback a guest-backed context.
1963  * (Request that the device flush the contents back into guest memory.)
1964  */
1965 
1966 typedef
1967 #include "vmware_pack_begin.h"
1968 struct SVGA3dCmdReadbackGBContext {
1969    uint32 cid;
1970 }
1971 #include "vmware_pack_end.h"
1972 SVGA3dCmdReadbackGBContext;   /* SVGA_3D_CMD_READBACK_GB_CONTEXT */
1973 
1974 /*
1975  * Invalidate a guest-backed context.
1976  */
1977 typedef
1978 #include "vmware_pack_begin.h"
1979 struct SVGA3dCmdInvalidateGBContext {
1980    uint32 cid;
1981 }
1982 #include "vmware_pack_end.h"
1983 SVGA3dCmdInvalidateGBContext;   /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */
1984 
1985 /*
1986  * Define a guest-backed shader.
1987  */
1988 
1989 typedef
1990 #include "vmware_pack_begin.h"
1991 struct SVGA3dCmdDefineGBShader {
1992    uint32 shid;
1993    SVGA3dShaderType type;
1994    uint32 sizeInBytes;
1995 }
1996 #include "vmware_pack_end.h"
1997 SVGA3dCmdDefineGBShader;   /* SVGA_3D_CMD_DEFINE_GB_SHADER */
1998 
1999 /*
2000  * Bind a guest-backed shader.
2001  */
2002 
2003 typedef
2004 #include "vmware_pack_begin.h"
2005 struct SVGA3dCmdBindGBShader {
2006    uint32 shid;
2007    SVGAMobId mobid;
2008    uint32 offsetInBytes;
2009 }
2010 #include "vmware_pack_end.h"
2011 SVGA3dCmdBindGBShader;   /* SVGA_3D_CMD_BIND_GB_SHADER */
2012 
2013 /*
2014  * Destroy a guest-backed shader.
2015  */
2016 
2017 typedef
2018 #include "vmware_pack_begin.h"
2019 struct SVGA3dCmdDestroyGBShader {
2020    uint32 shid;
2021 }
2022 #include "vmware_pack_end.h"
2023 SVGA3dCmdDestroyGBShader;   /* SVGA_3D_CMD_DESTROY_GB_SHADER */
2024 
2025 typedef
2026 #include "vmware_pack_begin.h"
2027 struct {
2028    uint32                  cid;
2029    uint32                  regStart;
2030    SVGA3dShaderType        shaderType;
2031    SVGA3dShaderConstType   constType;
2032 
2033    /*
2034     * Followed by a variable number of shader constants.
2035     *
2036     * Note that FLOAT and INT constants are 4-dwords in length, while
2037     * BOOL constants are 1-dword in length.
2038     */
2039 }
2040 #include "vmware_pack_end.h"
2041 SVGA3dCmdSetGBShaderConstInline;   /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */
2042 
2043 
2044 typedef
2045 #include "vmware_pack_begin.h"
2046 struct {
2047    uint32               cid;
2048    SVGA3dQueryType      type;
2049 }
2050 #include "vmware_pack_end.h"
2051 SVGA3dCmdBeginGBQuery;           /* SVGA_3D_CMD_BEGIN_GB_QUERY */
2052 
2053 typedef
2054 #include "vmware_pack_begin.h"
2055 struct {
2056    uint32               cid;
2057    SVGA3dQueryType      type;
2058    SVGAMobId mobid;
2059    uint32 offset;
2060 }
2061 #include "vmware_pack_end.h"
2062 SVGA3dCmdEndGBQuery;                  /* SVGA_3D_CMD_END_GB_QUERY */
2063 
2064 
2065 /*
2066  * SVGA_3D_CMD_WAIT_FOR_GB_QUERY --
2067  *
2068  *    The semantics of this command are identical to the
2069  *    SVGA_3D_CMD_WAIT_FOR_QUERY except that the results are written
2070  *    to a Mob instead of a GMR.
2071  */
2072 
2073 typedef
2074 #include "vmware_pack_begin.h"
2075 struct {
2076    uint32               cid;
2077    SVGA3dQueryType      type;
2078    SVGAMobId mobid;
2079    uint32 offset;
2080 }
2081 #include "vmware_pack_end.h"
2082 SVGA3dCmdWaitForGBQuery;          /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */
2083 
2084 
2085 typedef
2086 #include "vmware_pack_begin.h"
2087 struct {
2088    SVGAMobId mobid;
2089    uint32 mustBeZero;
2090    uint32 initialized;
2091 }
2092 #include "vmware_pack_end.h"
2093 SVGA3dCmdEnableGart;              /* SVGA_3D_CMD_ENABLE_GART */
2094 
2095 typedef
2096 #include "vmware_pack_begin.h"
2097 struct {
2098    SVGAMobId mobid;
2099    uint32 gartOffset;
2100 }
2101 #include "vmware_pack_end.h"
2102 SVGA3dCmdMapMobIntoGart;          /* SVGA_3D_CMD_MAP_MOB_INTO_GART */
2103 
2104 
2105 typedef
2106 #include "vmware_pack_begin.h"
2107 struct {
2108    uint32 gartOffset;
2109    uint32 numPages;
2110 }
2111 #include "vmware_pack_end.h"
2112 SVGA3dCmdUnmapGartRange;          /* SVGA_3D_CMD_UNMAP_GART_RANGE */
2113 
2114 
2115 /*
2116  * Screen Targets
2117  */
2118 
2119 typedef
2120 #include "vmware_pack_begin.h"
2121 struct {
2122    uint32 stid;
2123    uint32 width;
2124    uint32 height;
2125    int32 xRoot;
2126    int32 yRoot;
2127    SVGAScreenTargetFlags flags;
2128 
2129    /*
2130     * The physical DPI that the guest expects this screen displayed at.
2131     *
2132     * Guests which are not DPI-aware should set this to zero.
2133     */
2134    uint32 dpi;
2135 }
2136 #include "vmware_pack_end.h"
2137 SVGA3dCmdDefineGBScreenTarget;    /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */
2138 
2139 typedef
2140 #include "vmware_pack_begin.h"
2141 struct {
2142    uint32 stid;
2143 }
2144 #include "vmware_pack_end.h"
2145 SVGA3dCmdDestroyGBScreenTarget;  /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */
2146 
2147 typedef
2148 #include "vmware_pack_begin.h"
2149 struct {
2150    uint32 stid;
2151    SVGA3dSurfaceImageId image;
2152 }
2153 #include "vmware_pack_end.h"
2154 SVGA3dCmdBindGBScreenTarget;  /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */
2155 
2156 typedef
2157 #include "vmware_pack_begin.h"
2158 struct {
2159    uint32 stid;
2160    SVGA3dRect rect;
2161 }
2162 #include "vmware_pack_end.h"
2163 SVGA3dCmdUpdateGBScreenTarget;  /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */
2164 
2165 typedef
2166 #include "vmware_pack_begin.h"
2167 struct SVGA3dCmdGBScreenDMA {
2168    uint32 screenId;
2169    uint32 dead;
2170    SVGAMobId destMobID;
2171    uint32 destPitch;
2172    SVGAMobId changeMapMobID;
2173 }
2174 #include "vmware_pack_end.h"
2175 SVGA3dCmdGBScreenDMA;        /* SVGA_3D_CMD_GB_SCREEN_DMA */
2176 
2177 typedef
2178 #include "vmware_pack_begin.h"
2179 struct {
2180    uint32 value;
2181    uint32 mobId;
2182    uint32 mobOffset;
2183 }
2184 #include "vmware_pack_end.h"
2185 SVGA3dCmdGBMobFence;  /* SVGA_3D_CMD_GB_MOB_FENCE */
2186 
2187 typedef
2188 #include "vmware_pack_begin.h"
2189 struct {
2190    uint32 stid;
2191    SVGA3dSurfaceImageId dest;
2192 
2193    uint32 statusMobId;
2194    uint32 statusMobOffset;
2195 
2196    /* Reserved fields */
2197    uint32 mustBeInvalidId;
2198    uint32 mustBeZero;
2199 }
2200 #include "vmware_pack_end.h"
2201 SVGA3dCmdScreenCopy;  /* SVGA_3D_CMD_SCREEN_COPY */
2202 
2203 #define SVGA_SCREEN_COPY_STATUS_FAILURE 0x00
2204 #define SVGA_SCREEN_COPY_STATUS_SUCCESS 0x01
2205 #define SVGA_SCREEN_COPY_STATUS_INVALID 0xFFFFFFFF
2206 
2207 #endif // _SVGA3D_CMD_H_
2208