1 /********************************************************** 2 * Copyright 1998-2021 VMware, Inc. 3 * SPDX-License-Identifier: GPL-2.0 OR MIT 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 * svga_reg.h -- 29 * 30 * Virtual hardware definitions for the VMware SVGA II device. 31 */ 32 33 34 35 #ifndef _SVGA_REG_H_ 36 #define _SVGA_REG_H_ 37 38 #include "vm_basic_types.h" 39 40 typedef enum { 41 SVGA_REG_ENABLE_DISABLE = 0, 42 SVGA_REG_ENABLE_ENABLE = (1 << 0), 43 SVGA_REG_ENABLE_HIDE = (1 << 1), 44 } SvgaRegEnable; 45 46 typedef uint32 SVGAMobId; 47 48 #define SVGA_MAX_WIDTH 2560 49 #define SVGA_MAX_HEIGHT 1600 50 51 #define SVGA_MAX_BITS_PER_PIXEL 32 52 #define SVGA_MAX_DEPTH 24 53 #define SVGA_MAX_DISPLAYS 10 54 #define SVGA_MAX_SCREEN_SIZE 8192 55 #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS) 56 57 #define SVGA_CURSOR_ON_HIDE 0x0 58 #define SVGA_CURSOR_ON_SHOW 0x1 59 60 #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 61 62 #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 63 64 #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000 65 66 #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 67 #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH) 68 #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS) 69 70 #define SVGA_MAGIC 0x900000UL 71 #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver)) 72 73 #define SVGA_VERSION_3 3 74 #define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3) 75 76 #define SVGA_VERSION_2 2 77 #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2) 78 79 #define SVGA_VERSION_1 1 80 #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1) 81 82 #define SVGA_VERSION_0 0 83 #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) 84 85 #define SVGA_ID_INVALID 0xFFFFFFFF 86 87 #define SVGA_INDEX_PORT 0x0 88 #define SVGA_VALUE_PORT 0x1 89 #define SVGA_BIOS_PORT 0x2 90 #define SVGA_IRQSTATUS_PORT 0x8 91 92 #define SVGA_IRQFLAG_ANY_FENCE (1 << 0) 93 #define SVGA_IRQFLAG_FIFO_PROGRESS (1 << 1) 94 #define SVGA_IRQFLAG_FENCE_GOAL (1 << 2) 95 #define SVGA_IRQFLAG_COMMAND_BUFFER (1 << 3) 96 #define SVGA_IRQFLAG_ERROR (1 << 4) 97 #define SVGA_IRQFLAG_REG_FENCE_GOAL (1 << 5) 98 #define SVGA_IRQFLAG_MAX (1 << 6) 99 100 #define SVGA_MAX_CURSOR_CMD_BYTES (40 * 1024) 101 #define SVGA_MAX_CURSOR_CMD_DIMENSION 1024 102 103 enum { 104 SVGA_REG_ID = 0, 105 SVGA_REG_ENABLE = 1, 106 SVGA_REG_WIDTH = 2, 107 SVGA_REG_HEIGHT = 3, 108 SVGA_REG_MAX_WIDTH = 4, 109 SVGA_REG_MAX_HEIGHT = 5, 110 SVGA_REG_DEPTH = 6, 111 SVGA_REG_BITS_PER_PIXEL = 7, 112 SVGA_REG_PSEUDOCOLOR = 8, 113 SVGA_REG_RED_MASK = 9, 114 SVGA_REG_GREEN_MASK = 10, 115 SVGA_REG_BLUE_MASK = 11, 116 SVGA_REG_BYTES_PER_LINE = 12, 117 SVGA_REG_FB_START = 13, 118 SVGA_REG_FB_OFFSET = 14, 119 SVGA_REG_VRAM_SIZE = 15, 120 SVGA_REG_FB_SIZE = 16, 121 122 SVGA_REG_ID_0_TOP = 17, 123 124 SVGA_REG_CAPABILITIES = 17, 125 SVGA_REG_MEM_START = 18, 126 SVGA_REG_MEM_SIZE = 19, 127 SVGA_REG_CONFIG_DONE = 20, 128 SVGA_REG_SYNC = 21, 129 SVGA_REG_BUSY = 22, 130 SVGA_REG_GUEST_ID = 23, 131 SVGA_REG_DEAD = 24, 132 SVGA_REG_CURSOR_X = 25, 133 SVGA_REG_CURSOR_Y = 26, 134 SVGA_REG_CURSOR_ON = 27, 135 SVGA_REG_HOST_BITS_PER_PIXEL = 28, 136 SVGA_REG_SCRATCH_SIZE = 29, 137 SVGA_REG_MEM_REGS = 30, 138 SVGA_REG_NUM_DISPLAYS = 31, 139 SVGA_REG_PITCHLOCK = 32, 140 SVGA_REG_IRQMASK = 33, 141 142 SVGA_REG_NUM_GUEST_DISPLAYS = 34, 143 SVGA_REG_DISPLAY_ID = 35, 144 SVGA_REG_DISPLAY_IS_PRIMARY = 36, 145 SVGA_REG_DISPLAY_POSITION_X = 37, 146 SVGA_REG_DISPLAY_POSITION_Y = 38, 147 SVGA_REG_DISPLAY_WIDTH = 39, 148 SVGA_REG_DISPLAY_HEIGHT = 40, 149 150 SVGA_REG_GMR_ID = 41, 151 SVGA_REG_GMR_DESCRIPTOR = 42, 152 SVGA_REG_GMR_MAX_IDS = 43, 153 SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44, 154 155 SVGA_REG_TRACES = 45, 156 SVGA_REG_GMRS_MAX_PAGES = 46, 157 SVGA_REG_MEMORY_SIZE = 47, 158 SVGA_REG_COMMAND_LOW = 48, 159 SVGA_REG_COMMAND_HIGH = 49, 160 161 SVGA_REG_MAX_PRIMARY_MEM = 50, 162 163 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, 164 165 SVGA_REG_DEV_CAP = 52, 166 SVGA_REG_CMD_PREPEND_LOW = 53, 167 SVGA_REG_CMD_PREPEND_HIGH = 54, 168 SVGA_REG_SCREENTARGET_MAX_WIDTH = 55, 169 SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56, 170 SVGA_REG_MOB_MAX_SIZE = 57, 171 SVGA_REG_BLANK_SCREEN_TARGETS = 58, 172 SVGA_REG_CAP2 = 59, 173 SVGA_REG_DEVEL_CAP = 60, 174 175 SVGA_REG_GUEST_DRIVER_ID = 61, 176 SVGA_REG_GUEST_DRIVER_VERSION1 = 62, 177 SVGA_REG_GUEST_DRIVER_VERSION2 = 63, 178 SVGA_REG_GUEST_DRIVER_VERSION3 = 64, 179 180 SVGA_REG_CURSOR_MOBID = 65, 181 SVGA_REG_CURSOR_MAX_BYTE_SIZE = 66, 182 SVGA_REG_CURSOR_MAX_DIMENSION = 67, 183 184 SVGA_REG_FIFO_CAPS = 68, 185 SVGA_REG_FENCE = 69, 186 187 SVGA_REG_CURSOR4_ON = 70, 188 SVGA_REG_CURSOR4_X = 71, 189 SVGA_REG_CURSOR4_Y = 72, 190 SVGA_REG_CURSOR4_SCREEN_ID = 73, 191 SVGA_REG_CURSOR4_SUBMIT = 74, 192 193 SVGA_REG_SCREENDMA = 75, 194 195 SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76, 196 197 SVGA_REG_REGS_START_HIGH32 = 77, 198 SVGA_REG_REGS_START_LOW32 = 78, 199 SVGA_REG_FB_START_HIGH32 = 79, 200 SVGA_REG_FB_START_LOW32 = 80, 201 202 SVGA_REG_MSHINT = 81, 203 204 SVGA_REG_IRQ_STATUS = 82, 205 206 SVGA_REG_DIRTY_TRACKING = 83, 207 SVGA_REG_FENCE_GOAL = 84, 208 209 SVGA_REG_TOP = 85, 210 211 SVGA_PALETTE_BASE = 1024, 212 213 SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS 214 215 }; 216 217 typedef enum SVGARegGuestDriverId { 218 SVGA_REG_GUEST_DRIVER_ID_UNKNOWN = 0, 219 SVGA_REG_GUEST_DRIVER_ID_WDDM = 1, 220 SVGA_REG_GUEST_DRIVER_ID_LINUX = 2, 221 SVGA_REG_GUEST_DRIVER_ID_MAX, 222 223 SVGA_REG_GUEST_DRIVER_ID_SUBMIT = MAX_UINT32, 224 } SVGARegGuestDriverId; 225 226 typedef enum SVGARegMSHint { 227 SVGA_REG_MSHINT_DISABLED = 0, 228 SVGA_REG_MSHINT_FULL = 1, 229 SVGA_REG_MSHINT_RESOLVED = 2, 230 } SVGARegMSHint; 231 232 typedef enum SVGARegDirtyTracking { 233 SVGA_REG_DIRTY_TRACKING_PER_IMAGE = 0, 234 SVGA_REG_DIRTY_TRACKING_PER_SURFACE = 1, 235 } SVGARegDirtyTracking; 236 237 #define SVGA_GMR_NULL ((uint32)-1) 238 #define SVGA_GMR_FRAMEBUFFER ((uint32)-2) 239 240 #pragma pack(push, 1) 241 typedef struct SVGAGuestMemDescriptor { 242 uint32 ppn; 243 uint32 numPages; 244 } SVGAGuestMemDescriptor; 245 #pragma pack(pop) 246 247 #pragma pack(push, 1) 248 typedef struct SVGAGuestPtr { 249 uint32 gmrId; 250 uint32 offset; 251 } SVGAGuestPtr; 252 #pragma pack(pop) 253 254 #define SVGA_CB_MAX_SIZE_DEFAULT (KBYTES_2_BYTES(512)) 255 #define SVGA_CB_MAX_SIZE_4MB (MBYTES_2_BYTES(4)) 256 #define SVGA_CB_MAX_SIZE SVGA_CB_MAX_SIZE_4MB 257 #define SVGA_CB_MAX_QUEUED_PER_CONTEXT 32 258 #define SVGA_CB_MAX_COMMAND_SIZE (32 * 1024) 259 260 #define SVGA_CB_CONTEXT_MASK 0x3f 261 typedef enum { 262 SVGA_CB_CONTEXT_DEVICE = 0x3f, 263 SVGA_CB_CONTEXT_0 = 0x0, 264 SVGA_CB_CONTEXT_1 = 0x1, 265 SVGA_CB_CONTEXT_MAX = 0x2, 266 } SVGACBContext; 267 268 typedef enum { 269 270 SVGA_CB_STATUS_NONE = 0, 271 272 SVGA_CB_STATUS_COMPLETED = 1, 273 274 SVGA_CB_STATUS_QUEUE_FULL = 2, 275 276 SVGA_CB_STATUS_COMMAND_ERROR = 3, 277 278 SVGA_CB_STATUS_CB_HEADER_ERROR = 4, 279 280 SVGA_CB_STATUS_PREEMPTED = 5, 281 282 SVGA_CB_STATUS_SUBMISSION_ERROR = 6, 283 284 SVGA_CB_STATUS_PARTIAL_COMPLETE = 7, 285 } SVGACBStatus; 286 287 typedef enum { 288 SVGA_CB_FLAG_NONE = 0, 289 SVGA_CB_FLAG_NO_IRQ = 1 << 0, 290 SVGA_CB_FLAG_DX_CONTEXT = 1 << 1, 291 SVGA_CB_FLAG_MOB = 1 << 2, 292 } SVGACBFlags; 293 294 #pragma pack(push, 1) 295 typedef struct { 296 volatile SVGACBStatus status; 297 volatile uint32 errorOffset; 298 uint64 id; 299 SVGACBFlags flags; 300 uint32 length; 301 union { 302 PA pa; 303 struct { 304 SVGAMobId mobid; 305 uint32 mobOffset; 306 } mob; 307 } ptr; 308 uint32 offset; 309 uint32 dxContext; 310 uint32 mustBeZero[6]; 311 } SVGACBHeader; 312 #pragma pack(pop) 313 314 typedef enum { 315 SVGA_DC_CMD_NOP = 0, 316 SVGA_DC_CMD_START_STOP_CONTEXT = 1, 317 SVGA_DC_CMD_PREEMPT = 2, 318 SVGA_DC_CMD_START_QUEUE = 3, 319 SVGA_DC_CMD_ASYNC_STOP_QUEUE = 4, 320 SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE = 5, 321 SVGA_DC_CMD_MAX = 6 322 } SVGADeviceContextCmdId; 323 324 typedef struct SVGADCCmdStartStop { 325 uint32 enable; 326 SVGACBContext context; 327 } SVGADCCmdStartStop; 328 329 typedef struct SVGADCCmdPreempt { 330 SVGACBContext context; 331 uint32 ignoreIDZero; 332 } SVGADCCmdPreempt; 333 334 typedef struct SVGADCCmdStartQueue { 335 SVGACBContext context; 336 } SVGADCCmdStartQueue; 337 338 typedef struct SVGADCCmdAsyncStopQueue { 339 SVGACBContext context; 340 } SVGADCCmdAsyncStopQueue; 341 342 typedef struct SVGADCCmdEmptyQueue { 343 SVGACBContext context; 344 } SVGADCCmdEmptyQueue; 345 346 typedef struct SVGAGMRImageFormat { 347 union { 348 struct { 349 uint32 bitsPerPixel : 8; 350 uint32 colorDepth : 8; 351 uint32 reserved : 16; 352 }; 353 354 uint32 value; 355 }; 356 } SVGAGMRImageFormat; 357 358 #pragma pack(push, 1) 359 typedef struct SVGAGuestImage { 360 SVGAGuestPtr ptr; 361 362 uint32 pitch; 363 } SVGAGuestImage; 364 #pragma pack(pop) 365 366 typedef struct SVGAColorBGRX { 367 union { 368 struct { 369 uint32 b : 8; 370 uint32 g : 8; 371 uint32 r : 8; 372 uint32 x : 8; 373 }; 374 375 uint32 value; 376 }; 377 } SVGAColorBGRX; 378 379 #pragma pack(push, 1) 380 typedef struct { 381 int32 left; 382 int32 top; 383 int32 right; 384 int32 bottom; 385 } SVGASignedRect; 386 #pragma pack(pop) 387 388 #pragma pack(push, 1) 389 typedef struct { 390 int32 x; 391 int32 y; 392 } SVGASignedPoint; 393 #pragma pack(pop) 394 395 #pragma pack(push, 1) 396 typedef struct { 397 uint32 x; 398 uint32 y; 399 } SVGAUnsignedPoint; 400 #pragma pack(pop) 401 402 #define SVGA_CAP_NONE 0x00000000 403 #define SVGA_CAP_RECT_COPY 0x00000002 404 #define SVGA_CAP_CURSOR 0x00000020 405 #define SVGA_CAP_CURSOR_BYPASS 0x00000040 406 #define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 407 #define SVGA_CAP_8BIT_EMULATION 0x00000100 408 #define SVGA_CAP_ALPHA_CURSOR 0x00000200 409 #define SVGA_CAP_3D 0x00004000 410 #define SVGA_CAP_EXTENDED_FIFO 0x00008000 411 #define SVGA_CAP_MULTIMON 0x00010000 412 #define SVGA_CAP_PITCHLOCK 0x00020000 413 #define SVGA_CAP_IRQMASK 0x00040000 414 #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 415 #define SVGA_CAP_GMR 0x00100000 416 #define SVGA_CAP_TRACES 0x00200000 417 #define SVGA_CAP_GMR2 0x00400000 418 #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000 419 #define SVGA_CAP_COMMAND_BUFFERS 0x01000000 420 #define SVGA_CAP_DEAD1 0x02000000 421 #define SVGA_CAP_CMD_BUFFERS_2 0x04000000 422 #define SVGA_CAP_GBOBJECTS 0x08000000 423 #define SVGA_CAP_DX 0x10000000 424 #define SVGA_CAP_HP_CMD_QUEUE 0x20000000 425 #define SVGA_CAP_NO_BB_RESTRICTION 0x40000000 426 #define SVGA_CAP_CAP2_REGISTER 0x80000000 427 428 #define SVGA_CAP2_NONE 0x00000000 429 #define SVGA_CAP2_GROW_OTABLE 0x00000001 430 #define SVGA_CAP2_INTRA_SURFACE_COPY 0x00000002 431 #define SVGA_CAP2_DX2 0x00000004 432 #define SVGA_CAP2_GB_MEMSIZE_2 0x00000008 433 #define SVGA_CAP2_SCREENDMA_REG 0x00000010 434 #define SVGA_CAP2_OTABLE_PTDEPTH_2 0x00000020 435 #define SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT 0x00000040 436 #define SVGA_CAP2_CURSOR_MOB 0x00000080 437 #define SVGA_CAP2_MSHINT 0x00000100 438 #define SVGA_CAP2_CB_MAX_SIZE_4MB 0x00000200 439 #define SVGA_CAP2_DX3 0x00000400 440 #define SVGA_CAP2_FRAME_TYPE 0x00000800 441 #define SVGA_CAP2_COTABLE_COPY 0x00001000 442 #define SVGA_CAP2_TRACE_FULL_FB 0x00002000 443 #define SVGA_CAP2_EXTRA_REGS 0x00004000 444 #define SVGA_CAP2_LO_STAGING 0x00008000 445 #define SVGA_CAP2_RESERVED 0x80000000 446 447 typedef enum { 448 SVGABackdoorCapDeviceCaps = 0, 449 SVGABackdoorCapFifoCaps = 1, 450 SVGABackdoorCap3dHWVersion = 2, 451 SVGABackdoorCapDeviceCaps2 = 3, 452 SVGABackdoorCapDevelCaps = 4, 453 SVGABackdoorDevelRenderer = 5, 454 SVGABackdoorDevelUsingISB = 6, 455 SVGABackdoorCapMax = 7, 456 } SVGABackdoorCapType; 457 458 enum { 459 460 SVGA_FIFO_MIN = 0, 461 SVGA_FIFO_MAX, 462 SVGA_FIFO_NEXT_CMD, 463 SVGA_FIFO_STOP, 464 465 SVGA_FIFO_CAPABILITIES = 4, 466 SVGA_FIFO_FLAGS, 467 468 SVGA_FIFO_FENCE, 469 470 SVGA_FIFO_3D_HWVERSION, 471 472 SVGA_FIFO_PITCHLOCK, 473 474 SVGA_FIFO_CURSOR_ON, 475 SVGA_FIFO_CURSOR_X, 476 SVGA_FIFO_CURSOR_Y, 477 SVGA_FIFO_CURSOR_COUNT, 478 SVGA_FIFO_CURSOR_LAST_UPDATED, 479 480 SVGA_FIFO_RESERVED, 481 482 SVGA_FIFO_CURSOR_SCREEN_ID, 483 484 SVGA_FIFO_DEAD, 485 486 SVGA_FIFO_3D_HWVERSION_REVISED, 487 488 SVGA_FIFO_3D_CAPS = 32, 489 SVGA_FIFO_3D_CAPS_LAST = 32 + 255, 490 491 SVGA_FIFO_GUEST_3D_HWVERSION, 492 SVGA_FIFO_FENCE_GOAL, 493 SVGA_FIFO_BUSY, 494 495 SVGA_FIFO_NUM_REGS 496 }; 497 498 #define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - SVGA_FIFO_3D_CAPS + 1) 499 500 #define SVGA3D_FIFO_CAPS_RECORD_DEVCAPS 0x100 501 typedef uint32 SVGA3dFifoCapsRecordType; 502 503 typedef uint32 SVGA3dFifoCapPair[2]; 504 505 #pragma pack(push, 1) 506 typedef struct SVGA3dFifoCapsRecordHeader { 507 uint32 length; 508 SVGA3dFifoCapsRecordType type; 509 510 } SVGA3dFifoCapsRecordHeader; 511 #pragma pack(pop) 512 513 #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1) 514 515 #define SVGA_FIFO_CAP_NONE 0 516 #define SVGA_FIFO_CAP_FENCE (1 << 0) 517 #define SVGA_FIFO_CAP_ACCELFRONT (1 << 1) 518 #define SVGA_FIFO_CAP_PITCHLOCK (1 << 2) 519 #define SVGA_FIFO_CAP_VIDEO (1 << 3) 520 #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1 << 4) 521 #define SVGA_FIFO_CAP_ESCAPE (1 << 5) 522 #define SVGA_FIFO_CAP_RESERVE (1 << 6) 523 #define SVGA_FIFO_CAP_SCREEN_OBJECT (1 << 7) 524 #define SVGA_FIFO_CAP_GMR2 (1 << 8) 525 #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2 526 #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1 << 9) 527 #define SVGA_FIFO_CAP_DEAD (1 << 10) 528 529 #define SVGA_FIFO_FLAG_NONE 0 530 #define SVGA_FIFO_FLAG_ACCELFRONT (1 << 0) 531 #define SVGA_FIFO_FLAG_RESERVED (1 << 31) 532 533 #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff 534 535 #define SVGA_SCREENDMA_REG_UNDEFINED 0 536 #define SVGA_SCREENDMA_REG_NOT_PRESENT 1 537 #define SVGA_SCREENDMA_REG_PRESENT 2 538 #define SVGA_SCREENDMA_REG_MAX 3 539 540 #define SVGA_NUM_OVERLAY_UNITS 32 541 542 #define SVGA_VIDEO_FLAG_COLORKEY 0x0001 543 544 enum { 545 SVGA_VIDEO_ENABLED = 0, 546 SVGA_VIDEO_FLAGS, 547 SVGA_VIDEO_DATA_OFFSET, 548 SVGA_VIDEO_FORMAT, 549 SVGA_VIDEO_COLORKEY, 550 SVGA_VIDEO_SIZE, 551 SVGA_VIDEO_WIDTH, 552 SVGA_VIDEO_HEIGHT, 553 SVGA_VIDEO_SRC_X, 554 SVGA_VIDEO_SRC_Y, 555 SVGA_VIDEO_SRC_WIDTH, 556 SVGA_VIDEO_SRC_HEIGHT, 557 SVGA_VIDEO_DST_X, 558 SVGA_VIDEO_DST_Y, 559 SVGA_VIDEO_DST_WIDTH, 560 SVGA_VIDEO_DST_HEIGHT, 561 SVGA_VIDEO_PITCH_1, 562 SVGA_VIDEO_PITCH_2, 563 SVGA_VIDEO_PITCH_3, 564 SVGA_VIDEO_DATA_GMRID, 565 SVGA_VIDEO_DST_SCREEN_ID, 566 SVGA_VIDEO_NUM_REGS 567 }; 568 569 #pragma pack(push, 1) 570 typedef struct SVGAOverlayUnit { 571 uint32 enabled; 572 uint32 flags; 573 uint32 dataOffset; 574 uint32 format; 575 uint32 colorKey; 576 uint32 size; 577 uint32 width; 578 uint32 height; 579 uint32 srcX; 580 uint32 srcY; 581 uint32 srcWidth; 582 uint32 srcHeight; 583 int32 dstX; 584 int32 dstY; 585 uint32 dstWidth; 586 uint32 dstHeight; 587 uint32 pitches[3]; 588 uint32 dataGMRId; 589 uint32 dstScreenId; 590 } SVGAOverlayUnit; 591 #pragma pack(pop) 592 593 #define SVGA_INVALID_DISPLAY_ID ((uint32)-1) 594 595 typedef struct SVGADisplayTopology { 596 uint16 displayId; 597 uint16 isPrimary; 598 uint32 width; 599 uint32 height; 600 uint32 positionX; 601 uint32 positionY; 602 } SVGADisplayTopology; 603 604 #define SVGA_SCREEN_MUST_BE_SET (1 << 0) 605 #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET 606 #define SVGA_SCREEN_IS_PRIMARY (1 << 1) 607 #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) 608 609 #define SVGA_SCREEN_DEACTIVATE (1 << 3) 610 611 #define SVGA_SCREEN_BLANKING (1 << 4) 612 613 #pragma pack(push, 1) 614 typedef struct { 615 uint32 structSize; 616 uint32 id; 617 uint32 flags; 618 struct { 619 uint32 width; 620 uint32 height; 621 } size; 622 struct { 623 int32 x; 624 int32 y; 625 } root; 626 627 SVGAGuestImage backingStore; 628 629 uint32 cloneCount; 630 } SVGAScreenObject; 631 #pragma pack(pop) 632 633 typedef enum { 634 SVGA_CMD_INVALID_CMD = 0, 635 SVGA_CMD_UPDATE = 1, 636 SVGA_CMD_RECT_COPY = 3, 637 SVGA_CMD_RECT_ROP_COPY = 14, 638 SVGA_CMD_DEFINE_CURSOR = 19, 639 SVGA_CMD_DEFINE_ALPHA_CURSOR = 22, 640 SVGA_CMD_UPDATE_VERBOSE = 25, 641 SVGA_CMD_FRONT_ROP_FILL = 29, 642 SVGA_CMD_FENCE = 30, 643 SVGA_CMD_ESCAPE = 33, 644 SVGA_CMD_DEFINE_SCREEN = 34, 645 SVGA_CMD_DESTROY_SCREEN = 35, 646 SVGA_CMD_DEFINE_GMRFB = 36, 647 SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37, 648 SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38, 649 SVGA_CMD_ANNOTATION_FILL = 39, 650 SVGA_CMD_ANNOTATION_COPY = 40, 651 SVGA_CMD_DEFINE_GMR2 = 41, 652 SVGA_CMD_REMAP_GMR2 = 42, 653 SVGA_CMD_DEAD = 43, 654 SVGA_CMD_DEAD_2 = 44, 655 SVGA_CMD_NOP = 45, 656 SVGA_CMD_NOP_ERROR = 46, 657 SVGA_CMD_MAX 658 } SVGAFifoCmdId; 659 660 #define SVGA_CMD_MAX_DATASIZE (256 * 1024) 661 #define SVGA_CMD_MAX_ARGS 64 662 663 #pragma pack(push, 1) 664 typedef struct { 665 uint32 x; 666 uint32 y; 667 uint32 width; 668 uint32 height; 669 } SVGAFifoCmdUpdate; 670 #pragma pack(pop) 671 672 #pragma pack(push, 1) 673 typedef struct { 674 uint32 srcX; 675 uint32 srcY; 676 uint32 destX; 677 uint32 destY; 678 uint32 width; 679 uint32 height; 680 } SVGAFifoCmdRectCopy; 681 #pragma pack(pop) 682 683 #pragma pack(push, 1) 684 typedef struct { 685 uint32 srcX; 686 uint32 srcY; 687 uint32 destX; 688 uint32 destY; 689 uint32 width; 690 uint32 height; 691 uint32 rop; 692 } SVGAFifoCmdRectRopCopy; 693 #pragma pack(pop) 694 695 #pragma pack(push, 1) 696 typedef struct { 697 uint32 id; 698 uint32 hotspotX; 699 uint32 hotspotY; 700 uint32 width; 701 uint32 height; 702 uint32 andMaskDepth; 703 uint32 xorMaskDepth; 704 705 } SVGAFifoCmdDefineCursor; 706 #pragma pack(pop) 707 708 #pragma pack(push, 1) 709 typedef struct { 710 uint32 id; 711 uint32 hotspotX; 712 uint32 hotspotY; 713 uint32 width; 714 uint32 height; 715 716 } SVGAFifoCmdDefineAlphaCursor; 717 #pragma pack(pop) 718 719 #pragma pack(push, 1) 720 typedef struct { 721 uint32 hotspotX; 722 uint32 hotspotY; 723 uint32 width; 724 uint32 height; 725 uint32 andMaskDepth; 726 uint32 xorMaskDepth; 727 728 } SVGAGBColorCursorHeader; 729 #pragma pack(pop) 730 731 #pragma pack(push, 1) 732 typedef struct { 733 uint32 hotspotX; 734 uint32 hotspotY; 735 uint32 width; 736 uint32 height; 737 738 } SVGAGBAlphaCursorHeader; 739 #pragma pack(pop) 740 741 typedef enum { 742 SVGA_COLOR_CURSOR = 0, 743 SVGA_ALPHA_CURSOR = 1, 744 } SVGAGBCursorType; 745 746 #pragma pack(push, 1) 747 typedef struct { 748 SVGAGBCursorType type; 749 union { 750 SVGAGBColorCursorHeader colorHeader; 751 SVGAGBAlphaCursorHeader alphaHeader; 752 } header; 753 uint32 sizeInBytes; 754 755 } SVGAGBCursorHeader; 756 #pragma pack(pop) 757 758 #pragma pack(push, 1) 759 typedef struct { 760 uint32 x; 761 uint32 y; 762 uint32 width; 763 uint32 height; 764 uint32 reason; 765 } SVGAFifoCmdUpdateVerbose; 766 #pragma pack(pop) 767 768 #pragma pack(push, 1) 769 typedef struct { 770 uint32 color; 771 uint32 x; 772 uint32 y; 773 uint32 width; 774 uint32 height; 775 uint32 rop; 776 } SVGAFifoCmdFrontRopFill; 777 #pragma pack(pop) 778 779 #pragma pack(push, 1) 780 typedef struct { 781 uint32 fence; 782 } SVGAFifoCmdFence; 783 #pragma pack(pop) 784 785 #pragma pack(push, 1) 786 typedef struct { 787 uint32 nsid; 788 uint32 size; 789 790 } SVGAFifoCmdEscape; 791 #pragma pack(pop) 792 793 #pragma pack(push, 1) 794 typedef struct { 795 SVGAScreenObject screen; 796 } SVGAFifoCmdDefineScreen; 797 #pragma pack(pop) 798 799 #pragma pack(push, 1) 800 typedef struct { 801 uint32 screenId; 802 } SVGAFifoCmdDestroyScreen; 803 #pragma pack(pop) 804 805 #pragma pack(push, 1) 806 typedef struct { 807 SVGAGuestPtr ptr; 808 uint32 bytesPerLine; 809 SVGAGMRImageFormat format; 810 } SVGAFifoCmdDefineGMRFB; 811 #pragma pack(pop) 812 813 #pragma pack(push, 1) 814 typedef struct { 815 SVGASignedPoint srcOrigin; 816 SVGASignedRect destRect; 817 uint32 destScreenId; 818 } SVGAFifoCmdBlitGMRFBToScreen; 819 #pragma pack(pop) 820 821 #pragma pack(push, 1) 822 typedef struct { 823 SVGASignedPoint destOrigin; 824 SVGASignedRect srcRect; 825 uint32 srcScreenId; 826 } SVGAFifoCmdBlitScreenToGMRFB; 827 #pragma pack(pop) 828 829 #pragma pack(push, 1) 830 typedef struct { 831 SVGAColorBGRX color; 832 } SVGAFifoCmdAnnotationFill; 833 #pragma pack(pop) 834 835 #pragma pack(push, 1) 836 typedef struct { 837 SVGASignedPoint srcOrigin; 838 uint32 srcScreenId; 839 } SVGAFifoCmdAnnotationCopy; 840 #pragma pack(pop) 841 842 #pragma pack(push, 1) 843 typedef struct { 844 uint32 gmrId; 845 uint32 numPages; 846 } SVGAFifoCmdDefineGMR2; 847 #pragma pack(pop) 848 849 typedef enum { 850 SVGA_REMAP_GMR2_PPN32 = 0, 851 SVGA_REMAP_GMR2_VIA_GMR = (1 << 0), 852 SVGA_REMAP_GMR2_PPN64 = (1 << 1), 853 SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2), 854 } SVGARemapGMR2Flags; 855 856 #pragma pack(push, 1) 857 typedef struct { 858 uint32 gmrId; 859 SVGARemapGMR2Flags flags; 860 uint32 offsetPages; 861 uint32 numPages; 862 863 } SVGAFifoCmdRemapGMR2; 864 #pragma pack(pop) 865 866 #define SVGA_VRAM_MIN_SIZE (4 * 640 * 480) 867 #define SVGA_VRAM_MIN_SIZE_3D (16 * 1024 * 1024) 868 #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024) 869 #define SVGA_MEMORY_SIZE_MAX (1024 * 1024 * 1024) 870 #define SVGA_FIFO_SIZE_MAX (2 * 1024 * 1024) 871 #define SVGA_GRAPHICS_MEMORY_KB_MIN (32 * 1024) 872 #define SVGA_GRAPHICS_MEMORY_KB_MAX_2GB (2 * 1024 * 1024) 873 #define SVGA_GRAPHICS_MEMORY_KB_MAX_3GB (3 * 1024 * 1024) 874 #define SVGA_GRAPHICS_MEMORY_KB_MAX_4GB (4 * 1024 * 1024) 875 #define SVGA_GRAPHICS_MEMORY_KB_MAX_8GB (8 * 1024 * 1024) 876 #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024) 877 878 #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024) 879 880 #if defined(VMX86_SERVER) 881 #define SVGA_VRAM_SIZE (4 * 1024 * 1024) 882 #define SVGA_VRAM_SIZE_3D (64 * 1024 * 1024) 883 #define SVGA_FIFO_SIZE (256 * 1024) 884 #define SVGA_FIFO_SIZE_3D (516 * 1024) 885 #define SVGA_MEMORY_SIZE_DEFAULT (160 * 1024 * 1024) 886 #define SVGA_AUTODETECT_DEFAULT FALSE 887 #else 888 #define SVGA_VRAM_SIZE (16 * 1024 * 1024) 889 #define SVGA_VRAM_SIZE_3D SVGA_VRAM_MAX_SIZE 890 #define SVGA_FIFO_SIZE (2 * 1024 * 1024) 891 #define SVGA_FIFO_SIZE_3D SVGA_FIFO_SIZE 892 #define SVGA_MEMORY_SIZE_DEFAULT (768 * 1024 * 1024) 893 #define SVGA_AUTODETECT_DEFAULT TRUE 894 #endif 895 896 #define SVGA_FIFO_SIZE_GBOBJECTS (256 * 1024) 897 #define SVGA_VRAM_SIZE_GBOBJECTS (4 * 1024 * 1024) 898 899 #endif 900