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