Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
0002 /*
0003  * Copyright 1998-2021 VMware, Inc.
0004  *
0005  * Permission is hereby granted, free of charge, to any person
0006  * obtaining a copy of this software and associated documentation
0007  * files (the "Software"), to deal in the Software without
0008  * restriction, including without limitation the rights to use, copy,
0009  * modify, merge, publish, distribute, sublicense, and/or sell copies
0010  * of the Software, and to permit persons to whom the Software is
0011  * furnished to do so, subject to the following conditions:
0012  *
0013  * The above copyright notice and this permission notice shall be
0014  * included in all copies or substantial portions of the Software.
0015  *
0016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0017  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0018  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0019  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0020  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0021  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0023  * SOFTWARE.
0024  *
0025  */
0026 
0027 /*
0028  * svga_reg.h --
0029  *
0030  *    Virtual hardware definitions for the VMware SVGA II device.
0031  */
0032 
0033 
0034 
0035 #ifndef _SVGA_REG_H_
0036 #define _SVGA_REG_H_
0037 
0038 #include "vm_basic_types.h"
0039 
0040 typedef enum {
0041     SVGA_REG_ENABLE_DISABLE = 0,
0042     SVGA_REG_ENABLE_ENABLE = (1 << 0),
0043     SVGA_REG_ENABLE_HIDE = (1 << 1),
0044 } SvgaRegEnable;
0045 
0046 typedef uint32 SVGAMobId;
0047 
0048 #define SVGA_MAX_WIDTH 2560
0049 #define SVGA_MAX_HEIGHT 1600
0050 
0051 #define SVGA_MAX_BITS_PER_PIXEL 32
0052 #define SVGA_MAX_DEPTH 24
0053 #define SVGA_MAX_DISPLAYS 10
0054 #define SVGA_MAX_SCREEN_SIZE 8192
0055 #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS)
0056 
0057 #define SVGA_CURSOR_ON_HIDE 0x0
0058 #define SVGA_CURSOR_ON_SHOW 0x1
0059 
0060 #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2
0061 
0062 #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3
0063 
0064 #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000
0065 
0066 #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
0067 #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
0068 #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)
0069 
0070 #define SVGA_MAGIC 0x900000UL
0071 #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
0072 
0073 #define SVGA_VERSION_3 3
0074 #define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3)
0075 
0076 #define SVGA_VERSION_2 2
0077 #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
0078 
0079 #define SVGA_VERSION_1 1
0080 #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
0081 
0082 #define SVGA_VERSION_0 0
0083 #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
0084 
0085 #define SVGA_ID_INVALID 0xFFFFFFFF
0086 
0087 #define SVGA_INDEX_PORT 0x0
0088 #define SVGA_VALUE_PORT 0x1
0089 #define SVGA_BIOS_PORT 0x2
0090 #define SVGA_IRQSTATUS_PORT 0x8
0091 
0092 #define SVGA_IRQFLAG_ANY_FENCE (1 << 0)
0093 #define SVGA_IRQFLAG_FIFO_PROGRESS (1 << 1)
0094 #define SVGA_IRQFLAG_FENCE_GOAL (1 << 2)
0095 #define SVGA_IRQFLAG_COMMAND_BUFFER (1 << 3)
0096 #define SVGA_IRQFLAG_ERROR (1 << 4)
0097 #define SVGA_IRQFLAG_REG_FENCE_GOAL (1 << 5)
0098 #define SVGA_IRQFLAG_MAX (1 << 6)
0099 
0100 #define SVGA_MAX_CURSOR_CMD_BYTES (40 * 1024)
0101 #define SVGA_MAX_CURSOR_CMD_DIMENSION 1024
0102 
0103 enum {
0104     SVGA_REG_ID = 0,
0105     SVGA_REG_ENABLE = 1,
0106     SVGA_REG_WIDTH = 2,
0107     SVGA_REG_HEIGHT = 3,
0108     SVGA_REG_MAX_WIDTH = 4,
0109     SVGA_REG_MAX_HEIGHT = 5,
0110     SVGA_REG_DEPTH = 6,
0111     SVGA_REG_BITS_PER_PIXEL = 7,
0112     SVGA_REG_PSEUDOCOLOR = 8,
0113     SVGA_REG_RED_MASK = 9,
0114     SVGA_REG_GREEN_MASK = 10,
0115     SVGA_REG_BLUE_MASK = 11,
0116     SVGA_REG_BYTES_PER_LINE = 12,
0117     SVGA_REG_FB_START = 13,
0118     SVGA_REG_FB_OFFSET = 14,
0119     SVGA_REG_VRAM_SIZE = 15,
0120     SVGA_REG_FB_SIZE = 16,
0121 
0122     SVGA_REG_ID_0_TOP = 17,
0123 
0124     SVGA_REG_CAPABILITIES = 17,
0125     SVGA_REG_MEM_START = 18,
0126     SVGA_REG_MEM_SIZE = 19,
0127     SVGA_REG_CONFIG_DONE = 20,
0128     SVGA_REG_SYNC = 21,
0129     SVGA_REG_BUSY = 22,
0130     SVGA_REG_GUEST_ID = 23,
0131     SVGA_REG_DEAD = 24,
0132     SVGA_REG_CURSOR_X = 25,
0133     SVGA_REG_CURSOR_Y = 26,
0134     SVGA_REG_CURSOR_ON = 27,
0135     SVGA_REG_HOST_BITS_PER_PIXEL = 28,
0136     SVGA_REG_SCRATCH_SIZE = 29,
0137     SVGA_REG_MEM_REGS = 30,
0138     SVGA_REG_NUM_DISPLAYS = 31,
0139     SVGA_REG_PITCHLOCK = 32,
0140     SVGA_REG_IRQMASK = 33,
0141 
0142     SVGA_REG_NUM_GUEST_DISPLAYS = 34,
0143     SVGA_REG_DISPLAY_ID = 35,
0144     SVGA_REG_DISPLAY_IS_PRIMARY = 36,
0145     SVGA_REG_DISPLAY_POSITION_X = 37,
0146     SVGA_REG_DISPLAY_POSITION_Y = 38,
0147     SVGA_REG_DISPLAY_WIDTH = 39,
0148     SVGA_REG_DISPLAY_HEIGHT = 40,
0149 
0150     SVGA_REG_GMR_ID = 41,
0151     SVGA_REG_GMR_DESCRIPTOR = 42,
0152     SVGA_REG_GMR_MAX_IDS = 43,
0153     SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
0154 
0155     SVGA_REG_TRACES = 45,
0156     SVGA_REG_GMRS_MAX_PAGES = 46,
0157     SVGA_REG_MEMORY_SIZE = 47,
0158     SVGA_REG_COMMAND_LOW = 48,
0159     SVGA_REG_COMMAND_HIGH = 49,
0160 
0161     SVGA_REG_MAX_PRIMARY_MEM = 50,
0162 
0163     SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51,
0164 
0165     SVGA_REG_DEV_CAP = 52,
0166     SVGA_REG_CMD_PREPEND_LOW = 53,
0167     SVGA_REG_CMD_PREPEND_HIGH = 54,
0168     SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,
0169     SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,
0170     SVGA_REG_MOB_MAX_SIZE = 57,
0171     SVGA_REG_BLANK_SCREEN_TARGETS = 58,
0172     SVGA_REG_CAP2 = 59,
0173     SVGA_REG_DEVEL_CAP = 60,
0174 
0175     SVGA_REG_GUEST_DRIVER_ID = 61,
0176     SVGA_REG_GUEST_DRIVER_VERSION1 = 62,
0177     SVGA_REG_GUEST_DRIVER_VERSION2 = 63,
0178     SVGA_REG_GUEST_DRIVER_VERSION3 = 64,
0179 
0180     SVGA_REG_CURSOR_MOBID = 65,
0181     SVGA_REG_CURSOR_MAX_BYTE_SIZE = 66,
0182     SVGA_REG_CURSOR_MAX_DIMENSION = 67,
0183 
0184     SVGA_REG_FIFO_CAPS = 68,
0185     SVGA_REG_FENCE = 69,
0186 
0187     SVGA_REG_CURSOR4_ON = 70,
0188     SVGA_REG_CURSOR4_X = 71,
0189     SVGA_REG_CURSOR4_Y = 72,
0190     SVGA_REG_CURSOR4_SCREEN_ID = 73,
0191     SVGA_REG_CURSOR4_SUBMIT = 74,
0192 
0193     SVGA_REG_SCREENDMA = 75,
0194 
0195     SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76,
0196 
0197     SVGA_REG_REGS_START_HIGH32 = 77,
0198     SVGA_REG_REGS_START_LOW32 = 78,
0199     SVGA_REG_FB_START_HIGH32 = 79,
0200     SVGA_REG_FB_START_LOW32 = 80,
0201 
0202     SVGA_REG_MSHINT = 81,
0203 
0204     SVGA_REG_IRQ_STATUS = 82,
0205 
0206     SVGA_REG_DIRTY_TRACKING = 83,
0207     SVGA_REG_FENCE_GOAL = 84,
0208 
0209     SVGA_REG_TOP = 85,
0210 
0211     SVGA_PALETTE_BASE = 1024,
0212 
0213     SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
0214 
0215 };
0216 
0217 typedef enum SVGARegGuestDriverId {
0218     SVGA_REG_GUEST_DRIVER_ID_UNKNOWN = 0,
0219     SVGA_REG_GUEST_DRIVER_ID_WDDM = 1,
0220     SVGA_REG_GUEST_DRIVER_ID_LINUX = 2,
0221     SVGA_REG_GUEST_DRIVER_ID_MAX,
0222 
0223     SVGA_REG_GUEST_DRIVER_ID_SUBMIT = MAX_UINT32,
0224 } SVGARegGuestDriverId;
0225 
0226 typedef enum SVGARegMSHint {
0227     SVGA_REG_MSHINT_DISABLED = 0,
0228     SVGA_REG_MSHINT_FULL = 1,
0229     SVGA_REG_MSHINT_RESOLVED = 2,
0230 } SVGARegMSHint;
0231 
0232 typedef enum SVGARegDirtyTracking {
0233     SVGA_REG_DIRTY_TRACKING_PER_IMAGE = 0,
0234     SVGA_REG_DIRTY_TRACKING_PER_SURFACE = 1,
0235 } SVGARegDirtyTracking;
0236 
0237 #define SVGA_GMR_NULL ((uint32)-1)
0238 #define SVGA_GMR_FRAMEBUFFER ((uint32)-2)
0239 
0240 #pragma pack(push, 1)
0241 typedef struct SVGAGuestMemDescriptor {
0242     uint32 ppn;
0243     uint32 numPages;
0244 } SVGAGuestMemDescriptor;
0245 #pragma pack(pop)
0246 
0247 #pragma pack(push, 1)
0248 typedef struct SVGAGuestPtr {
0249     uint32 gmrId;
0250     uint32 offset;
0251 } SVGAGuestPtr;
0252 #pragma pack(pop)
0253 
0254 #define SVGA_CB_MAX_SIZE_DEFAULT (KBYTES_2_BYTES(512))
0255 #define SVGA_CB_MAX_SIZE_4MB (MBYTES_2_BYTES(4))
0256 #define SVGA_CB_MAX_SIZE SVGA_CB_MAX_SIZE_4MB
0257 #define SVGA_CB_MAX_QUEUED_PER_CONTEXT 32
0258 #define SVGA_CB_MAX_COMMAND_SIZE (32 * 1024)
0259 
0260 #define SVGA_CB_CONTEXT_MASK 0x3f
0261 typedef enum {
0262     SVGA_CB_CONTEXT_DEVICE = 0x3f,
0263     SVGA_CB_CONTEXT_0 = 0x0,
0264     SVGA_CB_CONTEXT_1 = 0x1,
0265     SVGA_CB_CONTEXT_MAX = 0x2,
0266 } SVGACBContext;
0267 
0268 typedef enum {
0269 
0270     SVGA_CB_STATUS_NONE = 0,
0271 
0272     SVGA_CB_STATUS_COMPLETED = 1,
0273 
0274     SVGA_CB_STATUS_QUEUE_FULL = 2,
0275 
0276     SVGA_CB_STATUS_COMMAND_ERROR = 3,
0277 
0278     SVGA_CB_STATUS_CB_HEADER_ERROR = 4,
0279 
0280     SVGA_CB_STATUS_PREEMPTED = 5,
0281 
0282     SVGA_CB_STATUS_SUBMISSION_ERROR = 6,
0283 
0284     SVGA_CB_STATUS_PARTIAL_COMPLETE = 7,
0285 } SVGACBStatus;
0286 
0287 typedef enum {
0288     SVGA_CB_FLAG_NONE = 0,
0289     SVGA_CB_FLAG_NO_IRQ = 1 << 0,
0290     SVGA_CB_FLAG_DX_CONTEXT = 1 << 1,
0291     SVGA_CB_FLAG_MOB = 1 << 2,
0292 } SVGACBFlags;
0293 
0294 #pragma pack(push, 1)
0295 typedef struct {
0296     volatile SVGACBStatus status;
0297     volatile uint32 errorOffset;
0298     uint64 id;
0299     SVGACBFlags flags;
0300     uint32 length;
0301     union {
0302         PA pa;
0303         struct {
0304             SVGAMobId mobid;
0305             uint32 mobOffset;
0306         } mob;
0307     } ptr;
0308     uint32 offset;
0309     uint32 dxContext;
0310     uint32 mustBeZero[6];
0311 } SVGACBHeader;
0312 #pragma pack(pop)
0313 
0314 typedef enum {
0315     SVGA_DC_CMD_NOP = 0,
0316     SVGA_DC_CMD_START_STOP_CONTEXT = 1,
0317     SVGA_DC_CMD_PREEMPT = 2,
0318     SVGA_DC_CMD_START_QUEUE = 3,
0319     SVGA_DC_CMD_ASYNC_STOP_QUEUE = 4,
0320     SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE = 5,
0321     SVGA_DC_CMD_MAX = 6
0322 } SVGADeviceContextCmdId;
0323 
0324 typedef struct SVGADCCmdStartStop {
0325     uint32 enable;
0326     SVGACBContext context;
0327 } SVGADCCmdStartStop;
0328 
0329 typedef struct SVGADCCmdPreempt {
0330     SVGACBContext context;
0331     uint32 ignoreIDZero;
0332 } SVGADCCmdPreempt;
0333 
0334 typedef struct SVGADCCmdStartQueue {
0335     SVGACBContext context;
0336 } SVGADCCmdStartQueue;
0337 
0338 typedef struct SVGADCCmdAsyncStopQueue {
0339     SVGACBContext context;
0340 } SVGADCCmdAsyncStopQueue;
0341 
0342 typedef struct SVGADCCmdEmptyQueue {
0343     SVGACBContext context;
0344 } SVGADCCmdEmptyQueue;
0345 
0346 typedef struct SVGAGMRImageFormat {
0347     union {
0348         struct {
0349             uint32 bitsPerPixel : 8;
0350             uint32 colorDepth : 8;
0351             uint32 reserved : 16;
0352         };
0353 
0354         uint32 value;
0355     };
0356 } SVGAGMRImageFormat;
0357 
0358 #pragma pack(push, 1)
0359 typedef struct SVGAGuestImage {
0360     SVGAGuestPtr ptr;
0361 
0362     uint32 pitch;
0363 } SVGAGuestImage;
0364 #pragma pack(pop)
0365 
0366 typedef struct SVGAColorBGRX {
0367     union {
0368         struct {
0369             uint32 b : 8;
0370             uint32 g : 8;
0371             uint32 r : 8;
0372             uint32 x : 8;
0373         };
0374 
0375         uint32 value;
0376     };
0377 } SVGAColorBGRX;
0378 
0379 #pragma pack(push, 1)
0380 typedef struct {
0381     int32 left;
0382     int32 top;
0383     int32 right;
0384     int32 bottom;
0385 } SVGASignedRect;
0386 #pragma pack(pop)
0387 
0388 #pragma pack(push, 1)
0389 typedef struct {
0390     int32 x;
0391     int32 y;
0392 } SVGASignedPoint;
0393 #pragma pack(pop)
0394 
0395 #pragma pack(push, 1)
0396 typedef struct {
0397     uint32 x;
0398     uint32 y;
0399 } SVGAUnsignedPoint;
0400 #pragma pack(pop)
0401 
0402 #define SVGA_CAP_NONE 0x00000000
0403 #define SVGA_CAP_RECT_COPY 0x00000002
0404 #define SVGA_CAP_CURSOR 0x00000020
0405 #define SVGA_CAP_CURSOR_BYPASS 0x00000040
0406 #define SVGA_CAP_CURSOR_BYPASS_2 0x00000080
0407 #define SVGA_CAP_8BIT_EMULATION 0x00000100
0408 #define SVGA_CAP_ALPHA_CURSOR 0x00000200
0409 #define SVGA_CAP_3D 0x00004000
0410 #define SVGA_CAP_EXTENDED_FIFO 0x00008000
0411 #define SVGA_CAP_MULTIMON 0x00010000
0412 #define SVGA_CAP_PITCHLOCK 0x00020000
0413 #define SVGA_CAP_IRQMASK 0x00040000
0414 #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000
0415 #define SVGA_CAP_GMR 0x00100000
0416 #define SVGA_CAP_TRACES 0x00200000
0417 #define SVGA_CAP_GMR2 0x00400000
0418 #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000
0419 #define SVGA_CAP_COMMAND_BUFFERS 0x01000000
0420 #define SVGA_CAP_DEAD1 0x02000000
0421 #define SVGA_CAP_CMD_BUFFERS_2 0x04000000
0422 #define SVGA_CAP_GBOBJECTS 0x08000000
0423 #define SVGA_CAP_DX 0x10000000
0424 #define SVGA_CAP_HP_CMD_QUEUE 0x20000000
0425 #define SVGA_CAP_NO_BB_RESTRICTION 0x40000000
0426 #define SVGA_CAP_CAP2_REGISTER 0x80000000
0427 
0428 #define SVGA_CAP2_NONE 0x00000000
0429 #define SVGA_CAP2_GROW_OTABLE 0x00000001
0430 #define SVGA_CAP2_INTRA_SURFACE_COPY 0x00000002
0431 #define SVGA_CAP2_DX2 0x00000004
0432 #define SVGA_CAP2_GB_MEMSIZE_2 0x00000008
0433 #define SVGA_CAP2_SCREENDMA_REG 0x00000010
0434 #define SVGA_CAP2_OTABLE_PTDEPTH_2 0x00000020
0435 #define SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT 0x00000040
0436 #define SVGA_CAP2_CURSOR_MOB 0x00000080
0437 #define SVGA_CAP2_MSHINT 0x00000100
0438 #define SVGA_CAP2_CB_MAX_SIZE_4MB 0x00000200
0439 #define SVGA_CAP2_DX3 0x00000400
0440 #define SVGA_CAP2_FRAME_TYPE 0x00000800
0441 #define SVGA_CAP2_COTABLE_COPY 0x00001000
0442 #define SVGA_CAP2_TRACE_FULL_FB 0x00002000
0443 #define SVGA_CAP2_EXTRA_REGS 0x00004000
0444 #define SVGA_CAP2_LO_STAGING 0x00008000
0445 #define SVGA_CAP2_VIDEO_BLT 0x00010000
0446 #define SVGA_CAP2_RESERVED 0x80000000
0447 
0448 typedef enum {
0449     SVGABackdoorCapDeviceCaps = 0,
0450     SVGABackdoorCapFifoCaps = 1,
0451     SVGABackdoorCap3dHWVersion = 2,
0452     SVGABackdoorCapDeviceCaps2 = 3,
0453     SVGABackdoorCapDevelCaps = 4,
0454     SVGABackdoorCapDevCaps = 5,
0455     SVGABackdoorDevelRenderer = 6,
0456     SVGABackdoorDevelUsingISB = 7,
0457     SVGABackdoorCapMax = 8,
0458 } SVGABackdoorCapType;
0459 
0460 enum {
0461 
0462     SVGA_FIFO_MIN = 0,
0463     SVGA_FIFO_MAX,
0464     SVGA_FIFO_NEXT_CMD,
0465     SVGA_FIFO_STOP,
0466 
0467     SVGA_FIFO_CAPABILITIES = 4,
0468     SVGA_FIFO_FLAGS,
0469 
0470     SVGA_FIFO_FENCE,
0471 
0472     SVGA_FIFO_3D_HWVERSION,
0473 
0474     SVGA_FIFO_PITCHLOCK,
0475 
0476     SVGA_FIFO_CURSOR_ON,
0477     SVGA_FIFO_CURSOR_X,
0478     SVGA_FIFO_CURSOR_Y,
0479     SVGA_FIFO_CURSOR_COUNT,
0480     SVGA_FIFO_CURSOR_LAST_UPDATED,
0481 
0482     SVGA_FIFO_RESERVED,
0483 
0484     SVGA_FIFO_CURSOR_SCREEN_ID,
0485 
0486     SVGA_FIFO_DEAD,
0487 
0488     SVGA_FIFO_3D_HWVERSION_REVISED,
0489 
0490     SVGA_FIFO_3D_CAPS = 32,
0491     SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
0492 
0493     SVGA_FIFO_GUEST_3D_HWVERSION,
0494     SVGA_FIFO_FENCE_GOAL,
0495     SVGA_FIFO_BUSY,
0496 
0497     SVGA_FIFO_NUM_REGS
0498 };
0499 
0500 #define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - SVGA_FIFO_3D_CAPS + 1)
0501 
0502 #define SVGA3D_FIFO_CAPS_RECORD_DEVCAPS 0x100
0503 typedef uint32 SVGA3dFifoCapsRecordType;
0504 
0505 typedef uint32 SVGA3dFifoCapPair[2];
0506 
0507 #pragma pack(push, 1)
0508 typedef struct SVGA3dFifoCapsRecordHeader {
0509     uint32 length;
0510     SVGA3dFifoCapsRecordType type;
0511 
0512 } SVGA3dFifoCapsRecordHeader;
0513 #pragma pack(pop)
0514 
0515 #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)
0516 
0517 #define SVGA_FIFO_CAP_NONE 0
0518 #define SVGA_FIFO_CAP_FENCE (1 << 0)
0519 #define SVGA_FIFO_CAP_ACCELFRONT (1 << 1)
0520 #define SVGA_FIFO_CAP_PITCHLOCK (1 << 2)
0521 #define SVGA_FIFO_CAP_VIDEO (1 << 3)
0522 #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1 << 4)
0523 #define SVGA_FIFO_CAP_ESCAPE (1 << 5)
0524 #define SVGA_FIFO_CAP_RESERVE (1 << 6)
0525 #define SVGA_FIFO_CAP_SCREEN_OBJECT (1 << 7)
0526 #define SVGA_FIFO_CAP_GMR2 (1 << 8)
0527 #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2
0528 #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1 << 9)
0529 #define SVGA_FIFO_CAP_DEAD (1 << 10)
0530 
0531 #define SVGA_FIFO_FLAG_NONE 0
0532 #define SVGA_FIFO_FLAG_ACCELFRONT (1 << 0)
0533 #define SVGA_FIFO_FLAG_RESERVED (1 << 31)
0534 
0535 #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff
0536 
0537 #define SVGA_SCREENDMA_REG_UNDEFINED 0
0538 #define SVGA_SCREENDMA_REG_NOT_PRESENT 1
0539 #define SVGA_SCREENDMA_REG_PRESENT 2
0540 #define SVGA_SCREENDMA_REG_MAX 3
0541 
0542 #define SVGA_NUM_OVERLAY_UNITS 32
0543 
0544 #define SVGA_VIDEO_FLAG_COLORKEY 0x0001
0545 
0546 enum {
0547     SVGA_VIDEO_ENABLED = 0,
0548     SVGA_VIDEO_FLAGS,
0549     SVGA_VIDEO_DATA_OFFSET,
0550     SVGA_VIDEO_FORMAT,
0551     SVGA_VIDEO_COLORKEY,
0552     SVGA_VIDEO_SIZE,
0553     SVGA_VIDEO_WIDTH,
0554     SVGA_VIDEO_HEIGHT,
0555     SVGA_VIDEO_SRC_X,
0556     SVGA_VIDEO_SRC_Y,
0557     SVGA_VIDEO_SRC_WIDTH,
0558     SVGA_VIDEO_SRC_HEIGHT,
0559     SVGA_VIDEO_DST_X,
0560     SVGA_VIDEO_DST_Y,
0561     SVGA_VIDEO_DST_WIDTH,
0562     SVGA_VIDEO_DST_HEIGHT,
0563     SVGA_VIDEO_PITCH_1,
0564     SVGA_VIDEO_PITCH_2,
0565     SVGA_VIDEO_PITCH_3,
0566     SVGA_VIDEO_DATA_GMRID,
0567     SVGA_VIDEO_DST_SCREEN_ID,
0568     SVGA_VIDEO_NUM_REGS
0569 };
0570 
0571 #pragma pack(push, 1)
0572 typedef struct SVGAOverlayUnit {
0573     uint32 enabled;
0574     uint32 flags;
0575     uint32 dataOffset;
0576     uint32 format;
0577     uint32 colorKey;
0578     uint32 size;
0579     uint32 width;
0580     uint32 height;
0581     uint32 srcX;
0582     uint32 srcY;
0583     uint32 srcWidth;
0584     uint32 srcHeight;
0585     int32 dstX;
0586     int32 dstY;
0587     uint32 dstWidth;
0588     uint32 dstHeight;
0589     uint32 pitches[3];
0590     uint32 dataGMRId;
0591     uint32 dstScreenId;
0592 } SVGAOverlayUnit;
0593 #pragma pack(pop)
0594 
0595 #define SVGA_INVALID_DISPLAY_ID ((uint32)-1)
0596 
0597 typedef struct SVGADisplayTopology {
0598     uint16 displayId;
0599     uint16 isPrimary;
0600     uint32 width;
0601     uint32 height;
0602     uint32 positionX;
0603     uint32 positionY;
0604 } SVGADisplayTopology;
0605 
0606 #define SVGA_SCREEN_MUST_BE_SET (1 << 0)
0607 #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET
0608 #define SVGA_SCREEN_IS_PRIMARY (1 << 1)
0609 #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2)
0610 
0611 #define SVGA_SCREEN_DEACTIVATE (1 << 3)
0612 
0613 #define SVGA_SCREEN_BLANKING (1 << 4)
0614 
0615 #pragma pack(push, 1)
0616 typedef struct {
0617     uint32 structSize;
0618     uint32 id;
0619     uint32 flags;
0620     struct {
0621         uint32 width;
0622         uint32 height;
0623     } size;
0624     struct {
0625         int32 x;
0626         int32 y;
0627     } root;
0628 
0629     SVGAGuestImage backingStore;
0630 
0631     uint32 cloneCount;
0632 } SVGAScreenObject;
0633 #pragma pack(pop)
0634 
0635 typedef enum {
0636     SVGA_CMD_INVALID_CMD = 0,
0637     SVGA_CMD_UPDATE = 1,
0638     SVGA_CMD_RECT_COPY = 3,
0639     SVGA_CMD_RECT_ROP_COPY = 14,
0640     SVGA_CMD_DEFINE_CURSOR = 19,
0641     SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,
0642     SVGA_CMD_UPDATE_VERBOSE = 25,
0643     SVGA_CMD_FRONT_ROP_FILL = 29,
0644     SVGA_CMD_FENCE = 30,
0645     SVGA_CMD_ESCAPE = 33,
0646     SVGA_CMD_DEFINE_SCREEN = 34,
0647     SVGA_CMD_DESTROY_SCREEN = 35,
0648     SVGA_CMD_DEFINE_GMRFB = 36,
0649     SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,
0650     SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,
0651     SVGA_CMD_ANNOTATION_FILL = 39,
0652     SVGA_CMD_ANNOTATION_COPY = 40,
0653     SVGA_CMD_DEFINE_GMR2 = 41,
0654     SVGA_CMD_REMAP_GMR2 = 42,
0655     SVGA_CMD_DEAD = 43,
0656     SVGA_CMD_DEAD_2 = 44,
0657     SVGA_CMD_NOP = 45,
0658     SVGA_CMD_NOP_ERROR = 46,
0659     SVGA_CMD_MAX
0660 } SVGAFifoCmdId;
0661 
0662 #define SVGA_CMD_MAX_DATASIZE (256 * 1024)
0663 #define SVGA_CMD_MAX_ARGS 64
0664 
0665 #pragma pack(push, 1)
0666 typedef struct {
0667     uint32 x;
0668     uint32 y;
0669     uint32 width;
0670     uint32 height;
0671 } SVGAFifoCmdUpdate;
0672 #pragma pack(pop)
0673 
0674 #pragma pack(push, 1)
0675 typedef struct {
0676     uint32 srcX;
0677     uint32 srcY;
0678     uint32 destX;
0679     uint32 destY;
0680     uint32 width;
0681     uint32 height;
0682 } SVGAFifoCmdRectCopy;
0683 #pragma pack(pop)
0684 
0685 #pragma pack(push, 1)
0686 typedef struct {
0687     uint32 srcX;
0688     uint32 srcY;
0689     uint32 destX;
0690     uint32 destY;
0691     uint32 width;
0692     uint32 height;
0693     uint32 rop;
0694 } SVGAFifoCmdRectRopCopy;
0695 #pragma pack(pop)
0696 
0697 #pragma pack(push, 1)
0698 typedef struct {
0699     uint32 id;
0700     uint32 hotspotX;
0701     uint32 hotspotY;
0702     uint32 width;
0703     uint32 height;
0704     uint32 andMaskDepth;
0705     uint32 xorMaskDepth;
0706 
0707 } SVGAFifoCmdDefineCursor;
0708 #pragma pack(pop)
0709 
0710 #pragma pack(push, 1)
0711 typedef struct {
0712     uint32 id;
0713     uint32 hotspotX;
0714     uint32 hotspotY;
0715     uint32 width;
0716     uint32 height;
0717 
0718 } SVGAFifoCmdDefineAlphaCursor;
0719 #pragma pack(pop)
0720 
0721 #pragma pack(push, 1)
0722 typedef struct {
0723     uint32 hotspotX;
0724     uint32 hotspotY;
0725     uint32 width;
0726     uint32 height;
0727     uint32 andMaskDepth;
0728     uint32 xorMaskDepth;
0729 
0730 } SVGAGBColorCursorHeader;
0731 #pragma pack(pop)
0732 
0733 #pragma pack(push, 1)
0734 typedef struct {
0735     uint32 hotspotX;
0736     uint32 hotspotY;
0737     uint32 width;
0738     uint32 height;
0739 
0740 } SVGAGBAlphaCursorHeader;
0741 #pragma pack(pop)
0742 
0743 typedef enum {
0744     SVGA_COLOR_CURSOR = 0,
0745     SVGA_ALPHA_CURSOR = 1,
0746 } SVGAGBCursorType;
0747 
0748 #pragma pack(push, 1)
0749 typedef struct {
0750     SVGAGBCursorType type;
0751     union {
0752         SVGAGBColorCursorHeader colorHeader;
0753         SVGAGBAlphaCursorHeader alphaHeader;
0754     } header;
0755     uint32 sizeInBytes;
0756 
0757 } SVGAGBCursorHeader;
0758 #pragma pack(pop)
0759 
0760 #pragma pack(push, 1)
0761 typedef struct {
0762     uint32 x;
0763     uint32 y;
0764     uint32 width;
0765     uint32 height;
0766     uint32 reason;
0767 } SVGAFifoCmdUpdateVerbose;
0768 #pragma pack(pop)
0769 
0770 #pragma pack(push, 1)
0771 typedef struct {
0772     uint32 color;
0773     uint32 x;
0774     uint32 y;
0775     uint32 width;
0776     uint32 height;
0777     uint32 rop;
0778 } SVGAFifoCmdFrontRopFill;
0779 #pragma pack(pop)
0780 
0781 #pragma pack(push, 1)
0782 typedef struct {
0783     uint32 fence;
0784 } SVGAFifoCmdFence;
0785 #pragma pack(pop)
0786 
0787 #pragma pack(push, 1)
0788 typedef struct {
0789     uint32 nsid;
0790     uint32 size;
0791 
0792 } SVGAFifoCmdEscape;
0793 #pragma pack(pop)
0794 
0795 #pragma pack(push, 1)
0796 typedef struct {
0797     SVGAScreenObject screen;
0798 } SVGAFifoCmdDefineScreen;
0799 #pragma pack(pop)
0800 
0801 #pragma pack(push, 1)
0802 typedef struct {
0803     uint32 screenId;
0804 } SVGAFifoCmdDestroyScreen;
0805 #pragma pack(pop)
0806 
0807 #pragma pack(push, 1)
0808 typedef struct {
0809     SVGAGuestPtr ptr;
0810     uint32 bytesPerLine;
0811     SVGAGMRImageFormat format;
0812 } SVGAFifoCmdDefineGMRFB;
0813 #pragma pack(pop)
0814 
0815 #pragma pack(push, 1)
0816 typedef struct {
0817     SVGASignedPoint srcOrigin;
0818     SVGASignedRect destRect;
0819     uint32 destScreenId;
0820 } SVGAFifoCmdBlitGMRFBToScreen;
0821 #pragma pack(pop)
0822 
0823 #pragma pack(push, 1)
0824 typedef struct {
0825     SVGASignedPoint destOrigin;
0826     SVGASignedRect srcRect;
0827     uint32 srcScreenId;
0828 } SVGAFifoCmdBlitScreenToGMRFB;
0829 #pragma pack(pop)
0830 
0831 #pragma pack(push, 1)
0832 typedef struct {
0833     SVGAColorBGRX color;
0834 } SVGAFifoCmdAnnotationFill;
0835 #pragma pack(pop)
0836 
0837 #pragma pack(push, 1)
0838 typedef struct {
0839     SVGASignedPoint srcOrigin;
0840     uint32 srcScreenId;
0841 } SVGAFifoCmdAnnotationCopy;
0842 #pragma pack(pop)
0843 
0844 #pragma pack(push, 1)
0845 typedef struct {
0846     uint32 gmrId;
0847     uint32 numPages;
0848 } SVGAFifoCmdDefineGMR2;
0849 #pragma pack(pop)
0850 
0851 typedef enum {
0852     SVGA_REMAP_GMR2_PPN32 = 0,
0853     SVGA_REMAP_GMR2_VIA_GMR = (1 << 0),
0854     SVGA_REMAP_GMR2_PPN64 = (1 << 1),
0855     SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2),
0856 } SVGARemapGMR2Flags;
0857 
0858 #pragma pack(push, 1)
0859 typedef struct {
0860     uint32 gmrId;
0861     SVGARemapGMR2Flags flags;
0862     uint32 offsetPages;
0863     uint32 numPages;
0864 
0865 } SVGAFifoCmdRemapGMR2;
0866 #pragma pack(pop)
0867 
0868 #define SVGA_VRAM_MIN_SIZE (4 * 640 * 480)
0869 #define SVGA_VRAM_MIN_SIZE_3D (16 * 1024 * 1024)
0870 #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024)
0871 #define SVGA_MEMORY_SIZE_MAX (1024 * 1024 * 1024)
0872 #define SVGA_FIFO_SIZE_MAX (2 * 1024 * 1024)
0873 #define SVGA_GRAPHICS_MEMORY_KB_MIN (32 * 1024)
0874 #define SVGA_GRAPHICS_MEMORY_KB_MAX_2GB (2 * 1024 * 1024)
0875 #define SVGA_GRAPHICS_MEMORY_KB_MAX_3GB (3 * 1024 * 1024)
0876 #define SVGA_GRAPHICS_MEMORY_KB_MAX_4GB (4 * 1024 * 1024)
0877 #define SVGA_GRAPHICS_MEMORY_KB_MAX_8GB (8 * 1024 * 1024)
0878 #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024)
0879 
0880 #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024)
0881 
0882 #if defined(VMX86_SERVER)
0883 #define SVGA_VRAM_SIZE (4 * 1024 * 1024)
0884 #define SVGA_VRAM_SIZE_3D (64 * 1024 * 1024)
0885 #define SVGA_FIFO_SIZE (256 * 1024)
0886 #define SVGA_FIFO_SIZE_3D (516 * 1024)
0887 #define SVGA_MEMORY_SIZE_DEFAULT (160 * 1024 * 1024)
0888 #define SVGA_AUTODETECT_DEFAULT FALSE
0889 #else
0890 #define SVGA_VRAM_SIZE (16 * 1024 * 1024)
0891 #define SVGA_VRAM_SIZE_3D SVGA_VRAM_MAX_SIZE
0892 #define SVGA_FIFO_SIZE (2 * 1024 * 1024)
0893 #define SVGA_FIFO_SIZE_3D SVGA_FIFO_SIZE
0894 #define SVGA_MEMORY_SIZE_DEFAULT (768 * 1024 * 1024)
0895 #define SVGA_AUTODETECT_DEFAULT TRUE
0896 #endif
0897 
0898 #define SVGA_FIFO_SIZE_GBOBJECTS (256 * 1024)
0899 #define SVGA_VRAM_SIZE_GBOBJECTS (4 * 1024 * 1024)
0900 
0901 #endif