1 | /**********************************************************
|
---|
2 | * Copyright 1998-2009 VMware, Inc. All rights reserved.
|
---|
3 | *
|
---|
4 | * Permission is hereby granted, free of charge, to any person
|
---|
5 | * obtaining a copy of this software and associated documentation
|
---|
6 | * files (the "Software"), to deal in the Software without
|
---|
7 | * restriction, including without limitation the rights to use, copy,
|
---|
8 | * modify, merge, publish, distribute, sublicense, and/or sell copies
|
---|
9 | * of the Software, and to permit persons to whom the Software is
|
---|
10 | * furnished to do so, subject to the following conditions:
|
---|
11 | *
|
---|
12 | * The above copyright notice and this permission notice shall be
|
---|
13 | * included in all copies or substantial portions of the Software.
|
---|
14 | *
|
---|
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
---|
19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
---|
20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
22 | * SOFTWARE.
|
---|
23 | *
|
---|
24 | **********************************************************/
|
---|
25 |
|
---|
26 | /*
|
---|
27 | * svga_reg.h --
|
---|
28 | *
|
---|
29 | * Virtual hardware definitions for the VMware SVGA II device.
|
---|
30 | */
|
---|
31 |
|
---|
32 | #ifndef _SVGA_REG_H_
|
---|
33 | #define _SVGA_REG_H_
|
---|
34 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
35 | # pragma once
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /*
|
---|
39 | * PCI device IDs.
|
---|
40 | */
|
---|
41 | #define PCI_VENDOR_ID_VMWARE 0x15AD
|
---|
42 | #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
|
---|
43 |
|
---|
44 | /*
|
---|
45 | * SVGA_REG_ENABLE bit definitions.
|
---|
46 | */
|
---|
47 | #define SVGA_REG_ENABLE_DISABLE 0
|
---|
48 | #define SVGA_REG_ENABLE_ENABLE 1
|
---|
49 | #define SVGA_REG_ENABLE_HIDE 2
|
---|
50 | #define SVGA_REG_ENABLE_ENABLE_HIDE (SVGA_REG_ENABLE_ENABLE |\
|
---|
51 | SVGA_REG_ENABLE_HIDE)
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned
|
---|
55 | * cursor bypass mode. This is still supported, but no new guest
|
---|
56 | * drivers should use it.
|
---|
57 | */
|
---|
58 | #define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */
|
---|
59 | #define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */
|
---|
60 | #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */
|
---|
61 | #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * The maximum framebuffer size that can traced for e.g. guests in VESA mode.
|
---|
65 | * The changeMap in the monitor is proportional to this number. Therefore, we'd
|
---|
66 | * like to keep it as small as possible to reduce monitor overhead (using
|
---|
67 | * SVGA_VRAM_MAX_SIZE for this increases the size of the shared area by over
|
---|
68 | * 4k!).
|
---|
69 | *
|
---|
70 | * NB: For compatibility reasons, this value must be greater than 0xff0000.
|
---|
71 | * See bug 335072.
|
---|
72 | */
|
---|
73 | #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000
|
---|
74 |
|
---|
75 | #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
|
---|
76 | #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
|
---|
77 | #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)
|
---|
78 |
|
---|
79 | #define SVGA_MAGIC 0x900000UL
|
---|
80 | #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
|
---|
81 |
|
---|
82 | /* Version 2 let the address of the frame buffer be unsigned on Win32 */
|
---|
83 | #define SVGA_VERSION_2 2
|
---|
84 | #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
|
---|
85 |
|
---|
86 | /* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so
|
---|
87 | PALETTE_BASE has moved */
|
---|
88 | #define SVGA_VERSION_1 1
|
---|
89 | #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
|
---|
90 |
|
---|
91 | /* Version 0 is the initial version */
|
---|
92 | #define SVGA_VERSION_0 0
|
---|
93 | #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
|
---|
94 |
|
---|
95 | /* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */
|
---|
96 | #define SVGA_ID_INVALID 0xFFFFFFFF
|
---|
97 |
|
---|
98 | /* Port offsets, relative to BAR0 */
|
---|
99 | #define SVGA_INDEX_PORT 0x0
|
---|
100 | #define SVGA_VALUE_PORT 0x1
|
---|
101 | #define SVGA_BIOS_PORT 0x2
|
---|
102 | #define SVGA_IRQSTATUS_PORT 0x8
|
---|
103 |
|
---|
104 | /*
|
---|
105 | * Interrupt source flags for IRQSTATUS_PORT and IRQMASK.
|
---|
106 | *
|
---|
107 | * Interrupts are only supported when the
|
---|
108 | * SVGA_CAP_IRQMASK capability is present.
|
---|
109 | */
|
---|
110 | #define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */
|
---|
111 | #define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */
|
---|
112 | #define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * Registers
|
---|
116 | */
|
---|
117 |
|
---|
118 | enum {
|
---|
119 | SVGA_REG_ID = 0,
|
---|
120 | SVGA_REG_ENABLE = 1,
|
---|
121 | SVGA_REG_WIDTH = 2,
|
---|
122 | SVGA_REG_HEIGHT = 3,
|
---|
123 | SVGA_REG_MAX_WIDTH = 4,
|
---|
124 | SVGA_REG_MAX_HEIGHT = 5,
|
---|
125 | SVGA_REG_DEPTH = 6,
|
---|
126 | SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */
|
---|
127 | SVGA_REG_PSEUDOCOLOR = 8,
|
---|
128 | SVGA_REG_RED_MASK = 9,
|
---|
129 | SVGA_REG_GREEN_MASK = 10,
|
---|
130 | SVGA_REG_BLUE_MASK = 11,
|
---|
131 | SVGA_REG_BYTES_PER_LINE = 12,
|
---|
132 | SVGA_REG_FB_START = 13, /* (Deprecated) */
|
---|
133 | SVGA_REG_FB_OFFSET = 14,
|
---|
134 | SVGA_REG_VRAM_SIZE = 15,
|
---|
135 | SVGA_REG_FB_SIZE = 16,
|
---|
136 |
|
---|
137 | /* ID 0 implementation only had the above registers, then the palette */
|
---|
138 |
|
---|
139 | SVGA_REG_CAPABILITIES = 17,
|
---|
140 | SVGA_REG_MEM_START = 18, /* (Deprecated) */
|
---|
141 | SVGA_REG_MEM_SIZE = 19,
|
---|
142 | SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */
|
---|
143 | SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */
|
---|
144 | SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */
|
---|
145 | SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */
|
---|
146 | SVGA_REG_CURSOR_ID = 24, /* (Deprecated) */
|
---|
147 | SVGA_REG_CURSOR_X = 25, /* (Deprecated) */
|
---|
148 | SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */
|
---|
149 | SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */
|
---|
150 | SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */
|
---|
151 | SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */
|
---|
152 | SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */
|
---|
153 | SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */
|
---|
154 | SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */
|
---|
155 | SVGA_REG_IRQMASK = 33, /* Interrupt mask */
|
---|
156 |
|
---|
157 | /* Legacy multi-monitor support */
|
---|
158 | SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */
|
---|
159 | SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */
|
---|
160 | SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */
|
---|
161 | SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */
|
---|
162 | SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */
|
---|
163 | SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */
|
---|
164 | SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */
|
---|
165 |
|
---|
166 | /* See "Guest memory regions" below. */
|
---|
167 | SVGA_REG_GMR_ID = 41,
|
---|
168 | SVGA_REG_GMR_DESCRIPTOR = 42,
|
---|
169 | SVGA_REG_GMR_MAX_IDS = 43,
|
---|
170 | SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
|
---|
171 |
|
---|
172 | SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */
|
---|
173 | SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */
|
---|
174 | SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */
|
---|
175 | SVGA_REG_TOP = 48, /* Must be 1 more than the last register */
|
---|
176 |
|
---|
177 | SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
|
---|
178 | /* Next 768 (== 256*3) registers exist for colormap */
|
---|
179 |
|
---|
180 | SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
|
---|
181 | /* Base of scratch registers */
|
---|
182 | /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage:
|
---|
183 | First 4 are reserved for VESA BIOS Extension; any remaining are for
|
---|
184 | the use of the current SVGA driver. */
|
---|
185 | };
|
---|
186 |
|
---|
187 |
|
---|
188 | /*
|
---|
189 | * Guest memory regions (GMRs):
|
---|
190 | *
|
---|
191 | * This is a new memory mapping feature available in SVGA devices
|
---|
192 | * which have the SVGA_CAP_GMR bit set. Previously, there were two
|
---|
193 | * fixed memory regions available with which to share data between the
|
---|
194 | * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs
|
---|
195 | * are our name for an extensible way of providing arbitrary DMA
|
---|
196 | * buffers for use between the driver and the SVGA device. They are a
|
---|
197 | * new alternative to framebuffer memory, usable for both 2D and 3D
|
---|
198 | * graphics operations.
|
---|
199 | *
|
---|
200 | * Since GMR mapping must be done synchronously with guest CPU
|
---|
201 | * execution, we use a new pair of SVGA registers:
|
---|
202 | *
|
---|
203 | * SVGA_REG_GMR_ID --
|
---|
204 | *
|
---|
205 | * Read/write.
|
---|
206 | * This register holds the 32-bit ID (a small positive integer)
|
---|
207 | * of a GMR to create, delete, or redefine. Writing this register
|
---|
208 | * has no side-effects.
|
---|
209 | *
|
---|
210 | * SVGA_REG_GMR_DESCRIPTOR --
|
---|
211 | *
|
---|
212 | * Write-only.
|
---|
213 | * Writing this register will create, delete, or redefine the GMR
|
---|
214 | * specified by the above ID register. If this register is zero,
|
---|
215 | * the GMR is deleted. Any pointers into this GMR (including those
|
---|
216 | * currently being processed by FIFO commands) will be
|
---|
217 | * synchronously invalidated.
|
---|
218 | *
|
---|
219 | * If this register is nonzero, it must be the physical page
|
---|
220 | * number (PPN) of a data structure which describes the physical
|
---|
221 | * layout of the memory region this GMR should describe. The
|
---|
222 | * descriptor structure will be read synchronously by the SVGA
|
---|
223 | * device when this register is written. The descriptor need not
|
---|
224 | * remain allocated for the lifetime of the GMR.
|
---|
225 | *
|
---|
226 | * The guest driver should write SVGA_REG_GMR_ID first, then
|
---|
227 | * SVGA_REG_GMR_DESCRIPTOR.
|
---|
228 | *
|
---|
229 | * SVGA_REG_GMR_MAX_IDS --
|
---|
230 | *
|
---|
231 | * Read-only.
|
---|
232 | * The SVGA device may choose to support a maximum number of
|
---|
233 | * user-defined GMR IDs. This register holds the number of supported
|
---|
234 | * IDs. (The maximum supported ID plus 1)
|
---|
235 | *
|
---|
236 | * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH --
|
---|
237 | *
|
---|
238 | * Read-only.
|
---|
239 | * The SVGA device may choose to put a limit on the total number
|
---|
240 | * of SVGAGuestMemDescriptor structures it will read when defining
|
---|
241 | * a single GMR.
|
---|
242 | *
|
---|
243 | * The descriptor structure is an array of SVGAGuestMemDescriptor
|
---|
244 | * structures. Each structure may do one of three things:
|
---|
245 | *
|
---|
246 | * - Terminate the GMR descriptor list.
|
---|
247 | * (ppn==0, numPages==0)
|
---|
248 | *
|
---|
249 | * - Add a PPN or range of PPNs to the GMR's virtual address space.
|
---|
250 | * (ppn != 0, numPages != 0)
|
---|
251 | *
|
---|
252 | * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to
|
---|
253 | * support multi-page GMR descriptor tables without forcing the
|
---|
254 | * driver to allocate physically contiguous memory.
|
---|
255 | * (ppn != 0, numPages == 0)
|
---|
256 | *
|
---|
257 | * Note that each physical page of SVGAGuestMemDescriptor structures
|
---|
258 | * can describe at least 2MB of guest memory. If the driver needs to
|
---|
259 | * use more than one page of descriptor structures, it must use one of
|
---|
260 | * its SVGAGuestMemDescriptors to point to an additional page. The
|
---|
261 | * device will never automatically cross a page boundary.
|
---|
262 | *
|
---|
263 | * Once the driver has described a GMR, it is immediately available
|
---|
264 | * for use via any FIFO command that uses an SVGAGuestPtr structure.
|
---|
265 | * These pointers include a GMR identifier plus an offset into that
|
---|
266 | * GMR.
|
---|
267 | *
|
---|
268 | * The driver must check the SVGA_CAP_GMR bit before using the GMR
|
---|
269 | * registers.
|
---|
270 | */
|
---|
271 |
|
---|
272 | /*
|
---|
273 | * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer
|
---|
274 | * memory as well. In the future, these IDs could even be used to
|
---|
275 | * allow legacy memory regions to be redefined by the guest as GMRs.
|
---|
276 | *
|
---|
277 | * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA
|
---|
278 | * is being phased out. Please try to use user-defined GMRs whenever
|
---|
279 | * possible.
|
---|
280 | */
|
---|
281 | #define SVGA_GMR_NULL ((uint32_t) -1)
|
---|
282 | #define SVGA_GMR_FRAMEBUFFER ((uint32_t) -2) // Guest Framebuffer (GFB)
|
---|
283 |
|
---|
284 | typedef
|
---|
285 | struct SVGAGuestMemDescriptor {
|
---|
286 | uint32_t ppn;
|
---|
287 | uint32_t numPages;
|
---|
288 | } SVGAGuestMemDescriptor;
|
---|
289 |
|
---|
290 | typedef
|
---|
291 | struct SVGAGuestPtr {
|
---|
292 | uint32_t gmrId;
|
---|
293 | uint32_t offset;
|
---|
294 | } SVGAGuestPtr;
|
---|
295 |
|
---|
296 |
|
---|
297 | /*
|
---|
298 | * SVGAGMRImageFormat --
|
---|
299 | *
|
---|
300 | * This is a packed representation of the source 2D image format
|
---|
301 | * for a GMR-to-screen blit. Currently it is defined as an encoding
|
---|
302 | * of the screen's color depth and bits-per-pixel, however, 16 bits
|
---|
303 | * are reserved for future use to identify other encodings (such as
|
---|
304 | * RGBA or higher-precision images).
|
---|
305 | *
|
---|
306 | * Currently supported formats:
|
---|
307 | *
|
---|
308 | * bpp depth Format Name
|
---|
309 | * --- ----- -----------
|
---|
310 | * 32 24 32-bit BGRX
|
---|
311 | * 24 24 24-bit BGR
|
---|
312 | * 16 16 RGB 5-6-5
|
---|
313 | * 16 15 RGB 5-5-5
|
---|
314 | *
|
---|
315 | */
|
---|
316 |
|
---|
317 | typedef
|
---|
318 | struct SVGAGMRImageFormat {
|
---|
319 | union {
|
---|
320 | struct {
|
---|
321 | uint32_t bitsPerPixel : 8;
|
---|
322 | uint32_t colorDepth : 8;
|
---|
323 | uint32_t reserved : 16; // Must be zero
|
---|
324 | } s;
|
---|
325 |
|
---|
326 | uint32_t value;
|
---|
327 | };
|
---|
328 | } SVGAGMRImageFormat;
|
---|
329 |
|
---|
330 | typedef
|
---|
331 | struct SVGAGuestImage {
|
---|
332 | SVGAGuestPtr ptr;
|
---|
333 |
|
---|
334 | /*
|
---|
335 | * A note on interpretation of pitch: This value of pitch is the
|
---|
336 | * number of bytes between vertically adjacent image
|
---|
337 | * blocks. Normally this is the number of bytes between the first
|
---|
338 | * pixel of two adjacent scanlines. With compressed textures,
|
---|
339 | * however, this may represent the number of bytes between
|
---|
340 | * compression blocks rather than between rows of pixels.
|
---|
341 | *
|
---|
342 | * XXX: Compressed textures currently must be tightly packed in guest memory.
|
---|
343 | *
|
---|
344 | * If the image is 1-dimensional, pitch is ignored.
|
---|
345 | *
|
---|
346 | * If 'pitch' is zero, the SVGA3D device calculates a pitch value
|
---|
347 | * assuming each row of blocks is tightly packed.
|
---|
348 | */
|
---|
349 | uint32_t pitch;
|
---|
350 | } SVGAGuestImage;
|
---|
351 |
|
---|
352 | /*
|
---|
353 | * SVGAColorBGRX --
|
---|
354 | *
|
---|
355 | * A 24-bit color format (BGRX), which does not depend on the
|
---|
356 | * format of the legacy guest framebuffer (GFB) or the current
|
---|
357 | * GMRFB state.
|
---|
358 | */
|
---|
359 |
|
---|
360 | typedef
|
---|
361 | struct SVGAColorBGRX {
|
---|
362 | union {
|
---|
363 | struct {
|
---|
364 | uint32_t b : 8;
|
---|
365 | uint32_t g : 8;
|
---|
366 | uint32_t r : 8;
|
---|
367 | uint32_t x : 8; // Unused
|
---|
368 | } s;
|
---|
369 |
|
---|
370 | uint32_t value;
|
---|
371 | };
|
---|
372 | } SVGAColorBGRX;
|
---|
373 |
|
---|
374 |
|
---|
375 | /*
|
---|
376 | * SVGASignedRect --
|
---|
377 | * SVGASignedPoint --
|
---|
378 | *
|
---|
379 | * Signed rectangle and point primitives. These are used by the new
|
---|
380 | * 2D primitives for drawing to Screen Objects, which can occupy a
|
---|
381 | * signed virtual coordinate space.
|
---|
382 | *
|
---|
383 | * SVGASignedRect specifies a half-open interval: the (left, top)
|
---|
384 | * pixel is part of the rectangle, but the (right, bottom) pixel is
|
---|
385 | * not.
|
---|
386 | */
|
---|
387 |
|
---|
388 | typedef
|
---|
389 | struct SVGASignedRect {
|
---|
390 | int32_t left;
|
---|
391 | int32_t top;
|
---|
392 | int32_t right;
|
---|
393 | int32_t bottom;
|
---|
394 | } SVGASignedRect;
|
---|
395 |
|
---|
396 | typedef
|
---|
397 | struct SVGASignedPoint {
|
---|
398 | int32_t x;
|
---|
399 | int32_t y;
|
---|
400 | } SVGASignedPoint;
|
---|
401 |
|
---|
402 |
|
---|
403 | /*
|
---|
404 | * Capabilities
|
---|
405 | *
|
---|
406 | * Note the holes in the bitfield. Missing bits have been deprecated,
|
---|
407 | * and must not be reused. Those capabilities will never be reported
|
---|
408 | * by new versions of the SVGA device.
|
---|
409 | *
|
---|
410 | * SVGA_CAP_GMR2 --
|
---|
411 | * Provides asynchronous commands to define and remap guest memory
|
---|
412 | * regions. Adds device registers SVGA_REG_GMRS_MAX_PAGES and
|
---|
413 | * SVGA_REG_MEMORY_SIZE.
|
---|
414 | *
|
---|
415 | * SVGA_CAP_SCREEN_OBJECT_2 --
|
---|
416 | * Allow screen object support, and require backing stores from the
|
---|
417 | * guest for each screen object.
|
---|
418 | */
|
---|
419 |
|
---|
420 | #define SVGA_CAP_NONE 0x00000000
|
---|
421 | #define SVGA_CAP_RECT_COPY 0x00000002
|
---|
422 | #define SVGA_CAP_CURSOR 0x00000020
|
---|
423 | #define SVGA_CAP_CURSOR_BYPASS 0x00000040 // Legacy (Use Cursor Bypass 3 instead)
|
---|
424 | #define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 // Legacy (Use Cursor Bypass 3 instead)
|
---|
425 | #define SVGA_CAP_8BIT_EMULATION 0x00000100
|
---|
426 | #define SVGA_CAP_ALPHA_CURSOR 0x00000200
|
---|
427 | #define SVGA_CAP_3D 0x00004000
|
---|
428 | #define SVGA_CAP_EXTENDED_FIFO 0x00008000
|
---|
429 | #define SVGA_CAP_MULTIMON 0x00010000 // Legacy multi-monitor support
|
---|
430 | #define SVGA_CAP_PITCHLOCK 0x00020000
|
---|
431 | #define SVGA_CAP_IRQMASK 0x00040000
|
---|
432 | #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 // Legacy multi-monitor support
|
---|
433 | #define SVGA_CAP_GMR 0x00100000
|
---|
434 | #define SVGA_CAP_TRACES 0x00200000
|
---|
435 | #define SVGA_CAP_GMR2 0x00400000
|
---|
436 | #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000
|
---|
437 |
|
---|
438 |
|
---|
439 | /*
|
---|
440 | * FIFO register indices.
|
---|
441 | *
|
---|
442 | * The FIFO is a chunk of device memory mapped into guest physmem. It
|
---|
443 | * is always treated as 32-bit words.
|
---|
444 | *
|
---|
445 | * The guest driver gets to decide how to partition it between
|
---|
446 | * - FIFO registers (there are always at least 4, specifying where the
|
---|
447 | * following data area is and how much data it contains; there may be
|
---|
448 | * more registers following these, depending on the FIFO protocol
|
---|
449 | * version in use)
|
---|
450 | * - FIFO data, written by the guest and slurped out by the VMX.
|
---|
451 | * These indices are 32-bit word offsets into the FIFO.
|
---|
452 | */
|
---|
453 |
|
---|
454 | enum {
|
---|
455 | /*
|
---|
456 | * Block 1 (basic registers): The originally defined FIFO registers.
|
---|
457 | * These exist and are valid for all versions of the FIFO protocol.
|
---|
458 | */
|
---|
459 |
|
---|
460 | SVGA_FIFO_MIN = 0,
|
---|
461 | SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */
|
---|
462 | SVGA_FIFO_NEXT_CMD,
|
---|
463 | SVGA_FIFO_STOP,
|
---|
464 |
|
---|
465 | /*
|
---|
466 | * Block 2 (extended registers): Mandatory registers for the extended
|
---|
467 | * FIFO. These exist if the SVGA caps register includes
|
---|
468 | * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their
|
---|
469 | * associated capability bit is enabled.
|
---|
470 | *
|
---|
471 | * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied
|
---|
472 | * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE.
|
---|
473 | * This means that the guest has to test individually (in most cases
|
---|
474 | * using FIFO caps) for the presence of registers after this; the VMX
|
---|
475 | * can define "extended FIFO" to mean whatever it wants, and currently
|
---|
476 | * won't enable it unless there's room for that set and much more.
|
---|
477 | */
|
---|
478 |
|
---|
479 | SVGA_FIFO_CAPABILITIES = 4,
|
---|
480 | SVGA_FIFO_FLAGS,
|
---|
481 | // Valid with SVGA_FIFO_CAP_FENCE:
|
---|
482 | SVGA_FIFO_FENCE,
|
---|
483 |
|
---|
484 | /*
|
---|
485 | * Block 3a (optional extended registers): Additional registers for the
|
---|
486 | * extended FIFO, whose presence isn't actually implied by
|
---|
487 | * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to
|
---|
488 | * leave room for them.
|
---|
489 | *
|
---|
490 | * These in block 3a, the VMX currently considers mandatory for the
|
---|
491 | * extended FIFO.
|
---|
492 | */
|
---|
493 |
|
---|
494 | // Valid if exists (i.e. if extended FIFO enabled):
|
---|
495 | SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */
|
---|
496 | // Valid with SVGA_FIFO_CAP_PITCHLOCK:
|
---|
497 | SVGA_FIFO_PITCHLOCK,
|
---|
498 |
|
---|
499 | // Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3:
|
---|
500 | SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */
|
---|
501 | SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */
|
---|
502 | SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */
|
---|
503 | SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */
|
---|
504 | SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */
|
---|
505 |
|
---|
506 | // Valid with SVGA_FIFO_CAP_RESERVE:
|
---|
507 | SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */
|
---|
508 |
|
---|
509 | /*
|
---|
510 | * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2:
|
---|
511 | *
|
---|
512 | * By default this is SVGA_ID_INVALID, to indicate that the cursor
|
---|
513 | * coordinates are specified relative to the virtual root. If this
|
---|
514 | * is set to a specific screen ID, cursor position is reinterpreted
|
---|
515 | * as a signed offset relative to that screen's origin.
|
---|
516 | */
|
---|
517 | SVGA_FIFO_CURSOR_SCREEN_ID,
|
---|
518 |
|
---|
519 | /*
|
---|
520 | * Valid with SVGA_FIFO_CAP_DEAD
|
---|
521 | *
|
---|
522 | * An arbitrary value written by the host, drivers should not use it.
|
---|
523 | */
|
---|
524 | SVGA_FIFO_DEAD,
|
---|
525 |
|
---|
526 | /*
|
---|
527 | * Valid with SVGA_FIFO_CAP_3D_HWVERSION_REVISED:
|
---|
528 | *
|
---|
529 | * Contains 3D HWVERSION (see SVGA3dHardwareVersion in svga3d_reg.h)
|
---|
530 | * on platforms that can enforce graphics resource limits.
|
---|
531 | */
|
---|
532 | SVGA_FIFO_3D_HWVERSION_REVISED,
|
---|
533 |
|
---|
534 | /*
|
---|
535 | * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new
|
---|
536 | * registers, but this must be done carefully and with judicious use of
|
---|
537 | * capability bits, since comparisons based on SVGA_FIFO_MIN aren't
|
---|
538 | * enough to tell you whether the register exists: we've shipped drivers
|
---|
539 | * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of
|
---|
540 | * the earlier ones. The actual order of introduction was:
|
---|
541 | * - PITCHLOCK
|
---|
542 | * - 3D_CAPS
|
---|
543 | * - CURSOR_* (cursor bypass 3)
|
---|
544 | * - RESERVED
|
---|
545 | * So, code that wants to know whether it can use any of the
|
---|
546 | * aforementioned registers, or anything else added after PITCHLOCK and
|
---|
547 | * before 3D_CAPS, needs to reason about something other than
|
---|
548 | * SVGA_FIFO_MIN.
|
---|
549 | */
|
---|
550 |
|
---|
551 | /*
|
---|
552 | * 3D caps block space; valid with 3D hardware version >=
|
---|
553 | * SVGA3D_HWVERSION_WS6_B1.
|
---|
554 | */
|
---|
555 | SVGA_FIFO_3D_CAPS = 32,
|
---|
556 | SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
|
---|
557 |
|
---|
558 | /*
|
---|
559 | * End of VMX's current definition of "extended-FIFO registers".
|
---|
560 | * Registers before here are always enabled/disabled as a block; either
|
---|
561 | * the extended FIFO is enabled and includes all preceding registers, or
|
---|
562 | * it's disabled entirely.
|
---|
563 | *
|
---|
564 | * Block 3b (truly optional extended registers): Additional registers for
|
---|
565 | * the extended FIFO, which the VMX already knows how to enable and
|
---|
566 | * disable with correct granularity.
|
---|
567 | *
|
---|
568 | * Registers after here exist if and only if the guest SVGA driver
|
---|
569 | * sets SVGA_FIFO_MIN high enough to leave room for them.
|
---|
570 | */
|
---|
571 |
|
---|
572 | // Valid if register exists:
|
---|
573 | SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */
|
---|
574 | SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */
|
---|
575 | SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */
|
---|
576 |
|
---|
577 | /*
|
---|
578 | * Always keep this last. This defines the maximum number of
|
---|
579 | * registers we know about. At power-on, this value is placed in
|
---|
580 | * the SVGA_REG_MEM_REGS register, and we expect the guest driver
|
---|
581 | * to allocate this much space in FIFO memory for registers.
|
---|
582 | */
|
---|
583 | SVGA_FIFO_NUM_REGS
|
---|
584 | };
|
---|
585 |
|
---|
586 |
|
---|
587 | /*
|
---|
588 | * Definition of registers included in extended FIFO support.
|
---|
589 | *
|
---|
590 | * The guest SVGA driver gets to allocate the FIFO between registers
|
---|
591 | * and data. It must always allocate at least 4 registers, but old
|
---|
592 | * drivers stopped there.
|
---|
593 | *
|
---|
594 | * The VMX will enable extended FIFO support if and only if the guest
|
---|
595 | * left enough room for all registers defined as part of the mandatory
|
---|
596 | * set for the extended FIFO.
|
---|
597 | *
|
---|
598 | * Note that the guest drivers typically allocate the FIFO only at
|
---|
599 | * initialization time, not at mode switches, so it's likely that the
|
---|
600 | * number of FIFO registers won't change without a reboot.
|
---|
601 | *
|
---|
602 | * All registers less than this value are guaranteed to be present if
|
---|
603 | * svgaUser->fifo.extended is set. Any later registers must be tested
|
---|
604 | * individually for compatibility at each use (in the VMX).
|
---|
605 | *
|
---|
606 | * This value is used only by the VMX, so it can change without
|
---|
607 | * affecting driver compatibility; keep it that way?
|
---|
608 | */
|
---|
609 | #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)
|
---|
610 |
|
---|
611 |
|
---|
612 | /*
|
---|
613 | * FIFO Synchronization Registers
|
---|
614 | *
|
---|
615 | * This explains the relationship between the various FIFO
|
---|
616 | * sync-related registers in IOSpace and in FIFO space.
|
---|
617 | *
|
---|
618 | * SVGA_REG_SYNC --
|
---|
619 | *
|
---|
620 | * The SYNC register can be used in two different ways by the guest:
|
---|
621 | *
|
---|
622 | * 1. If the guest wishes to fully sync (drain) the FIFO,
|
---|
623 | * it will write once to SYNC then poll on the BUSY
|
---|
624 | * register. The FIFO is sync'ed once BUSY is zero.
|
---|
625 | *
|
---|
626 | * 2. If the guest wants to asynchronously wake up the host,
|
---|
627 | * it will write once to SYNC without polling on BUSY.
|
---|
628 | * Ideally it will do this after some new commands have
|
---|
629 | * been placed in the FIFO, and after reading a zero
|
---|
630 | * from SVGA_FIFO_BUSY.
|
---|
631 | *
|
---|
632 | * (1) is the original behaviour that SYNC was designed to
|
---|
633 | * support. Originally, a write to SYNC would implicitly
|
---|
634 | * trigger a read from BUSY. This causes us to synchronously
|
---|
635 | * process the FIFO.
|
---|
636 | *
|
---|
637 | * This behaviour has since been changed so that writing SYNC
|
---|
638 | * will *not* implicitly cause a read from BUSY. Instead, it
|
---|
639 | * makes a channel call which asynchronously wakes up the MKS
|
---|
640 | * thread.
|
---|
641 | *
|
---|
642 | * New guests can use this new behaviour to implement (2)
|
---|
643 | * efficiently. This lets guests get the host's attention
|
---|
644 | * without waiting for the MKS to poll, which gives us much
|
---|
645 | * better CPU utilization on SMP hosts and on UP hosts while
|
---|
646 | * we're blocked on the host GPU.
|
---|
647 | *
|
---|
648 | * Old guests shouldn't notice the behaviour change. SYNC was
|
---|
649 | * never guaranteed to process the entire FIFO, since it was
|
---|
650 | * bounded to a particular number of CPU cycles. Old guests will
|
---|
651 | * still loop on the BUSY register until the FIFO is empty.
|
---|
652 | *
|
---|
653 | * Writing to SYNC currently has the following side-effects:
|
---|
654 | *
|
---|
655 | * - Sets SVGA_REG_BUSY to TRUE (in the monitor)
|
---|
656 | * - Asynchronously wakes up the MKS thread for FIFO processing
|
---|
657 | * - The value written to SYNC is recorded as a "reason", for
|
---|
658 | * stats purposes.
|
---|
659 | *
|
---|
660 | * If SVGA_FIFO_BUSY is available, drivers are advised to only
|
---|
661 | * write to SYNC if SVGA_FIFO_BUSY is FALSE. Drivers should set
|
---|
662 | * SVGA_FIFO_BUSY to TRUE after writing to SYNC. The MKS will
|
---|
663 | * eventually set SVGA_FIFO_BUSY on its own, but this approach
|
---|
664 | * lets the driver avoid sending multiple asynchronous wakeup
|
---|
665 | * messages to the MKS thread.
|
---|
666 | *
|
---|
667 | * SVGA_REG_BUSY --
|
---|
668 | *
|
---|
669 | * This register is set to TRUE when SVGA_REG_SYNC is written,
|
---|
670 | * and it reads as FALSE when the FIFO has been completely
|
---|
671 | * drained.
|
---|
672 | *
|
---|
673 | * Every read from this register causes us to synchronously
|
---|
674 | * process FIFO commands. There is no guarantee as to how many
|
---|
675 | * commands each read will process.
|
---|
676 | *
|
---|
677 | * CPU time spent processing FIFO commands will be billed to
|
---|
678 | * the guest.
|
---|
679 | *
|
---|
680 | * New drivers should avoid using this register unless they
|
---|
681 | * need to guarantee that the FIFO is completely drained. It
|
---|
682 | * is overkill for performing a sync-to-fence. Older drivers
|
---|
683 | * will use this register for any type of synchronization.
|
---|
684 | *
|
---|
685 | * SVGA_FIFO_BUSY --
|
---|
686 | *
|
---|
687 | * This register is a fast way for the guest driver to check
|
---|
688 | * whether the FIFO is already being processed. It reads and
|
---|
689 | * writes at normal RAM speeds, with no monitor intervention.
|
---|
690 | *
|
---|
691 | * If this register reads as TRUE, the host is guaranteeing that
|
---|
692 | * any new commands written into the FIFO will be noticed before
|
---|
693 | * the MKS goes back to sleep.
|
---|
694 | *
|
---|
695 | * If this register reads as FALSE, no such guarantee can be
|
---|
696 | * made.
|
---|
697 | *
|
---|
698 | * The guest should use this register to quickly determine
|
---|
699 | * whether or not it needs to wake up the host. If the guest
|
---|
700 | * just wrote a command or group of commands that it would like
|
---|
701 | * the host to begin processing, it should:
|
---|
702 | *
|
---|
703 | * 1. Read SVGA_FIFO_BUSY. If it reads as TRUE, no further
|
---|
704 | * action is necessary.
|
---|
705 | *
|
---|
706 | * 2. Write TRUE to SVGA_FIFO_BUSY. This informs future guest
|
---|
707 | * code that we've already sent a SYNC to the host and we
|
---|
708 | * don't need to send a duplicate.
|
---|
709 | *
|
---|
710 | * 3. Write a reason to SVGA_REG_SYNC. This will send an
|
---|
711 | * asynchronous wakeup to the MKS thread.
|
---|
712 | */
|
---|
713 |
|
---|
714 |
|
---|
715 | /*
|
---|
716 | * FIFO Capabilities
|
---|
717 | *
|
---|
718 | * Fence -- Fence register and command are supported
|
---|
719 | * Accel Front -- Front buffer only commands are supported
|
---|
720 | * Pitch Lock -- Pitch lock register is supported
|
---|
721 | * Video -- SVGA Video overlay units are supported
|
---|
722 | * Escape -- Escape command is supported
|
---|
723 | *
|
---|
724 | * XXX: Add longer descriptions for each capability, including a list
|
---|
725 | * of the new features that each capability provides.
|
---|
726 | *
|
---|
727 | * SVGA_FIFO_CAP_SCREEN_OBJECT --
|
---|
728 | *
|
---|
729 | * Provides dynamic multi-screen rendering, for improved Unity and
|
---|
730 | * multi-monitor modes. With Screen Object, the guest can
|
---|
731 | * dynamically create and destroy 'screens', which can represent
|
---|
732 | * Unity windows or virtual monitors. Screen Object also provides
|
---|
733 | * strong guarantees that DMA operations happen only when
|
---|
734 | * guest-initiated. Screen Object deprecates the BAR1 guest
|
---|
735 | * framebuffer (GFB) and all commands that work only with the GFB.
|
---|
736 | *
|
---|
737 | * New registers:
|
---|
738 | * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID
|
---|
739 | *
|
---|
740 | * New 2D commands:
|
---|
741 | * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN,
|
---|
742 | * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY
|
---|
743 | *
|
---|
744 | * New 3D commands:
|
---|
745 | * BLIT_SURFACE_TO_SCREEN
|
---|
746 | *
|
---|
747 | * New guarantees:
|
---|
748 | *
|
---|
749 | * - The host will not read or write guest memory, including the GFB,
|
---|
750 | * except when explicitly initiated by a DMA command.
|
---|
751 | *
|
---|
752 | * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK,
|
---|
753 | * is guaranteed to complete before any subsequent FENCEs.
|
---|
754 | *
|
---|
755 | * - All legacy commands which affect a Screen (UPDATE, PRESENT,
|
---|
756 | * PRESENT_READBACK) as well as new Screen blit commands will
|
---|
757 | * all behave consistently as blits, and memory will be read
|
---|
758 | * or written in FIFO order.
|
---|
759 | *
|
---|
760 | * For example, if you PRESENT from one SVGA3D surface to multiple
|
---|
761 | * places on the screen, the data copied will always be from the
|
---|
762 | * SVGA3D surface at the time the PRESENT was issued in the FIFO.
|
---|
763 | * This was not necessarily true on devices without Screen Object.
|
---|
764 | *
|
---|
765 | * This means that on devices that support Screen Object, the
|
---|
766 | * PRESENT_READBACK command should not be necessary unless you
|
---|
767 | * actually want to read back the results of 3D rendering into
|
---|
768 | * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB
|
---|
769 | * command provides a strict superset of functionality.)
|
---|
770 | *
|
---|
771 | * - When a screen is resized, either using Screen Object commands or
|
---|
772 | * legacy multimon registers, its contents are preserved.
|
---|
773 | *
|
---|
774 | * SVGA_FIFO_CAP_GMR2 --
|
---|
775 | *
|
---|
776 | * Provides new commands to define and remap guest memory regions (GMR).
|
---|
777 | *
|
---|
778 | * New 2D commands:
|
---|
779 | * DEFINE_GMR2, REMAP_GMR2.
|
---|
780 | *
|
---|
781 | * SVGA_FIFO_CAP_3D_HWVERSION_REVISED --
|
---|
782 | *
|
---|
783 | * Indicates new register SVGA_FIFO_3D_HWVERSION_REVISED exists.
|
---|
784 | * This register may replace SVGA_FIFO_3D_HWVERSION on platforms
|
---|
785 | * that enforce graphics resource limits. This allows the platform
|
---|
786 | * to clear SVGA_FIFO_3D_HWVERSION and disable 3D in legacy guest
|
---|
787 | * drivers that do not limit their resources.
|
---|
788 | *
|
---|
789 | * Note this is an alias to SVGA_FIFO_CAP_GMR2 because these indicators
|
---|
790 | * are codependent (and thus we use a single capability bit).
|
---|
791 | *
|
---|
792 | * SVGA_FIFO_CAP_SCREEN_OBJECT_2 --
|
---|
793 | *
|
---|
794 | * Modifies the DEFINE_SCREEN command to include a guest provided
|
---|
795 | * backing store in GMR memory and the bytesPerLine for the backing
|
---|
796 | * store. This capability requires the use of a backing store when
|
---|
797 | * creating screen objects. However if SVGA_FIFO_CAP_SCREEN_OBJECT
|
---|
798 | * is present then backing stores are optional.
|
---|
799 | *
|
---|
800 | * SVGA_FIFO_CAP_DEAD --
|
---|
801 | *
|
---|
802 | * Drivers should not use this cap bit. This cap bit can not be
|
---|
803 | * reused since some hosts already expose it.
|
---|
804 | */
|
---|
805 |
|
---|
806 | #define SVGA_FIFO_CAP_NONE 0
|
---|
807 | #define SVGA_FIFO_CAP_FENCE (1<<0)
|
---|
808 | #define SVGA_FIFO_CAP_ACCELFRONT (1<<1)
|
---|
809 | #define SVGA_FIFO_CAP_PITCHLOCK (1<<2)
|
---|
810 | #define SVGA_FIFO_CAP_VIDEO (1<<3)
|
---|
811 | #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4)
|
---|
812 | #define SVGA_FIFO_CAP_ESCAPE (1<<5)
|
---|
813 | #define SVGA_FIFO_CAP_RESERVE (1<<6)
|
---|
814 | #define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7)
|
---|
815 | #define SVGA_FIFO_CAP_GMR2 (1<<8)
|
---|
816 | #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2
|
---|
817 | #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1<<9)
|
---|
818 | #define SVGA_FIFO_CAP_DEAD (1<<10)
|
---|
819 |
|
---|
820 |
|
---|
821 | /*
|
---|
822 | * FIFO Flags
|
---|
823 | *
|
---|
824 | * Accel Front -- Driver should use front buffer only commands
|
---|
825 | */
|
---|
826 |
|
---|
827 | #define SVGA_FIFO_FLAG_NONE 0
|
---|
828 | #define SVGA_FIFO_FLAG_ACCELFRONT (1<<0)
|
---|
829 | #define SVGA_FIFO_FLAG_RESERVED (1<<31) // Internal use only
|
---|
830 |
|
---|
831 | /*
|
---|
832 | * FIFO reservation sentinel value
|
---|
833 | */
|
---|
834 |
|
---|
835 | #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff
|
---|
836 |
|
---|
837 |
|
---|
838 | /*
|
---|
839 | * Video overlay support
|
---|
840 | */
|
---|
841 |
|
---|
842 | #define SVGA_NUM_OVERLAY_UNITS 32
|
---|
843 |
|
---|
844 |
|
---|
845 | /*
|
---|
846 | * Video capabilities that the guest is currently using
|
---|
847 | */
|
---|
848 |
|
---|
849 | #define SVGA_VIDEO_FLAG_COLORKEY 0x0001
|
---|
850 |
|
---|
851 |
|
---|
852 | /*
|
---|
853 | * Offsets for the video overlay registers
|
---|
854 | */
|
---|
855 |
|
---|
856 | enum {
|
---|
857 | SVGA_VIDEO_ENABLED = 0,
|
---|
858 | SVGA_VIDEO_FLAGS,
|
---|
859 | SVGA_VIDEO_DATA_OFFSET,
|
---|
860 | SVGA_VIDEO_FORMAT,
|
---|
861 | SVGA_VIDEO_COLORKEY,
|
---|
862 | SVGA_VIDEO_SIZE, // Deprecated
|
---|
863 | SVGA_VIDEO_WIDTH,
|
---|
864 | SVGA_VIDEO_HEIGHT,
|
---|
865 | SVGA_VIDEO_SRC_X,
|
---|
866 | SVGA_VIDEO_SRC_Y,
|
---|
867 | SVGA_VIDEO_SRC_WIDTH,
|
---|
868 | SVGA_VIDEO_SRC_HEIGHT,
|
---|
869 | SVGA_VIDEO_DST_X, // Signed int32
|
---|
870 | SVGA_VIDEO_DST_Y, // Signed int32
|
---|
871 | SVGA_VIDEO_DST_WIDTH,
|
---|
872 | SVGA_VIDEO_DST_HEIGHT,
|
---|
873 | SVGA_VIDEO_PITCH_1,
|
---|
874 | SVGA_VIDEO_PITCH_2,
|
---|
875 | SVGA_VIDEO_PITCH_3,
|
---|
876 | SVGA_VIDEO_DATA_GMRID, // Optional, defaults to SVGA_GMR_FRAMEBUFFER
|
---|
877 | SVGA_VIDEO_DST_SCREEN_ID, // Optional, defaults to virtual coords (SVGA_ID_INVALID)
|
---|
878 | SVGA_VIDEO_NUM_REGS
|
---|
879 | };
|
---|
880 |
|
---|
881 |
|
---|
882 | /*
|
---|
883 | * SVGA Overlay Units
|
---|
884 | *
|
---|
885 | * width and height relate to the entire source video frame.
|
---|
886 | * srcX, srcY, srcWidth and srcHeight represent subset of the source
|
---|
887 | * video frame to be displayed.
|
---|
888 | */
|
---|
889 |
|
---|
890 | typedef struct SVGAOverlayUnit {
|
---|
891 | uint32_t enabled;
|
---|
892 | uint32_t flags;
|
---|
893 | uint32_t dataOffset;
|
---|
894 | uint32_t format;
|
---|
895 | uint32_t colorKey;
|
---|
896 | uint32_t size;
|
---|
897 | uint32_t width;
|
---|
898 | uint32_t height;
|
---|
899 | uint32_t srcX;
|
---|
900 | uint32_t srcY;
|
---|
901 | uint32_t srcWidth;
|
---|
902 | uint32_t srcHeight;
|
---|
903 | int32_t dstX;
|
---|
904 | int32_t dstY;
|
---|
905 | uint32_t dstWidth;
|
---|
906 | uint32_t dstHeight;
|
---|
907 | uint32_t pitches[3];
|
---|
908 | uint32_t dataGMRId;
|
---|
909 | uint32_t dstScreenId;
|
---|
910 | } SVGAOverlayUnit;
|
---|
911 |
|
---|
912 |
|
---|
913 | /*
|
---|
914 | * SVGAScreenObject --
|
---|
915 | *
|
---|
916 | * This is a new way to represent a guest's multi-monitor screen or
|
---|
917 | * Unity window. Screen objects are only supported if the
|
---|
918 | * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set.
|
---|
919 | *
|
---|
920 | * If Screen Objects are supported, they can be used to fully
|
---|
921 | * replace the functionality provided by the framebuffer registers
|
---|
922 | * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY.
|
---|
923 | *
|
---|
924 | * The screen object is a struct with guaranteed binary
|
---|
925 | * compatibility. New flags can be added, and the struct may grow,
|
---|
926 | * but existing fields must retain their meaning.
|
---|
927 | *
|
---|
928 | * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2 are required fields of
|
---|
929 | * a SVGAGuestPtr that is used to back the screen contents. This
|
---|
930 | * memory must come from the GFB. The guest is not allowed to
|
---|
931 | * access the memory and doing so will have undefined results. The
|
---|
932 | * backing store is required to be page aligned and the size is
|
---|
933 | * padded to the next page boundry. The number of pages is:
|
---|
934 | * (bytesPerLine * size.width * 4 + PAGE_SIZE - 1) / PAGE_SIZE
|
---|
935 | *
|
---|
936 | * The pitch in the backingStore is required to be at least large
|
---|
937 | * enough to hold a 32bbp scanline. It is recommended that the
|
---|
938 | * driver pad bytesPerLine for a potential performance win.
|
---|
939 | *
|
---|
940 | * The cloneCount field is treated as a hint from the guest that
|
---|
941 | * the user wants this display to be cloned, countCount times. A
|
---|
942 | * value of zero means no cloning should happen.
|
---|
943 | */
|
---|
944 |
|
---|
945 | #define SVGA_SCREEN_MUST_BE_SET (1 << 0) // Must be set or results undefined
|
---|
946 | #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET // Deprecated
|
---|
947 | #define SVGA_SCREEN_IS_PRIMARY (1 << 1) // Guest considers this screen to be 'primary'
|
---|
948 | #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) // Guest is running a fullscreen app here
|
---|
949 |
|
---|
950 | /*
|
---|
951 | * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When the screen is
|
---|
952 | * deactivated the base layer is defined to lose all contents and
|
---|
953 | * become black. When a screen is deactivated the backing store is
|
---|
954 | * optional. When set backingPtr and bytesPerLine will be ignored.
|
---|
955 | */
|
---|
956 | #define SVGA_SCREEN_DEACTIVATE (1 << 3)
|
---|
957 |
|
---|
958 | /*
|
---|
959 | * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When this flag is set
|
---|
960 | * the screen contents will be outputted as all black to the user
|
---|
961 | * though the base layer contents is preserved. The screen base layer
|
---|
962 | * can still be read and written to like normal though the no visible
|
---|
963 | * effect will be seen by the user. When the flag is changed the
|
---|
964 | * screen will be blanked or redrawn to the current contents as needed
|
---|
965 | * without any extra commands from the driver. This flag only has an
|
---|
966 | * effect when the screen is not deactivated.
|
---|
967 | */
|
---|
968 | #define SVGA_SCREEN_BLANKING (1 << 4)
|
---|
969 |
|
---|
970 | typedef
|
---|
971 | struct SVGAScreenObject {
|
---|
972 | uint32_t structSize; // sizeof(SVGAScreenObject)
|
---|
973 | uint32_t id;
|
---|
974 | uint32_t flags;
|
---|
975 | struct {
|
---|
976 | uint32_t width;
|
---|
977 | uint32_t height;
|
---|
978 | } size;
|
---|
979 | struct {
|
---|
980 | int32_t x;
|
---|
981 | int32_t y;
|
---|
982 | } root;
|
---|
983 |
|
---|
984 | /*
|
---|
985 | * Added and required by SVGA_FIFO_CAP_SCREEN_OBJECT_2, optional
|
---|
986 | * with SVGA_FIFO_CAP_SCREEN_OBJECT.
|
---|
987 | */
|
---|
988 | SVGAGuestImage backingStore;
|
---|
989 | uint32_t cloneCount;
|
---|
990 | } SVGAScreenObject;
|
---|
991 |
|
---|
992 |
|
---|
993 | /*
|
---|
994 | * Commands in the command FIFO:
|
---|
995 | *
|
---|
996 | * Command IDs defined below are used for the traditional 2D FIFO
|
---|
997 | * communication (not all commands are available for all versions of the
|
---|
998 | * SVGA FIFO protocol).
|
---|
999 | *
|
---|
1000 | * Note the holes in the command ID numbers: These commands have been
|
---|
1001 | * deprecated, and the old IDs must not be reused.
|
---|
1002 | *
|
---|
1003 | * Command IDs from 1000 to 1999 are reserved for use by the SVGA3D
|
---|
1004 | * protocol.
|
---|
1005 | *
|
---|
1006 | * Each command's parameters are described by the comments and
|
---|
1007 | * structs below.
|
---|
1008 | */
|
---|
1009 |
|
---|
1010 | typedef enum {
|
---|
1011 | SVGA_CMD_INVALID_CMD = 0,
|
---|
1012 | SVGA_CMD_UPDATE = 1,
|
---|
1013 | SVGA_CMD_RECT_COPY = 3,
|
---|
1014 | SVGA_CMD_DEFINE_CURSOR = 19,
|
---|
1015 | SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,
|
---|
1016 | SVGA_CMD_UPDATE_VERBOSE = 25,
|
---|
1017 | SVGA_CMD_FRONT_ROP_FILL = 29,
|
---|
1018 | SVGA_CMD_FENCE = 30,
|
---|
1019 | SVGA_CMD_ESCAPE = 33,
|
---|
1020 | SVGA_CMD_DEFINE_SCREEN = 34,
|
---|
1021 | SVGA_CMD_DESTROY_SCREEN = 35,
|
---|
1022 | SVGA_CMD_DEFINE_GMRFB = 36,
|
---|
1023 | SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,
|
---|
1024 | SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,
|
---|
1025 | SVGA_CMD_ANNOTATION_FILL = 39,
|
---|
1026 | SVGA_CMD_ANNOTATION_COPY = 40,
|
---|
1027 | SVGA_CMD_DEFINE_GMR2 = 41,
|
---|
1028 | SVGA_CMD_REMAP_GMR2 = 42,
|
---|
1029 | SVGA_CMD_MAX
|
---|
1030 | } SVGAFifoCmdId;
|
---|
1031 |
|
---|
1032 | #define SVGA_CMD_MAX_DATASIZE (256 * 1024)
|
---|
1033 | #define SVGA_CMD_MAX_ARGS 64
|
---|
1034 |
|
---|
1035 |
|
---|
1036 | /*
|
---|
1037 | * SVGA_CMD_UPDATE --
|
---|
1038 | *
|
---|
1039 | * This is a DMA transfer which copies from the Guest Framebuffer
|
---|
1040 | * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which
|
---|
1041 | * intersect with the provided virtual rectangle.
|
---|
1042 | *
|
---|
1043 | * This command does not support using arbitrary guest memory as a
|
---|
1044 | * data source- it only works with the pre-defined GFB memory.
|
---|
1045 | * This command also does not support signed virtual coordinates.
|
---|
1046 | * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with
|
---|
1047 | * negative root x/y coordinates, the negative portion of those
|
---|
1048 | * screens will not be reachable by this command.
|
---|
1049 | *
|
---|
1050 | * This command is not necessary when using framebuffer
|
---|
1051 | * traces. Traces are automatically enabled if the SVGA FIFO is
|
---|
1052 | * disabled, and you may explicitly enable/disable traces using
|
---|
1053 | * SVGA_REG_TRACES. With traces enabled, any write to the GFB will
|
---|
1054 | * automatically act as if a subsequent SVGA_CMD_UPDATE was issued.
|
---|
1055 | *
|
---|
1056 | * Traces and SVGA_CMD_UPDATE are the only supported ways to render
|
---|
1057 | * pseudocolor screen updates. The newer Screen Object commands
|
---|
1058 | * only support true color formats.
|
---|
1059 | *
|
---|
1060 | * Availability:
|
---|
1061 | * Always available.
|
---|
1062 | */
|
---|
1063 |
|
---|
1064 | typedef
|
---|
1065 | struct {
|
---|
1066 | uint32_t x;
|
---|
1067 | uint32_t y;
|
---|
1068 | uint32_t width;
|
---|
1069 | uint32_t height;
|
---|
1070 | } SVGAFifoCmdUpdate;
|
---|
1071 |
|
---|
1072 |
|
---|
1073 | /*
|
---|
1074 | * SVGA_CMD_RECT_COPY --
|
---|
1075 | *
|
---|
1076 | * Perform a rectangular DMA transfer from one area of the GFB to
|
---|
1077 | * another, and copy the result to any screens which intersect it.
|
---|
1078 | *
|
---|
1079 | * Availability:
|
---|
1080 | * SVGA_CAP_RECT_COPY
|
---|
1081 | */
|
---|
1082 |
|
---|
1083 | typedef
|
---|
1084 | struct {
|
---|
1085 | uint32_t srcX;
|
---|
1086 | uint32_t srcY;
|
---|
1087 | uint32_t destX;
|
---|
1088 | uint32_t destY;
|
---|
1089 | uint32_t width;
|
---|
1090 | uint32_t height;
|
---|
1091 | } SVGAFifoCmdRectCopy;
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | /*
|
---|
1095 | * SVGA_CMD_DEFINE_CURSOR --
|
---|
1096 | *
|
---|
1097 | * Provide a new cursor image, as an AND/XOR mask.
|
---|
1098 | *
|
---|
1099 | * The recommended way to position the cursor overlay is by using
|
---|
1100 | * the SVGA_FIFO_CURSOR_* registers, supported by the
|
---|
1101 | * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
|
---|
1102 | *
|
---|
1103 | * Availability:
|
---|
1104 | * SVGA_CAP_CURSOR
|
---|
1105 | */
|
---|
1106 |
|
---|
1107 | typedef
|
---|
1108 | struct {
|
---|
1109 | uint32_t id; // Reserved, must be zero.
|
---|
1110 | uint32_t hotspotX;
|
---|
1111 | uint32_t hotspotY;
|
---|
1112 | uint32_t width;
|
---|
1113 | uint32_t height;
|
---|
1114 | uint32_t andMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL
|
---|
1115 | uint32_t xorMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL
|
---|
1116 | /*
|
---|
1117 | * Followed by scanline data for AND mask, then XOR mask.
|
---|
1118 | * Each scanline is padded to a 32-bit boundary.
|
---|
1119 | */
|
---|
1120 | } SVGAFifoCmdDefineCursor;
|
---|
1121 |
|
---|
1122 |
|
---|
1123 | /*
|
---|
1124 | * SVGA_CMD_DEFINE_ALPHA_CURSOR --
|
---|
1125 | *
|
---|
1126 | * Provide a new cursor image, in 32-bit BGRA format.
|
---|
1127 | *
|
---|
1128 | * The recommended way to position the cursor overlay is by using
|
---|
1129 | * the SVGA_FIFO_CURSOR_* registers, supported by the
|
---|
1130 | * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
|
---|
1131 | *
|
---|
1132 | * Availability:
|
---|
1133 | * SVGA_CAP_ALPHA_CURSOR
|
---|
1134 | */
|
---|
1135 |
|
---|
1136 | typedef
|
---|
1137 | struct {
|
---|
1138 | uint32_t id; // Reserved, must be zero.
|
---|
1139 | uint32_t hotspotX;
|
---|
1140 | uint32_t hotspotY;
|
---|
1141 | uint32_t width;
|
---|
1142 | uint32_t height;
|
---|
1143 | /* Followed by scanline data */
|
---|
1144 | } SVGAFifoCmdDefineAlphaCursor;
|
---|
1145 |
|
---|
1146 |
|
---|
1147 | /*
|
---|
1148 | * SVGA_CMD_UPDATE_VERBOSE --
|
---|
1149 | *
|
---|
1150 | * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle
|
---|
1151 | * 'reason' value, an opaque cookie which is used by internal
|
---|
1152 | * debugging tools. Third party drivers should not use this
|
---|
1153 | * command.
|
---|
1154 | *
|
---|
1155 | * Availability:
|
---|
1156 | * SVGA_CAP_EXTENDED_FIFO
|
---|
1157 | */
|
---|
1158 |
|
---|
1159 | typedef
|
---|
1160 | struct {
|
---|
1161 | uint32_t x;
|
---|
1162 | uint32_t y;
|
---|
1163 | uint32_t width;
|
---|
1164 | uint32_t height;
|
---|
1165 | uint32_t reason;
|
---|
1166 | } SVGAFifoCmdUpdateVerbose;
|
---|
1167 |
|
---|
1168 |
|
---|
1169 | /*
|
---|
1170 | * SVGA_CMD_FRONT_ROP_FILL --
|
---|
1171 | *
|
---|
1172 | * This is a hint which tells the SVGA device that the driver has
|
---|
1173 | * just filled a rectangular region of the GFB with a solid
|
---|
1174 | * color. Instead of reading these pixels from the GFB, the device
|
---|
1175 | * can assume that they all equal 'color'. This is primarily used
|
---|
1176 | * for remote desktop protocols.
|
---|
1177 | *
|
---|
1178 | * Availability:
|
---|
1179 | * SVGA_FIFO_CAP_ACCELFRONT
|
---|
1180 | */
|
---|
1181 |
|
---|
1182 | #define SVGA_ROP_COPY 0x03
|
---|
1183 |
|
---|
1184 | typedef
|
---|
1185 | struct {
|
---|
1186 | uint32_t color; // In the same format as the GFB
|
---|
1187 | uint32_t x;
|
---|
1188 | uint32_t y;
|
---|
1189 | uint32_t width;
|
---|
1190 | uint32_t height;
|
---|
1191 | uint32_t rop; // Must be SVGA_ROP_COPY
|
---|
1192 | } SVGAFifoCmdFrontRopFill;
|
---|
1193 |
|
---|
1194 |
|
---|
1195 | /*
|
---|
1196 | * SVGA_CMD_FENCE --
|
---|
1197 | *
|
---|
1198 | * Insert a synchronization fence. When the SVGA device reaches
|
---|
1199 | * this command, it will copy the 'fence' value into the
|
---|
1200 | * SVGA_FIFO_FENCE register. It will also compare the fence against
|
---|
1201 | * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the
|
---|
1202 | * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will
|
---|
1203 | * raise this interrupt.
|
---|
1204 | *
|
---|
1205 | * Availability:
|
---|
1206 | * SVGA_FIFO_FENCE for this command,
|
---|
1207 | * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL.
|
---|
1208 | */
|
---|
1209 |
|
---|
1210 | typedef
|
---|
1211 | struct {
|
---|
1212 | uint32_t fence;
|
---|
1213 | } SVGAFifoCmdFence;
|
---|
1214 |
|
---|
1215 |
|
---|
1216 | /*
|
---|
1217 | * SVGA_CMD_ESCAPE --
|
---|
1218 | *
|
---|
1219 | * Send an extended or vendor-specific variable length command.
|
---|
1220 | * This is used for video overlay, third party plugins, and
|
---|
1221 | * internal debugging tools. See svga_escape.h
|
---|
1222 | *
|
---|
1223 | * Availability:
|
---|
1224 | * SVGA_FIFO_CAP_ESCAPE
|
---|
1225 | */
|
---|
1226 |
|
---|
1227 | typedef
|
---|
1228 | struct {
|
---|
1229 | uint32_t nsid;
|
---|
1230 | uint32_t size;
|
---|
1231 | /* followed by 'size' bytes of data */
|
---|
1232 | } SVGAFifoCmdEscape;
|
---|
1233 |
|
---|
1234 |
|
---|
1235 | /*
|
---|
1236 | * SVGA_CMD_DEFINE_SCREEN --
|
---|
1237 | *
|
---|
1238 | * Define or redefine an SVGAScreenObject. See the description of
|
---|
1239 | * SVGAScreenObject above. The video driver is responsible for
|
---|
1240 | * generating new screen IDs. They should be small positive
|
---|
1241 | * integers. The virtual device will have an implementation
|
---|
1242 | * specific upper limit on the number of screen IDs
|
---|
1243 | * supported. Drivers are responsible for recycling IDs. The first
|
---|
1244 | * valid ID is zero.
|
---|
1245 | *
|
---|
1246 | * - Interaction with other registers:
|
---|
1247 | *
|
---|
1248 | * For backwards compatibility, when the GFB mode registers (WIDTH,
|
---|
1249 | * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device
|
---|
1250 | * deletes all screens other than screen #0, and redefines screen
|
---|
1251 | * #0 according to the specified mode. Drivers that use
|
---|
1252 | * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0.
|
---|
1253 | *
|
---|
1254 | * If you use screen objects, do not use the legacy multi-mon
|
---|
1255 | * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*).
|
---|
1256 | *
|
---|
1257 | * Availability:
|
---|
1258 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1259 | */
|
---|
1260 |
|
---|
1261 | typedef
|
---|
1262 | struct {
|
---|
1263 | SVGAScreenObject screen; // Variable-length according to version
|
---|
1264 | } SVGAFifoCmdDefineScreen;
|
---|
1265 |
|
---|
1266 |
|
---|
1267 | /*
|
---|
1268 | * SVGA_CMD_DESTROY_SCREEN --
|
---|
1269 | *
|
---|
1270 | * Destroy an SVGAScreenObject. Its ID is immediately available for
|
---|
1271 | * re-use.
|
---|
1272 | *
|
---|
1273 | * Availability:
|
---|
1274 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1275 | */
|
---|
1276 |
|
---|
1277 | typedef
|
---|
1278 | struct {
|
---|
1279 | uint32_t screenId;
|
---|
1280 | } SVGAFifoCmdDestroyScreen;
|
---|
1281 |
|
---|
1282 |
|
---|
1283 | /*
|
---|
1284 | * SVGA_CMD_DEFINE_GMRFB --
|
---|
1285 | *
|
---|
1286 | * This command sets a piece of SVGA device state called the
|
---|
1287 | * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a
|
---|
1288 | * piece of light-weight state which identifies the location and
|
---|
1289 | * format of an image in guest memory or in BAR1. The GMRFB has
|
---|
1290 | * an arbitrary size, and it doesn't need to match the geometry
|
---|
1291 | * of the GFB or any screen object.
|
---|
1292 | *
|
---|
1293 | * The GMRFB can be redefined as often as you like. You could
|
---|
1294 | * always use the same GMRFB, you could redefine it before
|
---|
1295 | * rendering from a different guest screen, or you could even
|
---|
1296 | * redefine it before every blit.
|
---|
1297 | *
|
---|
1298 | * There are multiple ways to use this command. The simplest way is
|
---|
1299 | * to use it to move the framebuffer either to elsewhere in the GFB
|
---|
1300 | * (BAR1) memory region, or to a user-defined GMR. This lets a
|
---|
1301 | * driver use a framebuffer allocated entirely out of normal system
|
---|
1302 | * memory, which we encourage.
|
---|
1303 | *
|
---|
1304 | * Another way to use this command is to set up a ring buffer of
|
---|
1305 | * updates in GFB memory. If a driver wants to ensure that no
|
---|
1306 | * frames are skipped by the SVGA device, it is important that the
|
---|
1307 | * driver not modify the source data for a blit until the device is
|
---|
1308 | * done processing the command. One efficient way to accomplish
|
---|
1309 | * this is to use a ring of small DMA buffers. Each buffer is used
|
---|
1310 | * for one blit, then we move on to the next buffer in the
|
---|
1311 | * ring. The FENCE mechanism is used to protect each buffer from
|
---|
1312 | * re-use until the device is finished with that buffer's
|
---|
1313 | * corresponding blit.
|
---|
1314 | *
|
---|
1315 | * This command does not affect the meaning of SVGA_CMD_UPDATE.
|
---|
1316 | * UPDATEs always occur from the legacy GFB memory area. This
|
---|
1317 | * command has no support for pseudocolor GMRFBs. Currently only
|
---|
1318 | * true-color 15, 16, and 24-bit depths are supported. Future
|
---|
1319 | * devices may expose capabilities for additional framebuffer
|
---|
1320 | * formats.
|
---|
1321 | *
|
---|
1322 | * The default GMRFB value is undefined. Drivers must always send
|
---|
1323 | * this command at least once before performing any blit from the
|
---|
1324 | * GMRFB.
|
---|
1325 | *
|
---|
1326 | * Availability:
|
---|
1327 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1328 | */
|
---|
1329 |
|
---|
1330 | typedef
|
---|
1331 | struct {
|
---|
1332 | SVGAGuestPtr ptr;
|
---|
1333 | uint32_t bytesPerLine;
|
---|
1334 | SVGAGMRImageFormat format;
|
---|
1335 | } SVGAFifoCmdDefineGMRFB;
|
---|
1336 |
|
---|
1337 |
|
---|
1338 | /*
|
---|
1339 | * SVGA_CMD_BLIT_GMRFB_TO_SCREEN --
|
---|
1340 | *
|
---|
1341 | * This is a guest-to-host blit. It performs a DMA operation to
|
---|
1342 | * copy a rectangular region of pixels from the current GMRFB to
|
---|
1343 | * one or more Screen Objects.
|
---|
1344 | *
|
---|
1345 | * The destination coordinate may be specified relative to a
|
---|
1346 | * screen's origin (if a screen ID is specified) or relative to the
|
---|
1347 | * virtual coordinate system's origin (if the screen ID is
|
---|
1348 | * SVGA_ID_INVALID). The actual destination may span zero or more
|
---|
1349 | * screens, in the case of a virtual destination rect or a rect
|
---|
1350 | * which extends off the edge of the specified screen.
|
---|
1351 | *
|
---|
1352 | * This command writes to the screen's "base layer": the underlying
|
---|
1353 | * framebuffer which exists below any cursor or video overlays. No
|
---|
1354 | * action is necessary to explicitly hide or update any overlays
|
---|
1355 | * which exist on top of the updated region.
|
---|
1356 | *
|
---|
1357 | * The SVGA device is guaranteed to finish reading from the GMRFB
|
---|
1358 | * by the time any subsequent FENCE commands are reached.
|
---|
1359 | *
|
---|
1360 | * This command consumes an annotation. See the
|
---|
1361 | * SVGA_CMD_ANNOTATION_* commands for details.
|
---|
1362 | *
|
---|
1363 | * Availability:
|
---|
1364 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1365 | */
|
---|
1366 |
|
---|
1367 | typedef
|
---|
1368 | struct {
|
---|
1369 | SVGASignedPoint srcOrigin;
|
---|
1370 | SVGASignedRect destRect;
|
---|
1371 | uint32_t destScreenId;
|
---|
1372 | } SVGAFifoCmdBlitGMRFBToScreen;
|
---|
1373 |
|
---|
1374 |
|
---|
1375 | /*
|
---|
1376 | * SVGA_CMD_BLIT_SCREEN_TO_GMRFB --
|
---|
1377 | *
|
---|
1378 | * This is a host-to-guest blit. It performs a DMA operation to
|
---|
1379 | * copy a rectangular region of pixels from a single Screen Object
|
---|
1380 | * back to the current GMRFB.
|
---|
1381 | *
|
---|
1382 | * Usage note: This command should be used rarely. It will
|
---|
1383 | * typically be inefficient, but it is necessary for some types of
|
---|
1384 | * synchronization between 3D (GPU) and 2D (CPU) rendering into
|
---|
1385 | * overlapping areas of a screen.
|
---|
1386 | *
|
---|
1387 | * The source coordinate is specified relative to a screen's
|
---|
1388 | * origin. The provided screen ID must be valid. If any parameters
|
---|
1389 | * are invalid, the resulting pixel values are undefined.
|
---|
1390 | *
|
---|
1391 | * This command reads the screen's "base layer". Overlays like
|
---|
1392 | * video and cursor are not included, but any data which was sent
|
---|
1393 | * using a blit-to-screen primitive will be available, no matter
|
---|
1394 | * whether the data's original source was the GMRFB or the 3D
|
---|
1395 | * acceleration hardware.
|
---|
1396 | *
|
---|
1397 | * Note that our guest-to-host blits and host-to-guest blits aren't
|
---|
1398 | * symmetric in their current implementation. While the parameters
|
---|
1399 | * are identical, host-to-guest blits are a lot less featureful.
|
---|
1400 | * They do not support clipping: If the source parameters don't
|
---|
1401 | * fully fit within a screen, the blit fails. They must originate
|
---|
1402 | * from exactly one screen. Virtual coordinates are not directly
|
---|
1403 | * supported.
|
---|
1404 | *
|
---|
1405 | * Host-to-guest blits do support the same set of GMRFB formats
|
---|
1406 | * offered by guest-to-host blits.
|
---|
1407 | *
|
---|
1408 | * The SVGA device is guaranteed to finish writing to the GMRFB by
|
---|
1409 | * the time any subsequent FENCE commands are reached.
|
---|
1410 | *
|
---|
1411 | * Availability:
|
---|
1412 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1413 | */
|
---|
1414 |
|
---|
1415 | typedef
|
---|
1416 | struct {
|
---|
1417 | SVGASignedPoint destOrigin;
|
---|
1418 | SVGASignedRect srcRect;
|
---|
1419 | uint32_t srcScreenId;
|
---|
1420 | } SVGAFifoCmdBlitScreenToGMRFB;
|
---|
1421 |
|
---|
1422 |
|
---|
1423 | /*
|
---|
1424 | * SVGA_CMD_ANNOTATION_FILL --
|
---|
1425 | *
|
---|
1426 | * This is a blit annotation. This command stores a small piece of
|
---|
1427 | * device state which is consumed by the next blit-to-screen
|
---|
1428 | * command. The state is only cleared by commands which are
|
---|
1429 | * specifically documented as consuming an annotation. Other
|
---|
1430 | * commands (such as ESCAPEs for debugging) may intervene between
|
---|
1431 | * the annotation and its associated blit.
|
---|
1432 | *
|
---|
1433 | * This annotation is a promise about the contents of the next
|
---|
1434 | * blit: The video driver is guaranteeing that all pixels in that
|
---|
1435 | * blit will have the same value, specified here as a color in
|
---|
1436 | * SVGAColorBGRX format.
|
---|
1437 | *
|
---|
1438 | * The SVGA device can still render the blit correctly even if it
|
---|
1439 | * ignores this annotation, but the annotation may allow it to
|
---|
1440 | * perform the blit more efficiently, for example by ignoring the
|
---|
1441 | * source data and performing a fill in hardware.
|
---|
1442 | *
|
---|
1443 | * This annotation is most important for performance when the
|
---|
1444 | * user's display is being remoted over a network connection.
|
---|
1445 | *
|
---|
1446 | * Availability:
|
---|
1447 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1448 | */
|
---|
1449 |
|
---|
1450 | typedef
|
---|
1451 | struct {
|
---|
1452 | SVGAColorBGRX color;
|
---|
1453 | } SVGAFifoCmdAnnotationFill;
|
---|
1454 |
|
---|
1455 |
|
---|
1456 | /*
|
---|
1457 | * SVGA_CMD_ANNOTATION_COPY --
|
---|
1458 | *
|
---|
1459 | * This is a blit annotation. See SVGA_CMD_ANNOTATION_FILL for more
|
---|
1460 | * information about annotations.
|
---|
1461 | *
|
---|
1462 | * This annotation is a promise about the contents of the next
|
---|
1463 | * blit: The video driver is guaranteeing that all pixels in that
|
---|
1464 | * blit will have the same value as those which already exist at an
|
---|
1465 | * identically-sized region on the same or a different screen.
|
---|
1466 | *
|
---|
1467 | * Note that the source pixels for the COPY in this annotation are
|
---|
1468 | * sampled before applying the anqnotation's associated blit. They
|
---|
1469 | * are allowed to overlap with the blit's destination pixels.
|
---|
1470 | *
|
---|
1471 | * The copy source rectangle is specified the same way as the blit
|
---|
1472 | * destination: it can be a rectangle which spans zero or more
|
---|
1473 | * screens, specified relative to either a screen or to the virtual
|
---|
1474 | * coordinate system's origin. If the source rectangle includes
|
---|
1475 | * pixels which are not from exactly one screen, the results are
|
---|
1476 | * undefined.
|
---|
1477 | *
|
---|
1478 | * Availability:
|
---|
1479 | * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
|
---|
1480 | */
|
---|
1481 |
|
---|
1482 | typedef
|
---|
1483 | struct {
|
---|
1484 | SVGASignedPoint srcOrigin;
|
---|
1485 | uint32_t srcScreenId;
|
---|
1486 | } SVGAFifoCmdAnnotationCopy;
|
---|
1487 |
|
---|
1488 |
|
---|
1489 | /*
|
---|
1490 | * SVGA_CMD_DEFINE_GMR2 --
|
---|
1491 | *
|
---|
1492 | * Define guest memory region v2. See the description of GMRs above.
|
---|
1493 | *
|
---|
1494 | * Availability:
|
---|
1495 | * SVGA_CAP_GMR2
|
---|
1496 | */
|
---|
1497 |
|
---|
1498 | typedef
|
---|
1499 | struct {
|
---|
1500 | uint32_t gmrId;
|
---|
1501 | uint32_t numPages;
|
---|
1502 | }
|
---|
1503 | SVGAFifoCmdDefineGMR2;
|
---|
1504 |
|
---|
1505 |
|
---|
1506 | /*
|
---|
1507 | * SVGA_CMD_REMAP_GMR2 --
|
---|
1508 | *
|
---|
1509 | * Remap guest memory region v2. See the description of GMRs above.
|
---|
1510 | *
|
---|
1511 | * This command allows guest to modify a portion of an existing GMR by
|
---|
1512 | * invalidating it or reassigning it to different guest physical pages.
|
---|
1513 | * The pages are identified by physical page number (PPN). The pages
|
---|
1514 | * are assumed to be pinned and valid for DMA operations.
|
---|
1515 | *
|
---|
1516 | * Description of command flags:
|
---|
1517 | *
|
---|
1518 | * SVGA_REMAP_GMR2_VIA_GMR: If enabled, references a PPN list in a GMR.
|
---|
1519 | * The PPN list must not overlap with the remap region (this can be
|
---|
1520 | * handled trivially by referencing a separate GMR). If flag is
|
---|
1521 | * disabled, PPN list is appended to SVGARemapGMR command.
|
---|
1522 | *
|
---|
1523 | * SVGA_REMAP_GMR2_PPN64: If set, PPN list is in PPN64 format, otherwise
|
---|
1524 | * it is in PPN32 format.
|
---|
1525 | *
|
---|
1526 | * SVGA_REMAP_GMR2_SINGLE_PPN: If set, PPN list contains a single entry.
|
---|
1527 | * A single PPN can be used to invalidate a portion of a GMR or
|
---|
1528 | * map it to to a single guest scratch page.
|
---|
1529 | *
|
---|
1530 | * Availability:
|
---|
1531 | * SVGA_CAP_GMR2
|
---|
1532 | */
|
---|
1533 |
|
---|
1534 | typedef enum {
|
---|
1535 | SVGA_REMAP_GMR2_PPN32 = 0,
|
---|
1536 | SVGA_REMAP_GMR2_VIA_GMR = (1 << 0),
|
---|
1537 | SVGA_REMAP_GMR2_PPN64 = (1 << 1),
|
---|
1538 | SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2)
|
---|
1539 | } SVGARemapGMR2Flags;
|
---|
1540 |
|
---|
1541 | typedef
|
---|
1542 | struct {
|
---|
1543 | uint32_t gmrId;
|
---|
1544 | SVGARemapGMR2Flags flags;
|
---|
1545 | uint32_t offsetPages; // offset in pages to begin remap
|
---|
1546 | uint32_t numPages; // number of pages to remap
|
---|
1547 | /*
|
---|
1548 | * Followed by additional data depending on SVGARemapGMR2Flags.
|
---|
1549 | *
|
---|
1550 | * If flag SVGA_REMAP_GMR2_VIA_GMR is set, single SVGAGuestPtr follows.
|
---|
1551 | * Otherwise an array of page descriptors in PPN32 or PPN64 format
|
---|
1552 | * (according to flag SVGA_REMAP_GMR2_PPN64) follows. If flag
|
---|
1553 | * SVGA_REMAP_GMR2_SINGLE_PPN is set, array contains a single entry.
|
---|
1554 | */
|
---|
1555 | }
|
---|
1556 | SVGAFifoCmdRemapGMR2;
|
---|
1557 |
|
---|
1558 | #endif
|
---|