Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5564 serge 1
/**********************************************************
2
 * Copyright 1998-2014 VMware, Inc.  All rights reserved.
3
 *
4
 * Permission is hereby granted, free of charge, to any person
5
 * obtaining a copy of this software and associated documentation
6
 * files (the "Software"), to deal in the Software without
7
 * restriction, including without limitation the rights to use, copy,
8
 * modify, merge, publish, distribute, sublicense, and/or sell copies
9
 * of the Software, and to permit persons to whom the Software is
10
 * furnished to do so, subject to the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be
13
 * included in all copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 *
24
 **********************************************************/
25
 
26
/*
27
 * svga3d_cmd.h --
28
 *
29
 *       SVGA 3d hardware cmd definitions
30
 */
31
 
32
#ifndef _SVGA3D_CMD_H_
33
#define _SVGA3D_CMD_H_
34
 
35
#define INCLUDE_ALLOW_MODULE
36
#define INCLUDE_ALLOW_USERLEVEL
37
#define INCLUDE_ALLOW_VMCORE
38
 
39
#include "includeCheck.h"
40
#include "svga3d_types.h"
41
 
42
/*
43
 * Identifiers for commands in the command FIFO.
44
 *
45
 * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of
46
 * the SVGA3D protocol and remain reserved; they should not be used in the
47
 * future.
48
 *
49
 * IDs between 1040 and 1999 (inclusive) are available for use by the
50
 * current SVGA3D protocol.
51
 *
52
 * FIFO clients other than SVGA3D should stay below 1000, or at 2000
53
 * and up.
54
 */
55
 
56
#define SVGA_3D_CMD_LEGACY_BASE                                1000
57
#define SVGA_3D_CMD_BASE                                       1040
58
 
59
#define SVGA_3D_CMD_SURFACE_DEFINE                             1040
60
#define SVGA_3D_CMD_SURFACE_DESTROY                            1041
61
#define SVGA_3D_CMD_SURFACE_COPY                               1042
62
#define SVGA_3D_CMD_SURFACE_STRETCHBLT                         1043
63
#define SVGA_3D_CMD_SURFACE_DMA                                1044
64
#define SVGA_3D_CMD_CONTEXT_DEFINE                             1045
65
#define SVGA_3D_CMD_CONTEXT_DESTROY                            1046
66
#define SVGA_3D_CMD_SETTRANSFORM                               1047
67
#define SVGA_3D_CMD_SETZRANGE                                  1048
68
#define SVGA_3D_CMD_SETRENDERSTATE                             1049
69
#define SVGA_3D_CMD_SETRENDERTARGET                            1050
70
#define SVGA_3D_CMD_SETTEXTURESTATE                            1051
71
#define SVGA_3D_CMD_SETMATERIAL                                1052
72
#define SVGA_3D_CMD_SETLIGHTDATA                               1053
73
#define SVGA_3D_CMD_SETLIGHTENABLED                            1054
74
#define SVGA_3D_CMD_SETVIEWPORT                                1055
75
#define SVGA_3D_CMD_SETCLIPPLANE                               1056
76
#define SVGA_3D_CMD_CLEAR                                      1057
77
#define SVGA_3D_CMD_PRESENT                                    1058
78
#define SVGA_3D_CMD_SHADER_DEFINE                              1059
79
#define SVGA_3D_CMD_SHADER_DESTROY                             1060
80
#define SVGA_3D_CMD_SET_SHADER                                 1061
81
#define SVGA_3D_CMD_SET_SHADER_CONST                           1062
82
#define SVGA_3D_CMD_DRAW_PRIMITIVES                            1063
83
#define SVGA_3D_CMD_SETSCISSORRECT                             1064
84
#define SVGA_3D_CMD_BEGIN_QUERY                                1065
85
#define SVGA_3D_CMD_END_QUERY                                  1066
86
#define SVGA_3D_CMD_WAIT_FOR_QUERY                             1067
87
#define SVGA_3D_CMD_PRESENT_READBACK                           1068
88
#define SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN                     1069
89
#define SVGA_3D_CMD_SURFACE_DEFINE_V2                          1070
90
#define SVGA_3D_CMD_GENERATE_MIPMAPS                           1071
91
#define SVGA_3D_CMD_VIDEO_CREATE_DECODER                       1072
92
#define SVGA_3D_CMD_VIDEO_DESTROY_DECODER                      1073
93
#define SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR                     1074
94
#define SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR                    1075
95
#define SVGA_3D_CMD_VIDEO_DECODE_START_FRAME                   1076
96
#define SVGA_3D_CMD_VIDEO_DECODE_RENDER                        1077
97
#define SVGA_3D_CMD_VIDEO_DECODE_END_FRAME                     1078
98
#define SVGA_3D_CMD_VIDEO_PROCESS_FRAME                        1079
99
#define SVGA_3D_CMD_ACTIVATE_SURFACE                           1080
100
#define SVGA_3D_CMD_DEACTIVATE_SURFACE                         1081
101
#define SVGA_3D_CMD_SCREEN_DMA                                 1082
102
#define SVGA_3D_CMD_SET_UNITY_SURFACE_COOKIE                   1083
103
#define SVGA_3D_CMD_OPEN_CONTEXT_SURFACE                       1084
104
 
105
#define SVGA_3D_CMD_LOGICOPS_BITBLT                            1085
106
#define SVGA_3D_CMD_LOGICOPS_TRANSBLT                          1086
107
#define SVGA_3D_CMD_LOGICOPS_STRETCHBLT                        1087
108
#define SVGA_3D_CMD_LOGICOPS_COLORFILL                         1088
109
#define SVGA_3D_CMD_LOGICOPS_ALPHABLEND                        1089
110
#define SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND                    1090
111
 
112
#define SVGA_3D_CMD_SET_OTABLE_BASE                            1091
113
#define SVGA_3D_CMD_READBACK_OTABLE                            1092
114
 
115
#define SVGA_3D_CMD_DEFINE_GB_MOB                              1093
116
#define SVGA_3D_CMD_DESTROY_GB_MOB                             1094
117
#define SVGA_3D_CMD_REDEFINE_GB_MOB                            1095
118
#define SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING                      1096
119
 
120
#define SVGA_3D_CMD_DEFINE_GB_SURFACE                          1097
121
#define SVGA_3D_CMD_DESTROY_GB_SURFACE                         1098
122
#define SVGA_3D_CMD_BIND_GB_SURFACE                            1099
123
#define SVGA_3D_CMD_COND_BIND_GB_SURFACE                       1100
124
#define SVGA_3D_CMD_UPDATE_GB_IMAGE                            1101
125
#define SVGA_3D_CMD_UPDATE_GB_SURFACE                          1102
126
#define SVGA_3D_CMD_READBACK_GB_IMAGE                          1103
127
#define SVGA_3D_CMD_READBACK_GB_SURFACE                        1104
128
#define SVGA_3D_CMD_INVALIDATE_GB_IMAGE                        1105
129
#define SVGA_3D_CMD_INVALIDATE_GB_SURFACE                      1106
130
 
131
#define SVGA_3D_CMD_DEFINE_GB_CONTEXT                          1107
132
#define SVGA_3D_CMD_DESTROY_GB_CONTEXT                         1108
133
#define SVGA_3D_CMD_BIND_GB_CONTEXT                            1109
134
#define SVGA_3D_CMD_READBACK_GB_CONTEXT                        1110
135
#define SVGA_3D_CMD_INVALIDATE_GB_CONTEXT                      1111
136
 
137
#define SVGA_3D_CMD_DEFINE_GB_SHADER                           1112
138
#define SVGA_3D_CMD_DESTROY_GB_SHADER                          1113
139
#define SVGA_3D_CMD_BIND_GB_SHADER                             1114
140
 
141
#define SVGA_3D_CMD_BIND_SHADERCONSTS                          1115
142
 
143
#define SVGA_3D_CMD_BEGIN_GB_QUERY                             1116
144
#define SVGA_3D_CMD_END_GB_QUERY                               1117
145
#define SVGA_3D_CMD_WAIT_FOR_GB_QUERY                          1118
146
 
147
#define SVGA_3D_CMD_NOP                                        1119
148
 
149
#define SVGA_3D_CMD_ENABLE_GART                                1120
150
#define SVGA_3D_CMD_DISABLE_GART                               1121
151
#define SVGA_3D_CMD_MAP_MOB_INTO_GART                          1122
152
#define SVGA_3D_CMD_UNMAP_GART_RANGE                           1123
153
 
154
#define SVGA_3D_CMD_DEFINE_GB_SCREENTARGET                     1124
155
#define SVGA_3D_CMD_DESTROY_GB_SCREENTARGET                    1125
156
#define SVGA_3D_CMD_BIND_GB_SCREENTARGET                       1126
157
#define SVGA_3D_CMD_UPDATE_GB_SCREENTARGET                     1127
158
 
159
#define SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL                  1128
160
#define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL                1129
161
 
162
#define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE                 1130
163
 
164
#define SVGA_3D_CMD_GB_SCREEN_DMA                              1131
165
#define SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH                 1132
166
#define SVGA_3D_CMD_GB_MOB_FENCE                               1133
167
#define SVGA_3D_CMD_DEFINE_GB_SURFACE_V2                       1134
168
#define SVGA_3D_CMD_DEFINE_GB_MOB64                            1135
169
#define SVGA_3D_CMD_REDEFINE_GB_MOB64                          1136
170
#define SVGA_3D_CMD_NOP_ERROR                                  1137
171
 
172
#define SVGA_3D_CMD_RESERVED1                                  1138
173
#define SVGA_3D_CMD_RESERVED2                                  1139
174
#define SVGA_3D_CMD_RESERVED3                                  1140
175
#define SVGA_3D_CMD_RESERVED4                                  1141
176
#define SVGA_3D_CMD_RESERVED5                                  1142
177
 
178
#define SVGA_3D_CMD_MAX                                        1203
179
#define SVGA_3D_CMD_FUTURE_MAX                                 3000
180
 
181
/*
182
 * FIFO command format definitions:
183
 */
184
 
185
/*
186
 * The data size header following cmdNum for every 3d command
187
 */
188
typedef
189
#include "vmware_pack_begin.h"
190
struct {
191
   uint32               id;
192
   uint32               size;
193
}
194
#include "vmware_pack_end.h"
195
SVGA3dCmdHeader;
196
 
197
typedef enum {
198
   SVGA3D_SURFACE_CUBEMAP               = (1 << 0),
199
 
200
   /*
201
    * HINT flags are not enforced by the device but are useful for
202
    * performance.
203
    */
204
   SVGA3D_SURFACE_HINT_STATIC           = (1 << 1),
205
   SVGA3D_SURFACE_HINT_DYNAMIC          = (1 << 2),
206
   SVGA3D_SURFACE_HINT_INDEXBUFFER      = (1 << 3),
207
   SVGA3D_SURFACE_HINT_VERTEXBUFFER     = (1 << 4),
208
   SVGA3D_SURFACE_HINT_TEXTURE          = (1 << 5),
209
   SVGA3D_SURFACE_HINT_RENDERTARGET     = (1 << 6),
210
   SVGA3D_SURFACE_HINT_DEPTHSTENCIL     = (1 << 7),
211
   SVGA3D_SURFACE_HINT_WRITEONLY        = (1 << 8),
212
   SVGA3D_SURFACE_MASKABLE_ANTIALIAS    = (1 << 9),
213
   SVGA3D_SURFACE_AUTOGENMIPMAPS        = (1 << 10),
214
   SVGA3D_SURFACE_DECODE_RENDERTARGET   = (1 << 11),
215
 
216
   /*
217
    * Is this surface using a base-level pitch for it's mob backing?
218
    *
219
    * This flag is not intended to be set by guest-drivers, but is instead
220
    * set by the device when the surface is bound to a mob with a specified
221
    * pitch.
222
    */
223
   SVGA3D_SURFACE_MOB_PITCH             = (1 << 12),
224
 
225
   SVGA3D_SURFACE_INACTIVE              = (1 << 13),
226
   SVGA3D_SURFACE_HINT_RT_LOCKABLE      = (1 << 14),
227
   SVGA3D_SURFACE_VOLUME                = (1 << 15),
228
 
229
   /*
230
    * Required to be set on a surface to bind it to a screen target.
231
    */
232
   SVGA3D_SURFACE_SCREENTARGET          = (1 << 16),
233
 
234
   SVGA3D_SURFACE_RESERVED1             = (1 << 17),
235
   SVGA3D_SURFACE_1D                    = (1 << 18),
236
   SVGA3D_SURFACE_ARRAY                 = (1 << 19),
237
 
238
} SVGA3dSurfaceFlags;
239
 
240
#define SVGA3D_SURFACE_HB_DISALLOWED_MASK (SVGA3D_SURFACE_SCREENTARGET | \
241
                                           SVGA3D_SURFACE_MOB_PITCH    | \
242
                                           SVGA3D_SURFACE_BIND_CONSTANT_BUFFER | \
243
                                           SVGA3D_SURFACE_BIND_STREAM_OUTPUT)
244
 
245
typedef
246
#include "vmware_pack_begin.h"
247
struct {
248
   uint32               numMipLevels;
249
}
250
#include "vmware_pack_end.h"
251
SVGA3dSurfaceFace;
252
 
253
typedef
254
#include "vmware_pack_begin.h"
255
struct {
256
   uint32                      sid;
257
   SVGA3dSurfaceFlags          surfaceFlags;
258
   SVGA3dSurfaceFormat         format;
259
   /*
260
    * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace
261
    * structures must have the same value of numMipLevels field.
262
    * Otherwise, all but the first SVGA3dSurfaceFace structures must have the
263
    * numMipLevels set to 0.
264
    */
265
   SVGA3dSurfaceFace           face[SVGA3D_MAX_SURFACE_FACES];
266
   /*
267
    * Followed by an SVGA3dSize structure for each mip level in each face.
268
    *
269
    * A note on surface sizes: Sizes are always specified in pixels,
270
    * even if the true surface size is not a multiple of the minimum
271
    * block size of the surface's format. For example, a 3x3x1 DXT1
272
    * compressed texture would actually be stored as a 4x4x1 image in
273
    * memory.
274
    */
275
}
276
#include "vmware_pack_end.h"
277
SVGA3dCmdDefineSurface;       /* SVGA_3D_CMD_SURFACE_DEFINE */
278
 
279
typedef
280
#include "vmware_pack_begin.h"
281
struct {
282
   uint32                      sid;
283
   SVGA3dSurfaceFlags          surfaceFlags;
284
   SVGA3dSurfaceFormat         format;
285
   /*
286
    * If surfaceFlags has SVGA3D_SURFACE_CUBEMAP bit set, all SVGA3dSurfaceFace
287
    * structures must have the same value of numMipLevels field.
288
    * Otherwise, all but the first SVGA3dSurfaceFace structures must have the
289
    * numMipLevels set to 0.
290
    */
291
   SVGA3dSurfaceFace           face[SVGA3D_MAX_SURFACE_FACES];
292
   uint32                      multisampleCount;
293
   SVGA3dTextureFilter         autogenFilter;
294
   /*
295
    * Followed by an SVGA3dSize structure for each mip level in each face.
296
    *
297
    * A note on surface sizes: Sizes are always specified in pixels,
298
    * even if the true surface size is not a multiple of the minimum
299
    * block size of the surface's format. For example, a 3x3x1 DXT1
300
    * compressed texture would actually be stored as a 4x4x1 image in
301
    * memory.
302
    */
303
}
304
#include "vmware_pack_end.h"
305
SVGA3dCmdDefineSurface_v2;     /* SVGA_3D_CMD_SURFACE_DEFINE_V2 */
306
 
307
typedef
308
#include "vmware_pack_begin.h"
309
struct {
310
   uint32               sid;
311
}
312
#include "vmware_pack_end.h"
313
SVGA3dCmdDestroySurface;      /* SVGA_3D_CMD_SURFACE_DESTROY */
314
 
315
typedef
316
#include "vmware_pack_begin.h"
317
struct {
318
   uint32               cid;
319
}
320
#include "vmware_pack_end.h"
321
SVGA3dCmdDefineContext;       /* SVGA_3D_CMD_CONTEXT_DEFINE */
322
 
323
typedef
324
#include "vmware_pack_begin.h"
325
struct {
326
   uint32               cid;
327
}
328
#include "vmware_pack_end.h"
329
SVGA3dCmdDestroyContext;      /* SVGA_3D_CMD_CONTEXT_DESTROY */
330
 
331
typedef
332
#include "vmware_pack_begin.h"
333
struct {
334
   uint32               cid;
335
   SVGA3dClearFlag      clearFlag;
336
   uint32               color;
337
   float                depth;
338
   uint32               stencil;
339
   /* Followed by variable number of SVGA3dRect structures */
340
}
341
#include "vmware_pack_end.h"
342
SVGA3dCmdClear;               /* SVGA_3D_CMD_CLEAR */
343
 
344
typedef
345
#include "vmware_pack_begin.h"
346
struct {
347
   SVGA3dLightType      type;
348
   SVGA3dBool           inWorldSpace;
349
   float                diffuse[4];
350
   float                specular[4];
351
   float                ambient[4];
352
   float                position[4];
353
   float                direction[4];
354
   float                range;
355
   float                falloff;
356
   float                attenuation0;
357
   float                attenuation1;
358
   float                attenuation2;
359
   float                theta;
360
   float                phi;
361
}
362
#include "vmware_pack_end.h"
363
SVGA3dLightData;
364
 
365
typedef
366
#include "vmware_pack_begin.h"
367
struct {
368
   uint32               sid;
369
   /* Followed by variable number of SVGA3dCopyRect structures */
370
}
371
#include "vmware_pack_end.h"
372
SVGA3dCmdPresent;             /* SVGA_3D_CMD_PRESENT */
373
 
374
typedef
375
#include "vmware_pack_begin.h"
376
struct {
377
   SVGA3dRenderStateName   state;
378
   union {
379
      uint32               uintValue;
380
      float                floatValue;
381
   };
382
}
383
#include "vmware_pack_end.h"
384
SVGA3dRenderState;
385
 
386
typedef
387
#include "vmware_pack_begin.h"
388
struct {
389
   uint32               cid;
390
   /* Followed by variable number of SVGA3dRenderState structures */
391
}
392
#include "vmware_pack_end.h"
393
SVGA3dCmdSetRenderState;      /* SVGA_3D_CMD_SETRENDERSTATE */
394
 
395
typedef
396
#include "vmware_pack_begin.h"
397
struct {
398
   uint32                 cid;
399
   SVGA3dRenderTargetType type;
400
   SVGA3dSurfaceImageId   target;
401
}
402
#include "vmware_pack_end.h"
403
SVGA3dCmdSetRenderTarget;     /* SVGA_3D_CMD_SETRENDERTARGET */
404
 
405
typedef
406
#include "vmware_pack_begin.h"
407
struct {
408
   SVGA3dSurfaceImageId  src;
409
   SVGA3dSurfaceImageId  dest;
410
   /* Followed by variable number of SVGA3dCopyBox structures */
411
}
412
#include "vmware_pack_end.h"
413
SVGA3dCmdSurfaceCopy;               /* SVGA_3D_CMD_SURFACE_COPY */
414
 
415
typedef
416
#include "vmware_pack_begin.h"
417
struct {
418
   SVGA3dSurfaceImageId  src;
419
   SVGA3dSurfaceImageId  dest;
420
   SVGA3dBox             boxSrc;
421
   SVGA3dBox             boxDest;
422
   SVGA3dStretchBltMode  mode;
423
}
424
#include "vmware_pack_end.h"
425
SVGA3dCmdSurfaceStretchBlt;         /* SVGA_3D_CMD_SURFACE_STRETCHBLT */
426
 
427
typedef
428
#include "vmware_pack_begin.h"
429
struct {
430
   /*
431
    * If the discard flag is present in a surface DMA operation, the host may
432
    * discard the contents of the current mipmap level and face of the target
433
    * surface before applying the surface DMA contents.
434
    */
435
   uint32 discard : 1;
436
 
437
   /*
438
    * If the unsynchronized flag is present, the host may perform this upload
439
    * without syncing to pending reads on this surface.
440
    */
441
   uint32 unsynchronized : 1;
442
 
443
   /*
444
    * Guests *MUST* set the reserved bits to 0 before submitting the command
445
    * suffix as future flags may occupy these bits.
446
    */
447
   uint32 reserved : 30;
448
}
449
#include "vmware_pack_end.h"
450
SVGA3dSurfaceDMAFlags;
451
 
452
typedef
453
#include "vmware_pack_begin.h"
454
struct {
455
   SVGAGuestImage guest;
456
   SVGA3dSurfaceImageId host;
457
   SVGA3dTransferType transfer;
458
   /*
459
    * Followed by variable number of SVGA3dCopyBox structures. For consistency
460
    * in all clipping logic and coordinate translation, we define the
461
    * "source" in each copyBox as the guest image and the
462
    * "destination" as the host image, regardless of transfer
463
    * direction.
464
    *
465
    * For efficiency, the SVGA3D device is free to copy more data than
466
    * specified. For example, it may round copy boxes outwards such
467
    * that they lie on particular alignment boundaries.
468
    */
469
}
470
#include "vmware_pack_end.h"
471
SVGA3dCmdSurfaceDMA;                /* SVGA_3D_CMD_SURFACE_DMA */
472
 
473
/*
474
 * SVGA3dCmdSurfaceDMASuffix --
475
 *
476
 *    This is a command suffix that will appear after a SurfaceDMA command in
477
 *    the FIFO.  It contains some extra information that hosts may use to
478
 *    optimize performance or protect the guest.  This suffix exists to preserve
479
 *    backwards compatibility while also allowing for new functionality to be
480
 *    implemented.
481
 */
482
 
483
typedef
484
#include "vmware_pack_begin.h"
485
struct {
486
   uint32 suffixSize;
487
 
488
   /*
489
    * The maximum offset is used to determine the maximum offset from the
490
    * guestPtr base address that will be accessed or written to during this
491
    * surfaceDMA.  If the suffix is supported, the host will respect this
492
    * boundary while performing surface DMAs.
493
    *
494
    * Defaults to MAX_UINT32
495
    */
496
   uint32 maximumOffset;
497
 
498
   /*
499
    * A set of flags that describes optimizations that the host may perform
500
    * while performing this surface DMA operation.  The guest should never rely
501
    * on behaviour that is different when these flags are set for correctness.
502
    *
503
    * Defaults to 0
504
    */
505
   SVGA3dSurfaceDMAFlags flags;
506
}
507
#include "vmware_pack_end.h"
508
SVGA3dCmdSurfaceDMASuffix;
509
 
510
/*
511
 * SVGA_3D_CMD_DRAW_PRIMITIVES --
512
 *
513
 *   This command is the SVGA3D device's generic drawing entry point.
514
 *   It can draw multiple ranges of primitives, optionally using an
515
 *   index buffer, using an arbitrary collection of vertex buffers.
516
 *
517
 *   Each SVGA3dVertexDecl defines a distinct vertex array to bind
518
 *   during this draw call. The declarations specify which surface
519
 *   the vertex data lives in, what that vertex data is used for,
520
 *   and how to interpret it.
521
 *
522
 *   Each SVGA3dPrimitiveRange defines a collection of primitives
523
 *   to render using the same vertex arrays. An index buffer is
524
 *   optional.
525
 */
526
 
527
typedef
528
#include "vmware_pack_begin.h"
529
struct {
530
   /*
531
    * A range hint is an optional specification for the range of indices
532
    * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed
533
    * that the entire array will be used.
534
    *
535
    * These are only hints. The SVGA3D device may use them for
536
    * performance optimization if possible, but it's also allowed to
537
    * ignore these values.
538
    */
539
   uint32               first;
540
   uint32               last;
541
}
542
#include "vmware_pack_end.h"
543
SVGA3dArrayRangeHint;
544
 
545
typedef
546
#include "vmware_pack_begin.h"
547
struct {
548
   /*
549
    * Define the origin and shape of a vertex or index array. Both
550
    * 'offset' and 'stride' are in bytes. The provided surface will be
551
    * reinterpreted as a flat array of bytes in the same format used
552
    * by surface DMA operations. To avoid unnecessary conversions, the
553
    * surface should be created with the SVGA3D_BUFFER format.
554
    *
555
    * Index 0 in the array starts 'offset' bytes into the surface.
556
    * Index 1 begins at byte 'offset + stride', etc. Array indices may
557
    * not be negative.
558
    */
559
   uint32               surfaceId;
560
   uint32               offset;
561
   uint32               stride;
562
}
563
#include "vmware_pack_end.h"
564
SVGA3dArray;
565
 
566
typedef
567
#include "vmware_pack_begin.h"
568
struct {
569
   /*
570
    * Describe a vertex array's data type, and define how it is to be
571
    * used by the fixed function pipeline or the vertex shader. It
572
    * isn't useful to have two VertexDecls with the same
573
    * VertexArrayIdentity in one draw call.
574
    */
575
   SVGA3dDeclType       type;
576
   SVGA3dDeclMethod     method;
577
   SVGA3dDeclUsage      usage;
578
   uint32               usageIndex;
579
}
580
#include "vmware_pack_end.h"
581
SVGA3dVertexArrayIdentity;
582
 
583
typedef
584
#include "vmware_pack_begin.h"
585
struct SVGA3dVertexDecl {
586
   SVGA3dVertexArrayIdentity  identity;
587
   SVGA3dArray                array;
588
   SVGA3dArrayRangeHint       rangeHint;
589
}
590
#include "vmware_pack_end.h"
591
SVGA3dVertexDecl;
592
 
593
typedef
594
#include "vmware_pack_begin.h"
595
struct SVGA3dPrimitiveRange {
596
   /*
597
    * Define a group of primitives to render, from sequential indices.
598
    *
599
    * The value of 'primitiveType' and 'primitiveCount' imply the
600
    * total number of vertices that will be rendered.
601
    */
602
   SVGA3dPrimitiveType  primType;
603
   uint32               primitiveCount;
604
 
605
   /*
606
    * Optional index buffer. If indexArray.surfaceId is
607
    * SVGA3D_INVALID_ID, we render without an index buffer. Rendering
608
    * without an index buffer is identical to rendering with an index
609
    * buffer containing the sequence [0, 1, 2, 3, ...].
610
    *
611
    * If an index buffer is in use, indexWidth specifies the width in
612
    * bytes of each index value. It must be less than or equal to
613
    * indexArray.stride.
614
    *
615
    * (Currently, the SVGA3D device requires index buffers to be tightly
616
    * packed. In other words, indexWidth == indexArray.stride)
617
    */
618
   SVGA3dArray          indexArray;
619
   uint32               indexWidth;
620
 
621
   /*
622
    * Optional index bias. This number is added to all indices from
623
    * indexArray before they are used as vertex array indices. This
624
    * can be used in multiple ways:
625
    *
626
    *  - When not using an indexArray, this bias can be used to
627
    *    specify where in the vertex arrays to begin rendering.
628
    *
629
    *  - A positive number here is equivalent to increasing the
630
    *    offset in each vertex array.
631
    *
632
    *  - A negative number can be used to render using a small
633
    *    vertex array and an index buffer that contains large
634
    *    values. This may be used by some applications that
635
    *    crop a vertex buffer without modifying their index
636
    *    buffer.
637
    *
638
    * Note that rendering with a negative bias value may be slower and
639
    * use more memory than rendering with a positive or zero bias.
640
    */
641
   int32                indexBias;
642
}
643
#include "vmware_pack_end.h"
644
SVGA3dPrimitiveRange;
645
 
646
typedef
647
#include "vmware_pack_begin.h"
648
struct {
649
   uint32               cid;
650
   uint32               numVertexDecls;
651
   uint32               numRanges;
652
 
653
   /*
654
    * There are two variable size arrays after the
655
    * SVGA3dCmdDrawPrimitives structure. In order,
656
    * they are:
657
    *
658
    * 1. SVGA3dVertexDecl, quantity 'numVertexDecls', but no more than
659
    *    SVGA3D_MAX_VERTEX_ARRAYS;
660
    * 2. SVGA3dPrimitiveRange, quantity 'numRanges', but no more than
661
    *    SVGA3D_MAX_DRAW_PRIMITIVE_RANGES;
662
    * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains
663
    *    the frequency divisor for the corresponding vertex decl).
664
    */
665
}
666
#include "vmware_pack_end.h"
667
SVGA3dCmdDrawPrimitives;      /* SVGA_3D_CMD_DRAWPRIMITIVES */
668
 
669
typedef
670
#include "vmware_pack_begin.h"
671
struct {
672
   uint32                   stage;
673
   SVGA3dTextureStateName   name;
674
   union {
675
      uint32                value;
676
      float                 floatValue;
677
   };
678
}
679
#include "vmware_pack_end.h"
680
SVGA3dTextureState;
681
 
682
typedef
683
#include "vmware_pack_begin.h"
684
struct {
685
   uint32               cid;
686
   /* Followed by variable number of SVGA3dTextureState structures */
687
}
688
#include "vmware_pack_end.h"
689
SVGA3dCmdSetTextureState;      /* SVGA_3D_CMD_SETTEXTURESTATE */
690
 
691
typedef
692
#include "vmware_pack_begin.h"
693
struct {
694
   uint32                   cid;
695
   SVGA3dTransformType      type;
696
   float                    matrix[16];
697
}
698
#include "vmware_pack_end.h"
699
SVGA3dCmdSetTransform;          /* SVGA_3D_CMD_SETTRANSFORM */
700
 
701
typedef
702
#include "vmware_pack_begin.h"
703
struct {
704
   float                min;
705
   float                max;
706
}
707
#include "vmware_pack_end.h"
708
SVGA3dZRange;
709
 
710
typedef
711
#include "vmware_pack_begin.h"
712
struct {
713
   uint32               cid;
714
   SVGA3dZRange         zRange;
715
}
716
#include "vmware_pack_end.h"
717
SVGA3dCmdSetZRange;             /* SVGA_3D_CMD_SETZRANGE */
718
 
719
typedef
720
#include "vmware_pack_begin.h"
721
struct {
722
   float                diffuse[4];
723
   float                ambient[4];
724
   float                specular[4];
725
   float                emissive[4];
726
   float                shininess;
727
}
728
#include "vmware_pack_end.h"
729
SVGA3dMaterial;
730
 
731
typedef
732
#include "vmware_pack_begin.h"
733
struct {
734
   uint32               cid;
735
   SVGA3dFace           face;
736
   SVGA3dMaterial       material;
737
}
738
#include "vmware_pack_end.h"
739
SVGA3dCmdSetMaterial;           /* SVGA_3D_CMD_SETMATERIAL */
740
 
741
typedef
742
#include "vmware_pack_begin.h"
743
struct {
744
   uint32               cid;
745
   uint32               index;
746
   SVGA3dLightData      data;
747
}
748
#include "vmware_pack_end.h"
749
SVGA3dCmdSetLightData;           /* SVGA_3D_CMD_SETLIGHTDATA */
750
 
751
typedef
752
#include "vmware_pack_begin.h"
753
struct {
754
   uint32               cid;
755
   uint32               index;
756
   uint32               enabled;
757
}
758
#include "vmware_pack_end.h"
759
SVGA3dCmdSetLightEnabled;      /* SVGA_3D_CMD_SETLIGHTENABLED */
760
 
761
typedef
762
#include "vmware_pack_begin.h"
763
struct {
764
   uint32               cid;
765
   SVGA3dRect           rect;
766
}
767
#include "vmware_pack_end.h"
768
SVGA3dCmdSetViewport;           /* SVGA_3D_CMD_SETVIEWPORT */
769
 
770
typedef
771
#include "vmware_pack_begin.h"
772
struct {
773
   uint32               cid;
774
   SVGA3dRect           rect;
775
}
776
#include "vmware_pack_end.h"
777
SVGA3dCmdSetScissorRect;         /* SVGA_3D_CMD_SETSCISSORRECT */
778
 
779
typedef
780
#include "vmware_pack_begin.h"
781
struct {
782
   uint32               cid;
783
   uint32               index;
784
   float                plane[4];
785
}
786
#include "vmware_pack_end.h"
787
SVGA3dCmdSetClipPlane;           /* SVGA_3D_CMD_SETCLIPPLANE */
788
 
789
typedef
790
#include "vmware_pack_begin.h"
791
struct {
792
   uint32               cid;
793
   uint32               shid;
794
   SVGA3dShaderType     type;
795
   /* Followed by variable number of DWORDs for shader bycode */
796
}
797
#include "vmware_pack_end.h"
798
SVGA3dCmdDefineShader;           /* SVGA_3D_CMD_SHADER_DEFINE */
799
 
800
typedef
801
#include "vmware_pack_begin.h"
802
struct {
803
   uint32               cid;
804
   uint32               shid;
805
   SVGA3dShaderType     type;
806
}
807
#include "vmware_pack_end.h"
808
SVGA3dCmdDestroyShader;         /* SVGA_3D_CMD_SHADER_DESTROY */
809
 
810
typedef
811
#include "vmware_pack_begin.h"
812
struct {
813
   uint32                  cid;
814
   uint32                  reg;     /* register number */
815
   SVGA3dShaderType        type;
816
   SVGA3dShaderConstType   ctype;
817
   uint32                  values[4];
818
 
819
   /*
820
    * Followed by a variable number of additional values.
821
    */
822
}
823
#include "vmware_pack_end.h"
824
SVGA3dCmdSetShaderConst;        /* SVGA_3D_CMD_SET_SHADER_CONST */
825
 
826
typedef
827
#include "vmware_pack_begin.h"
828
struct {
829
   uint32               cid;
830
   SVGA3dShaderType     type;
831
   uint32               shid;
832
}
833
#include "vmware_pack_end.h"
834
SVGA3dCmdSetShader;       /* SVGA_3D_CMD_SET_SHADER */
835
 
836
typedef
837
#include "vmware_pack_begin.h"
838
struct {
839
   uint32               cid;
840
   SVGA3dQueryType      type;
841
}
842
#include "vmware_pack_end.h"
843
SVGA3dCmdBeginQuery;           /* SVGA_3D_CMD_BEGIN_QUERY */
844
 
845
typedef
846
#include "vmware_pack_begin.h"
847
struct {
848
   uint32               cid;
849
   SVGA3dQueryType      type;
850
   SVGAGuestPtr         guestResult;   /* Points to an SVGA3dQueryResult structure */
851
}
852
#include "vmware_pack_end.h"
853
SVGA3dCmdEndQuery;                  /* SVGA_3D_CMD_END_QUERY */
854
 
855
 
856
/*
857
 * SVGA3D_CMD_WAIT_FOR_QUERY --
858
 *
859
 *    Will read the SVGA3dQueryResult structure pointed to by guestResult,
860
 *    and if the state member is set to anything else than
861
 *    SVGA3D_QUERYSTATE_PENDING, this command will always be a no-op.
862
 *
863
 *    Otherwise, in addition to the query explicitly waited for,
864
 *    All queries with the same type and issued with the same cid, for which
865
 *    an SVGA_3D_CMD_END_QUERY command has previously been sent, will
866
 *    be finished after execution of this command.
867
 *
868
 *    A query will be identified by the gmrId and offset of the guestResult
869
 *    member. If the device can't find an SVGA_3D_CMD_END_QUERY that has
870
 *    been sent previously with an indentical gmrId and offset, it will
871
 *    effectively end all queries with an identical type issued with the
872
 *    same cid, and the SVGA3dQueryResult structure pointed to by
873
 *    guestResult will not be written to. This property can be used to
874
 *    implement a query barrier for a given cid and query type.
875
 */
876
 
877
typedef
878
#include "vmware_pack_begin.h"
879
struct {
880
   uint32               cid;        /* Same parameters passed to END_QUERY */
881
   SVGA3dQueryType      type;
882
   SVGAGuestPtr         guestResult;
883
}
884
#include "vmware_pack_end.h"
885
SVGA3dCmdWaitForQuery;              /* SVGA_3D_CMD_WAIT_FOR_QUERY */
886
 
887
typedef
888
#include "vmware_pack_begin.h"
889
struct {
890
   uint32               totalSize;    /* Set by guest before query is ended. */
891
   SVGA3dQueryState     state;        /* Set by host or guest. See SVGA3dQueryState. */
892
   union {                            /* Set by host on exit from PENDING state */
893
      uint32            result32;
894
      uint32            queryCookie; /* May be used to identify which QueryGetData this
895
                                        result corresponds to. */
896
   };
897
}
898
#include "vmware_pack_end.h"
899
SVGA3dQueryResult;
900
 
901
 
902
/*
903
 * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN --
904
 *
905
 *    This is a blit from an SVGA3D surface to a Screen Object.
906
 *    This blit must be directed at a specific screen.
907
 *
908
 *    The blit copies from a rectangular region of an SVGA3D surface
909
 *    image to a rectangular region of a screen.
910
 *
911
 *    This command takes an optional variable-length list of clipping
912
 *    rectangles after the body of the command. If no rectangles are
913
 *    specified, there is no clipping region. The entire destRect is
914
 *    drawn to. If one or more rectangles are included, they describe
915
 *    a clipping region. The clip rectangle coordinates are measured
916
 *    relative to the top-left corner of destRect.
917
 *
918
 *    The srcImage must be from mip=0 face=0.
919
 *
920
 *    This supports scaling if the src and dest are of different sizes.
921
 *
922
 * Availability:
923
 *    SVGA_FIFO_CAP_SCREEN_OBJECT
924
 */
925
 
926
typedef
927
#include "vmware_pack_begin.h"
928
struct {
929
   SVGA3dSurfaceImageId srcImage;
930
   SVGASignedRect       srcRect;
931
   uint32               destScreenId; /* Screen Object ID */
932
   SVGASignedRect       destRect;
933
   /* Clipping: zero or more SVGASignedRects follow */
934
}
935
#include "vmware_pack_end.h"
936
SVGA3dCmdBlitSurfaceToScreen;         /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */
937
 
938
typedef
939
#include "vmware_pack_begin.h"
940
struct {
941
   uint32               sid;
942
   SVGA3dTextureFilter  filter;
943
}
944
#include "vmware_pack_end.h"
945
SVGA3dCmdGenerateMipmaps;             /* SVGA_3D_CMD_GENERATE_MIPMAPS */
946
 
947
 
948
 
949
typedef
950
#include "vmware_pack_begin.h"
951
struct {
952
   uint32 sid;
953
}
954
#include "vmware_pack_end.h"
955
SVGA3dCmdActivateSurface;               /* SVGA_3D_CMD_ACTIVATE_SURFACE */
956
 
957
typedef
958
#include "vmware_pack_begin.h"
959
struct {
960
   uint32 sid;
961
}
962
#include "vmware_pack_end.h"
963
SVGA3dCmdDeactivateSurface;             /* SVGA_3D_CMD_DEACTIVATE_SURFACE */
964
 
965
/*
966
 * Screen DMA command
967
 *
968
 * Available with SVGA_FIFO_CAP_SCREEN_OBJECT_2.  The SVGA_CAP_3D device
969
 * cap bit is not required.
970
 *
971
 * - refBuffer and destBuffer are 32bit BGRX; refBuffer and destBuffer could
972
 *   be different, but it is required that guest makes sure refBuffer has
973
 *   exactly the same contents that were written to when last time screen DMA
974
 *   command is received by host.
975
 *
976
 * - changemap is generated by lib/blit, and it has the changes from last
977
 *   received screen DMA or more.
978
 */
979
 
980
typedef
981
#include "vmware_pack_begin.h"
982
struct SVGA3dCmdScreenDMA {
983
   uint32 screenId;
984
   SVGAGuestImage refBuffer;
985
   SVGAGuestImage destBuffer;
986
   SVGAGuestImage changeMap;
987
}
988
#include "vmware_pack_end.h"
989
SVGA3dCmdScreenDMA;        /* SVGA_3D_CMD_SCREEN_DMA */
990
 
991
/*
992
 * Set Unity Surface Cookie
993
 *
994
 * Associates the supplied cookie with the surface id for use with
995
 * Unity.  This cookie is a hint from guest to host, there is no way
996
 * for the guest to readback the cookie and the host is free to drop
997
 * the cookie association at will.  The default value for the cookie
998
 * on all surfaces is 0.
999
 */
1000
 
1001
typedef
1002
#include "vmware_pack_begin.h"
1003
struct SVGA3dCmdSetUnitySurfaceCookie {
1004
   uint32 sid;
1005
   uint64 cookie;
1006
}
1007
#include "vmware_pack_end.h"
1008
SVGA3dCmdSetUnitySurfaceCookie;   /* SVGA_3D_CMD_SET_UNITY_SURFACE_COOKIE */
1009
 
1010
/*
1011
 * Open a context-specific surface in a non-context-specific manner.
1012
 */
1013
 
1014
typedef
1015
#include "vmware_pack_begin.h"
1016
struct SVGA3dCmdOpenContextSurface {
1017
   uint32 sid;
1018
}
1019
#include "vmware_pack_end.h"
1020
SVGA3dCmdOpenContextSurface;   /* SVGA_3D_CMD_OPEN_CONTEXT_SURFACE */
1021
 
1022
 
1023
/*
1024
 * Logic ops
1025
 */
1026
 
1027
#define SVGA3D_LOTRANSBLT_HONORALPHA     (0x01)
1028
#define SVGA3D_LOSTRETCHBLT_MIRRORX      (0x01)
1029
#define SVGA3D_LOSTRETCHBLT_MIRRORY      (0x02)
1030
#define SVGA3D_LOALPHABLEND_SRCHASALPHA  (0x01)
1031
 
1032
typedef
1033
#include "vmware_pack_begin.h"
1034
struct SVGA3dCmdLogicOpsBitBlt {
1035
   /*
1036
    * All LogicOps surfaces are one-level
1037
    * surfaces so mipmap & face should always
1038
    * be zero.
1039
    */
1040
   SVGA3dSurfaceImageId src;
1041
   SVGA3dSurfaceImageId dst;
1042
   SVGA3dLogicOp logicOp;
1043
   /* Followed by variable number of SVGA3dCopyBox structures */
1044
}
1045
#include "vmware_pack_end.h"
1046
SVGA3dCmdLogicOpsBitBlt;   /* SVGA_3D_CMD_LOGICOPS_BITBLT */
1047
 
1048
 
1049
typedef
1050
#include "vmware_pack_begin.h"
1051
struct SVGA3dCmdLogicOpsTransBlt {
1052
   /*
1053
    * All LogicOps surfaces are one-level
1054
    * surfaces so mipmap & face should always
1055
    * be zero.
1056
    */
1057
   SVGA3dSurfaceImageId src;
1058
   SVGA3dSurfaceImageId dst;
1059
   uint32 color;
1060
   uint32 flags;
1061
   SVGA3dBox srcBox;
1062
   SVGA3dBox dstBox;
1063
}
1064
#include "vmware_pack_end.h"
1065
SVGA3dCmdLogicOpsTransBlt;   /* SVGA_3D_CMD_LOGICOPS_TRANSBLT */
1066
 
1067
 
1068
typedef
1069
#include "vmware_pack_begin.h"
1070
struct SVGA3dCmdLogicOpsStretchBlt {
1071
   /*
1072
    * All LogicOps surfaces are one-level
1073
    * surfaces so mipmap & face should always
1074
    * be zero.
1075
    */
1076
   SVGA3dSurfaceImageId src;
1077
   SVGA3dSurfaceImageId dst;
1078
   uint16 mode;
1079
   uint16 flags;
1080
   SVGA3dBox srcBox;
1081
   SVGA3dBox dstBox;
1082
}
1083
#include "vmware_pack_end.h"
1084
SVGA3dCmdLogicOpsStretchBlt;   /* SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
1085
 
1086
 
1087
typedef
1088
#include "vmware_pack_begin.h"
1089
struct SVGA3dCmdLogicOpsColorFill {
1090
   /*
1091
    * All LogicOps surfaces are one-level
1092
    * surfaces so mipmap & face should always
1093
    * be zero.
1094
    */
1095
   SVGA3dSurfaceImageId dst;
1096
   uint32 color;
1097
   SVGA3dLogicOp logicOp;
1098
   /* Followed by variable number of SVGA3dRect structures. */
1099
}
1100
#include "vmware_pack_end.h"
1101
SVGA3dCmdLogicOpsColorFill;   /* SVGA_3D_CMD_LOGICOPS_COLORFILL */
1102
 
1103
 
1104
typedef
1105
#include "vmware_pack_begin.h"
1106
struct SVGA3dCmdLogicOpsAlphaBlend {
1107
   /*
1108
    * All LogicOps surfaces are one-level
1109
    * surfaces so mipmap & face should always
1110
    * be zero.
1111
    */
1112
   SVGA3dSurfaceImageId src;
1113
   SVGA3dSurfaceImageId dst;
1114
   uint32 alphaVal;
1115
   uint32 flags;
1116
   SVGA3dBox srcBox;
1117
   SVGA3dBox dstBox;
1118
}
1119
#include "vmware_pack_end.h"
1120
SVGA3dCmdLogicOpsAlphaBlend;   /* SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
1121
 
1122
#define SVGA3D_CLEARTYPE_INVALID_GAMMA_INDEX 0xFFFFFFFF
1123
 
1124
#define SVGA3D_CLEARTYPE_GAMMA_WIDTH  512
1125
#define SVGA3D_CLEARTYPE_GAMMA_HEIGHT 16
1126
 
1127
typedef
1128
#include "vmware_pack_begin.h"
1129
struct SVGA3dCmdLogicOpsClearTypeBlend {
1130
   /*
1131
    * All LogicOps surfaces are one-level
1132
    * surfaces so mipmap & face should always
1133
    * be zero.
1134
    */
1135
   SVGA3dSurfaceImageId tmp;
1136
   SVGA3dSurfaceImageId dst;
1137
   SVGA3dSurfaceImageId gammaSurf;
1138
   SVGA3dSurfaceImageId alphaSurf;
1139
   uint32 gamma;
1140
   uint32 color;
1141
   uint32 color2;
1142
   int alphaOffsetX;
1143
   int alphaOffsetY;
1144
   /* Followed by variable number of SVGA3dBox structures */
1145
}
1146
#include "vmware_pack_end.h"
1147
SVGA3dCmdLogicOpsClearTypeBlend;   /* SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
1148
 
1149
 
1150
/*
1151
 * Guest-backed objects definitions.
1152
 */
1153
 
1154
#define SVGA_STFLAG_PRIMARY (1 << 0)
1155
typedef uint32 SVGAScreenTargetFlags;
1156
 
1157
typedef
1158
#include "vmware_pack_begin.h"
1159
struct {
1160
   float value[4];
1161
}
1162
#include "vmware_pack_end.h"
1163
SVGA3dShaderConstFloat;
1164
 
1165
typedef
1166
#include "vmware_pack_begin.h"
1167
struct {
1168
   int32 value[4];
1169
}
1170
#include "vmware_pack_end.h"
1171
SVGA3dShaderConstInt;
1172
 
1173
typedef
1174
#include "vmware_pack_begin.h"
1175
struct {
1176
   uint32 value;
1177
}
1178
#include "vmware_pack_end.h"
1179
SVGA3dShaderConstBool;
1180
 
1181
/*
1182
 * Define a guest-backed surface.
1183
 */
1184
 
1185
typedef
1186
#include "vmware_pack_begin.h"
1187
struct SVGA3dCmdDefineGBSurface {
1188
   uint32 sid;
1189
   SVGA3dSurfaceFlags surfaceFlags;
1190
   SVGA3dSurfaceFormat format;
1191
   uint32 numMipLevels;
1192
   uint32 multisampleCount;
1193
   SVGA3dTextureFilter autogenFilter;
1194
   SVGA3dSize size;
1195
}
1196
#include "vmware_pack_end.h"
1197
SVGA3dCmdDefineGBSurface;   /* SVGA_3D_CMD_DEFINE_GB_SURFACE */
1198
 
1199
/*
1200
 * Destroy a guest-backed surface.
1201
 */
1202
 
1203
typedef
1204
#include "vmware_pack_begin.h"
1205
struct SVGA3dCmdDestroyGBSurface {
1206
   uint32 sid;
1207
}
1208
#include "vmware_pack_end.h"
1209
SVGA3dCmdDestroyGBSurface;   /* SVGA_3D_CMD_DESTROY_GB_SURFACE */
1210
 
1211
/*
1212
 * Bind a guest-backed surface to a mob.
1213
 */
1214
 
1215
typedef
1216
#include "vmware_pack_begin.h"
1217
struct SVGA3dCmdBindGBSurface {
1218
   uint32 sid;
1219
   SVGAMobId mobid;
1220
}
1221
#include "vmware_pack_end.h"
1222
SVGA3dCmdBindGBSurface;   /* SVGA_3D_CMD_BIND_GB_SURFACE */
1223
 
1224
typedef
1225
#include "vmware_pack_begin.h"
1226
struct SVGA3dCmdBindGBSurfaceWithPitch {
1227
   uint32 sid;
1228
   SVGAMobId mobid;
1229
   uint32 baseLevelPitch;
1230
}
1231
#include "vmware_pack_end.h"
1232
SVGA3dCmdBindGBSurfaceWithPitch;   /* SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH */
1233
 
1234
/*
1235
 * Conditionally bind a mob to a guest-backed surface if testMobid
1236
 * matches the currently bound mob.  Optionally issue a
1237
 * readback/update on the surface while it is still bound to the old
1238
 * mobid if the mobid is changed by this command.
1239
 */
1240
 
1241
#define SVGA3D_COND_BIND_GB_SURFACE_FLAG_READBACK (1 << 0)
1242
#define SVGA3D_COND_BIND_GB_SURFACE_FLAG_UPDATE   (1 << 1)
1243
 
1244
typedef
1245
#include "vmware_pack_begin.h"
1246
struct{
1247
   uint32 sid;
1248
   SVGAMobId testMobid;
1249
   SVGAMobId mobid;
1250
   uint32 flags;
1251
}
1252
#include "vmware_pack_end.h"
1253
SVGA3dCmdCondBindGBSurface;          /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */
1254
 
1255
/*
1256
 * Update an image in a guest-backed surface.
1257
 * (Inform the device that the guest-contents have been updated.)
1258
 */
1259
 
1260
typedef
1261
#include "vmware_pack_begin.h"
1262
struct SVGA3dCmdUpdateGBImage {
1263
   SVGA3dSurfaceImageId image;
1264
   SVGA3dBox box;
1265
}
1266
#include "vmware_pack_end.h"
1267
SVGA3dCmdUpdateGBImage;   /* SVGA_3D_CMD_UPDATE_GB_IMAGE */
1268
 
1269
/*
1270
 * Update an entire guest-backed surface.
1271
 * (Inform the device that the guest-contents have been updated.)
1272
 */
1273
 
1274
typedef
1275
#include "vmware_pack_begin.h"
1276
struct SVGA3dCmdUpdateGBSurface {
1277
   uint32 sid;
1278
}
1279
#include "vmware_pack_end.h"
1280
SVGA3dCmdUpdateGBSurface;   /* SVGA_3D_CMD_UPDATE_GB_SURFACE */
1281
 
1282
/*
1283
 * Readback an image in a guest-backed surface.
1284
 * (Request the device to flush the dirty contents into the guest.)
1285
 */
1286
 
1287
typedef
1288
#include "vmware_pack_begin.h"
1289
struct SVGA3dCmdReadbackGBImage {
1290
   SVGA3dSurfaceImageId image;
1291
}
1292
#include "vmware_pack_end.h"
1293
SVGA3dCmdReadbackGBImage;   /* SVGA_3D_CMD_READBACK_GB_IMAGE */
1294
 
1295
/*
1296
 * Readback an entire guest-backed surface.
1297
 * (Request the device to flush the dirty contents into the guest.)
1298
 */
1299
 
1300
typedef
1301
#include "vmware_pack_begin.h"
1302
struct SVGA3dCmdReadbackGBSurface {
1303
   uint32 sid;
1304
}
1305
#include "vmware_pack_end.h"
1306
SVGA3dCmdReadbackGBSurface;   /* SVGA_3D_CMD_READBACK_GB_SURFACE */
1307
 
1308
/*
1309
 * Readback a sub rect of an image in a guest-backed surface.  After
1310
 * issuing this command the driver is required to issue an update call
1311
 * of the same region before issuing any other commands that reference
1312
 * this surface or rendering is not guaranteed.
1313
 */
1314
 
1315
typedef
1316
#include "vmware_pack_begin.h"
1317
struct SVGA3dCmdReadbackGBImagePartial {
1318
   SVGA3dSurfaceImageId image;
1319
   SVGA3dBox box;
1320
   uint32 invertBox;
1321
}
1322
#include "vmware_pack_end.h"
1323
SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
1324
 
1325
 
1326
/*
1327
 * Invalidate an image in a guest-backed surface.
1328
 * (Notify the device that the contents can be lost.)
1329
 */
1330
 
1331
typedef
1332
#include "vmware_pack_begin.h"
1333
struct SVGA3dCmdInvalidateGBImage {
1334
   SVGA3dSurfaceImageId image;
1335
}
1336
#include "vmware_pack_end.h"
1337
SVGA3dCmdInvalidateGBImage;   /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */
1338
 
1339
/*
1340
 * Invalidate an entire guest-backed surface.
1341
 * (Notify the device that the contents if all images can be lost.)
1342
 */
1343
 
1344
typedef
1345
#include "vmware_pack_begin.h"
1346
struct SVGA3dCmdInvalidateGBSurface {
1347
   uint32 sid;
1348
}
1349
#include "vmware_pack_end.h"
1350
SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */
1351
 
1352
/*
1353
 * Invalidate a sub rect of an image in a guest-backed surface.  After
1354
 * issuing this command the driver is required to issue an update call
1355
 * of the same region before issuing any other commands that reference
1356
 * this surface or rendering is not guaranteed.
1357
 */
1358
 
1359
typedef
1360
#include "vmware_pack_begin.h"
1361
struct SVGA3dCmdInvalidateGBImagePartial {
1362
   SVGA3dSurfaceImageId image;
1363
   SVGA3dBox box;
1364
   uint32 invertBox;
1365
}
1366
#include "vmware_pack_end.h"
1367
SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
1368
 
1369
 
1370
/*
1371
 * Define a guest-backed context.
1372
 */
1373
 
1374
typedef
1375
#include "vmware_pack_begin.h"
1376
struct SVGA3dCmdDefineGBContext {
1377
   uint32 cid;
1378
}
1379
#include "vmware_pack_end.h"
1380
SVGA3dCmdDefineGBContext;   /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */
1381
 
1382
/*
1383
 * Destroy a guest-backed context.
1384
 */
1385
 
1386
typedef
1387
#include "vmware_pack_begin.h"
1388
struct SVGA3dCmdDestroyGBContext {
1389
   uint32 cid;
1390
}
1391
#include "vmware_pack_end.h"
1392
SVGA3dCmdDestroyGBContext;   /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */
1393
 
1394
/*
1395
 * Bind a guest-backed context.
1396
 *
1397
 * validContents should be set to 0 for new contexts,
1398
 * and 1 if this is an old context which is getting paged
1399
 * back on to the device.
1400
 *
1401
 * For new contexts, it is recommended that the driver
1402
 * issue commands to initialize all interesting state
1403
 * prior to rendering.
1404
 */
1405
 
1406
typedef
1407
#include "vmware_pack_begin.h"
1408
struct SVGA3dCmdBindGBContext {
1409
   uint32 cid;
1410
   SVGAMobId mobid;
1411
   uint32 validContents;
1412
}
1413
#include "vmware_pack_end.h"
1414
SVGA3dCmdBindGBContext;   /* SVGA_3D_CMD_BIND_GB_CONTEXT */
1415
 
1416
/*
1417
 * Readback a guest-backed context.
1418
 * (Request that the device flush the contents back into guest memory.)
1419
 */
1420
 
1421
typedef
1422
#include "vmware_pack_begin.h"
1423
struct SVGA3dCmdReadbackGBContext {
1424
   uint32 cid;
1425
}
1426
#include "vmware_pack_end.h"
1427
SVGA3dCmdReadbackGBContext;   /* SVGA_3D_CMD_READBACK_GB_CONTEXT */
1428
 
1429
/*
1430
 * Invalidate a guest-backed context.
1431
 */
1432
typedef
1433
#include "vmware_pack_begin.h"
1434
struct SVGA3dCmdInvalidateGBContext {
1435
   uint32 cid;
1436
}
1437
#include "vmware_pack_end.h"
1438
SVGA3dCmdInvalidateGBContext;   /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */
1439
 
1440
/*
1441
 * Define a guest-backed shader.
1442
 */
1443
 
1444
typedef
1445
#include "vmware_pack_begin.h"
1446
struct SVGA3dCmdDefineGBShader {
1447
   uint32 shid;
1448
   SVGA3dShaderType type;
1449
   uint32 sizeInBytes;
1450
}
1451
#include "vmware_pack_end.h"
1452
SVGA3dCmdDefineGBShader;   /* SVGA_3D_CMD_DEFINE_GB_SHADER */
1453
 
1454
/*
1455
 * Bind a guest-backed shader.
1456
 */
1457
 
1458
typedef
1459
#include "vmware_pack_begin.h"
1460
struct SVGA3dCmdBindGBShader {
1461
   uint32 shid;
1462
   SVGAMobId mobid;
1463
   uint32 offsetInBytes;
1464
}
1465
#include "vmware_pack_end.h"
1466
SVGA3dCmdBindGBShader;   /* SVGA_3D_CMD_BIND_GB_SHADER */
1467
 
1468
/*
1469
 * Destroy a guest-backed shader.
1470
 */
1471
 
1472
typedef
1473
#include "vmware_pack_begin.h"
1474
struct SVGA3dCmdDestroyGBShader {
1475
   uint32 shid;
1476
}
1477
#include "vmware_pack_end.h"
1478
SVGA3dCmdDestroyGBShader;   /* SVGA_3D_CMD_DESTROY_GB_SHADER */
1479
 
1480
 
1481
typedef
1482
#include "vmware_pack_begin.h"
1483
struct SVGA3dCmdBindGBShaderConsts {
1484
   uint32 cid;
1485
   SVGA3dShaderType shaderType;
1486
   SVGA3dShaderConstType shaderConstType;
1487
   uint32 sid;
1488
}
1489
#include "vmware_pack_end.h"
1490
SVGA3dCmdBindGBShaderConsts;   /* SVGA_3D_CMD_BIND_SHADERCONSTS */
1491
 
1492
typedef
1493
#include "vmware_pack_begin.h"
1494
struct {
1495
   uint32                  cid;
1496
   uint32                  regStart;
1497
   SVGA3dShaderType        shaderType;
1498
   SVGA3dShaderConstType   constType;
1499
 
1500
   /*
1501
    * Followed by a variable number of shader constants.
1502
    *
1503
    * Note that FLOAT and INT constants are 4-dwords in length, while
1504
    * BOOL constants are 1-dword in length.
1505
    */
1506
}
1507
#include "vmware_pack_end.h"
1508
SVGA3dCmdSetGBShaderConstInline;   /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */
1509
 
1510
 
1511
typedef
1512
#include "vmware_pack_begin.h"
1513
struct {
1514
   uint32               cid;
1515
   SVGA3dQueryType      type;
1516
}
1517
#include "vmware_pack_end.h"
1518
SVGA3dCmdBeginGBQuery;           /* SVGA_3D_CMD_BEGIN_GB_QUERY */
1519
 
1520
typedef
1521
#include "vmware_pack_begin.h"
1522
struct {
1523
   uint32               cid;
1524
   SVGA3dQueryType      type;
1525
   SVGAMobId mobid;
1526
   uint32 offset;
1527
}
1528
#include "vmware_pack_end.h"
1529
SVGA3dCmdEndGBQuery;                  /* SVGA_3D_CMD_END_GB_QUERY */
1530
 
1531
 
1532
/*
1533
 * SVGA_3D_CMD_WAIT_FOR_GB_QUERY --
1534
 *
1535
 *    The semantics of this command are identical to the
1536
 *    SVGA_3D_CMD_WAIT_FOR_QUERY except that the results are written
1537
 *    to a Mob instead of a GMR.
1538
 */
1539
 
1540
typedef
1541
#include "vmware_pack_begin.h"
1542
struct {
1543
   uint32               cid;
1544
   SVGA3dQueryType      type;
1545
   SVGAMobId mobid;
1546
   uint32 offset;
1547
}
1548
#include "vmware_pack_end.h"
1549
SVGA3dCmdWaitForGBQuery;          /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */
1550
 
1551
 
1552
typedef
1553
#include "vmware_pack_begin.h"
1554
struct {
1555
   SVGAMobId mobid;
1556
   uint32 fbOffset;
1557
   uint32 initialized;
1558
}
1559
#include "vmware_pack_end.h"
1560
SVGA3dCmdEnableGart;              /* SVGA_3D_CMD_ENABLE_GART */
1561
 
1562
typedef
1563
#include "vmware_pack_begin.h"
1564
struct {
1565
   SVGAMobId mobid;
1566
   uint32 gartOffset;
1567
}
1568
#include "vmware_pack_end.h"
1569
SVGA3dCmdMapMobIntoGart;          /* SVGA_3D_CMD_MAP_MOB_INTO_GART */
1570
 
1571
 
1572
typedef
1573
#include "vmware_pack_begin.h"
1574
struct {
1575
   uint32 gartOffset;
1576
   uint32 numPages;
1577
}
1578
#include "vmware_pack_end.h"
1579
SVGA3dCmdUnmapGartRange;          /* SVGA_3D_CMD_UNMAP_GART_RANGE */
1580
 
1581
 
1582
/*
1583
 * Screen Targets
1584
 */
1585
 
1586
typedef
1587
#include "vmware_pack_begin.h"
1588
struct {
1589
   uint32 stid;
1590
   uint32 width;
1591
   uint32 height;
1592
   int32 xRoot;
1593
   int32 yRoot;
1594
   SVGAScreenTargetFlags flags;
1595
 
1596
   /*
1597
    * The physical DPI that the guest expects this screen displayed at.
1598
    *
1599
    * Guests which are not DPI-aware should set this to zero.
1600
    */
1601
   uint32 dpi;
1602
}
1603
#include "vmware_pack_end.h"
1604
SVGA3dCmdDefineGBScreenTarget;    /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */
1605
 
1606
typedef
1607
#include "vmware_pack_begin.h"
1608
struct {
1609
   uint32 stid;
1610
}
1611
#include "vmware_pack_end.h"
1612
SVGA3dCmdDestroyGBScreenTarget;  /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */
1613
 
1614
typedef
1615
#include "vmware_pack_begin.h"
1616
struct {
1617
   uint32 stid;
1618
   SVGA3dSurfaceImageId image;
1619
}
1620
#include "vmware_pack_end.h"
1621
SVGA3dCmdBindGBScreenTarget;  /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */
1622
 
1623
typedef
1624
#include "vmware_pack_begin.h"
1625
struct {
1626
   uint32 stid;
1627
   SVGA3dRect rect;
1628
}
1629
#include "vmware_pack_end.h"
1630
SVGA3dCmdUpdateGBScreenTarget;  /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */
1631
 
1632
typedef
1633
#include "vmware_pack_begin.h"
1634
struct SVGA3dCmdGBScreenDMA {
1635
   uint32 screenId;
1636
   uint32 dead;
1637
   SVGAMobId destMobID;
1638
   uint32 destPitch;
1639
   SVGAMobId changeMapMobID;
1640
}
1641
#include "vmware_pack_end.h"
1642
SVGA3dCmdGBScreenDMA;        /* SVGA_3D_CMD_GB_SCREEN_DMA */
1643
 
1644
typedef
1645
#include "vmware_pack_begin.h"
1646
struct {
1647
   uint32 value;
1648
   uint32 mobId;
1649
   uint32 mobOffset;
1650
}
1651
#include "vmware_pack_end.h"
1652
SVGA3dCmdGBMobFence;  /* SVGA_3D_CMD_GB_MOB_FENCE*/
1653
 
1654
#endif // _SVGA3D_CMD_H_