1 | /* SPDX-License-Identifier: GPL-2.0 OR MIT */
|
---|
2 | /**********************************************************
|
---|
3 | * Copyright 1998-2015 VMware, Inc.
|
---|
4 | *
|
---|
5 | * Permission is hereby granted, free of charge, to any person
|
---|
6 | * obtaining a copy of this software and associated documentation
|
---|
7 | * files (the "Software"), to deal in the Software without
|
---|
8 | * restriction, including without limitation the rights to use, copy,
|
---|
9 | * modify, merge, publish, distribute, sublicense, and/or sell copies
|
---|
10 | * of the Software, and to permit persons to whom the Software is
|
---|
11 | * furnished to do so, subject to the following conditions:
|
---|
12 | *
|
---|
13 | * The above copyright notice and this permission notice shall be
|
---|
14 | * included in all copies or substantial portions of the Software.
|
---|
15 | *
|
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
---|
20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
---|
21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
23 | * SOFTWARE.
|
---|
24 | *
|
---|
25 | **********************************************************/
|
---|
26 |
|
---|
27 | /*
|
---|
28 | * svga_reg.h --
|
---|
29 | *
|
---|
30 | * Virtual hardware definitions for the VMware SVGA II device.
|
---|
31 | */
|
---|
32 |
|
---|
33 | #ifndef _SVGA_REG_H_
|
---|
34 | #define _SVGA_REG_H_
|
---|
35 |
|
---|
36 | #define INCLUDE_ALLOW_MODULE
|
---|
37 | #define INCLUDE_ALLOW_USERLEVEL
|
---|
38 |
|
---|
39 | #define INCLUDE_ALLOW_VMCORE
|
---|
40 | #include "includeCheck.h"
|
---|
41 |
|
---|
42 | #include "svga_types.h"
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * SVGA_REG_ENABLE bit definitions.
|
---|
46 | */
|
---|
47 | typedef enum {
|
---|
48 | SVGA_REG_ENABLE_DISABLE = 0,
|
---|
49 | SVGA_REG_ENABLE_ENABLE = (1 << 0),
|
---|
50 | SVGA_REG_ENABLE_HIDE = (1 << 1),
|
---|
51 | } SvgaRegEnable;
|
---|
52 |
|
---|
53 | typedef uint32 SVGAMobId;
|
---|
54 |
|
---|
55 | /*
|
---|
56 | * Arbitrary and meaningless limits. Please ignore these when writing
|
---|
57 | * new drivers.
|
---|
58 | */
|
---|
59 | #define SVGA_MAX_WIDTH 2560
|
---|
60 | #define SVGA_MAX_HEIGHT 1600
|
---|
61 |
|
---|
62 |
|
---|
63 | #define SVGA_MAX_BITS_PER_PIXEL 32
|
---|
64 | #define SVGA_MAX_DEPTH 24
|
---|
65 | #define SVGA_MAX_DISPLAYS 10
|
---|
66 | #define SVGA_MAX_SCREEN_SIZE 8192
|
---|
67 | #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS)
|
---|
68 |
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned
|
---|
72 | * cursor bypass mode.
|
---|
73 | */
|
---|
74 | #define SVGA_CURSOR_ON_HIDE 0x0
|
---|
75 | #define SVGA_CURSOR_ON_SHOW 0x1
|
---|
76 |
|
---|
77 | /*
|
---|
78 | * Remove the cursor from the framebuffer
|
---|
79 | * because we need to see what's under it
|
---|
80 | */
|
---|
81 | #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2
|
---|
82 |
|
---|
83 | /* Put the cursor back in the framebuffer so the user can see it */
|
---|
84 | #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * The maximum framebuffer size that can traced for guests unless the
|
---|
88 | * SVGA_CAP_GBOBJECTS is set in SVGA_REG_CAPABILITIES. In that case
|
---|
89 | * the full framebuffer can be traced independent of this limit.
|
---|
90 | */
|
---|
91 | #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000
|
---|
92 |
|
---|
93 | #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
|
---|
94 | #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
|
---|
95 | #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)
|
---|
96 |
|
---|
97 | #define SVGA_MAGIC 0x900000UL
|
---|
98 | #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
|
---|
99 |
|
---|
100 | /* Version 2 let the address of the frame buffer be unsigned on Win32 */
|
---|
101 | #define SVGA_VERSION_2 2
|
---|
102 | #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
|
---|
103 |
|
---|
104 | /* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so
|
---|
105 | PALETTE_BASE has moved */
|
---|
106 | #define SVGA_VERSION_1 1
|
---|
107 | #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
|
---|
108 |
|
---|
109 | /* Version 0 is the initial version */
|
---|
110 | #define SVGA_VERSION_0 0
|
---|
111 | #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
|
---|
112 |
|
---|
113 | /*
|
---|
114 | * "Invalid" value for all SVGA IDs.
|
---|
115 | * (Version ID, screen object ID, surface ID...)
|
---|
116 | */
|
---|
117 | #define SVGA_ID_INVALID 0xFFFFFFFF
|
---|
118 |
|
---|
119 | /* Port offsets, relative to BAR0 */
|
---|
120 | #define SVGA_INDEX_PORT 0x0
|
---|
121 | #define SVGA_VALUE_PORT 0x1
|
---|
122 | #define SVGA_BIOS_PORT 0x2
|
---|
123 | #define SVGA_IRQSTATUS_PORT 0x8
|
---|
124 |
|
---|
125 | /*
|
---|
126 | * Interrupt source flags for IRQSTATUS_PORT and IRQMASK.
|
---|
127 | *
|
---|
128 | * Interrupts are only supported when the
|
---|
129 | * SVGA_CAP_IRQMASK capability is present.
|
---|
130 | */
|
---|
131 | #define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */
|
---|
132 | #define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */
|
---|
133 | #define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */
|
---|
134 | #define SVGA_IRQFLAG_COMMAND_BUFFER 0x8 /* Command buffer completed */
|
---|
135 | #define SVGA_IRQFLAG_ERROR 0x10 /* Error while processing commands */
|
---|
136 |
|
---|
137 | /*
|
---|
138 | * The byte-size is the size of the actual cursor data,
|
---|
139 | * possibly after expanding it to the current bit depth.
|
---|
140 | *
|
---|
141 | * 40K is sufficient memory for two 32-bit planes for a 64 x 64 cursor.
|
---|
142 | *
|
---|
143 | * The dimension limit is a bound on the maximum width or height.
|
---|
144 | */
|
---|
145 | #define SVGA_MAX_CURSOR_CMD_BYTES (40 * 1024)
|
---|
146 | #define SVGA_MAX_CURSOR_CMD_DIMENSION 1024
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * Registers
|
---|
150 | */
|
---|
151 |
|
---|
152 | enum {
|
---|
153 | SVGA_REG_ID = 0,
|
---|
154 | SVGA_REG_ENABLE = 1,
|
---|
155 | SVGA_REG_WIDTH = 2,
|
---|
156 | SVGA_REG_HEIGHT = 3,
|
---|
157 | SVGA_REG_MAX_WIDTH = 4,
|
---|
158 | SVGA_REG_MAX_HEIGHT = 5,
|
---|
159 | SVGA_REG_DEPTH = 6,
|
---|
160 | SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */
|
---|
161 | SVGA_REG_PSEUDOCOLOR = 8,
|
---|
162 | SVGA_REG_RED_MASK = 9,
|
---|
163 | SVGA_REG_GREEN_MASK = 10,
|
---|
164 | SVGA_REG_BLUE_MASK = 11,
|
---|
165 | SVGA_REG_BYTES_PER_LINE = 12,
|
---|
166 | SVGA_REG_FB_START = 13, /* (Deprecated) */
|
---|
167 | SVGA_REG_FB_OFFSET = 14,
|
---|
168 | SVGA_REG_VRAM_SIZE = 15,
|
---|
169 | SVGA_REG_FB_SIZE = 16,
|
---|
170 |
|
---|
171 | /* ID 0 implementation only had the above registers, then the palette */
|
---|
172 | SVGA_REG_ID_0_TOP = 17,
|
---|
173 |
|
---|
174 | SVGA_REG_CAPABILITIES = 17,
|
---|
175 | SVGA_REG_MEM_START = 18, /* (Deprecated) */
|
---|
176 | SVGA_REG_MEM_SIZE = 19,
|
---|
177 | SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */
|
---|
178 | SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */
|
---|
179 | SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */
|
---|
180 | SVGA_REG_GUEST_ID = 23, /* (Deprecated) */
|
---|
181 | SVGA_REG_DEAD = 24, /* Drivers should never write this. */
|
---|
182 | SVGA_REG_CURSOR_X = 25, /* (Deprecated) */
|
---|
183 | SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */
|
---|
184 | SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */
|
---|
185 | SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */
|
---|
186 | SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */
|
---|
187 | SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */
|
---|
188 | SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */
|
---|
189 | SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */
|
---|
190 | SVGA_REG_IRQMASK = 33, /* Interrupt mask */
|
---|
191 |
|
---|
192 | /* Legacy multi-monitor support */
|
---|
193 | SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */
|
---|
194 | SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */
|
---|
195 | SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */
|
---|
196 | SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */
|
---|
197 | SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */
|
---|
198 | SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */
|
---|
199 | SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */
|
---|
200 |
|
---|
201 | /* See "Guest memory regions" below. */
|
---|
202 | SVGA_REG_GMR_ID = 41,
|
---|
203 | SVGA_REG_GMR_DESCRIPTOR = 42,
|
---|
204 | SVGA_REG_GMR_MAX_IDS = 43,
|
---|
205 | SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
|
---|
206 |
|
---|
207 | SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */
|
---|
208 | SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */
|
---|
209 | SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */
|
---|
210 | SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */
|
---|
211 | SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */
|
---|
212 |
|
---|
213 | /*
|
---|
214 | * Max primary memory.
|
---|
215 | * See SVGA_CAP_NO_BB_RESTRICTION.
|
---|
216 | */
|
---|
217 | SVGA_REG_MAX_PRIMARY_MEM = 50,
|
---|
218 | SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50,
|
---|
219 |
|
---|
220 | /*
|
---|
221 | * Legacy version of SVGA_REG_GBOBJECT_MEM_SIZE_KB for drivers that
|
---|
222 | * don't know how to convert to a 64-bit byte value without overflowing.
|
---|
223 | * (See SVGA_REG_GBOBJECT_MEM_SIZE_KB).
|
---|
224 | */
|
---|
225 | SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51,
|
---|
226 |
|
---|
227 | SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */
|
---|
228 | SVGA_REG_CMD_PREPEND_LOW = 53,
|
---|
229 | SVGA_REG_CMD_PREPEND_HIGH = 54,
|
---|
230 | SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,
|
---|
231 | SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,
|
---|
232 | SVGA_REG_MOB_MAX_SIZE = 57,
|
---|
233 | SVGA_REG_BLANK_SCREEN_TARGETS = 58,
|
---|
234 | SVGA_REG_CAP2 = 59,
|
---|
235 | SVGA_REG_DEVEL_CAP = 60,
|
---|
236 |
|
---|
237 | /*
|
---|
238 | * Allow the guest to hint to the device which driver is running.
|
---|
239 | *
|
---|
240 | * This should not generally change device behavior, but might be
|
---|
241 | * convenient to work-around specific bugs in guest drivers.
|
---|
242 | *
|
---|
243 | * Drivers should first write their id value into SVGA_REG_GUEST_DRIVER_ID,
|
---|
244 | * and then fill out all of the version registers that they have defined.
|
---|
245 | *
|
---|
246 | * After the driver has written all of the registers, they should
|
---|
247 | * then write the value SVGA_REG_GUEST_DRIVER_ID_SUBMIT to the
|
---|
248 | * SVGA_REG_GUEST_DRIVER_ID register, to signal that they have finished.
|
---|
249 | *
|
---|
250 | * The SVGA_REG_GUEST_DRIVER_ID values are defined below by the
|
---|
251 | * SVGARegGuestDriverId enum.
|
---|
252 | *
|
---|
253 | * The SVGA_REG_GUEST_DRIVER_VERSION fields are driver-specific,
|
---|
254 | * but ideally should encode a monotonically increasing number that allows
|
---|
255 | * the device to perform inequality checks against ranges of driver versions.
|
---|
256 | */
|
---|
257 | SVGA_REG_GUEST_DRIVER_ID = 61,
|
---|
258 | SVGA_REG_GUEST_DRIVER_VERSION1 = 62,
|
---|
259 | SVGA_REG_GUEST_DRIVER_VERSION2 = 63,
|
---|
260 | SVGA_REG_GUEST_DRIVER_VERSION3 = 64,
|
---|
261 | SVGA_REG_CURSOR_MOBID = 65,
|
---|
262 | SVGA_REG_CURSOR_MAX_BYTE_SIZE = 66,
|
---|
263 | SVGA_REG_CURSOR_MAX_DIMENSION = 67,
|
---|
264 |
|
---|
265 | SVGA_REG_FIFO_CAPS = 68,
|
---|
266 | SVGA_REG_FENCE = 69,
|
---|
267 |
|
---|
268 | SVGA_REG_RESERVED1 = 70,
|
---|
269 | SVGA_REG_RESERVED2 = 71,
|
---|
270 | SVGA_REG_RESERVED3 = 72,
|
---|
271 | SVGA_REG_RESERVED4 = 73,
|
---|
272 | SVGA_REG_RESERVED5 = 74,
|
---|
273 | SVGA_REG_SCREENDMA = 75,
|
---|
274 |
|
---|
275 | /*
|
---|
276 | * The maximum amount of guest-backed objects that the device can have
|
---|
277 | * resident at a time. Guest-drivers should keep their working set size
|
---|
278 | * below this limit for best performance.
|
---|
279 | *
|
---|
280 | * Note that this value is in kilobytes, and not bytes, because the actual
|
---|
281 | * number of bytes might be larger than can fit in a 32-bit register.
|
---|
282 | *
|
---|
283 | * PLEASE USE A 64-BIT VALUE WHEN CONVERTING THIS INTO BYTES.
|
---|
284 | * (See SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB).
|
---|
285 | */
|
---|
286 | SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76,
|
---|
287 |
|
---|
288 | SVGA_REG_TOP = 77, /* Must be 1 more than the last register */
|
---|
289 |
|
---|
290 | SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
|
---|
291 | /* Next 768 (== 256*3) registers exist for colormap */
|
---|
292 | SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
|
---|
293 | /* Base of scratch registers */
|
---|
294 | /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage:
|
---|
295 | First 4 are reserved for VESA BIOS Extension; any remaining are for
|
---|
296 | the use of the current SVGA driver. */
|
---|
297 | };
|
---|
298 |
|
---|
299 |
|
---|
300 | /*
|
---|
301 | * Values for SVGA_REG_GUEST_DRIVER_ID.
|
---|
302 | */
|
---|
303 | typedef enum SVGARegGuestDriverId {
|
---|
304 | SVGA_REG_GUEST_DRIVER_ID_UNKNOWN = 0,
|
---|
305 | SVGA_REG_GUEST_DRIVER_ID_WDDM = 1,
|
---|
306 | SVGA_REG_GUEST_DRIVER_ID_LINUX = 2,
|
---|
307 | SVGA_REG_GUEST_DRIVER_ID_MAX,
|
---|
308 |
|
---|
309 | SVGA_REG_GUEST_DRIVER_ID_SUBMIT = MAX_UINT32,
|
---|
310 | } SVGARegGuestDriverId;
|
---|
311 |
|
---|
312 |
|
---|
313 | /*
|
---|
314 | * Guest memory regions (GMRs):
|
---|
315 | *
|
---|
316 | * This is a new memory mapping feature available in SVGA devices
|
---|
317 | * which have the SVGA_CAP_GMR bit set. Previously, there were two
|
---|
318 | * fixed memory regions available with which to share data between the
|
---|
319 | * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs
|
---|
320 | * are our name for an extensible way of providing arbitrary DMA
|
---|
321 | * buffers for use between the driver and the SVGA device. They are a
|
---|
322 | * new alternative to framebuffer memory, usable for both 2D and 3D
|
---|
323 | * graphics operations.
|
---|
324 | *
|
---|
325 | * Since GMR mapping must be done synchronously with guest CPU
|
---|
326 | * execution, we use a new pair of SVGA registers:
|
---|
327 | *
|
---|
328 | * SVGA_REG_GMR_ID --
|
---|
329 | *
|
---|
330 | * Read/write.
|
---|
331 | * This register holds the 32-bit ID (a small positive integer)
|
---|
332 | * of a GMR to create, delete, or redefine. Writing this register
|
---|
333 | * has no side-effects.
|
---|
334 | *
|
---|
335 | * SVGA_REG_GMR_DESCRIPTOR --
|
---|
336 | *
|
---|
337 | * Write-only.
|
---|
338 | * Writing this register will create, delete, or redefine the GMR
|
---|
339 | * specified by the above ID register. If this register is zero,
|
---|
340 | * the GMR is deleted. Any pointers into this GMR (including those
|
---|
341 | * currently being processed by FIFO commands) will be
|
---|
342 | * synchronously invalidated.
|
---|
343 | *
|
---|
344 | * If this register is nonzero, it must be the physical page
|
---|
345 | * number (PPN) of a data structure which describes the physical
|
---|
346 | * layout of the memory region this GMR should describe. The
|
---|
347 | * descriptor structure will be read synchronously by the SVGA
|
---|
348 | * device when this register is written. The descriptor need not
|
---|
349 | * remain allocated for the lifetime of the GMR.
|
---|
350 | *
|
---|
351 | * The guest driver should write SVGA_REG_GMR_ID first, then
|
---|
352 | * SVGA_REG_GMR_DESCRIPTOR.
|
---|
353 | *
|
---|
354 | * SVGA_REG_GMR_MAX_IDS --
|
---|
355 | *
|
---|
356 | * Read-only.
|
---|
357 | * The SVGA device may choose to support a maximum number of
|
---|
358 | * user-defined GMR IDs. This register holds the number of supported
|
---|
359 | * IDs. (The maximum supported ID plus 1)
|
---|
360 | *
|
---|
361 | * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH --
|
---|
362 | *
|
---|
363 | * Read-only.
|
---|
364 | * The SVGA device may choose to put a limit on the total number
|
---|
365 | * of SVGAGuestMemDescriptor structures it will read when defining
|
---|
366 | * a single GMR.
|
---|
367 | *
|
---|
368 | * The descriptor structure is an array of SVGAGuestMemDescriptor
|
---|
369 | * structures. Each structure may do one of three things:
|
---|
370 | *
|
---|
371 | * - Terminate the GMR descriptor list.
|
---|
372 | * (ppn==0, numPages==0)
|
---|
373 | *
|
---|
374 | * - Add a PPN or range of PPNs to the GMR's virtual address space.
|
---|
375 | * (ppn != 0, numPages != 0)
|
---|
376 | *
|
---|
377 | * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to
|
---|
378 | * support multi-page GMR descriptor tables without forcing the
|
---|
379 | * driver to allocate physically contiguous memory.
|
---|
380 | * (ppn != 0, numPages == 0)
|
---|
381 | *
|
---|
382 | * Note that each physical page of SVGAGuestMemDescriptor structures
|
---|
383 | * can describe at least 2MB of guest memory. If the driver needs to
|
---|
384 | * use more than one page of descriptor structures, it must use one of
|
---|
385 | * its SVGAGuestMemDescriptors to point to an additional page. The
|
---|
386 | * device will never automatically cross a page boundary.
|
---|
387 | *
|
---|
388 | * Once the driver has described a GMR, it is immediately available
|
---|
389 | * for use via any FIFO command that uses an SVGAGuestPtr structure.
|
---|
390 | * These pointers include a GMR identifier plus an offset into that
|
---|
391 | * GMR.
|
---|
392 | *
|
---|
393 | * The driver must check the SVGA_CAP_GMR bit before using the GMR
|
---|
394 | * registers.
|
---|
395 | */
|
---|
396 |
|
---|
397 | /*
|
---|
398 | * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer
|
---|
399 | * memory as well. In the future, these IDs could even be used to
|
---|
400 | * allow legacy memory regions to be redefined by the guest as GMRs.
|
---|
401 | *
|
---|
402 | * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA
|
---|
403 | * is being phased out. Please try to use user-defined GMRs whenever
|
---|
404 | * possible.
|
---|
405 | */
|
---|
406 | #define SVGA_GMR_NULL ((uint32) -1)
|
---|
407 | #define SVGA_GMR_FRAMEBUFFER ((uint32) -2) /* Guest Framebuffer (GFB) */
|
---|
408 |
|
---|
409 | typedef
|
---|
410 | #include "vmware_pack_begin.h"
|
---|
411 | struct SVGAGuestMemDescriptor {
|
---|
412 | uint32 ppn;
|
---|
413 | uint32 numPages;
|
---|
414 | }
|
---|
415 | #include "vmware_pack_end.h"
|
---|
416 | SVGAGuestMemDescriptor;
|
---|
417 |
|
---|
418 | typedef
|
---|
419 | #include "vmware_pack_begin.h"
|
---|
420 | struct SVGAGuestPtr {
|
---|
421 | uint32 gmrId;
|
---|
422 | uint32 offset;
|
---|
423 | }
|
---|
424 | #include "vmware_pack_end.h"
|
---|
425 | SVGAGuestPtr;
|
---|
426 |
|
---|
427 | /*
|
---|
428 | * Register based command buffers --
|
---|
429 | *
|
---|
430 | * Provide an SVGA device interface that allows the guest to submit
|
---|
431 | * command buffers to the SVGA device through an SVGA device register.
|
---|
432 | * The metadata for each command buffer is contained in the
|
---|
433 | * SVGACBHeader structure along with the return status codes.
|
---|
434 | *
|
---|
435 | * The SVGA device supports command buffers if
|
---|
436 | * SVGA_CAP_COMMAND_BUFFERS is set in the device caps register. The
|
---|
437 | * fifo must be enabled for command buffers to be submitted.
|
---|
438 | *
|
---|
439 | * Command buffers are submitted when the guest writing the 64 byte
|
---|
440 | * aligned physical address into the SVGA_REG_COMMAND_LOW and
|
---|
441 | * SVGA_REG_COMMAND_HIGH. SVGA_REG_COMMAND_HIGH contains the upper 32
|
---|
442 | * bits of the physical address. SVGA_REG_COMMAND_LOW contains the
|
---|
443 | * lower 32 bits of the physical address, since the command buffer
|
---|
444 | * headers are required to be 64 byte aligned the lower 6 bits are
|
---|
445 | * used for the SVGACBContext value. Writing to SVGA_REG_COMMAND_LOW
|
---|
446 | * submits the command buffer to the device and queues it for
|
---|
447 | * execution. The SVGA device supports at least
|
---|
448 | * SVGA_CB_MAX_QUEUED_PER_CONTEXT command buffers that can be queued
|
---|
449 | * per context and if that limit is reached the device will write the
|
---|
450 | * status SVGA_CB_STATUS_QUEUE_FULL to the status value of the command
|
---|
451 | * buffer header synchronously and not raise any IRQs.
|
---|
452 | *
|
---|
453 | * It is invalid to submit a command buffer without a valid physical
|
---|
454 | * address and results are undefined.
|
---|
455 | *
|
---|
456 | * The device guarantees that command buffers of size SVGA_CB_MAX_SIZE
|
---|
457 | * will be supported. If a larger command buffer is submitted results
|
---|
458 | * are unspecified and the device will either complete the command
|
---|
459 | * buffer or return an error.
|
---|
460 | *
|
---|
461 | * The device guarantees that any individual command in a command
|
---|
462 | * buffer can be up to SVGA_CB_MAX_COMMAND_SIZE in size which is
|
---|
463 | * enough to fit a 64x64 color-cursor definition. If the command is
|
---|
464 | * too large the device is allowed to process the command or return an
|
---|
465 | * error.
|
---|
466 | *
|
---|
467 | * The device context is a special SVGACBContext that allows for
|
---|
468 | * synchronous register like accesses with the flexibility of
|
---|
469 | * commands. There is a different command set defined by
|
---|
470 | * SVGADeviceContextCmdId. The commands in each command buffer is not
|
---|
471 | * allowed to straddle physical pages.
|
---|
472 | *
|
---|
473 | * The offset field which is available starting with the
|
---|
474 | * SVGA_CAP_CMD_BUFFERS_2 cap bit can be set by the guest to bias the
|
---|
475 | * start of command processing into the buffer. If an error is
|
---|
476 | * encountered the errorOffset will still be relative to the specific
|
---|
477 | * PA, not biased by the offset. When the command buffer is finished
|
---|
478 | * the guest should not read the offset field as there is no guarantee
|
---|
479 | * what it will set to.
|
---|
480 | *
|
---|
481 | * When the SVGA_CAP_HP_CMD_QUEUE cap bit is set a new command queue
|
---|
482 | * SVGA_CB_CONTEXT_1 is available. Commands submitted to this queue
|
---|
483 | * will be executed as quickly as possible by the SVGA device
|
---|
484 | * potentially before already queued commands on SVGA_CB_CONTEXT_0.
|
---|
485 | * The SVGA device guarantees that any command buffers submitted to
|
---|
486 | * SVGA_CB_CONTEXT_0 will be executed after any _already_ submitted
|
---|
487 | * command buffers to SVGA_CB_CONTEXT_1.
|
---|
488 | */
|
---|
489 |
|
---|
490 | #define SVGA_CB_MAX_SIZE (512 * 1024) /* 512 KB */
|
---|
491 | #define SVGA_CB_MAX_QUEUED_PER_CONTEXT 32
|
---|
492 | #define SVGA_CB_MAX_COMMAND_SIZE (32 * 1024) /* 32 KB */
|
---|
493 |
|
---|
494 | #define SVGA_CB_CONTEXT_MASK 0x3f
|
---|
495 | typedef enum {
|
---|
496 | SVGA_CB_CONTEXT_DEVICE = 0x3f,
|
---|
497 | SVGA_CB_CONTEXT_0 = 0x0,
|
---|
498 | SVGA_CB_CONTEXT_1 = 0x1, /* Supported with SVGA_CAP_HP_CMD_QUEUE */
|
---|
499 | SVGA_CB_CONTEXT_MAX = 0x2,
|
---|
500 | } SVGACBContext;
|
---|
501 |
|
---|
502 |
|
---|
503 | typedef enum {
|
---|
504 | /*
|
---|
505 | * The guest is supposed to write SVGA_CB_STATUS_NONE to the status
|
---|
506 | * field before submitting the command buffer header, the host will
|
---|
507 | * change the value when it is done with the command buffer.
|
---|
508 | */
|
---|
509 | SVGA_CB_STATUS_NONE = 0,
|
---|
510 |
|
---|
511 | /*
|
---|
512 | * Written by the host when a command buffer completes successfully.
|
---|
513 | * The device raises an IRQ with SVGA_IRQFLAG_COMMAND_BUFFER unless
|
---|
514 | * the SVGA_CB_FLAG_NO_IRQ flag is set.
|
---|
515 | */
|
---|
516 | SVGA_CB_STATUS_COMPLETED = 1,
|
---|
517 |
|
---|
518 | /*
|
---|
519 | * Written by the host synchronously with the command buffer
|
---|
520 | * submission to indicate the command buffer was not submitted. No
|
---|
521 | * IRQ is raised.
|
---|
522 | */
|
---|
523 | SVGA_CB_STATUS_QUEUE_FULL = 2,
|
---|
524 |
|
---|
525 | /*
|
---|
526 | * Written by the host when an error was detected parsing a command
|
---|
527 | * in the command buffer, errorOffset is written to contain the
|
---|
528 | * offset to the first byte of the failing command. The device
|
---|
529 | * raises the IRQ with both SVGA_IRQFLAG_ERROR and
|
---|
530 | * SVGA_IRQFLAG_COMMAND_BUFFER. Some of the commands may have been
|
---|
531 | * processed.
|
---|
532 | */
|
---|
533 | SVGA_CB_STATUS_COMMAND_ERROR = 3,
|
---|
534 |
|
---|
535 | /*
|
---|
536 | * Written by the host if there is an error parsing the command
|
---|
537 | * buffer header. The device raises the IRQ with both
|
---|
538 | * SVGA_IRQFLAG_ERROR and SVGA_IRQFLAG_COMMAND_BUFFER. The device
|
---|
539 | * did not processes any of the command buffer.
|
---|
540 | */
|
---|
541 | SVGA_CB_STATUS_CB_HEADER_ERROR = 4,
|
---|
542 |
|
---|
543 | /*
|
---|
544 | * Written by the host if the guest requested the host to preempt
|
---|
545 | * the command buffer. The device will not raise any IRQs and the
|
---|
546 | * command buffer was not processed.
|
---|
547 | */
|
---|
548 | SVGA_CB_STATUS_PREEMPTED = 5,
|
---|
549 |
|
---|
550 | /*
|
---|
551 | * Written by the host synchronously with the command buffer
|
---|
552 | * submission to indicate the the command buffer was not submitted
|
---|
553 | * due to an error. No IRQ is raised.
|
---|
554 | */
|
---|
555 | SVGA_CB_STATUS_SUBMISSION_ERROR = 6,
|
---|
556 |
|
---|
557 | /*
|
---|
558 | * Written by the host when the host finished a
|
---|
559 | * SVGA_DC_CMD_ASYNC_STOP_QUEUE request for this command buffer
|
---|
560 | * queue. The offset of the first byte not processed is stored in
|
---|
561 | * the errorOffset field of the command buffer header. All guest
|
---|
562 | * visible side effects of commands till that point are guaranteed
|
---|
563 | * to be finished before this is written. The
|
---|
564 | * SVGA_IRQFLAG_COMMAND_BUFFER IRQ is raised as long as the
|
---|
565 | * SVGA_CB_FLAG_NO_IRQ is not set.
|
---|
566 | */
|
---|
567 | SVGA_CB_STATUS_PARTIAL_COMPLETE = 7,
|
---|
568 | } SVGACBStatus;
|
---|
569 |
|
---|
570 | typedef enum {
|
---|
571 | SVGA_CB_FLAG_NONE = 0,
|
---|
572 | SVGA_CB_FLAG_NO_IRQ = 1 << 0,
|
---|
573 | SVGA_CB_FLAG_DX_CONTEXT = 1 << 1,
|
---|
574 | SVGA_CB_FLAG_MOB = 1 << 2,
|
---|
575 | } SVGACBFlags;
|
---|
576 |
|
---|
577 | typedef
|
---|
578 | #include "vmware_pack_begin.h"
|
---|
579 | struct {
|
---|
580 | volatile SVGACBStatus status; /* Modified by device. */
|
---|
581 | volatile uint32 errorOffset; /* Modified by device. */
|
---|
582 | uint64 id;
|
---|
583 | SVGACBFlags flags;
|
---|
584 | uint32 length;
|
---|
585 | union {
|
---|
586 | PA pa;
|
---|
587 | struct {
|
---|
588 | SVGAMobId mobid;
|
---|
589 | uint32 mobOffset;
|
---|
590 | } mob;
|
---|
591 | } ptr;
|
---|
592 | uint32 offset; /* Valid if CMD_BUFFERS_2 cap set, must be zero otherwise,
|
---|
593 | * modified by device.
|
---|
594 | */
|
---|
595 | uint32 dxContext; /* Valid if DX_CONTEXT flag set, must be zero otherwise */
|
---|
596 | uint32 mustBeZero[6];
|
---|
597 | }
|
---|
598 | #include "vmware_pack_end.h"
|
---|
599 | SVGACBHeader;
|
---|
600 |
|
---|
601 | typedef enum {
|
---|
602 | SVGA_DC_CMD_NOP = 0,
|
---|
603 | SVGA_DC_CMD_START_STOP_CONTEXT = 1,
|
---|
604 | SVGA_DC_CMD_PREEMPT = 2,
|
---|
605 | SVGA_DC_CMD_START_QUEUE = 3, /* Requires SVGA_CAP_HP_CMD_QUEUE */
|
---|
606 | SVGA_DC_CMD_ASYNC_STOP_QUEUE = 4, /* Requires SVGA_CAP_HP_CMD_QUEUE */
|
---|
607 | SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE = 5, /* Requires SVGA_CAP_HP_CMD_QUEUE */
|
---|
608 | SVGA_DC_CMD_MAX = 6,
|
---|
609 | } SVGADeviceContextCmdId;
|
---|
610 |
|
---|
611 | /*
|
---|
612 | * Starts or stops both SVGA_CB_CONTEXT_0 and SVGA_CB_CONTEXT_1.
|
---|
613 | */
|
---|
614 |
|
---|
615 | typedef struct SVGADCCmdStartStop {
|
---|
616 | uint32 enable;
|
---|
617 | SVGACBContext context; /* Must be zero */
|
---|
618 | } SVGADCCmdStartStop;
|
---|
619 |
|
---|
620 | /*
|
---|
621 | * SVGADCCmdPreempt --
|
---|
622 | *
|
---|
623 | * This command allows the guest to request that all command buffers
|
---|
624 | * on SVGA_CB_CONTEXT_0 be preempted that can be. After execution
|
---|
625 | * of this command all command buffers that were preempted will
|
---|
626 | * already have SVGA_CB_STATUS_PREEMPTED written into the status
|
---|
627 | * field. The device might still be processing a command buffer,
|
---|
628 | * assuming execution of it started before the preemption request was
|
---|
629 | * received. Specifying the ignoreIDZero flag to TRUE will cause the
|
---|
630 | * device to not preempt command buffers with the id field in the
|
---|
631 | * command buffer header set to zero.
|
---|
632 | */
|
---|
633 |
|
---|
634 | typedef struct SVGADCCmdPreempt {
|
---|
635 | SVGACBContext context; /* Must be zero */
|
---|
636 | uint32 ignoreIDZero;
|
---|
637 | } SVGADCCmdPreempt;
|
---|
638 |
|
---|
639 | /*
|
---|
640 | * Starts the requested command buffer processing queue. Valid only
|
---|
641 | * if the SVGA_CAP_HP_CMD_QUEUE cap is set.
|
---|
642 | *
|
---|
643 | * For a command queue to be considered runnable it must be enabled
|
---|
644 | * and any corresponding higher priority queues must also be enabled.
|
---|
645 | * For example in order for command buffers to be processed on
|
---|
646 | * SVGA_CB_CONTEXT_0 both SVGA_CB_CONTEXT_0 and SVGA_CB_CONTEXT_1 must
|
---|
647 | * be enabled. But for commands to be runnable on SVGA_CB_CONTEXT_1
|
---|
648 | * only that queue must be enabled.
|
---|
649 | */
|
---|
650 |
|
---|
651 | typedef struct SVGADCCmdStartQueue {
|
---|
652 | SVGACBContext context;
|
---|
653 | } SVGADCCmdStartQueue;
|
---|
654 |
|
---|
655 | /*
|
---|
656 | * Requests the SVGA device to stop processing the requested command
|
---|
657 | * buffer queue as soon as possible. The guest knows the stop has
|
---|
658 | * completed when one of the following happens.
|
---|
659 | *
|
---|
660 | * 1) A command buffer status of SVGA_CB_STATUS_PARTIAL_COMPLETE is returned
|
---|
661 | * 2) A command buffer error is encountered with would stop the queue
|
---|
662 | * regardless of the async stop request.
|
---|
663 | * 3) All command buffers that have been submitted complete successfully.
|
---|
664 | * 4) The stop completes synchronously if no command buffers are
|
---|
665 | * active on the queue when it is issued.
|
---|
666 | *
|
---|
667 | * If the command queue is not in a runnable state there is no
|
---|
668 | * guarentee this async stop will finish. For instance if the high
|
---|
669 | * priority queue is not enabled and a stop is requested on the low
|
---|
670 | * priority queue, the high priority queue must be reenabled to
|
---|
671 | * guarantee that the async stop will finish.
|
---|
672 | *
|
---|
673 | * This command along with SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE can be used
|
---|
674 | * to implement mid command buffer preemption.
|
---|
675 | *
|
---|
676 | * Valid only if the SVGA_CAP_HP_CMD_QUEUE cap is set.
|
---|
677 | */
|
---|
678 |
|
---|
679 | typedef struct SVGADCCmdAsyncStopQueue {
|
---|
680 | SVGACBContext context;
|
---|
681 | } SVGADCCmdAsyncStopQueue;
|
---|
682 |
|
---|
683 | /*
|
---|
684 | * Requests the SVGA device to throw away any full command buffers on
|
---|
685 | * the requested command queue that have not been started. For a
|
---|
686 | * driver to know which command buffers were thrown away a driver
|
---|
687 | * should only issue this command when the queue is stopped, for
|
---|
688 | * whatever reason.
|
---|
689 | */
|
---|
690 |
|
---|
691 | typedef struct SVGADCCmdEmptyQueue {
|
---|
692 | SVGACBContext context;
|
---|
693 | } SVGADCCmdEmptyQueue;
|
---|
694 |
|
---|
695 |
|
---|
696 | /*
|
---|
697 | * SVGAGMRImageFormat --
|
---|
698 | *
|
---|
699 | * This is a packed representation of the source 2D image format
|
---|
700 | * for a GMR-to-screen blit. Currently it is defined as an encoding
|
---|
701 | * of the screen's color depth and bits-per-pixel, however, 16 bits
|
---|
702 | * are reserved for future use to identify other encodings (such as
|
---|
703 | * RGBA or higher-precision images).
|
---|
704 | *
|
---|
705 | * Currently supported formats:
|
---|
706 | *
|
---|
707 | * bpp depth Format Name
|
---|
708 | * --- ----- -----------
|
---|
709 | * 32 24 32-bit BGRX
|
---|
710 | * 24 24 24-bit BGR
|
---|
711 | * 16 16 RGB 5-6-5
|
---|
712 | * 16 15 RGB 5-5-5
|
---|
713 | *
|
---|
714 | */
|
---|
715 |
|
---|
716 | typedef struct SVGAGMRImageFormat {
|
---|
717 | union {
|
---|
718 | struct {
|
---|
719 | uint32 bitsPerPixel : 8;
|
---|
720 | uint32 colorDepth : 8;
|
---|
721 | uint32 reserved : 16; /* Must be zero */
|
---|
722 | };
|
---|
723 |
|
---|
724 | uint32 value;
|
---|
725 | };
|
---|
726 | } SVGAGMRImageFormat;
|
---|
727 |
|
---|
728 | typedef
|
---|
729 | #include "vmware_pack_begin.h"
|
---|
730 | struct SVGAGuestImage {
|
---|
731 | SVGAGuestPtr ptr;
|
---|
732 |
|
---|
733 | /*
|
---|
734 | * A note on interpretation of pitch: This value of pitch is the
|
---|
735 | * number of bytes between vertically adjacent image
|
---|
736 | * blocks. Normally this is the number of bytes between the first
|
---|
737 | * pixel of two adjacent scanlines. With compressed textures,
|
---|
738 | * however, this may represent the number of bytes between
|
---|
739 | * compression blocks rather than between rows of pixels.
|
---|
740 | *
|
---|
741 | * XXX: Compressed textures currently must be tightly packed in guest memory.
|
---|
742 | *
|
---|
743 | * If the image is 1-dimensional, pitch is ignored.
|
---|
744 | *
|
---|
745 | * If 'pitch' is zero, the SVGA3D device calculates a pitch value
|
---|
746 | * assuming each row of blocks is tightly packed.
|
---|
747 | */
|
---|
748 | uint32 pitch;
|
---|
749 | }
|
---|
750 | #include "vmware_pack_end.h"
|
---|
751 | SVGAGuestImage;
|
---|
752 |
|
---|
753 | /*
|
---|
754 | * SVGAColorBGRX --
|
---|
755 | *
|
---|
756 | * A 24-bit color format (BGRX), which does not depend on the
|
---|
757 | * format of the legacy guest framebuffer (GFB) or the current
|
---|
758 | * GMRFB state.
|
---|
759 | */
|
---|
760 |
|
---|
761 | typedef struct SVGAColorBGRX {
|
---|
762 | union {
|
---|
763 | struct {
|
---|
764 | uint32 b : 8;
|
---|
765 | uint32 g : 8;
|
---|
766 | uint32 r : 8;
|
---|
767 | uint32 x : 8; /* Unused */
|
---|
768 | };
|
---|
769 |
|
---|
770 | uint32 value;
|
---|
771 | };
|
---|
772 | } SVGAColorBGRX;
|
---|
773 |
|
---|
774 |
|
---|
775 | /*
|
---|
776 | * SVGASignedRect --
|
---|
777 | * SVGASignedPoint --
|
---|
778 | *
|
---|
779 | * Signed rectangle and point primitives. These are used by the new
|
---|
780 | * 2D primitives for drawing to Screen Objects, which can occupy a
|
---|
781 | * signed virtual coordinate space.
|
---|
782 | *
|
---|
783 | * SVGASignedRect specifies a half-open interval: the (left, top)
|
---|
784 | * pixel is part of the rectangle, but the (right, bottom) pixel is
|
---|
785 | * not.
|
---|
786 | */
|
---|
787 |
|
---|
788 | typedef
|
---|
789 | #include "vmware_pack_begin.h"
|
---|
790 | struct {
|
---|
791 | int32 left;
|
---|
792 | int32 top;
|
---|
793 | int32 right;
|
---|
794 | int32 bottom;
|
---|
795 | }
|
---|
796 | #include "vmware_pack_end.h"
|
---|
797 | SVGASignedRect;
|
---|
798 |
|
---|
799 | typedef
|
---|
800 | #include "vmware_pack_begin.h"
|
---|
801 | struct {
|
---|
802 | int32 x;
|
---|
803 | int32 y;
|
---|
804 | }
|
---|
805 | #include "vmware_pack_end.h"
|
---|
806 | SVGASignedPoint;
|
---|
807 |
|
---|
808 |
|
---|
809 | /*
|
---|
810 | * SVGA Device Capabilities
|
---|
811 | *
|
---|
812 | * Note the holes in the bitfield. Missing bits have been deprecated,
|
---|
813 | * and must not be reused. Those capabilities will never be reported
|
---|
814 | * by new versions of the SVGA device.
|
---|
815 | *
|
---|
816 | * SVGA_CAP_IRQMASK --
|
---|
817 | * Provides device interrupts. Adds device register SVGA_REG_IRQMASK
|
---|
818 | * to set interrupt mask and direct I/O port SVGA_IRQSTATUS_PORT to
|
---|
819 | * set/clear pending interrupts.
|
---|
820 | *
|
---|
821 | * SVGA_CAP_GMR --
|
---|
822 | * Provides synchronous mapping of guest memory regions (GMR).
|
---|
823 | * Adds device registers SVGA_REG_GMR_ID, SVGA_REG_GMR_DESCRIPTOR,
|
---|
824 | * SVGA_REG_GMR_MAX_IDS, and SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH.
|
---|
825 | *
|
---|
826 | * SVGA_CAP_TRACES --
|
---|
827 | * Allows framebuffer trace-based updates even when FIFO is enabled.
|
---|
828 | * Adds device register SVGA_REG_TRACES.
|
---|
829 | *
|
---|
830 | * SVGA_CAP_GMR2 --
|
---|
831 | * Provides asynchronous commands to define and remap guest memory
|
---|
832 | * regions. Adds device registers SVGA_REG_GMRS_MAX_PAGES and
|
---|
833 | * SVGA_REG_MEMORY_SIZE.
|
---|
834 | *
|
---|
835 | * SVGA_CAP_SCREEN_OBJECT_2 --
|
---|
836 | * Allow screen object support, and require backing stores from the
|
---|
837 | * guest for each screen object.
|
---|
838 | *
|
---|
839 | * SVGA_CAP_COMMAND_BUFFERS --
|
---|
840 | * Enable register based command buffer submission.
|
---|
841 | *
|
---|
842 | * SVGA_CAP_DEAD1 --
|
---|
843 | * This cap was incorrectly used by old drivers and should not be
|
---|
844 | * reused.
|
---|
845 | *
|
---|
846 | * SVGA_CAP_CMD_BUFFERS_2 --
|
---|
847 | * Enable support for the prepend command buffer submision
|
---|
848 | * registers. SVGA_REG_CMD_PREPEND_LOW and
|
---|
849 | * SVGA_REG_CMD_PREPEND_HIGH.
|
---|
850 | *
|
---|
851 | * SVGA_CAP_GBOBJECTS --
|
---|
852 | * Enable guest-backed objects and surfaces.
|
---|
853 | *
|
---|
854 | * SVGA_CAP_DX --
|
---|
855 | * Enable support for DX commands, and command buffers in a mob.
|
---|
856 | *
|
---|
857 | * SVGA_CAP_HP_CMD_QUEUE --
|
---|
858 | * Enable support for the high priority command queue, and the
|
---|
859 | * ScreenCopy command.
|
---|
860 | *
|
---|
861 | * SVGA_CAP_NO_BB_RESTRICTION --
|
---|
862 | * Allow ScreenTargets to be defined without regard to the 32-bpp
|
---|
863 | * bounding-box memory restrictions. ie:
|
---|
864 | *
|
---|
865 | * The summed memory usage of all screens (assuming they were defined as
|
---|
866 | * 32-bpp) must always be less than the value of the
|
---|
867 | * SVGA_REG_MAX_PRIMARY_MEM register.
|
---|
868 | *
|
---|
869 | * If this cap is not present, the 32-bpp bounding box around all screens
|
---|
870 | * must additionally be under the value of the SVGA_REG_MAX_PRIMARY_MEM
|
---|
871 | * register.
|
---|
872 | *
|
---|
873 | * If the cap is present, the bounding box restriction is lifted (and only
|
---|
874 | * the screen-sum limit applies).
|
---|
875 | *
|
---|
876 | * (Note that this is a slight lie... there is still a sanity limit on any
|
---|
877 | * dimension of the topology to be less than SVGA_SCREEN_ROOT_LIMIT, even
|
---|
878 | * when SVGA_CAP_NO_BB_RESTRICTION is present, but that should be
|
---|
879 | * large enough to express any possible topology without holes between
|
---|
880 | * monitors.)
|
---|
881 | *
|
---|
882 | * SVGA_CAP_CAP2_REGISTER --
|
---|
883 | * If this cap is present, the SVGA_REG_CAP2 register is supported.
|
---|
884 | */
|
---|
885 |
|
---|
886 | #define SVGA_CAP_NONE 0x00000000
|
---|
887 | #define SVGA_CAP_RECT_COPY 0x00000002
|
---|
888 | #define SVGA_CAP_CURSOR 0x00000020
|
---|
889 | #define SVGA_CAP_CURSOR_BYPASS 0x00000040
|
---|
890 | #define SVGA_CAP_CURSOR_BYPASS_2 0x00000080
|
---|
891 | #define SVGA_CAP_8BIT_EMULATION 0x00000100
|
---|
892 | #define SVGA_CAP_ALPHA_CURSOR 0x00000200
|
---|
893 | #define SVGA_CAP_3D 0x00004000
|
---|
894 | #define SVGA_CAP_EXTENDED_FIFO 0x00008000
|
---|
895 | #define SVGA_CAP_MULTIMON 0x00010000
|
---|
896 | #define SVGA_CAP_PITCHLOCK 0x00020000
|
---|
897 | #define SVGA_CAP_IRQMASK 0x00040000
|
---|
898 | #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000
|
---|
899 | #define SVGA_CAP_GMR 0x00100000
|
---|
900 | #define SVGA_CAP_TRACES 0x00200000
|
---|
901 | #define SVGA_CAP_GMR2 0x00400000
|
---|
902 | #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000
|
---|
903 | #define SVGA_CAP_COMMAND_BUFFERS 0x01000000
|
---|
904 | #define SVGA_CAP_DEAD1 0x02000000
|
---|
905 | #define SVGA_CAP_CMD_BUFFERS_2 0x04000000
|
---|
906 | #define SVGA_CAP_GBOBJECTS 0x08000000
|
---|
907 | #define SVGA_CAP_DX 0x10000000
|
---|
908 | #define SVGA_CAP_HP_CMD_QUEUE 0x20000000
|
---|
909 | #define SVGA_CAP_NO_BB_RESTRICTION 0x40000000
|
---|
910 | #define SVGA_CAP_CAP2_REGISTER 0x80000000
|
---|
911 |
|
---|
912 | /*
|
---|
913 | * The SVGA_REG_CAP2 register is an additional set of SVGA capability bits.
|
---|
914 | *
|
---|
915 | * SVGA_CAP2_GROW_OTABLE --
|
---|
916 | * Allow the GrowOTable/DXGrowCOTable commands.
|
---|
917 | *
|
---|
918 | * SVGA_CAP2_INTRA_SURFACE_COPY --
|
---|
919 | * Allow the IntraSurfaceCopy command.
|
---|
920 | *
|
---|
921 | * SVGA_CAP2_DX2 --
|
---|
922 | * Allow the DefineGBSurface_v3, WholeSurfaceCopy, WriteZeroSurface, and
|
---|
923 | * HintZeroSurface commands, and the SVGA_REG_GUEST_DRIVER_ID register.
|
---|
924 | *
|
---|
925 | * SVGA_CAP2_GB_MEMSIZE_2 --
|
---|
926 | * Allow the SVGA_REG_GBOBJECT_MEM_SIZE_KB register.
|
---|
927 | *
|
---|
928 | * SVGA_CAP2_SCREENDMA_REG --
|
---|
929 | * Allow the SVGA_REG_SCREENDMA register.
|
---|
930 | *
|
---|
931 | * SVGA_CAP2_OTABLE_PTDEPTH_2 --
|
---|
932 | * Allow 2 level page tables for OTable commands.
|
---|
933 | *
|
---|
934 | * SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT --
|
---|
935 | * Allow a stretch blt from a non-multisampled surface to a multisampled
|
---|
936 | * surface.
|
---|
937 | *
|
---|
938 | * SVGA_CAP2_CURSOR_MOB --
|
---|
939 | * Allow the SVGA_REG_CURSOR_MOBID register.
|
---|
940 | *
|
---|
941 | * SVGA_CAP2_MSHINT --
|
---|
942 | * Allow the SVGA_REG_MSHINT register.
|
---|
943 | *
|
---|
944 | * SVGA_CAP2_DX3 --
|
---|
945 | * Allows the DefineGBSurface_v4 command.
|
---|
946 | * Allows the DXDefineDepthStencilView_v2, DXDefineStreamOutputWithMob,
|
---|
947 | * and DXBindStreamOutput commands if 3D is also available.
|
---|
948 | * Allows the DXPredStagingCopy and DXStagingCopy commands if SM41
|
---|
949 | * is also available.
|
---|
950 | *
|
---|
951 | * SVGA_CAP2_RESERVED --
|
---|
952 | * Reserve the last bit for extending the SVGA capabilities to some
|
---|
953 | * future mechanisms.
|
---|
954 | */
|
---|
955 | #define SVGA_CAP2_NONE 0x00000000
|
---|
956 | #define SVGA_CAP2_GROW_OTABLE 0x00000001
|
---|
957 | #define SVGA_CAP2_INTRA_SURFACE_COPY 0x00000002
|
---|
958 | #define SVGA_CAP2_DX2 0x00000004
|
---|
959 | #define SVGA_CAP2_GB_MEMSIZE_2 0x00000008
|
---|
960 | #define SVGA_CAP2_SCREENDMA_REG 0x00000010
|
---|
961 | #define SVGA_CAP2_OTABLE_PTDEPTH_2 0x00000020
|
---|
962 | #define SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT 0x00000040
|
---|
963 | #define SVGA_CAP2_CURSOR_MOB 0x00000080
|
---|
964 | #define SVGA_CAP2_MSHINT 0x00000100
|
---|
965 | #define SVGA_CAP2_DX3 0x00000400
|
---|
966 | #define SVGA_CAP2_RESERVED 0x80000000
|
---|
967 |
|
---|
968 |
|
---|
969 | /*
|
---|
970 | * The Guest can optionally read some SVGA device capabilities through
|
---|
971 | * the backdoor with command BDOOR_CMD_GET_SVGA_CAPABILITIES before
|
---|
972 | * the SVGA device is initialized. The type of capability the guest
|
---|
973 | * is requesting from the SVGABackdoorCapType enum should be placed in
|
---|
974 | * the upper 16 bits of the backdoor command id (ECX). On success the
|
---|
975 | * the value of EBX will be set to BDOOR_MAGIC and EAX will be set to
|
---|
976 | * the requested capability. If the command is not supported then EBX
|
---|
977 | * will be left unchanged and EAX will be set to -1. Because it is
|
---|
978 | * possible that -1 is the value of the requested cap the correct way
|
---|
979 | * to check if the command was successful is to check if EBX was changed
|
---|
980 | * to BDOOR_MAGIC making sure to initialize the register to something
|
---|
981 | * else first.
|
---|
982 | */
|
---|
983 |
|
---|
984 | typedef enum {
|
---|
985 | SVGABackdoorCapDeviceCaps = 0,
|
---|
986 | SVGABackdoorCapFifoCaps = 1,
|
---|
987 | SVGABackdoorCap3dHWVersion = 2,
|
---|
988 | SVGABackdoorCapDeviceCaps2 = 3,
|
---|
989 | SVGABackdoorCapDevelCaps = 4,
|
---|
990 | SVGABackdoorDevelRenderer = 5,
|
---|
991 | SVGABackdoorCapMax = 6,
|
---|
992 | } SVGABackdoorCapType;
|
---|
993 |
|
---|
994 |
|
---|
995 | /*
|
---|
996 | * FIFO register indices.
|
---|
997 | *
|
---|
998 | * The FIFO is a chunk of device memory mapped into guest physmem. It
|
---|
999 | * is always treated as 32-bit words.
|
---|
1000 | *
|
---|
1001 | * The guest driver gets to decide how to partition it between
|
---|
1002 | * - FIFO registers (there are always at least 4, specifying where the
|
---|
1003 | * following data area is and how much data it contains; there may be
|
---|
1004 | * more registers following these, depending on the FIFO protocol
|
---|
1005 | * version in use)
|
---|
1006 | * - FIFO data, written by the guest and slurped out by the VMX.
|
---|
1007 | * These indices are 32-bit word offsets into the FIFO.
|
---|
1008 | */
|
---|
1009 |
|
---|
1010 | enum {
|
---|
1011 | /*
|
---|
1012 | * Block 1 (basic registers): The originally defined FIFO registers.
|
---|
1013 | * These exist and are valid for all versions of the FIFO protocol.
|
---|
1014 | */
|
---|
1015 |
|
---|
1016 | SVGA_FIFO_MIN = 0,
|
---|
1017 | SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */
|
---|
1018 | SVGA_FIFO_NEXT_CMD,
|
---|
1019 | SVGA_FIFO_STOP,
|
---|
1020 |
|
---|
1021 | /*
|
---|
1022 | * Block 2 (extended registers): Mandatory registers for the extended
|
---|
1023 | * FIFO. These exist if the SVGA caps register includes
|
---|
1024 | * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their
|
---|
1025 | * associated capability bit is enabled.
|
---|
1026 | *
|
---|
1027 | * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied
|
---|
1028 | * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE.
|
---|
1029 | * This means that the guest has to test individually (in most cases
|
---|
1030 | * using FIFO caps) for the presence of registers after this; the VMX
|
---|
1031 | * can define "extended FIFO" to mean whatever it wants, and currently
|
---|
1032 | * won't enable it unless there's room for that set and much more.
|
---|
1033 | */
|
---|
1034 |
|
---|
1035 | SVGA_FIFO_CAPABILITIES = 4,
|
---|
1036 | SVGA_FIFO_FLAGS,
|
---|
1037 | /* Valid with SVGA_FIFO_CAP_FENCE: */
|
---|
1038 | SVGA_FIFO_FENCE,
|
---|
1039 |
|
---|
1040 | /*
|
---|
1041 | * Block 3a (optional extended registers): Additional registers for the
|
---|
1042 | * extended FIFO, whose presence isn't actually implied by
|
---|
1043 | * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to
|
---|
1044 | * leave room for them.
|
---|
1045 | *
|
---|
1046 | * These in block 3a, the VMX currently considers mandatory for the
|
---|
1047 | * extended FIFO.
|
---|
1048 | */
|
---|
1049 |
|
---|
1050 | /* Valid if exists (i.e. if extended FIFO enabled): */
|
---|
1051 | SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */
|
---|
1052 | /* Valid with SVGA_FIFO_CAP_PITCHLOCK: */
|
---|
1053 | SVGA_FIFO_PITCHLOCK,
|
---|
1054 |
|
---|
1055 | /* Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: */
|
---|
1056 | SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */
|
---|
1057 | SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */
|
---|
1058 | SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */
|
---|
1059 | SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */
|
---|
1060 | SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */
|
---|
1061 |
|
---|
1062 | /* Valid with SVGA_FIFO_CAP_RESERVE: */
|
---|
1063 | SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */
|
---|
1064 |
|
---|
1065 | /*
|
---|
1066 | * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2:
|
---|
1067 | *
|
---|
1068 | * By default this is SVGA_ID_INVALID, to indicate that the cursor
|
---|
1069 | * coordinates are specified relative to the virtual root. If this
|
---|
1070 | * is set to a specific screen ID, cursor position is reinterpreted
|
---|
1071 | * as a signed offset relative to that screen's origin.
|
---|
1072 | */
|
---|
1073 | SVGA_FIFO_CURSOR_SCREEN_ID,
|
---|
1074 |
|
---|
1075 | /*
|
---|
1076 | * Valid with SVGA_FIFO_CAP_DEAD
|
---|
1077 | *
|
---|
1078 | * An arbitrary value written by the host, drivers should not use it.
|
---|
1079 | */
|
---|
1080 | SVGA_FIFO_DEAD,
|
---|
1081 |
|
---|
1082 | /*
|
---|
1083 | * Valid with SVGA_FIFO_CAP_3D_HWVERSION_REVISED:
|
---|
1084 | *
|
---|
1085 | * Contains 3D HWVERSION (see SVGA3dHardwareVersion in svga3d_reg.h)
|
---|
1086 | * on platforms that can enforce graphics resource limits.
|
---|
1087 | */
|
---|
1088 | SVGA_FIFO_3D_HWVERSION_REVISED,
|
---|
1089 |
|
---|
1090 | /*
|
---|
1091 | * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new
|
---|
1092 | * registers, but this must be done carefully and with judicious use of
|
---|
1093 | * capability bits, since comparisons based on SVGA_FIFO_MIN aren't
|
---|
1094 | * enough to tell you whether the register exists: we've shipped drivers
|
---|
1095 | * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of
|
---|
1096 | * the earlier ones. The actual order of introduction was:
|
---|
1097 | * - PITCHLOCK
|
---|
1098 | * - 3D_CAPS
|
---|
1099 | * - CURSOR_* (cursor bypass 3)
|
---|
1100 | * - RESERVED
|
---|
1101 | * So, code that wants to know whether it can use any of the
|
---|
1102 | * aforementioned registers, or anything else added after PITCHLOCK and
|
---|
1103 | * before 3D_CAPS, needs to reason about something other than
|
---|
1104 | * SVGA_FIFO_MIN.
|
---|
1105 | */
|
---|
1106 |
|
---|
1107 | /*
|
---|
1108 | * 3D caps block space; valid with 3D hardware version >=
|
---|
1109 | * SVGA3D_HWVERSION_WS6_B1.
|
---|
1110 | */
|
---|
1111 | SVGA_FIFO_3D_CAPS = 32,
|
---|
1112 | SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
|
---|
1113 |
|
---|
1114 | /*
|
---|
1115 | * End of VMX's current definition of "extended-FIFO registers".
|
---|
1116 | * Registers before here are always enabled/disabled as a block; either
|
---|
1117 | * the extended FIFO is enabled and includes all preceding registers, or
|
---|
1118 | * it's disabled entirely.
|
---|
1119 | *
|
---|
1120 | * Block 3b (truly optional extended registers): Additional registers for
|
---|
1121 | * the extended FIFO, which the VMX already knows how to enable and
|
---|
1122 | * disable with correct granularity.
|
---|
1123 | *
|
---|
1124 | * Registers after here exist if and only if the guest SVGA driver
|
---|
1125 | * sets SVGA_FIFO_MIN high enough to leave room for them.
|
---|
1126 | */
|
---|
1127 |
|
---|
1128 | /* Valid if register exists: */
|
---|
1129 | SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */
|
---|
1130 | SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */
|
---|
1131 | SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */
|
---|
1132 |
|
---|
1133 | /*
|
---|
1134 | * Always keep this last. This defines the maximum number of
|
---|
1135 | * registers we know about. At power-on, this value is placed in
|
---|
1136 | * the SVGA_REG_MEM_REGS register, and we expect the guest driver
|
---|
1137 | * to allocate this much space in FIFO memory for registers.
|
---|
1138 | */
|
---|
1139 | SVGA_FIFO_NUM_REGS
|
---|
1140 | };
|
---|
1141 |
|
---|
1142 |
|
---|
1143 | /*
|
---|
1144 | * Definition of registers included in extended FIFO support.
|
---|
1145 | *
|
---|
1146 | * The guest SVGA driver gets to allocate the FIFO between registers
|
---|
1147 | * and data. It must always allocate at least 4 registers, but old
|
---|
1148 | * drivers stopped there.
|
---|
1149 | *
|
---|
1150 | * The VMX will enable extended FIFO support if and only if the guest
|
---|
1151 | * left enough room for all registers defined as part of the mandatory
|
---|
1152 | * set for the extended FIFO.
|
---|
1153 | *
|
---|
1154 | * Note that the guest drivers typically allocate the FIFO only at
|
---|
1155 | * initialization time, not at mode switches, so it's likely that the
|
---|
1156 | * number of FIFO registers won't change without a reboot.
|
---|
1157 | *
|
---|
1158 | * All registers less than this value are guaranteed to be present if
|
---|
1159 | * svgaUser->fifo.extended is set. Any later registers must be tested
|
---|
1160 | * individually for compatibility at each use (in the VMX).
|
---|
1161 | *
|
---|
1162 | * This value is used only by the VMX, so it can change without
|
---|
1163 | * affecting driver compatibility; keep it that way?
|
---|
1164 | */
|
---|
1165 | #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)
|
---|
1166 |
|
---|
1167 |
|
---|
1168 | /*
|
---|
1169 | * FIFO Synchronization Registers
|
---|
1170 | *
|
---|
1171 | * SVGA_REG_SYNC --
|
---|
1172 | *
|
---|
1173 | * The SYNC register can be used by the guest driver to signal to the
|
---|
1174 | * device that the guest driver is waiting for previously submitted
|
---|
1175 | * commands to complete.
|
---|
1176 | *
|
---|
1177 | * When the guest driver writes to the SYNC register, the device sets
|
---|
1178 | * the BUSY register to TRUE, and starts processing the submitted commands
|
---|
1179 | * (if it was not already doing so). When all previously submitted
|
---|
1180 | * commands are finished and the device is idle again, it sets the BUSY
|
---|
1181 | * register back to FALSE. (If the guest driver submits new commands
|
---|
1182 | * after writing the SYNC register, the new commands are not guaranteed
|
---|
1183 | * to have been procesesd.)
|
---|
1184 | *
|
---|
1185 | * When guest drivers are submitting commands using the FIFO, the device
|
---|
1186 | * periodically polls to check for new FIFO commands when idle, which may
|
---|
1187 | * introduce a delay in command processing. If the guest-driver wants
|
---|
1188 | * the commands to be processed quickly (which it typically does), it
|
---|
1189 | * should write SYNC after each batch of commands is committed to the
|
---|
1190 | * FIFO to immediately wake up the device. For even better performance,
|
---|
1191 | * the guest can use the SVGA_FIFO_BUSY register to avoid these extra
|
---|
1192 | * SYNC writes if the device is already active, using the technique known
|
---|
1193 | * as "Ringing the Doorbell" (described below). (Note that command
|
---|
1194 | * buffer submission implicitly wakes up the device, and so doesn't
|
---|
1195 | * suffer from this problem.)
|
---|
1196 | *
|
---|
1197 | * The SYNC register can also be used in combination with BUSY to
|
---|
1198 | * synchronously ensure that all SVGA commands are processed (with both
|
---|
1199 | * the FIFO and command-buffers). To do this, the guest driver should
|
---|
1200 | * write to SYNC, and then loop reading BUSY until BUSY returns FALSE.
|
---|
1201 | * This technique is known as a "Legacy Sync".
|
---|
1202 | *
|
---|
1203 | * SVGA_REG_BUSY --
|
---|
1204 | *
|
---|
1205 | * This register is set to TRUE when SVGA_REG_SYNC is written,
|
---|
1206 | * and is set back to FALSE when the device has finished processing
|
---|
1207 | * all commands and is idle again.
|
---|
1208 | *
|
---|
1209 | * Every read from the BUSY reigster will block for an undefined
|
---|
1210 | * amount of time (normally until the device finishes some interesting
|
---|
1211 | * work unit), or the device is idle.
|
---|
1212 | *
|
---|
1213 | * Guest drivers can also do a partial Legacy Sync to check for some
|
---|
1214 | * particular condition, for instance by stopping early when a fence
|
---|
1215 | * passes before BUSY has been set back to FALSE. This is particularly
|
---|
1216 | * useful if the guest-driver knows that it is blocked waiting on the
|
---|
1217 | * device, because it will yield CPU time back to the host.
|
---|
1218 | *
|
---|
1219 | * SVGA_FIFO_BUSY --
|
---|
1220 | *
|
---|
1221 | * The SVGA_FIFO_BUSY register is a fast way for the guest driver to check
|
---|
1222 | * whether the device is actively processing FIFO commands before writing
|
---|
1223 | * the more expensive SYNC register.
|
---|
1224 | *
|
---|
1225 | * If this register reads as TRUE, the device is actively processing
|
---|
1226 | * FIFO commands.
|
---|
1227 | *
|
---|
1228 | * If this register reads as FALSE, the device may not be actively
|
---|
1229 | * processing commands, and the guest driver should try
|
---|
1230 | * "Ringing the Doorbell".
|
---|
1231 | *
|
---|
1232 | * To Ring the Doorbell, the guest should:
|
---|
1233 | *
|
---|
1234 | * 1. Have already written their batch of commands into the FIFO.
|
---|
1235 | * 2. Check if the SVGA_FIFO_BUSY register is available by reading
|
---|
1236 | * SVGA_FIFO_MIN.
|
---|
1237 | * 3. Read SVGA_FIFO_BUSY. If it reads as TRUE, the device is actively
|
---|
1238 | * processing FIFO commands, and no further action is necessary.
|
---|
1239 | * 4. If SVGA_FIFO_BUSY was FALSE, write TRUE to SVGA_REG_SYNC.
|
---|
1240 | *
|
---|
1241 | * For maximum performance, this procedure should be followed after
|
---|
1242 | * every meaningful batch of commands has been written into the FIFO.
|
---|
1243 | * (Normally when the underlying application signals it's finished a
|
---|
1244 | * meaningful work unit by calling Flush.)
|
---|
1245 | */
|
---|
1246 |
|
---|
1247 |
|
---|
1248 | /*
|
---|
1249 | * FIFO Capabilities
|
---|
1250 | *
|
---|
1251 | * Fence -- Fence register and command are supported
|
---|
1252 | * Accel Front -- Front buffer only commands are supported
|
---|
1253 | * Pitch Lock -- Pitch lock register is supported
|
---|
1254 | * Video -- SVGA Video overlay units are supported
|
---|
1255 | * Escape -- Escape command is supported
|
---|
1256 | *
|
---|
1257 | * SVGA_FIFO_CAP_SCREEN_OBJECT --
|
---|
1258 | *
|
---|
1259 | * Provides dynamic multi-screen rendering, for improved Unity and
|
---|
1260 | * multi-monitor modes. With Screen Object, the guest can
|
---|
1261 | * dynamically create and destroy 'screens', which can represent
|
---|
1262 | * Unity windows or virtual monitors. Screen Object also provides
|
---|
1263 | * strong guarantees that DMA operations happen only when
|
---|
1264 | * guest-initiated. Screen Object deprecates the BAR1 guest
|
---|
1265 | * framebuffer (GFB) and all commands that work only with the GFB.
|
---|
1266 | *
|
---|
1267 | * New registers:
|
---|
1268 | * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID
|
---|
1269 | *
|
---|
1270 | * New 2D commands:
|
---|
1271 | * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN,
|
---|
1272 | * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY
|
---|
1273 | *
|
---|
1274 | * New 3D commands:
|
---|
1275 | * BLIT_SURFACE_TO_SCREEN
|
---|
1276 | *
|
---|
1277 | * New guarantees:
|
---|
1278 | *
|
---|
1279 | * - The host will not read or write guest memory, including the GFB,
|
---|
1280 | * except when explicitly initiated by a DMA command.
|
---|
1281 | *
|
---|
1282 | * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK,
|
---|
1283 | * is guaranteed to complete before any subsequent FENCEs.
|
---|
1284 | *
|
---|
1285 | * - All legacy commands which affect a Screen (UPDATE, PRESENT,
|
---|
1286 | * PRESENT_READBACK) as well as new Screen blit commands will
|
---|
1287 | * all behave consistently as blits, and memory will be read
|
---|
1288 | * or written in FIFO order.
|
---|
1289 | *
|
---|
1290 | * For example, if you PRESENT from one SVGA3D surface to multiple
|
---|
1291 | * places on the screen, the data copied will always be from the
|
---|
1292 | * SVGA3D surface at the time the PRESENT was issued in the FIFO.
|
---|
1293 | * This was not necessarily true on devices without Screen Object.
|
---|
1294 | *
|
---|
1295 | * This means that on devices that support Screen Object, the
|
---|
1296 | * PRESENT_READBACK command should not be necessary unless you
|
---|
1297 | * actually want to read back the results of 3D rendering into
|
---|
1298 | * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB
|
---|
1299 | * command provides a strict superset of functionality.)
|
---|
1300 | *
|
---|
1301 | * - When a screen is resized, either using Screen Object commands or
|
---|
1302 | * legacy multimon registers, its contents are preserved.
|
---|
1303 | *
|
---|
1304 | * SVGA_FIFO_CAP_GMR2 --
|
---|
1305 | *
|
---|
1306 | * Provides new commands to define and remap guest memory regions (GMR).
|
---|
1307 | *
|
---|
1308 | * New 2D commands:
|
---|
1309 | * DEFINE_GMR2, REMAP_GMR2.
|
---|
1310 | *
|
---|
1311 | * SVGA_FIFO_CAP_3D_HWVERSION_REVISED --
|
---|
1312 | *
|
---|
1313 | * Indicates new register SVGA_FIFO_3D_HWVERSION_REVISED exists.
|
---|
1314 | * This register may replace SVGA_FIFO_3D_HWVERSION on platforms
|
---|
1315 | * that enforce graphics resource limits. This allows the platform
|
---|
1316 | * to clear SVGA_FIFO_3D_HWVERSION and disable 3D in legacy guest
|
---|
1317 | * drivers that do not limit their resources.
|
---|
1318 | *
|
---|
1319 | * Note this is an alias to SVGA_FIFO_CAP_GMR2 because these indicators
|
---|
1320 | * are codependent (and thus we use a single capability bit).
|
---|
1321 | *
|
---|
1322 | * SVGA_FIFO_CAP_SCREEN_OBJECT_2 --
|
---|
1323 | *
|
---|
1324 | * Modifies the DEFINE_SCREEN command to include a guest provided
|
---|
1325 | * backing store in GMR memory and the bytesPerLine for the backing
|
---|
1326 | * store. This capability requires the use of a backing store when
|
---|
1327 | * creating screen objects. However if SVGA_FIFO_CAP_SCREEN_OBJECT
|
---|
1328 | * is present then backing stores are optional.
|
---|
1329 | *
|
---|
1330 | * SVGA_FIFO_CAP_DEAD --
|
---|
1331 | *
|
---|
1332 | * Drivers should not use this cap bit. This cap bit can not be
|
---|
1333 | * reused since some hosts already expose it.
|
---|
1334 | */
|
---|
1335 |
|
---|
1336 | #define SVGA_FIFO_CAP_NONE 0
|
---|
1337 | #define SVGA_FIFO_CAP_FENCE (1<<0)
|
---|
1338 | #define SVGA_FIFO_CAP_ACCELFRONT (1<<1)
|
---|
1339 | #define SVGA_FIFO_CAP_PITCHLOCK (1<<2)
|
---|
1340 | #define SVGA_FIFO_CAP_VIDEO (1<<3)
|
---|
1341 | #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4)
|
---|
1342 | #define SVGA_FIFO_CAP_ESCAPE (1<<5)
|
---|
1343 | #define SVGA_FIFO_CAP_RESERVE (1<<6)
|
---|
1344 | #define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7)
|
---|
1345 | #define SVGA_FIFO_CAP_GMR2 (1<<8)
|
---|
1346 | #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2
|
---|
1347 | #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1<<9)
|
---|
1348 | #define SVGA_FIFO_CAP_DEAD (1<<10)
|
---|
1349 |
|
---|
1350 |
|
---|
1351 | /*
|
---|
1352 | * FIFO Flags
|
---|
1353 | *
|
---|
1354 | * Accel Front -- Driver should use front buffer only commands
|
---|
1355 | */
|
---|
1356 |
|
---|
1357 | #define SVGA_FIFO_FLAG_NONE 0
|
---|
1358 | #define SVGA_FIFO_FLAG_ACCELFRONT (1<<0)
|
---|
1359 | #define SVGA_FIFO_FLAG_RESERVED (1<<31) /* Internal use only */
|
---|
1360 |
|
---|
1361 | /*
|
---|
1362 | * FIFO reservation sentinel value
|
---|
1363 | */
|
---|
1364 |
|
---|
1365 | #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff
|
---|
1366 |
|
---|
1367 |
|
---|
1368 | /*
|
---|
1369 | * ScreenDMA Register Values
|
---|
1370 | */
|
---|
1371 |
|
---|
1372 | #define SVGA_SCREENDMA_REG_UNDEFINED 0
|
---|
1373 | #define SVGA_SCREENDMA_REG_NOT_PRESENT 1
|
---|
1374 | #define SVGA_SCREENDMA_REG_PRESENT 2
|
---|
1375 | #define SVGA_SCREENDMA_REG_MAX 3
|
---|
1376 |
|
---|
1377 | /*
|
---|
1378 | * Video overlay support
|
---|
1379 | */
|
---|
1380 |
|
---|
1381 | #define SVGA_NUM_OVERLAY_UNITS 32
|
---|
1382 |
|
---|
1383 |
|
---|
1384 | /*
|
---|
1385 | * Video capabilities that the guest is currently using
|
---|
1386 | */
|
---|
1387 |
|
---|
1388 | #define SVGA_VIDEO_FLAG_COLORKEY 0x0001
|
---|
1389 |
|
---|
1390 |
|
---|
1391 | /*
|
---|
1392 | * Offsets for the video overlay registers
|
---|
1393 | */
|
---|
1394 |
|
---|
1395 | enum {
|
---|
1396 | SVGA_VIDEO_ENABLED = 0,
|
---|
1397 | SVGA_VIDEO_FLAGS,
|
---|
1398 | SVGA_VIDEO_DATA_OFFSET,
|
---|
1399 | SVGA_VIDEO_FORMAT,
|
---|
1400 | SVGA_VIDEO_COLORKEY,
|
---|
1401 | SVGA_VIDEO_SIZE, /* Deprecated */
|
---|
1402 | SVGA_VIDEO_WIDTH,
|
---|
1403 | SVGA_VIDEO_HEIGHT,
|
---|
1404 | SVGA_VIDEO_SRC_X,
|
---|
1405 | SVGA_VIDEO_SRC_Y,
|
---|
1406 | SVGA_VIDEO_SRC_WIDTH,
|
---|
1407 | SVGA_VIDEO_SRC_HEIGHT,
|
---|
1408 | SVGA_VIDEO_DST_X, /* Signed int32 */
|
---|
1409 | SVGA_VIDEO_DST_Y, /* Signed int32 */
|
---|
1410 | SVGA_VIDEO_DST_WIDTH,
|
---|
1411 | SVGA_VIDEO_DST_HEIGHT,
|
---|
1412 | SVGA_VIDEO_PITCH_1,
|
---|
1413 | SVGA_VIDEO_PITCH_2,
|
---|
1414 | SVGA_VIDEO_PITCH_3,
|
---|
1415 | SVGA_VIDEO_DATA_GMRID, /* Optional, defaults to SVGA_GMR_FRAMEBUFFER */
|
---|
1416 | SVGA_VIDEO_DST_SCREEN_ID, /* Optional, defaults to virtual coords */
|
---|
1417 | /* (SVGA_ID_INVALID) */
|
---|
1418 | SVGA_VIDEO_NUM_REGS
|
---|
1419 | };
|
---|
1420 |
|
---|
1421 |
|
---|
1422 | /*
|
---|
1423 | * SVGA Overlay Units
|
---|
1424 | *
|
---|
1425 | * width and height relate to the entire source video frame.
|
---|
1426 | * srcX, srcY, srcWidth and srcHeight represent subset of the source
|
---|
1427 | * video frame to be displayed.
|
---|
1428 | */
|
---|
1429 |
|
---|
1430 | typedef
|
---|
1431 | #include "vmware_pack_begin.h"
|
---|
1432 | struct SVGAOverlayUnit {
|
---|
1433 | uint32 enabled;
|
---|
1434 | uint32 flags;
|
---|
1435 | uint32 dataOffset;
|
---|
1436 | uint32 format;
|
---|
1437 | uint32 colorKey;
|
---|
1438 | uint32 size;
|
---|
1439 | uint32 width;
|
---|
1440 | uint32 height;
|
---|
1441 | uint32 srcX;
|
---|
1442 | uint32 srcY;
|
---|
1443 | uint32 srcWidth;
|
---|
1444 | uint32 srcHeight;
|
---|
1445 | int32 dstX;
|
---|
1446 | int32 dstY;
|
---|
1447 | uint32 dstWidth;
|
---|
1448 | uint32 dstHeight;
|
---|
1449 | uint32 pitches[3];
|
---|
1450 | uint32 dataGMRId;
|
---|
1451 | uint32 dstScreenId;
|
---|
1452 | }
|
---|
1453 | #include "vmware_pack_end.h"
|
---|
1454 | SVGAOverlayUnit;
|
---|
1455 |
|
---|
1456 |
|
---|
1457 | /*
|
---|
1458 | * Guest display topology
|
---|
1459 | *
|
---|
1460 | * XXX: This structure is not part of the SVGA device's interface, and
|
---|
1461 | * doesn't really belong here.
|
---|
1462 | */
|
---|
1463 | #define SVGA_INVALID_DISPLAY_ID ((uint32)-1)
|
---|
1464 |
|
---|
1465 | typedef struct SVGADisplayTopology {
|
---|
1466 | uint16 displayId;
|
---|
1467 | uint16 isPrimary;
|
---|
1468 | uint32 width;
|
---|
1469 | uint32 height;
|
---|
1470 | uint32 positionX;
|
---|
1471 | uint32 positionY;
|
---|
1472 | } SVGADisplayTopology;
|
---|
1473 |
|
---|
1474 |
|
---|
1475 | /*
|
---|
1476 | * SVGAScreenObject --
|
---|
1477 | *
|
---|
1478 | * This is a new way to represent a guest's multi-monitor screen or
|
---|
1479 | * Unity window. Screen objects are only supported if the
|
---|
1480 | * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set.
|
---|
1481 | *
|
---|
1482 | * If Screen Objects are supported, they can be used to fully
|
---|
1483 | * replace the functionality provided by the framebuffer registers
|
---|
1484 | * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY.
|
---|
1485 | *
|
---|
1486 | * The screen object is a struct with guaranteed binary
|
---|
1487 | * compatibility. New flags can be added, and the struct may grow,
|
---|
1488 | * but existing fields must retain their meaning.
|
---|
1489 | *
|
---|
1490 | * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2 are required fields of
|
---|
1491 | * a SVGAGuestPtr that is used to back the screen contents. This
|
---|
1492 | * memory must come from the GFB. The guest is not allowed to
|
---|
1493 | * access the memory and doing so will have undefined results. The
|
---|
1494 | * backing store is required to be page aligned and the size is
|
---|
1495 | * padded to the next page boundry. The number of pages is:
|
---|
1496 | * (bytesPerLine * size.width * 4 + PAGE_SIZE - 1) / PAGE_SIZE
|
---|
1497 | *
|
---|
1498 | * The pitch in the backingStore is required to be at least large
|
---|
1499 | * enough to hold a 32bbp scanline. It is recommended that the
|
---|
1500 | * driver pad bytesPerLine for a potential performance win.
|
---|
1501 | *
|
---|
1502 | * The cloneCount field is treated as a hint from the guest that
|
---|
1503 | * the user wants this display to be cloned, countCount times. A
|
---|
1504 | * value of zero means no cloning should happen.
|
---|
1505 | */
|
---|
1506 |
|
---|
1507 | #define SVGA_SCREEN_MUST_BE_SET (1 << 0)
|
---|
1508 | #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET /* Deprecated */
|
---|
1509 | #define SVGA_SCREEN_IS_PRIMARY (1 << 1)
|
---|
1510 | #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2)
|
---|
1511 |
|
---|
1512 | /*
|
---|
1513 | * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When the screen is
|
---|
1514 | * deactivated the base layer is defined to lose all contents and
|
---|
1515 | * become black. When a screen is deactivated the backing store is
|
---|
1516 | * optional. When set backingPtr and bytesPerLine will be ignored.
|
---|
1517 | */
|
---|
1518 | #define SVGA_SCREEN_DEACTIVATE (1 << 3)
|
---|
1519 |
|
---|
1520 | /*
|
---|
1521 | * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When this flag is set
|
---|
1522 | * the screen contents will be outputted as all black to the user
|
---|
1523 | * though the base layer contents is preserved. The screen base layer
|
---|
1524 | * can still be read and written to like normal though the no visible
|
---|
1525 | * effect will be seen by the user. When the flag is changed the
|
---|
1526 | * screen will be blanked or redrawn to the current contents as needed
|
---|
1527 | * without any extra commands from the driver. This flag only has an
|
---|
1528 | * effect when the screen is not deactivated.
|
---|
1529 | */
|
---|
1530 | #define SVGA_SCREEN_BLANKING (1 << 4)
|
---|
1531 |
|
---|
1532 | typedef
|
---|
1533 | #include "vmware_pack_begin.h"
|
---|
1534 | struct {
|
---|
1535 | uint32 structSize; /* sizeof(SVGAScreenObject) */
|
---|
1536 | uint32 id;
|
---|
1537 | uint32 flags;
|
---|
1538 | struct {
|
---|
1539 | uint32 width;
|
---|
1540 | uint32 height;
|
---|
1541 | } size;
|
---|
1542 | struct {
|
---|
1543 | int32 x;
|
---|
1544 | int32 y;
|
---|
1545 | } root;
|
---|
1546 |
|
---|
1547 | /*
|
---|
1548 | * Added and required by SVGA_FIFO_CAP_SCREEN_OBJECT_2, optional
|
---|
1549 | * with SVGA_FIFO_CAP_SCREEN_OBJECT.
|
---|
1550 | */
|
---|
1551 | SVGAGuestImage backingStore;
|
---|
1552 |
|
---|
1553 | /*
|
---|
1554 | * The cloneCount field is treated as a hint from the guest that
|
---|
1555 | * the user wants this display to be cloned, cloneCount times.
|
---|
1556 | *
|
---|
1557 | * A value of zero means no cloning should happen.
|
---|
1558 | */
|
---|
1559 | uint32 cloneCount;
|
---|
1560 | }
|
---|
1561 | #include "vmware_pack_end.h"
|
---|
1562 | SVGAScreenObject;
|
---|
1563 |
|
---|
1564 |
|
---|
1565 | /*
|
---|
1566 | * Commands in the command FIFO:
|
---|
1567 | *
|
---|
1568 | * Command IDs defined below are used for the traditional 2D FIFO
|
---|
1569 | * communication (not all commands are available for all versions of the
|
---|
1570 | * SVGA FIFO protocol).
|
---|
1571 | *
|
---|
1572 | * Note the holes in the command ID numbers: These commands have been
|
---|
1573 | * deprecated, and the old IDs must not be reused.
|
---|
1574 | *
|
---|
1575 | * Command IDs from 1000 to 2999 are reserved for use by the SVGA3D
|
---|
1576 | * protocol.
|
---|
1577 | *
|
---|
1578 | * Each command's parameters are described by the comments and
|
---|
1579 | * structs below.
|
---|
1580 | */
|
---|
1581 |
|
---|
1582 | typedef enum {
|
---|
1583 | SVGA_CMD_INVALID_CMD = 0,
|
---|
1584 | SVGA_CMD_UPDATE = 1,
|
---|
1585 | SVGA_CMD_RECT_COPY = 3,
|
---|
1586 | SVGA_CMD_RECT_ROP_COPY = 14,
|
---|
1587 | SVGA_CMD_DEFINE_CURSOR = 19,
|
---|
1588 | SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,
|
---|
1589 | SVGA_CMD_UPDATE_VERBOSE = 25,
|
---|
1590 | SVGA_CMD_FRONT_ROP_FILL = 29,
|
---|
1591 | SVGA_CMD_FENCE = 30,
|
---|
1592 | SVGA_CMD_ESCAPE = 33,
|
---|
1593 | SVGA_CMD_DEFINE_SCREEN = 34,
|
---|
1594 | SVGA_CMD_DESTROY_SCREEN = 35,
|
---|
1595 | SVGA_CMD_DEFINE_GMRFB = 36,
|
---|
1596 | SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,
|
---|
1597 | SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,
|
---|
1598 | SVGA_CMD_ANNOTATION_FILL = 39,
|
---|
1599 | SVGA_CMD_ANNOTATION_COPY = 40,
|
---|
1600 | SVGA_CMD_DEFINE_GMR2 = 41,
|
---|
1601 | SVGA_CMD_REMAP_GMR2 = 42,
|
---|
1602 | SVGA_CMD_DEAD = 43,
|
---|
1603 | SVGA_CMD_DEAD_2 = 44,
|
---|
1604 | SVGA_CMD_NOP = 45,
|
---|
1605 | SVGA_CMD_NOP_ERROR = 46,
|
---|
1606 | SVGA_CMD_MAX
|
---|
1607 | } SVGAFifoCmdId;
|
---|
1608 |
|
---|
1609 | #define SVGA_CMD_MAX_DATASIZE (256 * 1024)
|
---|
1610 | #define SVGA_CMD_MAX_ARGS 64
|
---|
1611 |
|
---|
1612 |
|
---|
1613 | /*
|
---|
1614 | * SVGA_CMD_UPDATE --
|
---|
1615 | *
|
---|
1616 | * This is a DMA transfer which copies from the Guest Framebuffer
|
---|
1617 | * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which
|
---|
1618 | * intersect with the provided virtual rectangle.
|
---|
1619 | *
|
---|
1620 | * This command does not support using arbitrary guest memory as a
|
---|
1621 | * data source- it only works with the pre-defined GFB memory.
|
---|
1622 | * This command also does not support signed virtual coordinates.
|
---|
1623 | * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with
|
---|
1624 | * negative root x/y coordinates, the negative portion of those
|
---|
1625 | * screens will not be reachable by this command.
|
---|
1626 | *
|
---|
1627 | * This command is not necessary when using framebuffer
|
---|
1628 | * traces. Traces are automatically enabled if the SVGA FIFO is
|
---|
1629 | * disabled, and you may explicitly enable/disable traces using
|
---|
1630 | * SVGA_REG_TRACES. With traces enabled, any write to the GFB will
|
---|
1631 | * automatically act as if a subsequent SVGA_CMD_UPDATE was issued.
|
---|
1632 | *
|
---|
1633 | * Traces and SVGA_CMD_UPDATE are the only supported ways to render
|
---|
1634 | * pseudocolor screen updates. The newer Screen Object commands
|
---|
1635 | * only support true color formats.
|
---|
1636 | *
|
---|
1637 | * Availability:
|
---|
1638 | * Always available.
|
---|
1639 | */
|
---|
1640 |
|
---|
1641 | typedef
|
---|
1642 | #include "vmware_pack_begin.h"
|
---|
1643 | struct {
|
---|
1644 | uint32 x;
|
---|
1645 | uint32 y;
|
---|
1646 | uint32 width;
|
---|
1647 | uint32 height;
|
---|
1648 | }
|
---|
1649 | #include "vmware_pack_end.h"
|
---|
1650 | SVGAFifoCmdUpdate;
|
---|
1651 |
|
---|
1652 |
|
---|
1653 | /*
|
---|
1654 | * SVGA_CMD_RECT_COPY --
|
---|
1655 | *
|
---|
1656 | * Perform a rectangular DMA transfer from one area of the GFB to
|
---|
1657 | * another, and copy the result to any screens which intersect it.
|
---|
1658 | *
|
---|
1659 | * Availability:
|
---|
1660 | * SVGA_CAP_RECT_COPY
|
---|
1661 | */
|
---|
1662 |
|
---|
1663 | typedef
|
---|
1664 | #include "vmware_pack_begin.h"
|
---|
1665 | struct {
|
---|
1666 | uint32 srcX;
|
---|
1667 | uint32 srcY;
|
---|
1668 | uint32 destX;
|
---|
1669 | uint32 destY;
|
---|
1670 | uint32 width;
|
---|
1671 | uint32 height;
|
---|
1672 | }
|
---|
1673 | #include "vmware_pack_end.h"
|
---|
1674 | SVGAFifoCmdRectCopy;
|
---|
1675 |
|
---|
1676 |
|
---|
1677 | /*
|
---|
1678 | * SVGA_CMD_RECT_ROP_COPY --
|
---|
1679 | *
|
---|
1680 | * Perform a rectangular DMA transfer from one area of the GFB to
|
---|
1681 | * another, and copy the result to any screens which intersect it.
|
---|
1682 | * The value of ROP may only be SVGA_ROP_COPY, and this command is
|
---|
1683 | * only supported for backwards compatibility reasons.
|
---|
1684 | *
|
---|
1685 | * Availability:
|
---|
1686 | * SVGA_CAP_RECT_COPY
|
---|
1687 | */
|
---|
1688 |
|
---|
1689 | typedef
|
---|
1690 | #include "vmware_pack_begin.h"
|
---|
1691 | struct {
|
---|
1692 | uint32 srcX;
|
---|
1693 | uint32 srcY;
|
---|
1694 | uint32 destX;
|
---|
1695 | uint32 destY;
|
---|
1696 | uint32 width;
|
---|
1697 | uint32 height;
|
---|
1698 | uint32 rop;
|
---|
1699 | }
|
---|
1700 | #include "vmware_pack_end.h"
|
---|
1701 | SVGAFifoCmdRectRopCopy;
|
---|
1702 |
|
---|
1703 |
|
---|
1704 | /*
|
---|
1705 | * SVGA_CMD_DEFINE_CURSOR --
|
---|
1706 | *
|
---|
1707 | * Provide a new cursor image, as an AND/XOR mask.
|
---|
1708 | *
|
---|
1709 | * The recommended way to position the cursor overlay is by using
|
---|
1710 | * the SVGA_FIFO_CURSOR_* registers, supported by the
|
---|
1711 | * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
|
---|
1712 | *
|
---|
1713 | * Availability:
|
---|
1714 | * SVGA_CAP_CURSOR
|
---|
1715 | */
|
---|
1716 |
|
---|
1717 | typedef
|
---|
1718 | #include "vmware_pack_begin.h"
|
---|
1719 | struct {
|
---|
1720 | uint32 id; /* Reserved, must be zero. */
|
---|
1721 | uint32 hotspotX;
|
---|
1722 | uint32 hotspotY;
|
---|
1723 | uint32 width;
|
---|
1724 | uint32 height;
|
---|
1725 | uint32 andMaskDepth; /* Value must be 1 or equal to BITS_PER_PIXEL */
|
---|
1726 | uint32 xorMaskDepth; /* Value must be 1 or equal to BITS_PER_PIXEL */
|
---|
1727 | /*
|
---|
1728 | * Followed by scanline data for AND mask, then XOR mask.
|
---|
1729 | * Each scanline is padded to a 32-bit boundary.
|
---|
1730 | */
|
---|
1731 | }
|
---|
1732 | #include "vmware_pack_end.h"
|
---|
1733 | SVGAFifoCmdDefineCursor;
|
---|
1734 |
|
---|
1735 |
|
---|
1736 | /*
|
---|
1737 | * SVGA_CMD_DEFINE_ALPHA_CURSOR --
|
---|
1738 | *
|
---|
1739 | * Provide a new cursor image, in 32-bit BGRA format.
|
---|
1740 | *
|
---|
1741 | * The recommended way to position the cursor overlay is by using
|
---|
1742 | * the SVGA_FIFO_CURSOR_* registers, supported by the
|
---|
1743 | * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
|
---|
1744 | *
|
---|
1745 | * Availability:
|
---|
1746 | * SVGA_CAP_ALPHA_CURSOR
|
---|
1747 | */
|
---|
1748 |
|
---|
1749 | typedef
|
---|
1750 | #include "vmware_pack_begin.h"
|
---|
1751 | struct {
|
---|
1752 | uint32 id; /* Reserved, must be zero. */
|
---|
1753 | uint32 hotspotX;
|
---|
1754 | uint32 hotspotY;
|
---|
1755 | uint32 width;
|
---|
1756 | uint32 height;
|
---|
1757 | /* Followed by scanline data */
|
---|
1758 | }
|
---|
1759 | #include "vmware_pack_end.h"
|
---|
1760 | SVGAFifoCmdDefineAlphaCursor;
|
---|
1761 |
|
---|
1762 |
|
---|
1763 | /*
|
---|
1764 | * Provide a new large cursor image, as an AND/XOR mask.
|
---|
1765 | *
|
---|
1766 | * Should only be used for CursorMob functionality
|
---|
1767 | */
|
---|
1768 |
|
---|
1769 | typedef
|
---|
1770 | #include "vmware_pack_begin.h"
|
---|
1771 | struct {
|
---|
1772 | uint32 hotspotX;
|
---|
1773 | uint32 hotspotY;
|
---|
1774 | uint32 width;
|
---|
1775 | uint32 height;
|
---|
1776 | uint32 andMaskDepth;
|
---|
1777 | uint32 xorMaskDepth;
|
---|
1778 | /*
|
---|
1779 | * Followed by scanline data for AND mask, then XOR mask.
|
---|
1780 | * Each scanline is padded to a 32-bit boundary.
|
---|
1781 | */
|
---|
1782 | }
|
---|
1783 | #include "vmware_pack_end.h"
|
---|
1784 | SVGAGBColorCursorHeader;
|
---|
1785 |
|
---|
1786 |
|
---|
1787 | /*
|
---|
1788 | * Provide a new large cursor image, in 32-bit BGRA format.
|
---|
1789 | *
|
---|
1790 | * Should only be used for CursorMob functionality
|
---|
1791 | */
|
---|
1792 |
|
---|
1793 | typedef
|
---|
1794 | #include "vmware_pack_begin.h"
|
---|
1795 | struct {
|
---|
1796 | uint32 hotspotX;
|
---|
1797 | uint32 hotspotY;
|
---|
1798 | uint32 width;
|
---|
1799 | uint32 height;
|
---|
1800 | /* Followed by scanline data */
|
---|
1801 | }
|
---|
1802 | #include "vmware_pack_end.h"
|
---|
1803 | SVGAGBAlphaCursorHeader;
|
---|
1804 |
|
---|
1805 | /*
|
---|
1806 | * Define the SVGA guest backed cursor types
|
---|
1807 | */
|
---|
1808 |
|
---|
1809 | typedef enum {
|
---|
1810 | SVGA_COLOR_CURSOR = 0,
|
---|
1811 | SVGA_ALPHA_CURSOR = 1,
|
---|
1812 | } SVGAGBCursorType;
|
---|
1813 |
|
---|
1814 | /*
|
---|
1815 | * Provide a new large cursor image.
|
---|
1816 | *
|
---|
1817 | * Should only be used for CursorMob functionality
|
---|
1818 | */
|
---|
1819 |
|
---|
1820 | typedef
|
---|
1821 | #include "vmware_pack_begin.h"
|
---|
1822 | struct {
|
---|
1823 | SVGAGBCursorType type;
|
---|
1824 | union {
|
---|
1825 | SVGAGBColorCursorHeader colorHeader;
|
---|
1826 | SVGAGBAlphaCursorHeader alphaHeader;
|
---|
1827 | } header;
|
---|
1828 | uint32 sizeInBytes;
|
---|
1829 | /*
|
---|
1830 | * Followed by the cursor data
|
---|
1831 | */
|
---|
1832 | }
|
---|
1833 | #include "vmware_pack_end.h"
|
---|
1834 | SVGAGBCursorHeader;
|
---|
1835 |
|
---|
1836 |
|
---|
1837 | /*
|
---|
1838 | * SVGA_CMD_UPDATE_VERBOSE --
|
---|
1839 | *
|
---|
1840 | * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle
|
---|
1841 | * 'reason' value, an opaque cookie which is used by internal
|
---|
1842 | * debugging tools. Third party drivers should not use this
|
---|
1843 | * command.
|
---|
1844 | *
|
---|
1845 | * Availability:
|
---|
1846 | * SVGA_CAP_EXTENDED_FIFO
|
---|
1847 | */
|
---|
1848 |
|
---|
1849 | typedef
|
---|
1850 | #include "vmware_pack_begin.h"
|
---|
1851 | struct {
|
---|
1852 | uint32 x;
|
---|
1853 | uint32 y;
|
---|
1854 | uint32 width;
|
---|
1855 | uint32 height;
|
---|
1856 | uint32 reason;
|
---|
1857 | }
|
---|
1858 | #include "vmware_pack_end.h"
|
---|
1859 | SVGAFifoCmdUpdateVerbose;
|
---|
1860 |
|
---|
1861 |
|
---|
1862 | /*
|
---|
1863 | * SVGA_CMD_FRONT_ROP_FILL --
|
---|
1864 | *
|
---|
1865 | * This is a hint which tells the SVGA device that the driver has
|
---|
1866 | * just filled a rectangular region of the GFB with a solid
|
---|
1867 | * color. Instead of reading these pixels from the GFB, the device
|
---|
1868 | * can assume that they all equal 'color'. This is primarily used
|
---|
1869 | * for remote desktop protocols.
|
---|
1870 | *
|
---|
1871 | * Availability:
|
---|
1872 | * SVGA_FIFO_CAP_ACCELFRONT
|
---|
1873 | */
|
---|
1874 |
|
---|
1875 | #define SVGA_ROP_COPY 0x03
|
---|
1876 |
|
---|
1877 | typedef
|
---|
1878 | #include "vmware_pack_begin.h"
|
---|
1879 | struct {
|
---|
1880 | uint32 color; /* In the same format as the GFB */
|
---|
1881 | uint32 x;
|
---|
1882 | uint32 y;
|
---|
1883 | uint32 width;
|
---|
1884 | uint32 height;
|
---|
1885 | uint32 rop; /* Must be SVGA_ROP_COPY */
|
---|
1886 | }
|
---|
1887 | #include "vmware_pack_end.h"
|
---|
1888 | SVGAFifoCmdFrontRopFill;
|
---|
1889 |
|
---|
1890 |
|
---|
1891 | /*
|
---|
1892 | * SVGA_CMD_FENCE --
|
---|
1893 | *
|
---|
1894 | * Insert a synchronization fence. When the SVGA device reaches
|
---|
1895 | * this command, it will copy the 'fence' value into the
|
---|
1896 | * SVGA_FIFO_FENCE register. It will also compare the fence against
|
---|
1897 | * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the
|
---|
1898 | * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will
|
---|
1899 | * raise this interrupt.
|
---|
1900 | *
|
---|
1901 | * Availability:
|
---|
1902 | * SVGA_FIFO_FENCE for this command,
|
---|
1903 | * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL.
|
---|
1904 | */
|
---|
1905 |
|
---|
1906 | typedef
|
---|
1907 | #include "vmware_pack_begin.h"
|
---|
1908 | struct {
|
---|
1909 | uint32 fence;
|
---|
1910 | }
|
---|
1911 | #include "vmware_pack_end.h"
|
---|
1912 | SVGAFifoCmdFence;
|
---|
1913 |
|
---|
1914 |
|
---|
1915 | /*
|
---|
1916 | * SVGA_CMD_ESCAPE --
|
---|
1917 | *
|
---|
1918 | * Send an extended or vendor-specific variable length command.
|
---|
1919 | * This is used for video overlay, third party plugins, and
|
---|
1920 | * internal debugging tools. See svga_escape.h
|
---|
1921 | *
|
---|
1922 | * Availability:
|
---|
1923 | * SVGA_FIFO_CAP_ESCAPE
|
---|
1924 | */
|
---|
1925 |
|
---|
1926 | typedef
|
---|
1927 | #include "vmware_pack_begin.h"
|
---|
1928 | struct {
|
---|
1929 | uint32 nsid;
|
---|
1930 | uint32 size;
|
---|
1931 | /* followed by 'size' bytes of data */
|
---|
1932 | }
|
---|
1933 | #include "vmware_pack_end.h"
|
---|
1934 | SVGAFifoCmdEscape;
|
---|
1935 |
|
---|
1936 |
|
---|
1937 | /*
|
---|
1938 | * SVGA_CMD_DEFINE_SCREEN --
|
---|
1939 | *
|
---|
1940 | * Define or redefine an SVGAScreenObject. See the description of
|
---|
1941 | * SVGAScreenObject above. The video driver is responsible for
|
---|
1942 | * generating new screen IDs. They should be small positive
|
---|
1943 | * integers. The virtual device will have an implementation
|
---|
1944 | * specific upper limit on the number of screen IDs
|
---|
1945 | * supported. Drivers are responsible for recycling IDs. The first
|
---|
1946 | * valid ID is zero.
|
---|
1947 | *
|
---|
1948 | * - Interaction with other registers:
|
---|
1949 | *
|
---|
1950 | * For backwards compatibility, when the GFB mode registers (WIDTH,
|
---|
1951 | * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device
|
---|
1952 | * deletes all screens other than screen #0, and redefines screen
|
---|
1953 | * #0 according to the specified mode. Drivers that use
|
---|
1954 | * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0.
|
---|
1955 | *
|
---|
1956 | * If you use screen objects, do not use the legacy multi-mon
|
---|
1957 | * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*).
|
---|
1958 | *
|
---|
1959 | * Availability:
|
---|
1960 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1961 | */
|
---|
1962 |
|
---|
1963 | typedef
|
---|
1964 | #include "vmware_pack_begin.h"
|
---|
1965 | struct {
|
---|
1966 | SVGAScreenObject screen; /* Variable-length according to version */
|
---|
1967 | }
|
---|
1968 | #include "vmware_pack_end.h"
|
---|
1969 | SVGAFifoCmdDefineScreen;
|
---|
1970 |
|
---|
1971 |
|
---|
1972 | /*
|
---|
1973 | * SVGA_CMD_DESTROY_SCREEN --
|
---|
1974 | *
|
---|
1975 | * Destroy an SVGAScreenObject. Its ID is immediately available for
|
---|
1976 | * re-use.
|
---|
1977 | *
|
---|
1978 | * Availability:
|
---|
1979 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1980 | */
|
---|
1981 |
|
---|
1982 | typedef
|
---|
1983 | #include "vmware_pack_begin.h"
|
---|
1984 | struct {
|
---|
1985 | uint32 screenId;
|
---|
1986 | }
|
---|
1987 | #include "vmware_pack_end.h"
|
---|
1988 | SVGAFifoCmdDestroyScreen;
|
---|
1989 |
|
---|
1990 |
|
---|
1991 | /*
|
---|
1992 | * SVGA_CMD_DEFINE_GMRFB --
|
---|
1993 | *
|
---|
1994 | * This command sets a piece of SVGA device state called the
|
---|
1995 | * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a
|
---|
1996 | * piece of light-weight state which identifies the location and
|
---|
1997 | * format of an image in guest memory or in BAR1. The GMRFB has
|
---|
1998 | * an arbitrary size, and it doesn't need to match the geometry
|
---|
1999 | * of the GFB or any screen object.
|
---|
2000 | *
|
---|
2001 | * The GMRFB can be redefined as often as you like. You could
|
---|
2002 | * always use the same GMRFB, you could redefine it before
|
---|
2003 | * rendering from a different guest screen, or you could even
|
---|
2004 | * redefine it before every blit.
|
---|
2005 | *
|
---|
2006 | * There are multiple ways to use this command. The simplest way is
|
---|
2007 | * to use it to move the framebuffer either to elsewhere in the GFB
|
---|
2008 | * (BAR1) memory region, or to a user-defined GMR. This lets a
|
---|
2009 | * driver use a framebuffer allocated entirely out of normal system
|
---|
2010 | * memory, which we encourage.
|
---|
2011 | *
|
---|
2012 | * Another way to use this command is to set up a ring buffer of
|
---|
2013 | * updates in GFB memory. If a driver wants to ensure that no
|
---|
2014 | * frames are skipped by the SVGA device, it is important that the
|
---|
2015 | * driver not modify the source data for a blit until the device is
|
---|
2016 | * done processing the command. One efficient way to accomplish
|
---|
2017 | * this is to use a ring of small DMA buffers. Each buffer is used
|
---|
2018 | * for one blit, then we move on to the next buffer in the
|
---|
2019 | * ring. The FENCE mechanism is used to protect each buffer from
|
---|
2020 | * re-use until the device is finished with that buffer's
|
---|
2021 | * corresponding blit.
|
---|
2022 | *
|
---|
2023 | * This command does not affect the meaning of SVGA_CMD_UPDATE.
|
---|
2024 | * UPDATEs always occur from the legacy GFB memory area. This
|
---|
2025 | * command has no support for pseudocolor GMRFBs. Currently only
|
---|
2026 | * true-color 15, 16, and 24-bit depths are supported. Future
|
---|
2027 | * devices may expose capabilities for additional framebuffer
|
---|
2028 | * formats.
|
---|
2029 | *
|
---|
2030 | * The default GMRFB value is undefined. Drivers must always send
|
---|
2031 | * this command at least once before performing any blit from the
|
---|
2032 | * GMRFB.
|
---|
2033 | *
|
---|
2034 | * Availability:
|
---|
2035 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
2036 | */
|
---|
2037 |
|
---|
2038 | typedef
|
---|
2039 | #include "vmware_pack_begin.h"
|
---|
2040 | struct {
|
---|
2041 | SVGAGuestPtr ptr;
|
---|
2042 | uint32 bytesPerLine;
|
---|
2043 | SVGAGMRImageFormat format;
|
---|
2044 | }
|
---|
2045 | #include "vmware_pack_end.h"
|
---|
2046 | SVGAFifoCmdDefineGMRFB;
|
---|
2047 |
|
---|
2048 |
|
---|
2049 | /*
|
---|
2050 | * SVGA_CMD_BLIT_GMRFB_TO_SCREEN --
|
---|
2051 | *
|
---|
2052 | * This is a guest-to-host blit. It performs a DMA operation to
|
---|
2053 | * copy a rectangular region of pixels from the current GMRFB to
|
---|
2054 | * a ScreenObject.
|
---|
2055 | *
|
---|
2056 | * The destination coordinate may be specified relative to a
|
---|
2057 | * screen's origin. The provided screen ID must be valid.
|
---|
2058 | *
|
---|
2059 | * The SVGA device is guaranteed to finish reading from the GMRFB
|
---|
2060 | * by the time any subsequent FENCE commands are reached.
|
---|
2061 | *
|
---|
2062 | * This command consumes an annotation. See the
|
---|
2063 | * SVGA_CMD_ANNOTATION_* commands for details.
|
---|
2064 | *
|
---|
2065 | * Availability:
|
---|
2066 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
2067 | */
|
---|
2068 |
|
---|
2069 | typedef
|
---|
2070 | #include "vmware_pack_begin.h"
|
---|
2071 | struct {
|
---|
2072 | SVGASignedPoint srcOrigin;
|
---|
2073 | SVGASignedRect destRect;
|
---|
2074 | uint32 destScreenId;
|
---|
2075 | }
|
---|
2076 | #include "vmware_pack_end.h"
|
---|
2077 | SVGAFifoCmdBlitGMRFBToScreen;
|
---|
2078 |
|
---|
2079 |
|
---|
2080 | /*
|
---|
2081 | * SVGA_CMD_BLIT_SCREEN_TO_GMRFB --
|
---|
2082 | *
|
---|
2083 | * This is a host-to-guest blit. It performs a DMA operation to
|
---|
2084 | * copy a rectangular region of pixels from a single ScreenObject
|
---|
2085 | * back to the current GMRFB.
|
---|
2086 | *
|
---|
2087 | * The source coordinate is specified relative to a screen's
|
---|
2088 | * origin. The provided screen ID must be valid. If any parameters
|
---|
2089 | * are invalid, the resulting pixel values are undefined.
|
---|
2090 | *
|
---|
2091 | * The SVGA device is guaranteed to finish writing to the GMRFB by
|
---|
2092 | * the time any subsequent FENCE commands are reached.
|
---|
2093 | *
|
---|
2094 | * Availability:
|
---|
2095 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
2096 | */
|
---|
2097 |
|
---|
2098 | typedef
|
---|
2099 | #include "vmware_pack_begin.h"
|
---|
2100 | struct {
|
---|
2101 | SVGASignedPoint destOrigin;
|
---|
2102 | SVGASignedRect srcRect;
|
---|
2103 | uint32 srcScreenId;
|
---|
2104 | }
|
---|
2105 | #include "vmware_pack_end.h"
|
---|
2106 | SVGAFifoCmdBlitScreenToGMRFB;
|
---|
2107 |
|
---|
2108 |
|
---|
2109 | /*
|
---|
2110 | * SVGA_CMD_ANNOTATION_FILL --
|
---|
2111 | *
|
---|
2112 | * The annotation commands have been deprecated, should not be used
|
---|
2113 | * by new drivers. They used to provide performance hints to the SVGA
|
---|
2114 | * device about the content of screen updates, but newer SVGA devices
|
---|
2115 | * ignore these.
|
---|
2116 | *
|
---|
2117 | * Availability:
|
---|
2118 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
2119 | */
|
---|
2120 |
|
---|
2121 | typedef
|
---|
2122 | #include "vmware_pack_begin.h"
|
---|
2123 | struct {
|
---|
2124 | SVGAColorBGRX color;
|
---|
2125 | }
|
---|
2126 | #include "vmware_pack_end.h"
|
---|
2127 | SVGAFifoCmdAnnotationFill;
|
---|
2128 |
|
---|
2129 |
|
---|
2130 | /*
|
---|
2131 | * SVGA_CMD_ANNOTATION_COPY --
|
---|
2132 | *
|
---|
2133 | * The annotation commands have been deprecated, should not be used
|
---|
2134 | * by new drivers. They used to provide performance hints to the SVGA
|
---|
2135 | * device about the content of screen updates, but newer SVGA devices
|
---|
2136 | * ignore these.
|
---|
2137 | *
|
---|
2138 | * Availability:
|
---|
2139 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
2140 | */
|
---|
2141 |
|
---|
2142 | typedef
|
---|
2143 | #include "vmware_pack_begin.h"
|
---|
2144 | struct {
|
---|
2145 | SVGASignedPoint srcOrigin;
|
---|
2146 | uint32 srcScreenId;
|
---|
2147 | }
|
---|
2148 | #include "vmware_pack_end.h"
|
---|
2149 | SVGAFifoCmdAnnotationCopy;
|
---|
2150 |
|
---|
2151 |
|
---|
2152 | /*
|
---|
2153 | * SVGA_CMD_DEFINE_GMR2 --
|
---|
2154 | *
|
---|
2155 | * Define guest memory region v2. See the description of GMRs above.
|
---|
2156 | *
|
---|
2157 | * Availability:
|
---|
2158 | * SVGA_CAP_GMR2
|
---|
2159 | */
|
---|
2160 |
|
---|
2161 | typedef
|
---|
2162 | #include "vmware_pack_begin.h"
|
---|
2163 | struct {
|
---|
2164 | uint32 gmrId;
|
---|
2165 | uint32 numPages;
|
---|
2166 | }
|
---|
2167 | #include "vmware_pack_end.h"
|
---|
2168 | SVGAFifoCmdDefineGMR2;
|
---|
2169 |
|
---|
2170 |
|
---|
2171 | /*
|
---|
2172 | * SVGA_CMD_REMAP_GMR2 --
|
---|
2173 | *
|
---|
2174 | * Remap guest memory region v2. See the description of GMRs above.
|
---|
2175 | *
|
---|
2176 | * This command allows guest to modify a portion of an existing GMR by
|
---|
2177 | * invalidating it or reassigning it to different guest physical pages.
|
---|
2178 | * The pages are identified by physical page number (PPN). The pages
|
---|
2179 | * are assumed to be pinned and valid for DMA operations.
|
---|
2180 | *
|
---|
2181 | * Description of command flags:
|
---|
2182 | *
|
---|
2183 | * SVGA_REMAP_GMR2_VIA_GMR: If enabled, references a PPN list in a GMR.
|
---|
2184 | * The PPN list must not overlap with the remap region (this can be
|
---|
2185 | * handled trivially by referencing a separate GMR). If flag is
|
---|
2186 | * disabled, PPN list is appended to SVGARemapGMR command.
|
---|
2187 | *
|
---|
2188 | * SVGA_REMAP_GMR2_PPN64: If set, PPN list is in PPN64 format, otherwise
|
---|
2189 | * it is in PPN32 format.
|
---|
2190 | *
|
---|
2191 | * SVGA_REMAP_GMR2_SINGLE_PPN: If set, PPN list contains a single entry.
|
---|
2192 | * A single PPN can be used to invalidate a portion of a GMR or
|
---|
2193 | * map it to to a single guest scratch page.
|
---|
2194 | *
|
---|
2195 | * Availability:
|
---|
2196 | * SVGA_CAP_GMR2
|
---|
2197 | */
|
---|
2198 |
|
---|
2199 | typedef enum {
|
---|
2200 | SVGA_REMAP_GMR2_PPN32 = 0,
|
---|
2201 | SVGA_REMAP_GMR2_VIA_GMR = (1 << 0),
|
---|
2202 | SVGA_REMAP_GMR2_PPN64 = (1 << 1),
|
---|
2203 | SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2),
|
---|
2204 | } SVGARemapGMR2Flags;
|
---|
2205 |
|
---|
2206 | typedef
|
---|
2207 | #include "vmware_pack_begin.h"
|
---|
2208 | struct {
|
---|
2209 | uint32 gmrId;
|
---|
2210 | SVGARemapGMR2Flags flags;
|
---|
2211 | uint32 offsetPages; /* offset in pages to begin remap */
|
---|
2212 | uint32 numPages; /* number of pages to remap */
|
---|
2213 | /*
|
---|
2214 | * Followed by additional data depending on SVGARemapGMR2Flags.
|
---|
2215 | *
|
---|
2216 | * If flag SVGA_REMAP_GMR2_VIA_GMR is set, single SVGAGuestPtr follows.
|
---|
2217 | * Otherwise an array of page descriptors in PPN32 or PPN64 format
|
---|
2218 | * (according to flag SVGA_REMAP_GMR2_PPN64) follows. If flag
|
---|
2219 | * SVGA_REMAP_GMR2_SINGLE_PPN is set, array contains a single entry.
|
---|
2220 | */
|
---|
2221 | }
|
---|
2222 | #include "vmware_pack_end.h"
|
---|
2223 | SVGAFifoCmdRemapGMR2;
|
---|
2224 |
|
---|
2225 |
|
---|
2226 | /*
|
---|
2227 | * Size of SVGA device memory such as frame buffer and FIFO.
|
---|
2228 | */
|
---|
2229 | #define SVGA_VRAM_MIN_SIZE (4 * 640 * 480) /* bytes */
|
---|
2230 | #define SVGA_VRAM_MIN_SIZE_3D (16 * 1024 * 1024)
|
---|
2231 | #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024)
|
---|
2232 | #define SVGA_MEMORY_SIZE_MAX (1024 * 1024 * 1024)
|
---|
2233 | #define SVGA_FIFO_SIZE_MAX (2 * 1024 * 1024)
|
---|
2234 | #define SVGA_GRAPHICS_MEMORY_KB_MIN (32 * 1024)
|
---|
2235 | #define SVGA_GRAPHICS_MEMORY_KB_MAX_2GB (2 * 1024 * 1024)
|
---|
2236 | #define SVGA_GRAPHICS_MEMORY_KB_MAX_3GB (3 * 1024 * 1024)
|
---|
2237 | #define SVGA_GRAPHICS_MEMORY_KB_MAX_4GB (4 * 1024 * 1024)
|
---|
2238 | #define SVGA_GRAPHICS_MEMORY_KB_MAX_8GB (8 * 1024 * 1024)
|
---|
2239 | #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024)
|
---|
2240 |
|
---|
2241 | #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024) /* 64 MB */
|
---|
2242 |
|
---|
2243 | #if defined(VMX86_SERVER)
|
---|
2244 | #define SVGA_VRAM_SIZE (4 * 1024 * 1024)
|
---|
2245 | #define SVGA_VRAM_SIZE_3D (64 * 1024 * 1024)
|
---|
2246 | #define SVGA_FIFO_SIZE (256 * 1024)
|
---|
2247 | #define SVGA_FIFO_SIZE_3D (516 * 1024)
|
---|
2248 | #define SVGA_MEMORY_SIZE_DEFAULT (160 * 1024 * 1024)
|
---|
2249 | #define SVGA_AUTODETECT_DEFAULT FALSE
|
---|
2250 | #else
|
---|
2251 | #define SVGA_VRAM_SIZE (16 * 1024 * 1024)
|
---|
2252 | #define SVGA_VRAM_SIZE_3D SVGA_VRAM_MAX_SIZE
|
---|
2253 | #define SVGA_FIFO_SIZE (2 * 1024 * 1024)
|
---|
2254 | #define SVGA_FIFO_SIZE_3D SVGA_FIFO_SIZE
|
---|
2255 | #define SVGA_MEMORY_SIZE_DEFAULT (768 * 1024 * 1024)
|
---|
2256 | #define SVGA_AUTODETECT_DEFAULT TRUE
|
---|
2257 | #endif
|
---|
2258 |
|
---|
2259 | #define SVGA_FIFO_SIZE_GBOBJECTS (256 * 1024)
|
---|
2260 | #define SVGA_VRAM_SIZE_GBOBJECTS (4 * 1024 * 1024)
|
---|
2261 |
|
---|
2262 | #define SVGA_PCI_REGS_PAGES (1)
|
---|
2263 |
|
---|
2264 | #endif
|
---|