Linux Audio

Check our new training course

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