1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /**********************************************************
3 * Copyright 1998-2021 VMware, Inc.
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:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
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
25 **********************************************************/
30 * Virtual hardware definitions for the VMware SVGA II device.
35 #include <linux/pci_ids.h>
37 #define INCLUDE_ALLOW_MODULE
38 #define INCLUDE_ALLOW_USERLEVEL
40 #define INCLUDE_ALLOW_VMCORE
41 #include "includeCheck.h"
43 #include "svga_types.h"
46 * SVGA_REG_ENABLE bit definitions.
49 SVGA_REG_ENABLE_DISABLE = 0,
50 SVGA_REG_ENABLE_ENABLE = (1 << 0),
51 SVGA_REG_ENABLE_HIDE = (1 << 1),
54 typedef uint32 SVGAMobId;
57 * Arbitrary and meaningless limits. Please ignore these when writing
60 #define SVGA_MAX_WIDTH 2560
61 #define SVGA_MAX_HEIGHT 1600
64 #define SVGA_MAX_BITS_PER_PIXEL 32
65 #define SVGA_MAX_DEPTH 24
66 #define SVGA_MAX_DISPLAYS 10
67 #define SVGA_MAX_SCREEN_SIZE 8192
68 #define SVGA_SCREEN_ROOT_LIMIT (SVGA_MAX_SCREEN_SIZE * SVGA_MAX_DISPLAYS)
72 * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned
75 #define SVGA_CURSOR_ON_HIDE 0x0
76 #define SVGA_CURSOR_ON_SHOW 0x1
79 * Remove the cursor from the framebuffer
80 * because we need to see what's under it
82 #define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2
84 /* Put the cursor back in the framebuffer so the user can see it */
85 #define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3
88 * The maximum framebuffer size that can traced for guests unless the
89 * SVGA_CAP_GBOBJECTS is set in SVGA_REG_CAPABILITIES. In that case
90 * the full framebuffer can be traced independent of this limit.
92 #define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000
94 #define SVGA_MAX_PSEUDOCOLOR_DEPTH 8
95 #define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)
96 #define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)
98 #define SVGA_MAGIC 0x900000UL
99 #define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))
101 /* Version 3 has the control bar instead of the FIFO */
102 #define SVGA_VERSION_3 3
103 #define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3)
105 /* Version 2 let the address of the frame buffer be unsigned on Win32 */
106 #define SVGA_VERSION_2 2
107 #define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
109 /* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so
110 PALETTE_BASE has moved */
111 #define SVGA_VERSION_1 1
112 #define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)
114 /* Version 0 is the initial version */
115 #define SVGA_VERSION_0 0
116 #define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)
119 * "Invalid" value for all SVGA IDs.
120 * (Version ID, screen object ID, surface ID...)
122 #define SVGA_ID_INVALID 0xFFFFFFFF
124 /* Port offsets, relative to BAR0 */
125 #define SVGA_INDEX_PORT 0x0
126 #define SVGA_VALUE_PORT 0x1
127 #define SVGA_BIOS_PORT 0x2
128 #define SVGA_IRQSTATUS_PORT 0x8
131 * Interrupt source flags for IRQSTATUS_PORT and IRQMASK.
133 * Interrupts are only supported when the
134 * SVGA_CAP_IRQMASK capability is present.
136 #define SVGA_IRQFLAG_ANY_FENCE (1 << 0) /* Any fence was passed */
137 #define SVGA_IRQFLAG_FIFO_PROGRESS (1 << 1) /* Made forward progress in the FIFO */
138 #define SVGA_IRQFLAG_FENCE_GOAL (1 << 2) /* SVGA_FIFO_FENCE_GOAL reached */
139 #define SVGA_IRQFLAG_COMMAND_BUFFER (1 << 3) /* Command buffer completed */
140 #define SVGA_IRQFLAG_ERROR (1 << 4) /* Error while processing commands */
141 #define SVGA_IRQFLAG_MAX (1 << 5)
144 * The byte-size is the size of the actual cursor data,
145 * possibly after expanding it to the current bit depth.
147 * 40K is sufficient memory for two 32-bit planes for a 64 x 64 cursor.
149 * The dimension limit is a bound on the maximum width or height.
151 #define SVGA_MAX_CURSOR_CMD_BYTES (40 * 1024)
152 #define SVGA_MAX_CURSOR_CMD_DIMENSION 1024
163 SVGA_REG_MAX_WIDTH = 4,
164 SVGA_REG_MAX_HEIGHT = 5,
166 SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */
167 SVGA_REG_PSEUDOCOLOR = 8,
168 SVGA_REG_RED_MASK = 9,
169 SVGA_REG_GREEN_MASK = 10,
170 SVGA_REG_BLUE_MASK = 11,
171 SVGA_REG_BYTES_PER_LINE = 12,
172 SVGA_REG_FB_START = 13, /* (Deprecated) */
173 SVGA_REG_FB_OFFSET = 14,
174 SVGA_REG_VRAM_SIZE = 15,
175 SVGA_REG_FB_SIZE = 16,
177 /* ID 0 implementation only had the above registers, then the palette */
178 SVGA_REG_ID_0_TOP = 17,
180 SVGA_REG_CAPABILITIES = 17,
181 SVGA_REG_MEM_START = 18, /* (Deprecated) */
182 SVGA_REG_MEM_SIZE = 19,
183 SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */
184 SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */
185 SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */
186 SVGA_REG_GUEST_ID = 23, /* (Deprecated) */
187 SVGA_REG_DEAD = 24, /* Drivers should never write this. */
188 SVGA_REG_CURSOR_X = 25, /* (Deprecated) */
189 SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */
190 SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */
191 SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */
192 SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */
193 SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */
194 SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */
195 SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */
196 SVGA_REG_IRQMASK = 33, /* Interrupt mask */
198 /* Legacy multi-monitor support */
199 SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */
200 SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */
201 SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */
202 SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */
203 SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */
204 SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */
205 SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */
207 /* See "Guest memory regions" below. */
208 SVGA_REG_GMR_ID = 41,
209 SVGA_REG_GMR_DESCRIPTOR = 42,
210 SVGA_REG_GMR_MAX_IDS = 43,
211 SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
213 SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */
214 SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */
215 SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */
216 SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */
217 SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */
220 * Max primary memory.
221 * See SVGA_CAP_NO_BB_RESTRICTION.
223 SVGA_REG_MAX_PRIMARY_MEM = 50,
224 SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50,
227 * Legacy version of SVGA_REG_GBOBJECT_MEM_SIZE_KB for drivers that
228 * don't know how to convert to a 64-bit byte value without overflowing.
229 * (See SVGA_REG_GBOBJECT_MEM_SIZE_KB).
231 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51,
233 SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */
234 SVGA_REG_CMD_PREPEND_LOW = 53,
235 SVGA_REG_CMD_PREPEND_HIGH = 54,
236 SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,
237 SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,
238 SVGA_REG_MOB_MAX_SIZE = 57,
239 SVGA_REG_BLANK_SCREEN_TARGETS = 58,
241 SVGA_REG_DEVEL_CAP = 60,
244 * Allow the guest to hint to the device which driver is running.
246 * This should not generally change device behavior, but might be
247 * convenient to work-around specific bugs in guest drivers.
249 * Drivers should first write their id value into SVGA_REG_GUEST_DRIVER_ID,
250 * and then fill out all of the version registers that they have defined.
252 * After the driver has written all of the registers, they should
253 * then write the value SVGA_REG_GUEST_DRIVER_ID_SUBMIT to the
254 * SVGA_REG_GUEST_DRIVER_ID register, to signal that they have finished.
256 * The SVGA_REG_GUEST_DRIVER_ID values are defined below by the
257 * SVGARegGuestDriverId enum.
259 * The SVGA_REG_GUEST_DRIVER_VERSION fields are driver-specific,
260 * but ideally should encode a monotonically increasing number that allows
261 * the device to perform inequality checks against ranges of driver versions.
263 SVGA_REG_GUEST_DRIVER_ID = 61,
264 SVGA_REG_GUEST_DRIVER_VERSION1 = 62,
265 SVGA_REG_GUEST_DRIVER_VERSION2 = 63,
266 SVGA_REG_GUEST_DRIVER_VERSION3 = 64,
267 SVGA_REG_CURSOR_MOBID = 65,
268 SVGA_REG_CURSOR_MAX_BYTE_SIZE = 66,
269 SVGA_REG_CURSOR_MAX_DIMENSION = 67,
271 SVGA_REG_FIFO_CAPS = 68,
274 SVGA_REG_RESERVED1 = 70,
275 SVGA_REG_RESERVED2 = 71,
276 SVGA_REG_RESERVED3 = 72,
277 SVGA_REG_RESERVED4 = 73,
278 SVGA_REG_RESERVED5 = 74,
279 SVGA_REG_SCREENDMA = 75,
282 * The maximum amount of guest-backed objects that the device can have
283 * resident at a time. Guest-drivers should keep their working set size
284 * below this limit for best performance.
286 * Note that this value is in kilobytes, and not bytes, because the actual
287 * number of bytes might be larger than can fit in a 32-bit register.
289 * PLEASE USE A 64-BIT VALUE WHEN CONVERTING THIS INTO BYTES.
290 * (See SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB).
292 SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76,
295 + * These registers are for the addresses of the memory BARs for SVGA3
297 SVGA_REG_REGS_START_HIGH32 = 77,
298 SVGA_REG_REGS_START_LOW32 = 78,
299 SVGA_REG_FB_START_HIGH32 = 79,
300 SVGA_REG_FB_START_LOW32 = 80,
303 * A hint register that recommends which quality level the guest should
304 * currently use to define multisample surfaces.
306 * If the register is SVGA_REG_MSHINT_DISABLED,
307 * the guest is only allowed to use SVGA3D_MS_QUALITY_FULL.
309 * Otherwise, this is a live value that can change while the VM is
310 * powered on with the hint suggestion for which quality level the guest
311 * should be using. Guests are free to ignore the hint and use either
312 * RESOLVE or FULL quality.
314 SVGA_REG_MSHINT = 81,
316 SVGA_REG_IRQ_STATUS = 82,
317 SVGA_REG_DIRTY_TRACKING = 83,
319 SVGA_REG_TOP = 84, /* Must be 1 more than the last register */
321 SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
322 /* Next 768 (== 256*3) registers exist for colormap */
323 SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS
324 /* Base of scratch registers */
325 /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage:
326 First 4 are reserved for VESA BIOS Extension; any remaining are for
327 the use of the current SVGA driver. */
332 * Values for SVGA_REG_GUEST_DRIVER_ID.
334 typedef enum SVGARegGuestDriverId {
335 SVGA_REG_GUEST_DRIVER_ID_UNKNOWN = 0,
336 SVGA_REG_GUEST_DRIVER_ID_WDDM = 1,
337 SVGA_REG_GUEST_DRIVER_ID_LINUX = 2,
338 SVGA_REG_GUEST_DRIVER_ID_MAX,
340 SVGA_REG_GUEST_DRIVER_ID_SUBMIT = MAX_UINT32,
341 } SVGARegGuestDriverId;
343 typedef enum SVGARegMSHint {
344 SVGA_REG_MSHINT_DISABLED = 0,
345 SVGA_REG_MSHINT_FULL = 1,
346 SVGA_REG_MSHINT_RESOLVED = 2,
349 typedef enum SVGARegDirtyTracking {
350 SVGA_REG_DIRTY_TRACKING_PER_IMAGE = 0,
351 SVGA_REG_DIRTY_TRACKING_PER_SURFACE = 1,
352 } SVGARegDirtyTracking;
356 * Guest memory regions (GMRs):
358 * This is a new memory mapping feature available in SVGA devices
359 * which have the SVGA_CAP_GMR bit set. Previously, there were two
360 * fixed memory regions available with which to share data between the
361 * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs
362 * are our name for an extensible way of providing arbitrary DMA
363 * buffers for use between the driver and the SVGA device. They are a
364 * new alternative to framebuffer memory, usable for both 2D and 3D
365 * graphics operations.
367 * Since GMR mapping must be done synchronously with guest CPU
368 * execution, we use a new pair of SVGA registers:
373 * This register holds the 32-bit ID (a small positive integer)
374 * of a GMR to create, delete, or redefine. Writing this register
375 * has no side-effects.
377 * SVGA_REG_GMR_DESCRIPTOR --
380 * Writing this register will create, delete, or redefine the GMR
381 * specified by the above ID register. If this register is zero,
382 * the GMR is deleted. Any pointers into this GMR (including those
383 * currently being processed by FIFO commands) will be
384 * synchronously invalidated.
386 * If this register is nonzero, it must be the physical page
387 * number (PPN) of a data structure which describes the physical
388 * layout of the memory region this GMR should describe. The
389 * descriptor structure will be read synchronously by the SVGA
390 * device when this register is written. The descriptor need not
391 * remain allocated for the lifetime of the GMR.
393 * The guest driver should write SVGA_REG_GMR_ID first, then
394 * SVGA_REG_GMR_DESCRIPTOR.
396 * SVGA_REG_GMR_MAX_IDS --
399 * The SVGA device may choose to support a maximum number of
400 * user-defined GMR IDs. This register holds the number of supported
401 * IDs. (The maximum supported ID plus 1)
403 * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH --
406 * The SVGA device may choose to put a limit on the total number
407 * of SVGAGuestMemDescriptor structures it will read when defining
410 * The descriptor structure is an array of SVGAGuestMemDescriptor
411 * structures. Each structure may do one of three things:
413 * - Terminate the GMR descriptor list.
414 * (ppn==0, numPages==0)
416 * - Add a PPN or range of PPNs to the GMR's virtual address space.
417 * (ppn != 0, numPages != 0)
419 * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to
420 * support multi-page GMR descriptor tables without forcing the
421 * driver to allocate physically contiguous memory.
422 * (ppn != 0, numPages == 0)
424 * Note that each physical page of SVGAGuestMemDescriptor structures
425 * can describe at least 2MB of guest memory. If the driver needs to
426 * use more than one page of descriptor structures, it must use one of
427 * its SVGAGuestMemDescriptors to point to an additional page. The
428 * device will never automatically cross a page boundary.
430 * Once the driver has described a GMR, it is immediately available
431 * for use via any FIFO command that uses an SVGAGuestPtr structure.
432 * These pointers include a GMR identifier plus an offset into that
435 * The driver must check the SVGA_CAP_GMR bit before using the GMR
440 * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer
441 * memory as well. In the future, these IDs could even be used to
442 * allow legacy memory regions to be redefined by the guest as GMRs.
444 * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA
445 * is being phased out. Please try to use user-defined GMRs whenever
448 #define SVGA_GMR_NULL ((uint32) -1)
449 #define SVGA_GMR_FRAMEBUFFER ((uint32) -2) /* Guest Framebuffer (GFB) */
452 #include "vmware_pack_begin.h"
453 struct SVGAGuestMemDescriptor {
457 #include "vmware_pack_end.h"
458 SVGAGuestMemDescriptor;
461 #include "vmware_pack_begin.h"
462 struct SVGAGuestPtr {
466 #include "vmware_pack_end.h"
470 * Register based command buffers --
472 * Provide an SVGA device interface that allows the guest to submit
473 * command buffers to the SVGA device through an SVGA device register.
474 * The metadata for each command buffer is contained in the
475 * SVGACBHeader structure along with the return status codes.
477 * The SVGA device supports command buffers if
478 * SVGA_CAP_COMMAND_BUFFERS is set in the device caps register. The
479 * fifo must be enabled for command buffers to be submitted.
481 * Command buffers are submitted when the guest writing the 64 byte
482 * aligned physical address into the SVGA_REG_COMMAND_LOW and
483 * SVGA_REG_COMMAND_HIGH. SVGA_REG_COMMAND_HIGH contains the upper 32
484 * bits of the physical address. SVGA_REG_COMMAND_LOW contains the
485 * lower 32 bits of the physical address, since the command buffer
486 * headers are required to be 64 byte aligned the lower 6 bits are
487 * used for the SVGACBContext value. Writing to SVGA_REG_COMMAND_LOW
488 * submits the command buffer to the device and queues it for
489 * execution. The SVGA device supports at least
490 * SVGA_CB_MAX_QUEUED_PER_CONTEXT command buffers that can be queued
491 * per context and if that limit is reached the device will write the
492 * status SVGA_CB_STATUS_QUEUE_FULL to the status value of the command
493 * buffer header synchronously and not raise any IRQs.
495 * It is invalid to submit a command buffer without a valid physical
496 * address and results are undefined.
498 * The device guarantees that command buffers of size SVGA_CB_MAX_SIZE
499 * will be supported. If a larger command buffer is submitted results
500 * are unspecified and the device will either complete the command
501 * buffer or return an error.
503 * The device guarantees that any individual command in a command
504 * buffer can be up to SVGA_CB_MAX_COMMAND_SIZE in size which is
505 * enough to fit a 64x64 color-cursor definition. If the command is
506 * too large the device is allowed to process the command or return an
509 * The device context is a special SVGACBContext that allows for
510 * synchronous register like accesses with the flexibility of
511 * commands. There is a different command set defined by
512 * SVGADeviceContextCmdId. The commands in each command buffer is not
513 * allowed to straddle physical pages.
515 * The offset field which is available starting with the
516 * SVGA_CAP_CMD_BUFFERS_2 cap bit can be set by the guest to bias the
517 * start of command processing into the buffer. If an error is
518 * encountered the errorOffset will still be relative to the specific
519 * PA, not biased by the offset. When the command buffer is finished
520 * the guest should not read the offset field as there is no guarantee
521 * what it will set to.
523 * When the SVGA_CAP_HP_CMD_QUEUE cap bit is set a new command queue
524 * SVGA_CB_CONTEXT_1 is available. Commands submitted to this queue
525 * will be executed as quickly as possible by the SVGA device
526 * potentially before already queued commands on SVGA_CB_CONTEXT_0.
527 * The SVGA device guarantees that any command buffers submitted to
528 * SVGA_CB_CONTEXT_0 will be executed after any _already_ submitted
529 * command buffers to SVGA_CB_CONTEXT_1.
532 #define SVGA_CB_MAX_SIZE (512 * 1024) /* 512 KB */
533 #define SVGA_CB_MAX_QUEUED_PER_CONTEXT 32
534 #define SVGA_CB_MAX_COMMAND_SIZE (32 * 1024) /* 32 KB */
536 #define SVGA_CB_CONTEXT_MASK 0x3f
538 SVGA_CB_CONTEXT_DEVICE = 0x3f,
539 SVGA_CB_CONTEXT_0 = 0x0,
540 SVGA_CB_CONTEXT_1 = 0x1, /* Supported with SVGA_CAP_HP_CMD_QUEUE */
541 SVGA_CB_CONTEXT_MAX = 0x2,
547 * The guest is supposed to write SVGA_CB_STATUS_NONE to the status
548 * field before submitting the command buffer header, the host will
549 * change the value when it is done with the command buffer.
551 SVGA_CB_STATUS_NONE = 0,
554 * Written by the host when a command buffer completes successfully.
555 * The device raises an IRQ with SVGA_IRQFLAG_COMMAND_BUFFER unless
556 * the SVGA_CB_FLAG_NO_IRQ flag is set.
558 SVGA_CB_STATUS_COMPLETED = 1,
561 * Written by the host synchronously with the command buffer
562 * submission to indicate the command buffer was not submitted. No
565 SVGA_CB_STATUS_QUEUE_FULL = 2,
568 * Written by the host when an error was detected parsing a command
569 * in the command buffer, errorOffset is written to contain the
570 * offset to the first byte of the failing command. The device
571 * raises the IRQ with both SVGA_IRQFLAG_ERROR and
572 * SVGA_IRQFLAG_COMMAND_BUFFER. Some of the commands may have been
575 SVGA_CB_STATUS_COMMAND_ERROR = 3,
578 * Written by the host if there is an error parsing the command
579 * buffer header. The device raises the IRQ with both
580 * SVGA_IRQFLAG_ERROR and SVGA_IRQFLAG_COMMAND_BUFFER. The device
581 * did not processes any of the command buffer.
583 SVGA_CB_STATUS_CB_HEADER_ERROR = 4,
586 * Written by the host if the guest requested the host to preempt
587 * the command buffer. The device will not raise any IRQs and the
588 * command buffer was not processed.
590 SVGA_CB_STATUS_PREEMPTED = 5,
593 * Written by the host synchronously with the command buffer
594 * submission to indicate the the command buffer was not submitted
595 * due to an error. No IRQ is raised.
597 SVGA_CB_STATUS_SUBMISSION_ERROR = 6,
600 * Written by the host when the host finished a
601 * SVGA_DC_CMD_ASYNC_STOP_QUEUE request for this command buffer
602 * queue. The offset of the first byte not processed is stored in
603 * the errorOffset field of the command buffer header. All guest
604 * visible side effects of commands till that point are guaranteed
605 * to be finished before this is written. The
606 * SVGA_IRQFLAG_COMMAND_BUFFER IRQ is raised as long as the
607 * SVGA_CB_FLAG_NO_IRQ is not set.
609 SVGA_CB_STATUS_PARTIAL_COMPLETE = 7,
613 SVGA_CB_FLAG_NONE = 0,
614 SVGA_CB_FLAG_NO_IRQ = 1 << 0,
615 SVGA_CB_FLAG_DX_CONTEXT = 1 << 1,
616 SVGA_CB_FLAG_MOB = 1 << 2,
620 #include "vmware_pack_begin.h"
622 volatile SVGACBStatus status; /* Modified by device. */
623 volatile uint32 errorOffset; /* Modified by device. */
634 uint32 offset; /* Valid if CMD_BUFFERS_2 cap set, must be zero otherwise,
635 * modified by device.
637 uint32 dxContext; /* Valid if DX_CONTEXT flag set, must be zero otherwise */
638 uint32 mustBeZero[6];
640 #include "vmware_pack_end.h"
645 SVGA_DC_CMD_START_STOP_CONTEXT = 1,
646 SVGA_DC_CMD_PREEMPT = 2,
647 SVGA_DC_CMD_START_QUEUE = 3, /* Requires SVGA_CAP_HP_CMD_QUEUE */
648 SVGA_DC_CMD_ASYNC_STOP_QUEUE = 4, /* Requires SVGA_CAP_HP_CMD_QUEUE */
649 SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE = 5, /* Requires SVGA_CAP_HP_CMD_QUEUE */
651 } SVGADeviceContextCmdId;
654 * Starts or stops both SVGA_CB_CONTEXT_0 and SVGA_CB_CONTEXT_1.
657 typedef struct SVGADCCmdStartStop {
659 SVGACBContext context; /* Must be zero */
660 } SVGADCCmdStartStop;
663 * SVGADCCmdPreempt --
665 * This command allows the guest to request that all command buffers
666 * on SVGA_CB_CONTEXT_0 be preempted that can be. After execution
667 * of this command all command buffers that were preempted will
668 * already have SVGA_CB_STATUS_PREEMPTED written into the status
669 * field. The device might still be processing a command buffer,
670 * assuming execution of it started before the preemption request was
671 * received. Specifying the ignoreIDZero flag to TRUE will cause the
672 * device to not preempt command buffers with the id field in the
673 * command buffer header set to zero.
676 typedef struct SVGADCCmdPreempt {
677 SVGACBContext context; /* Must be zero */
682 * Starts the requested command buffer processing queue. Valid only
683 * if the SVGA_CAP_HP_CMD_QUEUE cap is set.
685 * For a command queue to be considered runnable it must be enabled
686 * and any corresponding higher priority queues must also be enabled.
687 * For example in order for command buffers to be processed on
688 * SVGA_CB_CONTEXT_0 both SVGA_CB_CONTEXT_0 and SVGA_CB_CONTEXT_1 must
689 * be enabled. But for commands to be runnable on SVGA_CB_CONTEXT_1
690 * only that queue must be enabled.
693 typedef struct SVGADCCmdStartQueue {
694 SVGACBContext context;
695 } SVGADCCmdStartQueue;
698 * Requests the SVGA device to stop processing the requested command
699 * buffer queue as soon as possible. The guest knows the stop has
700 * completed when one of the following happens.
702 * 1) A command buffer status of SVGA_CB_STATUS_PARTIAL_COMPLETE is returned
703 * 2) A command buffer error is encountered with would stop the queue
704 * regardless of the async stop request.
705 * 3) All command buffers that have been submitted complete successfully.
706 * 4) The stop completes synchronously if no command buffers are
707 * active on the queue when it is issued.
709 * If the command queue is not in a runnable state there is no
710 * guarentee this async stop will finish. For instance if the high
711 * priority queue is not enabled and a stop is requested on the low
712 * priority queue, the high priority queue must be reenabled to
713 * guarantee that the async stop will finish.
715 * This command along with SVGA_DC_CMD_EMPTY_CONTEXT_QUEUE can be used
716 * to implement mid command buffer preemption.
718 * Valid only if the SVGA_CAP_HP_CMD_QUEUE cap is set.
721 typedef struct SVGADCCmdAsyncStopQueue {
722 SVGACBContext context;
723 } SVGADCCmdAsyncStopQueue;
726 * Requests the SVGA device to throw away any full command buffers on
727 * the requested command queue that have not been started. For a
728 * driver to know which command buffers were thrown away a driver
729 * should only issue this command when the queue is stopped, for
733 typedef struct SVGADCCmdEmptyQueue {
734 SVGACBContext context;
735 } SVGADCCmdEmptyQueue;
739 * SVGAGMRImageFormat --
741 * This is a packed representation of the source 2D image format
742 * for a GMR-to-screen blit. Currently it is defined as an encoding
743 * of the screen's color depth and bits-per-pixel, however, 16 bits
744 * are reserved for future use to identify other encodings (such as
745 * RGBA or higher-precision images).
747 * Currently supported formats:
749 * bpp depth Format Name
750 * --- ----- -----------
758 typedef struct SVGAGMRImageFormat {
761 uint32 bitsPerPixel : 8;
762 uint32 colorDepth : 8;
763 uint32 reserved : 16; /* Must be zero */
768 } SVGAGMRImageFormat;
771 #include "vmware_pack_begin.h"
772 struct SVGAGuestImage {
776 * A note on interpretation of pitch: This value of pitch is the
777 * number of bytes between vertically adjacent image
778 * blocks. Normally this is the number of bytes between the first
779 * pixel of two adjacent scanlines. With compressed textures,
780 * however, this may represent the number of bytes between
781 * compression blocks rather than between rows of pixels.
783 * XXX: Compressed textures currently must be tightly packed in guest memory.
785 * If the image is 1-dimensional, pitch is ignored.
787 * If 'pitch' is zero, the SVGA3D device calculates a pitch value
788 * assuming each row of blocks is tightly packed.
792 #include "vmware_pack_end.h"
798 * A 24-bit color format (BGRX), which does not depend on the
799 * format of the legacy guest framebuffer (GFB) or the current
803 typedef struct SVGAColorBGRX {
809 uint32 x : 8; /* Unused */
821 * Signed rectangle and point primitives. These are used by the new
822 * 2D primitives for drawing to Screen Objects, which can occupy a
823 * signed virtual coordinate space.
825 * SVGASignedRect specifies a half-open interval: the (left, top)
826 * pixel is part of the rectangle, but the (right, bottom) pixel is
831 #include "vmware_pack_begin.h"
838 #include "vmware_pack_end.h"
842 #include "vmware_pack_begin.h"
847 #include "vmware_pack_end.h"
852 * SVGA Device Capabilities
854 * Note the holes in the bitfield. Missing bits have been deprecated,
855 * and must not be reused. Those capabilities will never be reported
856 * by new versions of the SVGA device.
858 * SVGA_CAP_IRQMASK --
859 * Provides device interrupts. Adds device register SVGA_REG_IRQMASK
860 * to set interrupt mask and direct I/O port SVGA_IRQSTATUS_PORT to
861 * set/clear pending interrupts.
864 * Provides synchronous mapping of guest memory regions (GMR).
865 * Adds device registers SVGA_REG_GMR_ID, SVGA_REG_GMR_DESCRIPTOR,
866 * SVGA_REG_GMR_MAX_IDS, and SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH.
869 * Allows framebuffer trace-based updates even when FIFO is enabled.
870 * Adds device register SVGA_REG_TRACES.
873 * Provides asynchronous commands to define and remap guest memory
874 * regions. Adds device registers SVGA_REG_GMRS_MAX_PAGES and
875 * SVGA_REG_MEMORY_SIZE.
877 * SVGA_CAP_SCREEN_OBJECT_2 --
878 * Allow screen object support, and require backing stores from the
879 * guest for each screen object.
881 * SVGA_CAP_COMMAND_BUFFERS --
882 * Enable register based command buffer submission.
885 * This cap was incorrectly used by old drivers and should not be
888 * SVGA_CAP_CMD_BUFFERS_2 --
889 * Enable support for the prepend command buffer submision
890 * registers. SVGA_REG_CMD_PREPEND_LOW and
891 * SVGA_REG_CMD_PREPEND_HIGH.
893 * SVGA_CAP_GBOBJECTS --
894 * Enable guest-backed objects and surfaces.
897 * Enable support for DX commands, and command buffers in a mob.
899 * SVGA_CAP_HP_CMD_QUEUE --
900 * Enable support for the high priority command queue, and the
901 * ScreenCopy command.
903 * SVGA_CAP_NO_BB_RESTRICTION --
904 * Allow ScreenTargets to be defined without regard to the 32-bpp
905 * bounding-box memory restrictions. ie:
907 * The summed memory usage of all screens (assuming they were defined as
908 * 32-bpp) must always be less than the value of the
909 * SVGA_REG_MAX_PRIMARY_MEM register.
911 * If this cap is not present, the 32-bpp bounding box around all screens
912 * must additionally be under the value of the SVGA_REG_MAX_PRIMARY_MEM
915 * If the cap is present, the bounding box restriction is lifted (and only
916 * the screen-sum limit applies).
918 * (Note that this is a slight lie... there is still a sanity limit on any
919 * dimension of the topology to be less than SVGA_SCREEN_ROOT_LIMIT, even
920 * when SVGA_CAP_NO_BB_RESTRICTION is present, but that should be
921 * large enough to express any possible topology without holes between
924 * SVGA_CAP_CAP2_REGISTER --
925 * If this cap is present, the SVGA_REG_CAP2 register is supported.
928 #define SVGA_CAP_NONE 0x00000000
929 #define SVGA_CAP_RECT_COPY 0x00000002
930 #define SVGA_CAP_CURSOR 0x00000020
931 #define SVGA_CAP_CURSOR_BYPASS 0x00000040
932 #define SVGA_CAP_CURSOR_BYPASS_2 0x00000080
933 #define SVGA_CAP_8BIT_EMULATION 0x00000100
934 #define SVGA_CAP_ALPHA_CURSOR 0x00000200
935 #define SVGA_CAP_3D 0x00004000
936 #define SVGA_CAP_EXTENDED_FIFO 0x00008000
937 #define SVGA_CAP_MULTIMON 0x00010000
938 #define SVGA_CAP_PITCHLOCK 0x00020000
939 #define SVGA_CAP_IRQMASK 0x00040000
940 #define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000
941 #define SVGA_CAP_GMR 0x00100000
942 #define SVGA_CAP_TRACES 0x00200000
943 #define SVGA_CAP_GMR2 0x00400000
944 #define SVGA_CAP_SCREEN_OBJECT_2 0x00800000
945 #define SVGA_CAP_COMMAND_BUFFERS 0x01000000
946 #define SVGA_CAP_DEAD1 0x02000000
947 #define SVGA_CAP_CMD_BUFFERS_2 0x04000000
948 #define SVGA_CAP_GBOBJECTS 0x08000000
949 #define SVGA_CAP_DX 0x10000000
950 #define SVGA_CAP_HP_CMD_QUEUE 0x20000000
951 #define SVGA_CAP_NO_BB_RESTRICTION 0x40000000
952 #define SVGA_CAP_CAP2_REGISTER 0x80000000
955 * The SVGA_REG_CAP2 register is an additional set of SVGA capability bits.
957 * SVGA_CAP2_GROW_OTABLE --
958 * Allow the GrowOTable/DXGrowCOTable commands.
960 * SVGA_CAP2_INTRA_SURFACE_COPY --
961 * Allow the IntraSurfaceCopy command.
964 * Allow the DefineGBSurface_v3, WholeSurfaceCopy, WriteZeroSurface, and
965 * HintZeroSurface commands, and the SVGA_REG_GUEST_DRIVER_ID register.
967 * SVGA_CAP2_GB_MEMSIZE_2 --
968 * Allow the SVGA_REG_GBOBJECT_MEM_SIZE_KB register.
970 * SVGA_CAP2_SCREENDMA_REG --
971 * Allow the SVGA_REG_SCREENDMA register.
973 * SVGA_CAP2_OTABLE_PTDEPTH_2 --
974 * Allow 2 level page tables for OTable commands.
976 * SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT --
977 * Allow a stretch blt from a non-multisampled surface to a multisampled
980 * SVGA_CAP2_CURSOR_MOB --
981 * Allow the SVGA_REG_CURSOR_MOBID register.
983 * SVGA_CAP2_MSHINT --
984 * Allow the SVGA_REG_MSHINT register.
987 * Allows the DefineGBSurface_v4 command.
988 * Allows the DXDefineDepthStencilView_v2, DXDefineStreamOutputWithMob,
989 * and DXBindStreamOutput commands if 3D is also available.
990 * Allows the DXPredStagingCopy and DXStagingCopy commands if SM41
993 * SVGA_CAP2_RESERVED --
994 * Reserve the last bit for extending the SVGA capabilities to some
997 #define SVGA_CAP2_NONE 0x00000000
998 #define SVGA_CAP2_GROW_OTABLE 0x00000001
999 #define SVGA_CAP2_INTRA_SURFACE_COPY 0x00000002
1000 #define SVGA_CAP2_DX2 0x00000004
1001 #define SVGA_CAP2_GB_MEMSIZE_2 0x00000008
1002 #define SVGA_CAP2_SCREENDMA_REG 0x00000010
1003 #define SVGA_CAP2_OTABLE_PTDEPTH_2 0x00000020
1004 #define SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT 0x00000040
1005 #define SVGA_CAP2_CURSOR_MOB 0x00000080
1006 #define SVGA_CAP2_MSHINT 0x00000100
1007 #define SVGA_CAP2_DX3 0x00000400
1008 #define SVGA_CAP2_RESERVED 0x80000000
1012 * The Guest can optionally read some SVGA device capabilities through
1013 * the backdoor with command BDOOR_CMD_GET_SVGA_CAPABILITIES before
1014 * the SVGA device is initialized. The type of capability the guest
1015 * is requesting from the SVGABackdoorCapType enum should be placed in
1016 * the upper 16 bits of the backdoor command id (ECX). On success the
1017 * the value of EBX will be set to BDOOR_MAGIC and EAX will be set to
1018 * the requested capability. If the command is not supported then EBX
1019 * will be left unchanged and EAX will be set to -1. Because it is
1020 * possible that -1 is the value of the requested cap the correct way
1021 * to check if the command was successful is to check if EBX was changed
1022 * to BDOOR_MAGIC making sure to initialize the register to something
1027 SVGABackdoorCapDeviceCaps = 0,
1028 SVGABackdoorCapFifoCaps = 1,
1029 SVGABackdoorCap3dHWVersion = 2,
1030 SVGABackdoorCapDeviceCaps2 = 3,
1031 SVGABackdoorCapDevelCaps = 4,
1032 SVGABackdoorDevelRenderer = 5,
1033 SVGABackdoorCapMax = 6,
1034 } SVGABackdoorCapType;
1038 * FIFO register indices.
1040 * The FIFO is a chunk of device memory mapped into guest physmem. It
1041 * is always treated as 32-bit words.
1043 * The guest driver gets to decide how to partition it between
1044 * - FIFO registers (there are always at least 4, specifying where the
1045 * following data area is and how much data it contains; there may be
1046 * more registers following these, depending on the FIFO protocol
1048 * - FIFO data, written by the guest and slurped out by the VMX.
1049 * These indices are 32-bit word offsets into the FIFO.
1054 * Block 1 (basic registers): The originally defined FIFO registers.
1055 * These exist and are valid for all versions of the FIFO protocol.
1059 SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */
1064 * Block 2 (extended registers): Mandatory registers for the extended
1065 * FIFO. These exist if the SVGA caps register includes
1066 * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their
1067 * associated capability bit is enabled.
1069 * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied
1070 * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE.
1071 * This means that the guest has to test individually (in most cases
1072 * using FIFO caps) for the presence of registers after this; the VMX
1073 * can define "extended FIFO" to mean whatever it wants, and currently
1074 * won't enable it unless there's room for that set and much more.
1077 SVGA_FIFO_CAPABILITIES = 4,
1079 /* Valid with SVGA_FIFO_CAP_FENCE: */
1083 * Block 3a (optional extended registers): Additional registers for the
1084 * extended FIFO, whose presence isn't actually implied by
1085 * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to
1086 * leave room for them.
1088 * These in block 3a, the VMX currently considers mandatory for the
1092 /* Valid if exists (i.e. if extended FIFO enabled): */
1093 SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */
1094 /* Valid with SVGA_FIFO_CAP_PITCHLOCK: */
1095 SVGA_FIFO_PITCHLOCK,
1097 /* Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: */
1098 SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */
1099 SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */
1100 SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */
1101 SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */
1102 SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */
1104 /* Valid with SVGA_FIFO_CAP_RESERVE: */
1105 SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */
1108 * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2:
1110 * By default this is SVGA_ID_INVALID, to indicate that the cursor
1111 * coordinates are specified relative to the virtual root. If this
1112 * is set to a specific screen ID, cursor position is reinterpreted
1113 * as a signed offset relative to that screen's origin.
1115 SVGA_FIFO_CURSOR_SCREEN_ID,
1118 * Valid with SVGA_FIFO_CAP_DEAD
1120 * An arbitrary value written by the host, drivers should not use it.
1125 * Valid with SVGA_FIFO_CAP_3D_HWVERSION_REVISED:
1127 * Contains 3D HWVERSION (see SVGA3dHardwareVersion in svga3d_reg.h)
1128 * on platforms that can enforce graphics resource limits.
1130 SVGA_FIFO_3D_HWVERSION_REVISED,
1133 * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new
1134 * registers, but this must be done carefully and with judicious use of
1135 * capability bits, since comparisons based on SVGA_FIFO_MIN aren't
1136 * enough to tell you whether the register exists: we've shipped drivers
1137 * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of
1138 * the earlier ones. The actual order of introduction was:
1141 * - CURSOR_* (cursor bypass 3)
1143 * So, code that wants to know whether it can use any of the
1144 * aforementioned registers, or anything else added after PITCHLOCK and
1145 * before 3D_CAPS, needs to reason about something other than
1150 * 3D caps block space; valid with 3D hardware version >=
1151 * SVGA3D_HWVERSION_WS6_B1.
1153 SVGA_FIFO_3D_CAPS = 32,
1154 SVGA_FIFO_3D_CAPS_LAST = 32 + 255,
1157 * End of VMX's current definition of "extended-FIFO registers".
1158 * Registers before here are always enabled/disabled as a block; either
1159 * the extended FIFO is enabled and includes all preceding registers, or
1160 * it's disabled entirely.
1162 * Block 3b (truly optional extended registers): Additional registers for
1163 * the extended FIFO, which the VMX already knows how to enable and
1164 * disable with correct granularity.
1166 * Registers after here exist if and only if the guest SVGA driver
1167 * sets SVGA_FIFO_MIN high enough to leave room for them.
1170 /* Valid if register exists: */
1171 SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */
1172 SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */
1173 SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */
1176 * Always keep this last. This defines the maximum number of
1177 * registers we know about. At power-on, this value is placed in
1178 * the SVGA_REG_MEM_REGS register, and we expect the guest driver
1179 * to allocate this much space in FIFO memory for registers.
1186 * Definition of registers included in extended FIFO support.
1188 * The guest SVGA driver gets to allocate the FIFO between registers
1189 * and data. It must always allocate at least 4 registers, but old
1190 * drivers stopped there.
1192 * The VMX will enable extended FIFO support if and only if the guest
1193 * left enough room for all registers defined as part of the mandatory
1194 * set for the extended FIFO.
1196 * Note that the guest drivers typically allocate the FIFO only at
1197 * initialization time, not at mode switches, so it's likely that the
1198 * number of FIFO registers won't change without a reboot.
1200 * All registers less than this value are guaranteed to be present if
1201 * svgaUser->fifo.extended is set. Any later registers must be tested
1202 * individually for compatibility at each use (in the VMX).
1204 * This value is used only by the VMX, so it can change without
1205 * affecting driver compatibility; keep it that way?
1207 #define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)
1211 * FIFO Synchronization Registers
1215 * The SYNC register can be used by the guest driver to signal to the
1216 * device that the guest driver is waiting for previously submitted
1217 * commands to complete.
1219 * When the guest driver writes to the SYNC register, the device sets
1220 * the BUSY register to TRUE, and starts processing the submitted commands
1221 * (if it was not already doing so). When all previously submitted
1222 * commands are finished and the device is idle again, it sets the BUSY
1223 * register back to FALSE. (If the guest driver submits new commands
1224 * after writing the SYNC register, the new commands are not guaranteed
1225 * to have been procesesd.)
1227 * When guest drivers are submitting commands using the FIFO, the device
1228 * periodically polls to check for new FIFO commands when idle, which may
1229 * introduce a delay in command processing. If the guest-driver wants
1230 * the commands to be processed quickly (which it typically does), it
1231 * should write SYNC after each batch of commands is committed to the
1232 * FIFO to immediately wake up the device. For even better performance,
1233 * the guest can use the SVGA_FIFO_BUSY register to avoid these extra
1234 * SYNC writes if the device is already active, using the technique known
1235 * as "Ringing the Doorbell" (described below). (Note that command
1236 * buffer submission implicitly wakes up the device, and so doesn't
1237 * suffer from this problem.)
1239 * The SYNC register can also be used in combination with BUSY to
1240 * synchronously ensure that all SVGA commands are processed (with both
1241 * the FIFO and command-buffers). To do this, the guest driver should
1242 * write to SYNC, and then loop reading BUSY until BUSY returns FALSE.
1243 * This technique is known as a "Legacy Sync".
1247 * This register is set to TRUE when SVGA_REG_SYNC is written,
1248 * and is set back to FALSE when the device has finished processing
1249 * all commands and is idle again.
1251 * Every read from the BUSY reigster will block for an undefined
1252 * amount of time (normally until the device finishes some interesting
1253 * work unit), or the device is idle.
1255 * Guest drivers can also do a partial Legacy Sync to check for some
1256 * particular condition, for instance by stopping early when a fence
1257 * passes before BUSY has been set back to FALSE. This is particularly
1258 * useful if the guest-driver knows that it is blocked waiting on the
1259 * device, because it will yield CPU time back to the host.
1263 * The SVGA_FIFO_BUSY register is a fast way for the guest driver to check
1264 * whether the device is actively processing FIFO commands before writing
1265 * the more expensive SYNC register.
1267 * If this register reads as TRUE, the device is actively processing
1270 * If this register reads as FALSE, the device may not be actively
1271 * processing commands, and the guest driver should try
1272 * "Ringing the Doorbell".
1274 * To Ring the Doorbell, the guest should:
1276 * 1. Have already written their batch of commands into the FIFO.
1277 * 2. Check if the SVGA_FIFO_BUSY register is available by reading
1279 * 3. Read SVGA_FIFO_BUSY. If it reads as TRUE, the device is actively
1280 * processing FIFO commands, and no further action is necessary.
1281 * 4. If SVGA_FIFO_BUSY was FALSE, write TRUE to SVGA_REG_SYNC.
1283 * For maximum performance, this procedure should be followed after
1284 * every meaningful batch of commands has been written into the FIFO.
1285 * (Normally when the underlying application signals it's finished a
1286 * meaningful work unit by calling Flush.)
1293 * Fence -- Fence register and command are supported
1294 * Accel Front -- Front buffer only commands are supported
1295 * Pitch Lock -- Pitch lock register is supported
1296 * Video -- SVGA Video overlay units are supported
1297 * Escape -- Escape command is supported
1299 * SVGA_FIFO_CAP_SCREEN_OBJECT --
1301 * Provides dynamic multi-screen rendering, for improved Unity and
1302 * multi-monitor modes. With Screen Object, the guest can
1303 * dynamically create and destroy 'screens', which can represent
1304 * Unity windows or virtual monitors. Screen Object also provides
1305 * strong guarantees that DMA operations happen only when
1306 * guest-initiated. Screen Object deprecates the BAR1 guest
1307 * framebuffer (GFB) and all commands that work only with the GFB.
1310 * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID
1313 * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN,
1314 * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY
1317 * BLIT_SURFACE_TO_SCREEN
1321 * - The host will not read or write guest memory, including the GFB,
1322 * except when explicitly initiated by a DMA command.
1324 * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK,
1325 * is guaranteed to complete before any subsequent FENCEs.
1327 * - All legacy commands which affect a Screen (UPDATE, PRESENT,
1328 * PRESENT_READBACK) as well as new Screen blit commands will
1329 * all behave consistently as blits, and memory will be read
1330 * or written in FIFO order.
1332 * For example, if you PRESENT from one SVGA3D surface to multiple
1333 * places on the screen, the data copied will always be from the
1334 * SVGA3D surface at the time the PRESENT was issued in the FIFO.
1335 * This was not necessarily true on devices without Screen Object.
1337 * This means that on devices that support Screen Object, the
1338 * PRESENT_READBACK command should not be necessary unless you
1339 * actually want to read back the results of 3D rendering into
1340 * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB
1341 * command provides a strict superset of functionality.)
1343 * - When a screen is resized, either using Screen Object commands or
1344 * legacy multimon registers, its contents are preserved.
1346 * SVGA_FIFO_CAP_GMR2 --
1348 * Provides new commands to define and remap guest memory regions (GMR).
1351 * DEFINE_GMR2, REMAP_GMR2.
1353 * SVGA_FIFO_CAP_3D_HWVERSION_REVISED --
1355 * Indicates new register SVGA_FIFO_3D_HWVERSION_REVISED exists.
1356 * This register may replace SVGA_FIFO_3D_HWVERSION on platforms
1357 * that enforce graphics resource limits. This allows the platform
1358 * to clear SVGA_FIFO_3D_HWVERSION and disable 3D in legacy guest
1359 * drivers that do not limit their resources.
1361 * Note this is an alias to SVGA_FIFO_CAP_GMR2 because these indicators
1362 * are codependent (and thus we use a single capability bit).
1364 * SVGA_FIFO_CAP_SCREEN_OBJECT_2 --
1366 * Modifies the DEFINE_SCREEN command to include a guest provided
1367 * backing store in GMR memory and the bytesPerLine for the backing
1368 * store. This capability requires the use of a backing store when
1369 * creating screen objects. However if SVGA_FIFO_CAP_SCREEN_OBJECT
1370 * is present then backing stores are optional.
1372 * SVGA_FIFO_CAP_DEAD --
1374 * Drivers should not use this cap bit. This cap bit can not be
1375 * reused since some hosts already expose it.
1378 #define SVGA_FIFO_CAP_NONE 0
1379 #define SVGA_FIFO_CAP_FENCE (1<<0)
1380 #define SVGA_FIFO_CAP_ACCELFRONT (1<<1)
1381 #define SVGA_FIFO_CAP_PITCHLOCK (1<<2)
1382 #define SVGA_FIFO_CAP_VIDEO (1<<3)
1383 #define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4)
1384 #define SVGA_FIFO_CAP_ESCAPE (1<<5)
1385 #define SVGA_FIFO_CAP_RESERVE (1<<6)
1386 #define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7)
1387 #define SVGA_FIFO_CAP_GMR2 (1<<8)
1388 #define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2
1389 #define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1<<9)
1390 #define SVGA_FIFO_CAP_DEAD (1<<10)
1396 * Accel Front -- Driver should use front buffer only commands
1399 #define SVGA_FIFO_FLAG_NONE 0
1400 #define SVGA_FIFO_FLAG_ACCELFRONT (1<<0)
1401 #define SVGA_FIFO_FLAG_RESERVED (1<<31) /* Internal use only */
1404 * FIFO reservation sentinel value
1407 #define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff
1411 * ScreenDMA Register Values
1414 #define SVGA_SCREENDMA_REG_UNDEFINED 0
1415 #define SVGA_SCREENDMA_REG_NOT_PRESENT 1
1416 #define SVGA_SCREENDMA_REG_PRESENT 2
1417 #define SVGA_SCREENDMA_REG_MAX 3
1420 * Video overlay support
1423 #define SVGA_NUM_OVERLAY_UNITS 32
1427 * Video capabilities that the guest is currently using
1430 #define SVGA_VIDEO_FLAG_COLORKEY 0x0001
1434 * Offsets for the video overlay registers
1438 SVGA_VIDEO_ENABLED = 0,
1440 SVGA_VIDEO_DATA_OFFSET,
1442 SVGA_VIDEO_COLORKEY,
1443 SVGA_VIDEO_SIZE, /* Deprecated */
1448 SVGA_VIDEO_SRC_WIDTH,
1449 SVGA_VIDEO_SRC_HEIGHT,
1450 SVGA_VIDEO_DST_X, /* Signed int32 */
1451 SVGA_VIDEO_DST_Y, /* Signed int32 */
1452 SVGA_VIDEO_DST_WIDTH,
1453 SVGA_VIDEO_DST_HEIGHT,
1457 SVGA_VIDEO_DATA_GMRID, /* Optional, defaults to SVGA_GMR_FRAMEBUFFER */
1458 SVGA_VIDEO_DST_SCREEN_ID, /* Optional, defaults to virtual coords */
1459 /* (SVGA_ID_INVALID) */
1465 * SVGA Overlay Units
1467 * width and height relate to the entire source video frame.
1468 * srcX, srcY, srcWidth and srcHeight represent subset of the source
1469 * video frame to be displayed.
1473 #include "vmware_pack_begin.h"
1474 struct SVGAOverlayUnit {
1495 #include "vmware_pack_end.h"
1500 * Guest display topology
1502 * XXX: This structure is not part of the SVGA device's interface, and
1503 * doesn't really belong here.
1505 #define SVGA_INVALID_DISPLAY_ID ((uint32)-1)
1507 typedef struct SVGADisplayTopology {
1514 } SVGADisplayTopology;
1518 * SVGAScreenObject --
1520 * This is a new way to represent a guest's multi-monitor screen or
1521 * Unity window. Screen objects are only supported if the
1522 * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set.
1524 * If Screen Objects are supported, they can be used to fully
1525 * replace the functionality provided by the framebuffer registers
1526 * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY.
1528 * The screen object is a struct with guaranteed binary
1529 * compatibility. New flags can be added, and the struct may grow,
1530 * but existing fields must retain their meaning.
1532 * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2 are required fields of
1533 * a SVGAGuestPtr that is used to back the screen contents. This
1534 * memory must come from the GFB. The guest is not allowed to
1535 * access the memory and doing so will have undefined results. The
1536 * backing store is required to be page aligned and the size is
1537 * padded to the next page boundry. The number of pages is:
1538 * (bytesPerLine * size.width * 4 + PAGE_SIZE - 1) / PAGE_SIZE
1540 * The pitch in the backingStore is required to be at least large
1541 * enough to hold a 32bbp scanline. It is recommended that the
1542 * driver pad bytesPerLine for a potential performance win.
1544 * The cloneCount field is treated as a hint from the guest that
1545 * the user wants this display to be cloned, countCount times. A
1546 * value of zero means no cloning should happen.
1549 #define SVGA_SCREEN_MUST_BE_SET (1 << 0)
1550 #define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET /* Deprecated */
1551 #define SVGA_SCREEN_IS_PRIMARY (1 << 1)
1552 #define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2)
1555 * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When the screen is
1556 * deactivated the base layer is defined to lose all contents and
1557 * become black. When a screen is deactivated the backing store is
1558 * optional. When set backingPtr and bytesPerLine will be ignored.
1560 #define SVGA_SCREEN_DEACTIVATE (1 << 3)
1563 * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When this flag is set
1564 * the screen contents will be outputted as all black to the user
1565 * though the base layer contents is preserved. The screen base layer
1566 * can still be read and written to like normal though the no visible
1567 * effect will be seen by the user. When the flag is changed the
1568 * screen will be blanked or redrawn to the current contents as needed
1569 * without any extra commands from the driver. This flag only has an
1570 * effect when the screen is not deactivated.
1572 #define SVGA_SCREEN_BLANKING (1 << 4)
1575 #include "vmware_pack_begin.h"
1577 uint32 structSize; /* sizeof(SVGAScreenObject) */
1590 * Added and required by SVGA_FIFO_CAP_SCREEN_OBJECT_2, optional
1591 * with SVGA_FIFO_CAP_SCREEN_OBJECT.
1593 SVGAGuestImage backingStore;
1596 * The cloneCount field is treated as a hint from the guest that
1597 * the user wants this display to be cloned, cloneCount times.
1599 * A value of zero means no cloning should happen.
1603 #include "vmware_pack_end.h"
1608 * Commands in the command FIFO:
1610 * Command IDs defined below are used for the traditional 2D FIFO
1611 * communication (not all commands are available for all versions of the
1612 * SVGA FIFO protocol).
1614 * Note the holes in the command ID numbers: These commands have been
1615 * deprecated, and the old IDs must not be reused.
1617 * Command IDs from 1000 to 2999 are reserved for use by the SVGA3D
1620 * Each command's parameters are described by the comments and
1625 SVGA_CMD_INVALID_CMD = 0,
1626 SVGA_CMD_UPDATE = 1,
1627 SVGA_CMD_RECT_COPY = 3,
1628 SVGA_CMD_RECT_ROP_COPY = 14,
1629 SVGA_CMD_DEFINE_CURSOR = 19,
1630 SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,
1631 SVGA_CMD_UPDATE_VERBOSE = 25,
1632 SVGA_CMD_FRONT_ROP_FILL = 29,
1633 SVGA_CMD_FENCE = 30,
1634 SVGA_CMD_ESCAPE = 33,
1635 SVGA_CMD_DEFINE_SCREEN = 34,
1636 SVGA_CMD_DESTROY_SCREEN = 35,
1637 SVGA_CMD_DEFINE_GMRFB = 36,
1638 SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,
1639 SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,
1640 SVGA_CMD_ANNOTATION_FILL = 39,
1641 SVGA_CMD_ANNOTATION_COPY = 40,
1642 SVGA_CMD_DEFINE_GMR2 = 41,
1643 SVGA_CMD_REMAP_GMR2 = 42,
1645 SVGA_CMD_DEAD_2 = 44,
1647 SVGA_CMD_NOP_ERROR = 46,
1651 #define SVGA_CMD_MAX_DATASIZE (256 * 1024)
1652 #define SVGA_CMD_MAX_ARGS 64
1656 * SVGA_CMD_UPDATE --
1658 * This is a DMA transfer which copies from the Guest Framebuffer
1659 * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which
1660 * intersect with the provided virtual rectangle.
1662 * This command does not support using arbitrary guest memory as a
1663 * data source- it only works with the pre-defined GFB memory.
1664 * This command also does not support signed virtual coordinates.
1665 * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with
1666 * negative root x/y coordinates, the negative portion of those
1667 * screens will not be reachable by this command.
1669 * This command is not necessary when using framebuffer
1670 * traces. Traces are automatically enabled if the SVGA FIFO is
1671 * disabled, and you may explicitly enable/disable traces using
1672 * SVGA_REG_TRACES. With traces enabled, any write to the GFB will
1673 * automatically act as if a subsequent SVGA_CMD_UPDATE was issued.
1675 * Traces and SVGA_CMD_UPDATE are the only supported ways to render
1676 * pseudocolor screen updates. The newer Screen Object commands
1677 * only support true color formats.
1684 #include "vmware_pack_begin.h"
1691 #include "vmware_pack_end.h"
1696 * SVGA_CMD_RECT_COPY --
1698 * Perform a rectangular DMA transfer from one area of the GFB to
1699 * another, and copy the result to any screens which intersect it.
1702 * SVGA_CAP_RECT_COPY
1706 #include "vmware_pack_begin.h"
1715 #include "vmware_pack_end.h"
1716 SVGAFifoCmdRectCopy;
1720 * SVGA_CMD_RECT_ROP_COPY --
1722 * Perform a rectangular DMA transfer from one area of the GFB to
1723 * another, and copy the result to any screens which intersect it.
1724 * The value of ROP may only be SVGA_ROP_COPY, and this command is
1725 * only supported for backwards compatibility reasons.
1728 * SVGA_CAP_RECT_COPY
1732 #include "vmware_pack_begin.h"
1742 #include "vmware_pack_end.h"
1743 SVGAFifoCmdRectRopCopy;
1747 * SVGA_CMD_DEFINE_CURSOR --
1749 * Provide a new cursor image, as an AND/XOR mask.
1751 * The recommended way to position the cursor overlay is by using
1752 * the SVGA_FIFO_CURSOR_* registers, supported by the
1753 * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
1760 #include "vmware_pack_begin.h"
1762 uint32 id; /* Reserved, must be zero. */
1767 uint32 andMaskDepth; /* Value must be 1 or equal to BITS_PER_PIXEL */
1768 uint32 xorMaskDepth; /* Value must be 1 or equal to BITS_PER_PIXEL */
1770 * Followed by scanline data for AND mask, then XOR mask.
1771 * Each scanline is padded to a 32-bit boundary.
1774 #include "vmware_pack_end.h"
1775 SVGAFifoCmdDefineCursor;
1779 * SVGA_CMD_DEFINE_ALPHA_CURSOR --
1781 * Provide a new cursor image, in 32-bit BGRA format.
1783 * The recommended way to position the cursor overlay is by using
1784 * the SVGA_FIFO_CURSOR_* registers, supported by the
1785 * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.
1788 * SVGA_CAP_ALPHA_CURSOR
1792 #include "vmware_pack_begin.h"
1794 uint32 id; /* Reserved, must be zero. */
1799 /* Followed by scanline data */
1801 #include "vmware_pack_end.h"
1802 SVGAFifoCmdDefineAlphaCursor;
1806 * Provide a new large cursor image, as an AND/XOR mask.
1808 * Should only be used for CursorMob functionality
1812 #include "vmware_pack_begin.h"
1818 uint32 andMaskDepth;
1819 uint32 xorMaskDepth;
1821 * Followed by scanline data for AND mask, then XOR mask.
1822 * Each scanline is padded to a 32-bit boundary.
1825 #include "vmware_pack_end.h"
1826 SVGAGBColorCursorHeader;
1830 * Provide a new large cursor image, in 32-bit BGRA format.
1832 * Should only be used for CursorMob functionality
1836 #include "vmware_pack_begin.h"
1842 /* Followed by scanline data */
1844 #include "vmware_pack_end.h"
1845 SVGAGBAlphaCursorHeader;
1848 * Define the SVGA guest backed cursor types
1852 SVGA_COLOR_CURSOR = 0,
1853 SVGA_ALPHA_CURSOR = 1,
1857 * Provide a new large cursor image.
1859 * Should only be used for CursorMob functionality
1863 #include "vmware_pack_begin.h"
1865 SVGAGBCursorType type;
1867 SVGAGBColorCursorHeader colorHeader;
1868 SVGAGBAlphaCursorHeader alphaHeader;
1872 * Followed by the cursor data
1875 #include "vmware_pack_end.h"
1880 * SVGA_CMD_UPDATE_VERBOSE --
1882 * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle
1883 * 'reason' value, an opaque cookie which is used by internal
1884 * debugging tools. Third party drivers should not use this
1888 * SVGA_CAP_EXTENDED_FIFO
1892 #include "vmware_pack_begin.h"
1900 #include "vmware_pack_end.h"
1901 SVGAFifoCmdUpdateVerbose;
1905 * SVGA_CMD_FRONT_ROP_FILL --
1907 * This is a hint which tells the SVGA device that the driver has
1908 * just filled a rectangular region of the GFB with a solid
1909 * color. Instead of reading these pixels from the GFB, the device
1910 * can assume that they all equal 'color'. This is primarily used
1911 * for remote desktop protocols.
1914 * SVGA_FIFO_CAP_ACCELFRONT
1917 #define SVGA_ROP_COPY 0x03
1920 #include "vmware_pack_begin.h"
1922 uint32 color; /* In the same format as the GFB */
1927 uint32 rop; /* Must be SVGA_ROP_COPY */
1929 #include "vmware_pack_end.h"
1930 SVGAFifoCmdFrontRopFill;
1936 * Insert a synchronization fence. When the SVGA device reaches
1937 * this command, it will copy the 'fence' value into the
1938 * SVGA_FIFO_FENCE register. It will also compare the fence against
1939 * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the
1940 * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will
1941 * raise this interrupt.
1944 * SVGA_FIFO_FENCE for this command,
1945 * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL.
1949 #include "vmware_pack_begin.h"
1953 #include "vmware_pack_end.h"
1958 * SVGA_CMD_ESCAPE --
1960 * Send an extended or vendor-specific variable length command.
1961 * This is used for video overlay, third party plugins, and
1962 * internal debugging tools. See svga_escape.h
1965 * SVGA_FIFO_CAP_ESCAPE
1969 #include "vmware_pack_begin.h"
1973 /* followed by 'size' bytes of data */
1975 #include "vmware_pack_end.h"
1980 * SVGA_CMD_DEFINE_SCREEN --
1982 * Define or redefine an SVGAScreenObject. See the description of
1983 * SVGAScreenObject above. The video driver is responsible for
1984 * generating new screen IDs. They should be small positive
1985 * integers. The virtual device will have an implementation
1986 * specific upper limit on the number of screen IDs
1987 * supported. Drivers are responsible for recycling IDs. The first
1990 * - Interaction with other registers:
1992 * For backwards compatibility, when the GFB mode registers (WIDTH,
1993 * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device
1994 * deletes all screens other than screen #0, and redefines screen
1995 * #0 according to the specified mode. Drivers that use
1996 * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0.
1998 * If you use screen objects, do not use the legacy multi-mon
1999 * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*).
2002 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2006 #include "vmware_pack_begin.h"
2008 SVGAScreenObject screen; /* Variable-length according to version */
2010 #include "vmware_pack_end.h"
2011 SVGAFifoCmdDefineScreen;
2015 * SVGA_CMD_DESTROY_SCREEN --
2017 * Destroy an SVGAScreenObject. Its ID is immediately available for
2021 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2025 #include "vmware_pack_begin.h"
2029 #include "vmware_pack_end.h"
2030 SVGAFifoCmdDestroyScreen;
2034 * SVGA_CMD_DEFINE_GMRFB --
2036 * This command sets a piece of SVGA device state called the
2037 * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a
2038 * piece of light-weight state which identifies the location and
2039 * format of an image in guest memory or in BAR1. The GMRFB has
2040 * an arbitrary size, and it doesn't need to match the geometry
2041 * of the GFB or any screen object.
2043 * The GMRFB can be redefined as often as you like. You could
2044 * always use the same GMRFB, you could redefine it before
2045 * rendering from a different guest screen, or you could even
2046 * redefine it before every blit.
2048 * There are multiple ways to use this command. The simplest way is
2049 * to use it to move the framebuffer either to elsewhere in the GFB
2050 * (BAR1) memory region, or to a user-defined GMR. This lets a
2051 * driver use a framebuffer allocated entirely out of normal system
2052 * memory, which we encourage.
2054 * Another way to use this command is to set up a ring buffer of
2055 * updates in GFB memory. If a driver wants to ensure that no
2056 * frames are skipped by the SVGA device, it is important that the
2057 * driver not modify the source data for a blit until the device is
2058 * done processing the command. One efficient way to accomplish
2059 * this is to use a ring of small DMA buffers. Each buffer is used
2060 * for one blit, then we move on to the next buffer in the
2061 * ring. The FENCE mechanism is used to protect each buffer from
2062 * re-use until the device is finished with that buffer's
2063 * corresponding blit.
2065 * This command does not affect the meaning of SVGA_CMD_UPDATE.
2066 * UPDATEs always occur from the legacy GFB memory area. This
2067 * command has no support for pseudocolor GMRFBs. Currently only
2068 * true-color 15, 16, and 24-bit depths are supported. Future
2069 * devices may expose capabilities for additional framebuffer
2072 * The default GMRFB value is undefined. Drivers must always send
2073 * this command at least once before performing any blit from the
2077 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2081 #include "vmware_pack_begin.h"
2084 uint32 bytesPerLine;
2085 SVGAGMRImageFormat format;
2087 #include "vmware_pack_end.h"
2088 SVGAFifoCmdDefineGMRFB;
2092 * SVGA_CMD_BLIT_GMRFB_TO_SCREEN --
2094 * This is a guest-to-host blit. It performs a DMA operation to
2095 * copy a rectangular region of pixels from the current GMRFB to
2098 * The destination coordinate may be specified relative to a
2099 * screen's origin. The provided screen ID must be valid.
2101 * The SVGA device is guaranteed to finish reading from the GMRFB
2102 * by the time any subsequent FENCE commands are reached.
2104 * This command consumes an annotation. See the
2105 * SVGA_CMD_ANNOTATION_* commands for details.
2108 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2112 #include "vmware_pack_begin.h"
2114 SVGASignedPoint srcOrigin;
2115 SVGASignedRect destRect;
2116 uint32 destScreenId;
2118 #include "vmware_pack_end.h"
2119 SVGAFifoCmdBlitGMRFBToScreen;
2123 * SVGA_CMD_BLIT_SCREEN_TO_GMRFB --
2125 * This is a host-to-guest blit. It performs a DMA operation to
2126 * copy a rectangular region of pixels from a single ScreenObject
2127 * back to the current GMRFB.
2129 * The source coordinate is specified relative to a screen's
2130 * origin. The provided screen ID must be valid. If any parameters
2131 * are invalid, the resulting pixel values are undefined.
2133 * The SVGA device is guaranteed to finish writing to the GMRFB by
2134 * the time any subsequent FENCE commands are reached.
2137 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2141 #include "vmware_pack_begin.h"
2143 SVGASignedPoint destOrigin;
2144 SVGASignedRect srcRect;
2147 #include "vmware_pack_end.h"
2148 SVGAFifoCmdBlitScreenToGMRFB;
2152 * SVGA_CMD_ANNOTATION_FILL --
2154 * The annotation commands have been deprecated, should not be used
2155 * by new drivers. They used to provide performance hints to the SVGA
2156 * device about the content of screen updates, but newer SVGA devices
2160 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2164 #include "vmware_pack_begin.h"
2166 SVGAColorBGRX color;
2168 #include "vmware_pack_end.h"
2169 SVGAFifoCmdAnnotationFill;
2173 * SVGA_CMD_ANNOTATION_COPY --
2175 * The annotation commands have been deprecated, should not be used
2176 * by new drivers. They used to provide performance hints to the SVGA
2177 * device about the content of screen updates, but newer SVGA devices
2181 * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2
2185 #include "vmware_pack_begin.h"
2187 SVGASignedPoint srcOrigin;
2190 #include "vmware_pack_end.h"
2191 SVGAFifoCmdAnnotationCopy;
2195 * SVGA_CMD_DEFINE_GMR2 --
2197 * Define guest memory region v2. See the description of GMRs above.
2204 #include "vmware_pack_begin.h"
2209 #include "vmware_pack_end.h"
2210 SVGAFifoCmdDefineGMR2;
2214 * SVGA_CMD_REMAP_GMR2 --
2216 * Remap guest memory region v2. See the description of GMRs above.
2218 * This command allows guest to modify a portion of an existing GMR by
2219 * invalidating it or reassigning it to different guest physical pages.
2220 * The pages are identified by physical page number (PPN). The pages
2221 * are assumed to be pinned and valid for DMA operations.
2223 * Description of command flags:
2225 * SVGA_REMAP_GMR2_VIA_GMR: If enabled, references a PPN list in a GMR.
2226 * The PPN list must not overlap with the remap region (this can be
2227 * handled trivially by referencing a separate GMR). If flag is
2228 * disabled, PPN list is appended to SVGARemapGMR command.
2230 * SVGA_REMAP_GMR2_PPN64: If set, PPN list is in PPN64 format, otherwise
2231 * it is in PPN32 format.
2233 * SVGA_REMAP_GMR2_SINGLE_PPN: If set, PPN list contains a single entry.
2234 * A single PPN can be used to invalidate a portion of a GMR or
2235 * map it to to a single guest scratch page.
2242 SVGA_REMAP_GMR2_PPN32 = 0,
2243 SVGA_REMAP_GMR2_VIA_GMR = (1 << 0),
2244 SVGA_REMAP_GMR2_PPN64 = (1 << 1),
2245 SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2),
2246 } SVGARemapGMR2Flags;
2249 #include "vmware_pack_begin.h"
2252 SVGARemapGMR2Flags flags;
2253 uint32 offsetPages; /* offset in pages to begin remap */
2254 uint32 numPages; /* number of pages to remap */
2256 * Followed by additional data depending on SVGARemapGMR2Flags.
2258 * If flag SVGA_REMAP_GMR2_VIA_GMR is set, single SVGAGuestPtr follows.
2259 * Otherwise an array of page descriptors in PPN32 or PPN64 format
2260 * (according to flag SVGA_REMAP_GMR2_PPN64) follows. If flag
2261 * SVGA_REMAP_GMR2_SINGLE_PPN is set, array contains a single entry.
2264 #include "vmware_pack_end.h"
2265 SVGAFifoCmdRemapGMR2;
2269 * Size of SVGA device memory such as frame buffer and FIFO.
2271 #define SVGA_VRAM_MIN_SIZE (4 * 640 * 480) /* bytes */
2272 #define SVGA_VRAM_MIN_SIZE_3D (16 * 1024 * 1024)
2273 #define SVGA_VRAM_MAX_SIZE (128 * 1024 * 1024)
2274 #define SVGA_MEMORY_SIZE_MAX (1024 * 1024 * 1024)
2275 #define SVGA_FIFO_SIZE_MAX (2 * 1024 * 1024)
2276 #define SVGA_GRAPHICS_MEMORY_KB_MIN (32 * 1024)
2277 #define SVGA_GRAPHICS_MEMORY_KB_MAX_2GB (2 * 1024 * 1024)
2278 #define SVGA_GRAPHICS_MEMORY_KB_MAX_3GB (3 * 1024 * 1024)
2279 #define SVGA_GRAPHICS_MEMORY_KB_MAX_4GB (4 * 1024 * 1024)
2280 #define SVGA_GRAPHICS_MEMORY_KB_MAX_8GB (8 * 1024 * 1024)
2281 #define SVGA_GRAPHICS_MEMORY_KB_DEFAULT (256 * 1024)
2283 #define SVGA_VRAM_SIZE_W2K (64 * 1024 * 1024) /* 64 MB */
2285 #if defined(VMX86_SERVER)
2286 #define SVGA_VRAM_SIZE (4 * 1024 * 1024)
2287 #define SVGA_VRAM_SIZE_3D (64 * 1024 * 1024)
2288 #define SVGA_FIFO_SIZE (256 * 1024)
2289 #define SVGA_FIFO_SIZE_3D (516 * 1024)
2290 #define SVGA_MEMORY_SIZE_DEFAULT (160 * 1024 * 1024)
2291 #define SVGA_AUTODETECT_DEFAULT FALSE
2293 #define SVGA_VRAM_SIZE (16 * 1024 * 1024)
2294 #define SVGA_VRAM_SIZE_3D SVGA_VRAM_MAX_SIZE
2295 #define SVGA_FIFO_SIZE (2 * 1024 * 1024)
2296 #define SVGA_FIFO_SIZE_3D SVGA_FIFO_SIZE
2297 #define SVGA_MEMORY_SIZE_DEFAULT (768 * 1024 * 1024)
2298 #define SVGA_AUTODETECT_DEFAULT TRUE
2301 #define SVGA_FIFO_SIZE_GBOBJECTS (256 * 1024)
2302 #define SVGA_VRAM_SIZE_GBOBJECTS (4 * 1024 * 1024)
2304 #define SVGA_PCI_REGS_PAGES (1)