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