1 | /* $Id: DevVGA-SVGA.h 86838 2020-11-09 23:16:50Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMware SVGA device
|
---|
4 | */
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2013-2020 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA_h
|
---|
18 | #define VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA_h
|
---|
19 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
20 | # pragma once
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #ifndef VBOX_WITH_VMSVGA
|
---|
24 | # error "VBOX_WITH_VMSVGA is not defined"
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #define VMSVGA_USE_EMT_HALT_CODE
|
---|
28 |
|
---|
29 | #include <VBox/pci.h>
|
---|
30 | #include <VBox/vmm/pdmifs.h>
|
---|
31 | #include <VBox/vmm/pdmthread.h>
|
---|
32 | #include <VBox/vmm/stam.h>
|
---|
33 | #ifdef VMSVGA_USE_EMT_HALT_CODE
|
---|
34 | # include <VBox/vmm/vmapi.h>
|
---|
35 | # include <VBox/vmm/vmcpuset.h>
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /*
|
---|
39 | * PCI device IDs.
|
---|
40 | */
|
---|
41 | #ifndef PCI_VENDOR_ID_VMWARE
|
---|
42 | # define PCI_VENDOR_ID_VMWARE 0x15AD
|
---|
43 | #endif
|
---|
44 | #ifndef PCI_DEVICE_ID_VMWARE_SVGA2
|
---|
45 | # define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | /* For "svga_overlay.h" */
|
---|
49 | #ifndef TRUE
|
---|
50 | # define TRUE 1
|
---|
51 | #endif
|
---|
52 | #ifndef FALSE
|
---|
53 | # define FALSE 0
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /* GCC complains that 'ISO C++ prohibits anonymous structs' when "-Wpedantic" is enabled. */
|
---|
57 | #if RT_GNUC_PREREQ(4, 6)
|
---|
58 | # pragma GCC diagnostic push
|
---|
59 | # pragma GCC diagnostic ignored "-Wpedantic"
|
---|
60 | #endif
|
---|
61 | /* VMSVGA headers from SVGA Gallium driver. */
|
---|
62 | #pragma pack(1) /* VMSVGA structures are '__packed'. */
|
---|
63 | #include <svga3d_caps.h>
|
---|
64 | #include <svga3d_reg.h>
|
---|
65 | #include <svga3d_shaderdefs.h>
|
---|
66 | #include <svga_escape.h>
|
---|
67 | #include <svga_overlay.h>
|
---|
68 | #pragma pack()
|
---|
69 | #if RT_GNUC_PREREQ(4, 6)
|
---|
70 | # pragma GCC diagnostic pop
|
---|
71 | #endif
|
---|
72 |
|
---|
73 | /* Deprecated commands. They are not included in the VMSVGA headers anymore. */
|
---|
74 | #define SVGA_CMD_RECT_FILL 2
|
---|
75 | #define SVGA_CMD_DISPLAY_CURSOR 20
|
---|
76 | #define SVGA_CMD_MOVE_CURSOR 21
|
---|
77 |
|
---|
78 | /*
|
---|
79 | * SVGA_CMD_RECT_FILL --
|
---|
80 | *
|
---|
81 | * Fill a rectangular area in the the GFB, and copy the result
|
---|
82 | * to any screens which intersect it.
|
---|
83 | *
|
---|
84 | * Deprecated?
|
---|
85 | *
|
---|
86 | * Availability:
|
---|
87 | * SVGA_CAP_RECT_FILL
|
---|
88 | */
|
---|
89 |
|
---|
90 | typedef
|
---|
91 | struct {
|
---|
92 | uint32_t pixel;
|
---|
93 | uint32_t destX;
|
---|
94 | uint32_t destY;
|
---|
95 | uint32_t width;
|
---|
96 | uint32_t height;
|
---|
97 | } SVGAFifoCmdRectFill;
|
---|
98 |
|
---|
99 | /*
|
---|
100 | * SVGA_CMD_DISPLAY_CURSOR --
|
---|
101 | *
|
---|
102 | * Turn the cursor on or off.
|
---|
103 | *
|
---|
104 | * Deprecated.
|
---|
105 | *
|
---|
106 | * Availability:
|
---|
107 | * SVGA_CAP_CURSOR?
|
---|
108 | */
|
---|
109 |
|
---|
110 | typedef
|
---|
111 | struct {
|
---|
112 | uint32_t id; // Reserved, must be zero.
|
---|
113 | uint32_t state; // 0=off
|
---|
114 | } SVGAFifoCmdDisplayCursor;
|
---|
115 |
|
---|
116 | /*
|
---|
117 | * SVGA_CMD_MOVE_CURSOR --
|
---|
118 | *
|
---|
119 | * Set the cursor position.
|
---|
120 | *
|
---|
121 | * Deprecated.
|
---|
122 | *
|
---|
123 | * Availability:
|
---|
124 | * SVGA_CAP_CURSOR?
|
---|
125 | */
|
---|
126 |
|
---|
127 | typedef
|
---|
128 | struct {
|
---|
129 | SVGASignedPoint pos;
|
---|
130 | } SVGAFifoCmdMoveCursor;
|
---|
131 |
|
---|
132 |
|
---|
133 | /** Default FIFO size. */
|
---|
134 | #define VMSVGA_FIFO_SIZE _2M
|
---|
135 | /** The old FIFO size. */
|
---|
136 | #define VMSVGA_FIFO_SIZE_OLD _128K
|
---|
137 |
|
---|
138 | /** Default scratch region size. */
|
---|
139 | #define VMSVGA_SCRATCH_SIZE 0x100
|
---|
140 | /** Surface memory available to the guest. */
|
---|
141 | #define VMSVGA_SURFACE_SIZE (512*1024*1024)
|
---|
142 | /** Maximum GMR pages. */
|
---|
143 | #define VMSVGA_MAX_GMR_PAGES 0x100000
|
---|
144 | /** Maximum nr of GMR ids. */
|
---|
145 | #define VMSVGA_MAX_GMR_IDS _8K
|
---|
146 | /** Maximum number of GMR descriptors. */
|
---|
147 | #define VMSVGA_MAX_GMR_DESC_LOOP_COUNT VMSVGA_MAX_GMR_PAGES
|
---|
148 |
|
---|
149 | #define VMSVGA_VAL_UNINITIALIZED (unsigned)-1
|
---|
150 |
|
---|
151 | /** For validating X and width values.
|
---|
152 | * The code assumes it's at least an order of magnitude less than UINT32_MAX. */
|
---|
153 | #define VMSVGA_MAX_X _1M
|
---|
154 | /** For validating Y and height values.
|
---|
155 | * The code assumes it's at least an order of magnitude less than UINT32_MAX. */
|
---|
156 | #define VMSVGA_MAX_Y _1M
|
---|
157 |
|
---|
158 | /* u32ActionFlags */
|
---|
159 | #define VMSVGA_ACTION_CHANGEMODE_BIT 0
|
---|
160 | #define VMSVGA_ACTION_CHANGEMODE RT_BIT(VMSVGA_ACTION_CHANGEMODE_BIT)
|
---|
161 |
|
---|
162 |
|
---|
163 | #ifdef DEBUG
|
---|
164 | /* Enable to log FIFO register accesses. */
|
---|
165 | //# define DEBUG_FIFO_ACCESS
|
---|
166 | /* Enable to log GMR page accesses. */
|
---|
167 | //# define DEBUG_GMR_ACCESS
|
---|
168 | #endif
|
---|
169 |
|
---|
170 | #define VMSVGA_FIFO_EXTCMD_NONE 0
|
---|
171 | #define VMSVGA_FIFO_EXTCMD_TERMINATE 1
|
---|
172 | #define VMSVGA_FIFO_EXTCMD_SAVESTATE 2
|
---|
173 | #define VMSVGA_FIFO_EXTCMD_LOADSTATE 3
|
---|
174 | #define VMSVGA_FIFO_EXTCMD_RESET 4
|
---|
175 | #define VMSVGA_FIFO_EXTCMD_UPDATE_SURFACE_HEAP_BUFFERS 5
|
---|
176 | #define VMSVGA_FIFO_EXTCMD_POWEROFF 6
|
---|
177 |
|
---|
178 | /** Size of the region to backup when switching into svga mode. */
|
---|
179 | #define VMSVGA_VGA_FB_BACKUP_SIZE _512K
|
---|
180 |
|
---|
181 | /** @def VMSVGA_WITH_VGA_FB_BACKUP
|
---|
182 | * Enables correct VGA MMIO read/write handling when VMSVGA is enabled. It
|
---|
183 | * is SLOW and probably not entirely right, but it helps with getting 3dmark
|
---|
184 | * output and other stuff. */
|
---|
185 | #define VMSVGA_WITH_VGA_FB_BACKUP 1
|
---|
186 |
|
---|
187 | /** @def VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3
|
---|
188 | * defined(VMSVGA_WITH_VGA_FB_BACKUP) && defined(IN_RING3) */
|
---|
189 | #if (defined(VMSVGA_WITH_VGA_FB_BACKUP) && defined(IN_RING3)) || defined(DOXYGEN_RUNNING)
|
---|
190 | # define VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3 1
|
---|
191 | #else
|
---|
192 | # undef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RING3
|
---|
193 | #endif
|
---|
194 |
|
---|
195 | /** @def VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RZ
|
---|
196 | * defined(VMSVGA_WITH_VGA_FB_BACKUP) && !defined(IN_RING3) */
|
---|
197 | #if (defined(VMSVGA_WITH_VGA_FB_BACKUP) && !defined(IN_RING3)) || defined(DOXYGEN_RUNNING)
|
---|
198 | # define VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RZ 1
|
---|
199 | #else
|
---|
200 | # undef VMSVGA_WITH_VGA_FB_BACKUP_AND_IN_RZ
|
---|
201 | #endif
|
---|
202 |
|
---|
203 |
|
---|
204 | typedef struct
|
---|
205 | {
|
---|
206 | PSSMHANDLE pSSM;
|
---|
207 | uint32_t uVersion;
|
---|
208 | uint32_t uPass;
|
---|
209 | } VMSVGA_STATE_LOAD;
|
---|
210 | typedef VMSVGA_STATE_LOAD *PVMSVGA_STATE_LOAD;
|
---|
211 |
|
---|
212 | /** Host screen viewport.
|
---|
213 | * (4th quadrant with negated Y values - usual Windows and X11 world view.) */
|
---|
214 | typedef struct VMSVGAVIEWPORT
|
---|
215 | {
|
---|
216 | uint32_t x; /**< x coordinate (left). */
|
---|
217 | uint32_t y; /**< y coordinate (top). */
|
---|
218 | uint32_t cx; /**< width. */
|
---|
219 | uint32_t cy; /**< height. */
|
---|
220 | /** Right side coordinate (exclusive). Same as x + cx. */
|
---|
221 | uint32_t xRight;
|
---|
222 | /** First quadrant low y coordinate.
|
---|
223 | * Same as y + cy - 1 in window coordinates. */
|
---|
224 | uint32_t yLowWC;
|
---|
225 | /** First quadrant high y coordinate (exclusive) - yLowWC + cy.
|
---|
226 | * Same as y - 1 in window coordinates. */
|
---|
227 | uint32_t yHighWC;
|
---|
228 | /** Alignment padding. */
|
---|
229 | uint32_t uAlignment;
|
---|
230 | } VMSVGAVIEWPORT;
|
---|
231 |
|
---|
232 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
233 | typedef struct VMSVGAHWSCREEN *PVMSVGAHWSCREEN;
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | /**
|
---|
237 | * Screen object state.
|
---|
238 | */
|
---|
239 | typedef struct VMSVGASCREENOBJECT
|
---|
240 | {
|
---|
241 | /** SVGA_SCREEN_* flags. */
|
---|
242 | uint32_t fuScreen;
|
---|
243 | /** The screen object id. */
|
---|
244 | uint32_t idScreen;
|
---|
245 | /** The screen dimensions. */
|
---|
246 | int32_t xOrigin;
|
---|
247 | int32_t yOrigin;
|
---|
248 | uint32_t cWidth;
|
---|
249 | uint32_t cHeight;
|
---|
250 | /** Offset of the screen buffer in the guest VRAM. */
|
---|
251 | uint32_t offVRAM;
|
---|
252 | /** Scanline pitch. */
|
---|
253 | uint32_t cbPitch;
|
---|
254 | /** Bits per pixel. */
|
---|
255 | uint32_t cBpp;
|
---|
256 | /** The physical DPI that the guest expects for this screen. Zero, if the guest is not DPI aware. */
|
---|
257 | uint32_t cDpi;
|
---|
258 | bool fDefined;
|
---|
259 | bool fModified;
|
---|
260 | void *pvScreenBitmap;
|
---|
261 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
262 | /** Pointer to the HW accelerated (3D) screen data. */
|
---|
263 | R3PTRTYPE(PVMSVGAHWSCREEN) pHwScreen;
|
---|
264 | #endif
|
---|
265 | } VMSVGASCREENOBJECT;
|
---|
266 |
|
---|
267 | /** Pointer to the private VMSVGA ring-3 state structure.
|
---|
268 | * @todo Still not entirely satisfired with the type name, but better than
|
---|
269 | * the previous lower/upper case only distinction. */
|
---|
270 | typedef struct VMSVGAR3STATE *PVMSVGAR3STATE;
|
---|
271 | /** Pointer to the private (implementation specific) VMSVGA3d state. */
|
---|
272 | typedef struct VMSVGA3DSTATE *PVMSVGA3DSTATE;
|
---|
273 |
|
---|
274 |
|
---|
275 | /**
|
---|
276 | * The VMSVGA device state.
|
---|
277 | *
|
---|
278 | * This instantatiated as VGASTATE::svga.
|
---|
279 | */
|
---|
280 | typedef struct VMSVGAState
|
---|
281 | {
|
---|
282 | /** Guest physical address of the FIFO memory range. */
|
---|
283 | RTGCPHYS GCPhysFIFO;
|
---|
284 | /** Size in bytes of the FIFO memory range.
|
---|
285 | * This may be smaller than cbFIFOConfig after restoring an old VM state. */
|
---|
286 | uint32_t cbFIFO;
|
---|
287 | /** The configured FIFO size. */
|
---|
288 | uint32_t cbFIFOConfig;
|
---|
289 | /** SVGA id. */
|
---|
290 | uint32_t u32SVGAId;
|
---|
291 | /** SVGA extensions enabled or not. */
|
---|
292 | uint32_t fEnabled;
|
---|
293 | /** SVGA memory area configured status. */
|
---|
294 | uint32_t fConfigured;
|
---|
295 | /** Device is busy handling FIFO requests (VMSVGA_BUSY_F_FIFO,
|
---|
296 | * VMSVGA_BUSY_F_EMT_FORCE). */
|
---|
297 | uint32_t volatile fBusy;
|
---|
298 | #define VMSVGA_BUSY_F_FIFO RT_BIT_32(0) /**< The normal true/false busy FIFO bit. */
|
---|
299 | #define VMSVGA_BUSY_F_EMT_FORCE RT_BIT_32(1) /**< Bit preventing race status flickering when EMT kicks the FIFO thread. */
|
---|
300 | /** Traces (dirty page detection) enabled or not. */
|
---|
301 | uint32_t fTraces;
|
---|
302 | /** Guest OS identifier. */
|
---|
303 | uint32_t u32GuestId;
|
---|
304 | /** Scratch region size (VMSVGAState::au32ScratchRegion). */
|
---|
305 | uint32_t cScratchRegion;
|
---|
306 | /** Irq status. */
|
---|
307 | uint32_t u32IrqStatus;
|
---|
308 | /** Irq mask. */
|
---|
309 | uint32_t u32IrqMask;
|
---|
310 | /** Pitch lock. */
|
---|
311 | uint32_t u32PitchLock;
|
---|
312 | /** Current GMR id. (SVGA_REG_GMR_ID) */
|
---|
313 | uint32_t u32CurrentGMRId;
|
---|
314 | /** SVGA device capabilities. */
|
---|
315 | uint32_t u32DeviceCaps;
|
---|
316 | uint32_t Padding0; /* Used to be I/O port base address. */
|
---|
317 | /** Port io index register. */
|
---|
318 | uint32_t u32IndexReg;
|
---|
319 | /** FIFO request semaphore. */
|
---|
320 | SUPSEMEVENT hFIFORequestSem;
|
---|
321 | /** The last seen SVGA_FIFO_CURSOR_COUNT value.
|
---|
322 | * Used by the FIFO thread and its watchdog. */
|
---|
323 | uint32_t uLastCursorUpdateCount;
|
---|
324 | /** Indicates that the FIFO thread is sleeping and might need waking up. */
|
---|
325 | bool volatile fFIFOThreadSleeping;
|
---|
326 | /** The legacy GFB mode registers. If used, they correspond to screen 0. */
|
---|
327 | /** True when the guest modifies the GFB mode registers. */
|
---|
328 | bool fGFBRegisters;
|
---|
329 | /** SVGA 3D overlay enabled or not. */
|
---|
330 | bool f3DOverlayEnabled;
|
---|
331 | bool afPadding[5];
|
---|
332 | uint32_t uWidth;
|
---|
333 | uint32_t uHeight;
|
---|
334 | uint32_t uBpp;
|
---|
335 | uint32_t cbScanline;
|
---|
336 | uint32_t uHostBpp;
|
---|
337 | /** Maximum width supported. */
|
---|
338 | uint32_t u32MaxWidth;
|
---|
339 | /** Maximum height supported. */
|
---|
340 | uint32_t u32MaxHeight;
|
---|
341 | /** Viewport rectangle, i.e. what's currently visible of the target host
|
---|
342 | * window. This is usually (0,0)(uWidth,uHeight), but if the window is
|
---|
343 | * shrunk and scrolling applied, both the origin and size may differ. */
|
---|
344 | VMSVGAVIEWPORT viewport;
|
---|
345 | /** Action flags */
|
---|
346 | uint32_t u32ActionFlags;
|
---|
347 | /** SVGA 3d extensions enabled or not. */
|
---|
348 | bool f3DEnabled;
|
---|
349 | /** VRAM page monitoring enabled or not. */
|
---|
350 | bool fVRAMTracking;
|
---|
351 | /** External command to be executed in the FIFO thread. */
|
---|
352 | uint8_t volatile u8FIFOExtCommand;
|
---|
353 | /** Set by vmsvgaR3RunExtCmdOnFifoThread when it temporarily resumes the FIFO
|
---|
354 | * thread and does not want it do anything but the command. */
|
---|
355 | bool volatile fFifoExtCommandWakeup;
|
---|
356 | #ifdef DEBUG_GMR_ACCESS
|
---|
357 | /** GMR debug access handler type handle. */
|
---|
358 | PGMPHYSHANDLERTYPE hGmrAccessHandlerType;
|
---|
359 | #endif
|
---|
360 | #if defined(VMSVGA_USE_FIFO_ACCESS_HANDLER) || defined(DEBUG_FIFO_ACCESS)
|
---|
361 | /** FIFO debug access handler type handle. */
|
---|
362 | PGMPHYSHANDLERTYPE hFifoAccessHandlerType;
|
---|
363 | #elif defined(DEBUG_GMR_ACCESS)
|
---|
364 | uint32_t uPadding1;
|
---|
365 | #endif
|
---|
366 | /** Number of GMRs (VMSVGA_MAX_GMR_IDS, count of elements in VMSVGAR3STATE::paGMR array). */
|
---|
367 | uint32_t cGMR;
|
---|
368 | uint32_t uScreenOffset; /* Used only for loading older saved states. */
|
---|
369 |
|
---|
370 | /** Legacy cursor state. */
|
---|
371 | uint32_t uCursorX;
|
---|
372 | uint32_t uCursorY;
|
---|
373 | uint32_t uCursorID;
|
---|
374 | uint32_t uCursorOn;
|
---|
375 |
|
---|
376 | /** Scratch array.
|
---|
377 | * Putting this at the end since it's big it probably not . */
|
---|
378 | uint32_t au32ScratchRegion[VMSVGA_SCRATCH_SIZE];
|
---|
379 |
|
---|
380 | /** Array of SVGA3D_DEVCAP values, which are accessed via SVGA_REG_DEV_CAP. */
|
---|
381 | uint32_t au32DevCaps[SVGA3D_DEVCAP_MAX];
|
---|
382 | /** Index written to the SVGA_REG_DEV_CAP register. */
|
---|
383 | uint32_t u32DevCapIndex;
|
---|
384 | uint32_t u32RegCommandLow;
|
---|
385 | uint32_t u32RegCommandHigh;
|
---|
386 |
|
---|
387 | STAMCOUNTER StatRegBitsPerPixelWr;
|
---|
388 | STAMCOUNTER StatRegBusyWr;
|
---|
389 | STAMCOUNTER StatRegCursorXWr;
|
---|
390 | STAMCOUNTER StatRegCursorYWr;
|
---|
391 | STAMCOUNTER StatRegCursorIdWr;
|
---|
392 | STAMCOUNTER StatRegCursorOnWr;
|
---|
393 | STAMCOUNTER StatRegDepthWr;
|
---|
394 | STAMCOUNTER StatRegDisplayHeightWr;
|
---|
395 | STAMCOUNTER StatRegDisplayIdWr;
|
---|
396 | STAMCOUNTER StatRegDisplayIsPrimaryWr;
|
---|
397 | STAMCOUNTER StatRegDisplayPositionXWr;
|
---|
398 | STAMCOUNTER StatRegDisplayPositionYWr;
|
---|
399 | STAMCOUNTER StatRegDisplayWidthWr;
|
---|
400 | STAMCOUNTER StatRegEnableWr;
|
---|
401 | STAMCOUNTER StatRegGmrIdWr;
|
---|
402 | STAMCOUNTER StatRegGuestIdWr;
|
---|
403 | STAMCOUNTER StatRegHeightWr;
|
---|
404 | STAMCOUNTER StatRegIdWr;
|
---|
405 | STAMCOUNTER StatRegIrqMaskWr;
|
---|
406 | STAMCOUNTER StatRegNumDisplaysWr;
|
---|
407 | STAMCOUNTER StatRegNumGuestDisplaysWr;
|
---|
408 | STAMCOUNTER StatRegPaletteWr;
|
---|
409 | STAMCOUNTER StatRegPitchLockWr;
|
---|
410 | STAMCOUNTER StatRegPseudoColorWr;
|
---|
411 | STAMCOUNTER StatRegReadOnlyWr;
|
---|
412 | STAMCOUNTER StatRegScratchWr;
|
---|
413 | STAMCOUNTER StatRegSyncWr;
|
---|
414 | STAMCOUNTER StatRegTopWr;
|
---|
415 | STAMCOUNTER StatRegTracesWr;
|
---|
416 | STAMCOUNTER StatRegUnknownWr;
|
---|
417 | STAMCOUNTER StatRegWidthWr;
|
---|
418 | STAMCOUNTER StatRegCommandLowWr;
|
---|
419 | STAMCOUNTER StatRegCommandHighWr;
|
---|
420 | STAMCOUNTER StatRegDevCapWr;
|
---|
421 | STAMCOUNTER StatRegCmdPrependLowWr;
|
---|
422 | STAMCOUNTER StatRegCmdPrependHighWr;
|
---|
423 |
|
---|
424 | STAMCOUNTER StatRegBitsPerPixelRd;
|
---|
425 | STAMCOUNTER StatRegBlueMaskRd;
|
---|
426 | STAMCOUNTER StatRegBusyRd;
|
---|
427 | STAMCOUNTER StatRegBytesPerLineRd;
|
---|
428 | STAMCOUNTER StatRegCapabilitesRd;
|
---|
429 | STAMCOUNTER StatRegConfigDoneRd;
|
---|
430 | STAMCOUNTER StatRegCursorXRd;
|
---|
431 | STAMCOUNTER StatRegCursorYRd;
|
---|
432 | STAMCOUNTER StatRegCursorIdRd;
|
---|
433 | STAMCOUNTER StatRegCursorOnRd;
|
---|
434 | STAMCOUNTER StatRegDepthRd;
|
---|
435 | STAMCOUNTER StatRegDisplayHeightRd;
|
---|
436 | STAMCOUNTER StatRegDisplayIdRd;
|
---|
437 | STAMCOUNTER StatRegDisplayIsPrimaryRd;
|
---|
438 | STAMCOUNTER StatRegDisplayPositionXRd;
|
---|
439 | STAMCOUNTER StatRegDisplayPositionYRd;
|
---|
440 | STAMCOUNTER StatRegDisplayWidthRd;
|
---|
441 | STAMCOUNTER StatRegEnableRd;
|
---|
442 | STAMCOUNTER StatRegFbOffsetRd;
|
---|
443 | STAMCOUNTER StatRegFbSizeRd;
|
---|
444 | STAMCOUNTER StatRegFbStartRd;
|
---|
445 | STAMCOUNTER StatRegGmrIdRd;
|
---|
446 | STAMCOUNTER StatRegGmrMaxDescriptorLengthRd;
|
---|
447 | STAMCOUNTER StatRegGmrMaxIdsRd;
|
---|
448 | STAMCOUNTER StatRegGmrsMaxPagesRd;
|
---|
449 | STAMCOUNTER StatRegGreenMaskRd;
|
---|
450 | STAMCOUNTER StatRegGuestIdRd;
|
---|
451 | STAMCOUNTER StatRegHeightRd;
|
---|
452 | STAMCOUNTER StatRegHostBitsPerPixelRd;
|
---|
453 | STAMCOUNTER StatRegIdRd;
|
---|
454 | STAMCOUNTER StatRegIrqMaskRd;
|
---|
455 | STAMCOUNTER StatRegMaxHeightRd;
|
---|
456 | STAMCOUNTER StatRegMaxWidthRd;
|
---|
457 | STAMCOUNTER StatRegMemorySizeRd;
|
---|
458 | STAMCOUNTER StatRegMemRegsRd;
|
---|
459 | STAMCOUNTER StatRegMemSizeRd;
|
---|
460 | STAMCOUNTER StatRegMemStartRd;
|
---|
461 | STAMCOUNTER StatRegNumDisplaysRd;
|
---|
462 | STAMCOUNTER StatRegNumGuestDisplaysRd;
|
---|
463 | STAMCOUNTER StatRegPaletteRd;
|
---|
464 | STAMCOUNTER StatRegPitchLockRd;
|
---|
465 | STAMCOUNTER StatRegPsuedoColorRd;
|
---|
466 | STAMCOUNTER StatRegRedMaskRd;
|
---|
467 | STAMCOUNTER StatRegScratchRd;
|
---|
468 | STAMCOUNTER StatRegScratchSizeRd;
|
---|
469 | STAMCOUNTER StatRegSyncRd;
|
---|
470 | STAMCOUNTER StatRegTopRd;
|
---|
471 | STAMCOUNTER StatRegTracesRd;
|
---|
472 | STAMCOUNTER StatRegUnknownRd;
|
---|
473 | STAMCOUNTER StatRegVramSizeRd;
|
---|
474 | STAMCOUNTER StatRegWidthRd;
|
---|
475 | STAMCOUNTER StatRegWriteOnlyRd;
|
---|
476 | STAMCOUNTER StatRegCommandLowRd;
|
---|
477 | STAMCOUNTER StatRegCommandHighRd;
|
---|
478 | STAMCOUNTER StatRegMaxPrimBBMemRd;
|
---|
479 | STAMCOUNTER StatRegGBMemSizeRd;
|
---|
480 | STAMCOUNTER StatRegDevCapRd;
|
---|
481 | STAMCOUNTER StatRegCmdPrependLowRd;
|
---|
482 | STAMCOUNTER StatRegCmdPrependHighRd;
|
---|
483 | STAMCOUNTER StatRegScrnTgtMaxWidthRd;
|
---|
484 | STAMCOUNTER StatRegScrnTgtMaxHeightRd;
|
---|
485 | STAMCOUNTER StatRegMobMaxSizeRd;
|
---|
486 | } VMSVGAState, VMSVGASTATE;
|
---|
487 |
|
---|
488 |
|
---|
489 | /**
|
---|
490 | * The VMSVGA device state for ring-3
|
---|
491 | *
|
---|
492 | * This instantatiated as VGASTATER3::svga.
|
---|
493 | */
|
---|
494 | typedef struct VMSVGASTATER3
|
---|
495 | {
|
---|
496 | /** The R3 FIFO pointer. */
|
---|
497 | R3PTRTYPE(uint32_t *) pau32FIFO;
|
---|
498 | /** R3 Opaque pointer to svga state. */
|
---|
499 | R3PTRTYPE(PVMSVGAR3STATE) pSvgaR3State;
|
---|
500 | /** R3 Opaque pointer to 3d state. */
|
---|
501 | R3PTRTYPE(PVMSVGA3DSTATE) p3dState;
|
---|
502 | /** The separate VGA frame buffer in svga mode.
|
---|
503 | * Unlike the the boch-based VGA device implementation, VMSVGA seems to have a
|
---|
504 | * separate frame buffer for VGA and allows concurrent use of both. The SVGA
|
---|
505 | * SDK is making use of this to do VGA text output while testing other things in
|
---|
506 | * SVGA mode, displaying the result by switching back to VGA text mode. So,
|
---|
507 | * when entering SVGA mode we copy the first part of the frame buffer here and
|
---|
508 | * direct VGA accesses here instead. It is copied back when leaving SVGA mode. */
|
---|
509 | R3PTRTYPE(uint8_t *) pbVgaFrameBufferR3;
|
---|
510 | /** R3 Opaque pointer to an external fifo cmd parameter. */
|
---|
511 | R3PTRTYPE(void * volatile) pvFIFOExtCmdParam;
|
---|
512 |
|
---|
513 | /** FIFO external command semaphore. */
|
---|
514 | R3PTRTYPE(RTSEMEVENT) hFIFOExtCmdSem;
|
---|
515 | /** FIFO IO Thread. */
|
---|
516 | R3PTRTYPE(PPDMTHREAD) pFIFOIOThread;
|
---|
517 | } VMSVGASTATER3;
|
---|
518 |
|
---|
519 |
|
---|
520 | /**
|
---|
521 | * The VMSVGA device state for ring-0
|
---|
522 | *
|
---|
523 | * This instantatiated as VGASTATER0::svga.
|
---|
524 | */
|
---|
525 | typedef struct VMSVGASTATER0
|
---|
526 | {
|
---|
527 | /** The R0 FIFO pointer.
|
---|
528 | * @note This only points to the _first_ _page_ of the FIFO! */
|
---|
529 | R0PTRTYPE(uint32_t *) pau32FIFO;
|
---|
530 | } VMSVGASTATER0;
|
---|
531 |
|
---|
532 |
|
---|
533 | typedef struct VGAState *PVGASTATE;
|
---|
534 | typedef struct VGASTATER3 *PVGASTATER3;
|
---|
535 | typedef struct VGASTATER0 *PVGASTATER0;
|
---|
536 | typedef struct VGASTATERC *PVGASTATERC;
|
---|
537 | typedef CTX_SUFF(PVGASTATE) PVGASTATECC;
|
---|
538 |
|
---|
539 | DECLCALLBACK(int) vmsvgaR3PciIORegionFifoMapUnmap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
|
---|
540 | RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType);
|
---|
541 | DECLCALLBACK(VBOXSTRICTRC) vmsvgaIORead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t *pu32, unsigned cb);
|
---|
542 | DECLCALLBACK(VBOXSTRICTRC) vmsvgaIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb);
|
---|
543 |
|
---|
544 | DECLCALLBACK(void) vmsvgaR3PortSetViewport(PPDMIDISPLAYPORT pInterface, uint32_t uScreenId,
|
---|
545 | uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
|
---|
546 | DECLCALLBACK(void) vmsvgaR3PortReportMonitorPositions(PPDMIDISPLAYPORT pInterface, uint32_t cPositions, PCRTPOINT paPositions);
|
---|
547 |
|
---|
548 | int vmsvgaR3Init(PPDMDEVINS pDevIns);
|
---|
549 | int vmsvgaR3Reset(PPDMDEVINS pDevIns);
|
---|
550 | int vmsvgaR3Destruct(PPDMDEVINS pDevIns);
|
---|
551 | int vmsvgaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
|
---|
552 | int vmsvgaR3LoadDone(PPDMDEVINS pDevIns);
|
---|
553 | int vmsvgaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
|
---|
554 | DECLCALLBACK(void) vmsvgaR3PowerOn(PPDMDEVINS pDevIns);
|
---|
555 | DECLCALLBACK(void) vmsvgaR3PowerOff(PPDMDEVINS pDevIns);
|
---|
556 | void vmsvgaR3FifoWatchdogTimer(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC);
|
---|
557 |
|
---|
558 | #ifdef IN_RING3
|
---|
559 | VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATECC pThisCC, uint32_t idScreen);
|
---|
560 | int vmsvgaR3UpdateScreen(PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen, int x, int y, int w, int h);
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | int vmsvgaR3GmrTransfer(PVGASTATE pThis, PVGASTATECC pThisCC, const SVGA3dTransferType enmTransferType,
|
---|
564 | uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
|
---|
565 | SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
|
---|
566 | uint32_t cbWidth, uint32_t cHeight);
|
---|
567 |
|
---|
568 | void vmsvgaR3ClipCopyBox(const SVGA3dSize *pSizeSrc, const SVGA3dSize *pSizeDest, SVGA3dCopyBox *pBox);
|
---|
569 | void vmsvgaR3ClipBox(const SVGA3dSize *pSize, SVGA3dBox *pBox);
|
---|
570 | void vmsvgaR3ClipRect(SVGASignedRect const *pBound, SVGASignedRect *pRect);
|
---|
571 | void vmsvgaR3Clip3dRect(SVGA3dRect const *pBound, SVGA3dRect RT_UNTRUSTED_GUEST *pRect);
|
---|
572 |
|
---|
573 | #endif /* !VBOX_INCLUDED_SRC_Graphics_DevVGA_SVGA_h */
|
---|