1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */ 2 /* 3 * Copyright (c) 1998-2024 Broadcom. All Rights Reserved. The term 4 * "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. 5 * 6 * Permission is hereby granted, free of charge, to any person 7 * obtaining a copy of this software and associated documentation 8 * files (the "Software"), to deal in the Software without 9 * restriction, including without limitation the rights to use, copy, 10 * modify, merge, publish, distribute, sublicense, and/or sell copies 11 * of the Software, and to permit persons to whom the Software is 12 * furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be 15 * included in all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 * SOFTWARE. 25 * 26 */ 27 28 /* 29 * svga_reg.h -- 30 * 31 * Virtual hardware definitions for the VMware SVGA II device. 32 */ 33 34 #ifndef _SVGA_REG_H_ 35 #define _SVGA_REG_H_ 36 37 #include "vm_basic_types.h" 38 39 typedef enum { 40 SVGA_REG_ENABLE_DISABLE = 0, 41 SVGA_REG_ENABLE_ENABLE = (1 << 0), 42 SVGA_REG_ENABLE_HIDE = (1 << 1), 43 } SvgaRegEnable; 44 45 typedef uint32 SVGAMobId; 46 47 #define SVGA_MAX_WIDTH 2560 48 #define SVGA_MAX_HEIGHT 1600 49 50 #define SVGA_MAX_BITS_PER_PIXEL 32 51 #define SVGA_MAX_DEPTH 24 52 #define SVGA_MAX_DISPLAYS 10 53 #define SVGA_MAX_SCREEN_SIZE 8192 54 #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS) 55 56 #define SVGA_CURSOR_ON_HIDE 0x0 57 #define SVGA_CURSOR_ON_SHOW 0x1 58 59 #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 60 61 #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 62 63 #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000 64 65 #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 66 #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH) 67 #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS) 68 69 #define SVGA_MAGIC 0x900000UL 70 #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver)) 71 72 #define SVGA_VERSION_3 3 73 #define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3) 74 75 #define SVGA_VERSION_2 2 76 #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2) 77 78 #define SVGA_VERSION_1 1 79 #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1) 80 81 #define SVGA_VERSION_0 0 82 #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) 83 84 #define SVGA_ID_INVALID 0xFFFFFFFF 85 86 #define SVGA_INDEX_PORT 0x0 87 #define SVGA_VALUE_PORT 0x1 88 #define SVGA_BIOS_PORT 0x2 89 #define SVGA_IRQSTATUS_PORT 0x8 90 91 #define SVGA_IRQFLAG_ANY_FENCE (1 << 0) 92 #define SVGA_IRQFLAG_FIFO_PROGRESS (1 << 1) 93 #define SVGA_IRQFLAG_FENCE_GOAL (1 << 2) 94 #define SVGA_IRQFLAG_COMMAND_BUFFER (1 << 3) 95 #define SVGA_IRQFLAG_ERROR (1 << 4) 96 #define SVGA_IRQFLAG_REG_FENCE_GOAL (1 << 5) 97 #define SVGA_IRQFLAG_MOB_FENCE (1 << 6) 98 #define SVGA_IRQFLAG_MAX (1 << 7) 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_VIDEO_BLT 0x00010000 446 #define SVGA_CAP2_MOBFMT_16K_PT64 0x00020000 447 #define SVGA_CAP2_MOB_FENCE_WITH_FLAGS 0x00040000 448 #define SVGA_CAP2_DIRTY_TRACKING_REG 0x00080000 449 #define SVGA_CAP2_CURSOR_MOB_ALPHA3D 0x00100000 450 #define SVGA_CAP2_RESERVED 0x80000000 451 452 typedef enum { 453 SVGABackdoorCapDeviceCaps = 0, 454 SVGABackdoorCapFifoCaps = 1, 455 SVGABackdoorCap3dHWVersion = 2, 456 SVGABackdoorCapDeviceCaps2 = 3, 457 SVGABackdoorCapDevelCaps = 4, 458 SVGABackdoorCapDevCaps = 5, 459 SVGABackdoorDevelRenderer = 6, 460 SVGABackdoorDevelUsingISB = 7, 461 SVGABackdoorCapMax = 8, 462 } SVGABackdoorCapType; 463 464 enum { 465 466 SVGA_FIFO_MIN = 0, 467 SVGA_FIFO_MAX, 468 SVGA_FIFO_NEXT_CMD, 469 SVGA_FIFO_STOP, 470 471 SVGA_FIFO_CAPABILITIES = 4, 472 SVGA_FIFO_FLAGS, 473 474 SVGA_FIFO_FENCE, 475 476 SVGA_FIFO_3D_HWVERSION, 477 478 SVGA_FIFO_PITCHLOCK, 479 480 SVGA_FIFO_CURSOR_ON, 481 SVGA_FIFO_CURSOR_X, 482 SVGA_FIFO_CURSOR_Y, 483 SVGA_FIFO_CURSOR_COUNT, 484 SVGA_FIFO_CURSOR_LAST_UPDATED, 485 486 SVGA_FIFO_RESERVED, 487 488 SVGA_FIFO_CURSOR_SCREEN_ID, 489 490 SVGA_FIFO_DEAD, 491 492 SVGA_FIFO_3D_HWVERSION_REVISED, 493 494 SVGA_FIFO_3D_CAPS = 32, 495 SVGA_FIFO_3D_CAPS_LAST = 32 + 255, 496 497 SVGA_FIFO_GUEST_3D_HWVERSION, 498 SVGA_FIFO_FENCE_GOAL, 499 SVGA_FIFO_BUSY, 500 501 SVGA_FIFO_NUM_REGS 502 }; 503 504 #define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - SVGA_FIFO_3D_CAPS + 1) 505 506 #define SVGA3D_FIFO_CAPS_RECORD_DEVCAPS 0x100 507 typedef uint32 SVGA3dFifoCapsRecordType; 508 509 typedef uint32 SVGA3dFifoCapPair[2]; 510 511 #pragma pack(push, 1) 512 typedef struct SVGA3dFifoCapsRecordHeader { 513 uint32 length; 514 SVGA3dFifoCapsRecordType type; 515 516 } SVGA3dFifoCapsRecordHeader; 517 #pragma pack(pop) 518 519 #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1) 520 521 #define SVGA_FIFO_CAP_NONE 0 522 #define SVGA_FIFO_CAP_FENCE (1 << 0) 523 #define SVGA_FIFO_CAP_ACCELFRONT (1 << 1) 524 #define SVGA_FIFO_CAP_PITCHLOCK (1 << 2) 525 #define SVGA_FIFO_CAP_VIDEO (1 << 3) 526 #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1 << 4) 527 #define SVGA_FIFO_CAP_ESCAPE (1 << 5) 528 #define SVGA_FIFO_CAP_RESERVE (1 << 6) 529 #define SVGA_FIFO_CAP_SCREEN_OBJECT (1 << 7) 530 #define SVGA_FIFO_CAP_GMR2 (1 << 8) 531 #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2 532 #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1 << 9) 533 #define SVGA_FIFO_CAP_DEAD (1 << 10) 534 535 #define SVGA_FIFO_FLAG_NONE 0 536 #define SVGA_FIFO_FLAG_ACCELFRONT (1 << 0) 537 #define SVGA_FIFO_FLAG_RESERVED (1 << 31) 538 539 #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff 540 541 #define SVGA_SCREENDMA_REG_UNDEFINED 0 542 #define SVGA_SCREENDMA_REG_NOT_PRESENT 1 543 #define SVGA_SCREENDMA_REG_PRESENT 2 544 #define SVGA_SCREENDMA_REG_MAX 3 545 546 #define SVGA_NUM_OVERLAY_UNITS 32 547 548 #define SVGA_VIDEO_FLAG_COLORKEY 0x0001 549 550 enum { 551 SVGA_VIDEO_ENABLED = 0, 552 SVGA_VIDEO_FLAGS, 553 SVGA_VIDEO_DATA_OFFSET, 554 SVGA_VIDEO_FORMAT, 555 SVGA_VIDEO_COLORKEY, 556 SVGA_VIDEO_SIZE, 557 SVGA_VIDEO_WIDTH, 558 SVGA_VIDEO_HEIGHT, 559 SVGA_VIDEO_SRC_X, 560 SVGA_VIDEO_SRC_Y, 561 SVGA_VIDEO_SRC_WIDTH, 562 SVGA_VIDEO_SRC_HEIGHT, 563 SVGA_VIDEO_DST_X, 564 SVGA_VIDEO_DST_Y, 565 SVGA_VIDEO_DST_WIDTH, 566 SVGA_VIDEO_DST_HEIGHT, 567 SVGA_VIDEO_PITCH_1, 568 SVGA_VIDEO_PITCH_2, 569 SVGA_VIDEO_PITCH_3, 570 SVGA_VIDEO_DATA_GMRID, 571 SVGA_VIDEO_DST_SCREEN_ID, 572 SVGA_VIDEO_NUM_REGS 573 }; 574 575 #pragma pack(push, 1) 576 typedef struct SVGAOverlayUnit { 577 uint32 enabled; 578 uint32 flags; 579 uint32 dataOffset; 580 uint32 format; 581 uint32 colorKey; 582 uint32 size; 583 uint32 width; 584 uint32 height; 585 uint32 srcX; 586 uint32 srcY; 587 uint32 srcWidth; 588 uint32 srcHeight; 589 int32 dstX; 590 int32 dstY; 591 uint32 dstWidth; 592 uint32 dstHeight; 593 uint32 pitches[3]; 594 uint32 dataGMRId; 595 uint32 dstScreenId; 596 } SVGAOverlayUnit; 597 #pragma pack(pop) 598 599 #define SVGA_INVALID_DISPLAY_ID ((uint32) - 1) 600 601 typedef struct SVGADisplayTopology { 602 uint16 displayId; 603 uint16 isPrimary; 604 uint32 width; 605 uint32 height; 606 uint32 positionX; 607 uint32 positionY; 608 } SVGADisplayTopology; 609 610 #define SVGA_SCREEN_MUST_BE_SET (1 << 0) 611 #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET 612 #define SVGA_SCREEN_IS_PRIMARY (1 << 1) 613 #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) 614 615 #define SVGA_SCREEN_DEACTIVATE (1 << 3) 616 617 #define SVGA_SCREEN_BLANKING (1 << 4) 618 619 #pragma pack(push, 1) 620 typedef struct { 621 uint32 structSize; 622 uint32 id; 623 uint32 flags; 624 struct { 625 uint32 width; 626 uint32 height; 627 } size; 628 struct { 629 int32 x; 630 int32 y; 631 } root; 632 633 SVGAGuestImage backingStore; 634 635 uint32 cloneCount; 636 } SVGAScreenObject; 637 #pragma pack(pop) 638 639 typedef enum { 640 SVGA_CMD_INVALID_CMD = 0, 641 SVGA_CMD_UPDATE = 1, 642 SVGA_CMD_RECT_COPY = 3, 643 SVGA_CMD_RECT_ROP_COPY = 14, 644 SVGA_CMD_DEFINE_CURSOR = 19, 645 SVGA_CMD_DEFINE_ALPHA_CURSOR = 22, 646 SVGA_CMD_UPDATE_VERBOSE = 25, 647 SVGA_CMD_FRONT_ROP_FILL = 29, 648 SVGA_CMD_FENCE = 30, 649 SVGA_CMD_ESCAPE = 33, 650 SVGA_CMD_DEFINE_SCREEN = 34, 651 SVGA_CMD_DESTROY_SCREEN = 35, 652 SVGA_CMD_DEFINE_GMRFB = 36, 653 SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37, 654 SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38, 655 SVGA_CMD_ANNOTATION_FILL = 39, 656 SVGA_CMD_ANNOTATION_COPY = 40, 657 SVGA_CMD_DEFINE_GMR2 = 41, 658 SVGA_CMD_REMAP_GMR2 = 42, 659 SVGA_CMD_DEAD = 43, 660 SVGA_CMD_DEAD_2 = 44, 661 SVGA_CMD_NOP = 45, 662 SVGA_CMD_NOP_ERROR = 46, 663 SVGA_CMD_MAX 664 } SVGAFifoCmdId; 665 666 #define SVGA_CMD_MAX_DATASIZE (256 * 1024) 667 #define SVGA_CMD_MAX_ARGS 64 668 669 #pragma pack(push, 1) 670 typedef struct { 671 uint32 x; 672 uint32 y; 673 uint32 width; 674 uint32 height; 675 } SVGAFifoCmdUpdate; 676 #pragma pack(pop) 677 678 #pragma pack(push, 1) 679 typedef struct { 680 uint32 srcX; 681 uint32 srcY; 682 uint32 destX; 683 uint32 destY; 684 uint32 width; 685 uint32 height; 686 } SVGAFifoCmdRectCopy; 687 #pragma pack(pop) 688 689 #pragma pack(push, 1) 690 typedef struct { 691 uint32 srcX; 692 uint32 srcY; 693 uint32 destX; 694 uint32 destY; 695 uint32 width; 696 uint32 height; 697 uint32 rop; 698 } SVGAFifoCmdRectRopCopy; 699 #pragma pack(pop) 700 701 #pragma pack(push, 1) 702 typedef struct { 703 uint32 id; 704 uint32 hotspotX; 705 uint32 hotspotY; 706 uint32 width; 707 uint32 height; 708 uint32 andMaskDepth; 709 uint32 xorMaskDepth; 710 711 } SVGAFifoCmdDefineCursor; 712 #pragma pack(pop) 713 714 #pragma pack(push, 1) 715 typedef struct { 716 uint32 id; 717 uint32 hotspotX; 718 uint32 hotspotY; 719 uint32 width; 720 uint32 height; 721 722 } SVGAFifoCmdDefineAlphaCursor; 723 #pragma pack(pop) 724 725 #pragma pack(push, 1) 726 typedef struct { 727 uint32 hotspotX; 728 uint32 hotspotY; 729 uint32 width; 730 uint32 height; 731 uint32 andMaskDepth; 732 uint32 xorMaskDepth; 733 734 } SVGAGBColorCursorHeader; 735 #pragma pack(pop) 736 737 #pragma pack(push, 1) 738 typedef struct { 739 uint32 hotspotX; 740 uint32 hotspotY; 741 uint32 width; 742 uint32 height; 743 744 } SVGAGBAlphaCursorHeader; 745 #pragma pack(pop) 746 747 #pragma pack(push, 1) 748 typedef struct { 749 uint32 hotspotX; 750 uint32 hotspotY; 751 uint32 width; 752 uint32 height; 753 } SVGAGBAlpha3dCursorHeader; 754 #pragma pack(pop) 755 756 #pragma pack(push, 1) 757 typedef struct { 758 uint32 srcx; 759 uint32 srcy; 760 uint32 sid; 761 uint32 face; 762 uint32 mipmap; 763 } SVGAGBAlpha3dCursorData; 764 #pragma pack(pop) 765 766 typedef enum { 767 SVGA_COLOR_CURSOR = 0, 768 SVGA_ALPHA_CURSOR = 1, 769 SVGA_ALPHA3D_CURSOR = 2, 770 } SVGAGBCursorType; 771 772 #pragma pack(push, 1) 773 typedef struct { 774 SVGAGBCursorType type; 775 union { 776 SVGAGBColorCursorHeader colorHeader; 777 SVGAGBAlphaCursorHeader alphaHeader; 778 SVGAGBAlpha3dCursorHeader alpha3dHeader; 779 } header; 780 uint32 sizeInBytes; 781 782 } SVGAGBCursorHeader; 783 #pragma pack(pop) 784 785 #pragma pack(push, 1) 786 typedef struct { 787 uint32 x; 788 uint32 y; 789 uint32 width; 790 uint32 height; 791 uint32 reason; 792 } SVGAFifoCmdUpdateVerbose; 793 #pragma pack(pop) 794 795 #pragma pack(push, 1) 796 typedef struct { 797 uint32 color; 798 uint32 x; 799 uint32 y; 800 uint32 width; 801 uint32 height; 802 uint32 rop; 803 } SVGAFifoCmdFrontRopFill; 804 #pragma pack(pop) 805 806 #pragma pack(push, 1) 807 typedef struct { 808 uint32 fence; 809 } SVGAFifoCmdFence; 810 #pragma pack(pop) 811 812 #pragma pack(push, 1) 813 typedef struct { 814 uint32 nsid; 815 uint32 size; 816 817 } SVGAFifoCmdEscape; 818 #pragma pack(pop) 819 820 #pragma pack(push, 1) 821 typedef struct { 822 SVGAScreenObject screen; 823 } SVGAFifoCmdDefineScreen; 824 #pragma pack(pop) 825 826 #pragma pack(push, 1) 827 typedef struct { 828 uint32 screenId; 829 } SVGAFifoCmdDestroyScreen; 830 #pragma pack(pop) 831 832 #pragma pack(push, 1) 833 typedef struct { 834 SVGAGuestPtr ptr; 835 uint32 bytesPerLine; 836 SVGAGMRImageFormat format; 837 } SVGAFifoCmdDefineGMRFB; 838 #pragma pack(pop) 839 840 #pragma pack(push, 1) 841 typedef struct { 842 SVGASignedPoint srcOrigin; 843 SVGASignedRect destRect; 844 uint32 destScreenId; 845 } SVGAFifoCmdBlitGMRFBToScreen; 846 #pragma pack(pop) 847 848 #pragma pack(push, 1) 849 typedef struct { 850 SVGASignedPoint destOrigin; 851 SVGASignedRect srcRect; 852 uint32 srcScreenId; 853 } SVGAFifoCmdBlitScreenToGMRFB; 854 #pragma pack(pop) 855 856 #pragma pack(push, 1) 857 typedef struct { 858 SVGAColorBGRX color; 859 } SVGAFifoCmdAnnotationFill; 860 #pragma pack(pop) 861 862 #pragma pack(push, 1) 863 typedef struct { 864 SVGASignedPoint srcOrigin; 865 uint32 srcScreenId; 866 } SVGAFifoCmdAnnotationCopy; 867 #pragma pack(pop) 868 869 #pragma pack(push, 1) 870 typedef struct { 871 uint32 gmrId; 872 uint32 numPages; 873 } SVGAFifoCmdDefineGMR2; 874 #pragma pack(pop) 875 876 typedef enum { 877 SVGA_REMAP_GMR2_PPN32 = 0, 878 SVGA_REMAP_GMR2_VIA_GMR = (1 << 0), 879 SVGA_REMAP_GMR2_PPN64 = (1 << 1), 880 SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2), 881 } SVGARemapGMR2Flags; 882 883 #pragma pack(push, 1) 884 typedef struct { 885 uint32 gmrId; 886 SVGARemapGMR2Flags flags; 887 uint32 offsetPages; 888 uint32 numPages; 889 890 } SVGAFifoCmdRemapGMR2; 891 #pragma pack(pop) 892 893 #define SVGA_VRAM_MIN_SIZE (4 * 640 * 480) 894 #define SVGA_VRAM_MIN_SIZE_3D (16 * 1024 * 1024) 895 #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024) 896 #define SVGA_MEMORY_SIZE_MAX (1024 * 1024 * 1024) 897 #define SVGA_FIFO_SIZE_MAX (2 * 1024 * 1024) 898 #define SVGA_GRAPHICS_MEMORY_KB_MIN (32 * 1024) 899 #define SVGA_GRAPHICS_MEMORY_KB_MAX_2GB (2 * 1024 * 1024) 900 #define SVGA_GRAPHICS_MEMORY_KB_MAX_3GB (3 * 1024 * 1024) 901 #define SVGA_GRAPHICS_MEMORY_KB_MAX_4GB (4 * 1024 * 1024) 902 #define SVGA_GRAPHICS_MEMORY_KB_MAX_8GB (8 * 1024 * 1024) 903 #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024) 904 905 #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024) 906 907 #if defined(VMX86_SERVER) 908 #define SVGA_VRAM_SIZE (4 * 1024 * 1024) 909 #define SVGA_VRAM_SIZE_3D (64 * 1024 * 1024) 910 #define SVGA_FIFO_SIZE (256 * 1024) 911 #define SVGA_FIFO_SIZE_3D (516 * 1024) 912 #define SVGA_MEMORY_SIZE_DEFAULT (160 * 1024 * 1024) 913 #define SVGA_AUTODETECT_DEFAULT FALSE 914 #else 915 #define SVGA_VRAM_SIZE (16 * 1024 * 1024) 916 #define SVGA_VRAM_SIZE_3D SVGA_VRAM_MAX_SIZE 917 #define SVGA_FIFO_SIZE (2 * 1024 * 1024) 918 #define SVGA_FIFO_SIZE_3D SVGA_FIFO_SIZE 919 #define SVGA_MEMORY_SIZE_DEFAULT (768 * 1024 * 1024) 920 #define SVGA_AUTODETECT_DEFAULT TRUE 921 #endif 922 923 #define SVGA_FIFO_SIZE_GBOBJECTS (256 * 1024) 924 #define SVGA_VRAM_SIZE_GBOBJECTS (4 * 1024 * 1024) 925 926 #endif 927