13bfa90b6Smrg/********************************************************** 23bfa90b6Smrg * Copyright 1998-2009 VMware, Inc. All rights reserved. 33bfa90b6Smrg * 43bfa90b6Smrg * Permission is hereby granted, free of charge, to any person 53bfa90b6Smrg * obtaining a copy of this software and associated documentation 63bfa90b6Smrg * files (the "Software"), to deal in the Software without 73bfa90b6Smrg * restriction, including without limitation the rights to use, copy, 83bfa90b6Smrg * modify, merge, publish, distribute, sublicense, and/or sell copies 93bfa90b6Smrg * of the Software, and to permit persons to whom the Software is 103bfa90b6Smrg * furnished to do so, subject to the following conditions: 113bfa90b6Smrg * 123bfa90b6Smrg * The above copyright notice and this permission notice shall be 133bfa90b6Smrg * included in all copies or substantial portions of the Software. 143bfa90b6Smrg * 153bfa90b6Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 163bfa90b6Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 173bfa90b6Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 183bfa90b6Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 193bfa90b6Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 203bfa90b6Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 213bfa90b6Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 223bfa90b6Smrg * SOFTWARE. 233bfa90b6Smrg * 243bfa90b6Smrg **********************************************************/ 256df26cacSmrg 266df26cacSmrg/* 276df26cacSmrg * svga_reg.h -- 286df26cacSmrg * 293bfa90b6Smrg * Virtual hardware definitions for the VMware SVGA II device. 306df26cacSmrg */ 316df26cacSmrg 326df26cacSmrg#ifndef _SVGA_REG_H_ 336df26cacSmrg#define _SVGA_REG_H_ 346df26cacSmrg 353bfa90b6Smrg/* 363bfa90b6Smrg * PCI device IDs. 373bfa90b6Smrg */ 383bfa90b6Smrg#define PCI_VENDOR_ID_VMWARE 0x15AD 393bfa90b6Smrg#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 406df26cacSmrg 416df26cacSmrg/* 423bfa90b6Smrg * SVGA_REG_ENABLE bit definitions. 436df26cacSmrg */ 443bfa90b6Smrg#define SVGA_REG_ENABLE_DISABLE 0 453bfa90b6Smrg#define SVGA_REG_ENABLE_ENABLE 1 463bfa90b6Smrg#define SVGA_REG_ENABLE_HIDE 2 473bfa90b6Smrg#define SVGA_REG_ENABLE_ENABLE_HIDE (SVGA_REG_ENABLE_ENABLE |\ 483bfa90b6Smrg SVGA_REG_ENABLE_HIDE) 496df26cacSmrg 506df26cacSmrg/* 513bfa90b6Smrg * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned 523bfa90b6Smrg * cursor bypass mode. This is still supported, but no new guest 533bfa90b6Smrg * drivers should use it. 546df26cacSmrg */ 553bfa90b6Smrg#define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */ 563bfa90b6Smrg#define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */ 573bfa90b6Smrg#define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */ 583bfa90b6Smrg#define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */ 596df26cacSmrg 606df26cacSmrg/* 613bfa90b6Smrg * The maximum framebuffer size that can traced for e.g. guests in VESA mode. 623bfa90b6Smrg * The changeMap in the monitor is proportional to this number. Therefore, we'd 636df26cacSmrg * like to keep it as small as possible to reduce monitor overhead (using 643bfa90b6Smrg * SVGA_VRAM_MAX_SIZE for this increases the size of the shared area by over 653bfa90b6Smrg * 4k!). 663bfa90b6Smrg * 673bfa90b6Smrg * NB: For compatibility reasons, this value must be greater than 0xff0000. 683bfa90b6Smrg * See bug 335072. 696df26cacSmrg */ 703bfa90b6Smrg#define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000 716df26cacSmrg 723bfa90b6Smrg#define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 733bfa90b6Smrg#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH) 746df26cacSmrg#define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS) 756df26cacSmrg 763bfa90b6Smrg/* Base and Offset gets us headed the right way for PCI Base Addr Registers */ 773bfa90b6Smrg#define SVGA_LEGACY_BASE_PORT 0x4560 783bfa90b6Smrg#define SVGA_NUM_PORTS 0x3 793bfa90b6Smrg 806df26cacSmrg#define SVGA_MAGIC 0x900000UL 816df26cacSmrg#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver)) 826df26cacSmrg 836df26cacSmrg/* Version 2 let the address of the frame buffer be unsigned on Win32 */ 846df26cacSmrg#define SVGA_VERSION_2 2 856df26cacSmrg#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2) 866df26cacSmrg 876df26cacSmrg/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so 886df26cacSmrg PALETTE_BASE has moved */ 896df26cacSmrg#define SVGA_VERSION_1 1 906df26cacSmrg#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1) 916df26cacSmrg 926df26cacSmrg/* Version 0 is the initial version */ 936df26cacSmrg#define SVGA_VERSION_0 0 946df26cacSmrg#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) 956df26cacSmrg 963bfa90b6Smrg/* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */ 976df26cacSmrg#define SVGA_ID_INVALID 0xFFFFFFFF 986df26cacSmrg 993bfa90b6Smrg/* Port offsets, relative to BAR0 */ 1003bfa90b6Smrg#define SVGA_INDEX_PORT 0x0 1013bfa90b6Smrg#define SVGA_VALUE_PORT 0x1 1023bfa90b6Smrg#define SVGA_BIOS_PORT 0x2 1033bfa90b6Smrg#define SVGA_IRQSTATUS_PORT 0x8 1046df26cacSmrg 1056df26cacSmrg/* 1066df26cacSmrg * Interrupt source flags for IRQSTATUS_PORT and IRQMASK. 1076df26cacSmrg * 1086df26cacSmrg * Interrupts are only supported when the 1096df26cacSmrg * SVGA_CAP_IRQMASK capability is present. 1106df26cacSmrg */ 1116df26cacSmrg#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */ 1126df26cacSmrg#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */ 1136df26cacSmrg#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */ 1146df26cacSmrg 1156df26cacSmrg/* 1166df26cacSmrg * Registers 1176df26cacSmrg */ 1186df26cacSmrg 1196df26cacSmrgenum { 1206df26cacSmrg SVGA_REG_ID = 0, 1216df26cacSmrg SVGA_REG_ENABLE = 1, 1226df26cacSmrg SVGA_REG_WIDTH = 2, 1236df26cacSmrg SVGA_REG_HEIGHT = 3, 1246df26cacSmrg SVGA_REG_MAX_WIDTH = 4, 1256df26cacSmrg SVGA_REG_MAX_HEIGHT = 5, 1266df26cacSmrg SVGA_REG_DEPTH = 6, 1273bfa90b6Smrg SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */ 1286df26cacSmrg SVGA_REG_PSEUDOCOLOR = 8, 1296df26cacSmrg SVGA_REG_RED_MASK = 9, 1306df26cacSmrg SVGA_REG_GREEN_MASK = 10, 1316df26cacSmrg SVGA_REG_BLUE_MASK = 11, 1326df26cacSmrg SVGA_REG_BYTES_PER_LINE = 12, 1333bfa90b6Smrg SVGA_REG_FB_START = 13, /* (Deprecated) */ 1346df26cacSmrg SVGA_REG_FB_OFFSET = 14, 1356df26cacSmrg SVGA_REG_VRAM_SIZE = 15, 1366df26cacSmrg SVGA_REG_FB_SIZE = 16, 1376df26cacSmrg 1386df26cacSmrg /* ID 0 implementation only had the above registers, then the palette */ 1396df26cacSmrg 1406df26cacSmrg SVGA_REG_CAPABILITIES = 17, 1413bfa90b6Smrg SVGA_REG_MEM_START = 18, /* (Deprecated) */ 1426df26cacSmrg SVGA_REG_MEM_SIZE = 19, 1433bfa90b6Smrg SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */ 1443bfa90b6Smrg SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */ 1453bfa90b6Smrg SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */ 1463bfa90b6Smrg SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */ 1473bfa90b6Smrg SVGA_REG_CURSOR_ID = 24, /* (Deprecated) */ 1483bfa90b6Smrg SVGA_REG_CURSOR_X = 25, /* (Deprecated) */ 1493bfa90b6Smrg SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */ 1503bfa90b6Smrg SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */ 1513bfa90b6Smrg SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */ 1523bfa90b6Smrg SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */ 1533bfa90b6Smrg SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */ 1543bfa90b6Smrg SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */ 1553bfa90b6Smrg SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ 1563bfa90b6Smrg SVGA_REG_IRQMASK = 33, /* Interrupt mask */ 1573bfa90b6Smrg 1583bfa90b6Smrg /* Legacy multi-monitor support */ 1596df26cacSmrg SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */ 1603bfa90b6Smrg SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */ 1616df26cacSmrg SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */ 1626df26cacSmrg SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */ 1636df26cacSmrg SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */ 1646df26cacSmrg SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */ 1656df26cacSmrg SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */ 1666df26cacSmrg 1673bfa90b6Smrg /* See "Guest memory regions" below. */ 1683bfa90b6Smrg SVGA_REG_GMR_ID = 41, 1693bfa90b6Smrg SVGA_REG_GMR_DESCRIPTOR = 42, 1703bfa90b6Smrg SVGA_REG_GMR_MAX_IDS = 43, 1713bfa90b6Smrg SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44, 1723bfa90b6Smrg 1733bfa90b6Smrg SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ 1743bfa90b6Smrg SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */ 1753bfa90b6Smrg SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */ 1763bfa90b6Smrg SVGA_REG_TOP = 48, /* Must be 1 more than the last register */ 1773bfa90b6Smrg 1783bfa90b6Smrg SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ 1796df26cacSmrg /* Next 768 (== 256*3) registers exist for colormap */ 1803bfa90b6Smrg 1816df26cacSmrg SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS 1826df26cacSmrg /* Base of scratch registers */ 1836df26cacSmrg /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage: 1846df26cacSmrg First 4 are reserved for VESA BIOS Extension; any remaining are for 1856df26cacSmrg the use of the current SVGA driver. */ 1866df26cacSmrg}; 1876df26cacSmrg 1883bfa90b6Smrg/* 1893bfa90b6Smrg * Macros to compute variable length items (sizes in 32-bit words, except 1903bfa90b6Smrg * for SVGA_GLYPH_SCANLINE_SIZE, which is in bytes). 1913bfa90b6Smrg */ 1923bfa90b6Smrg#define SVGA_BITMAP_SIZE(w,h) ((((w)+31) >> 5) * (h)) 1933bfa90b6Smrg#define SVGA_PIXMAP_SIZE(w,h,bpp) ((( ((w)*(bpp))+31 ) >> 5) * (h)) 1943bfa90b6Smrg#define SVGA_BITMAP_INCREMENT(w) ((( (w)+31 ) >> 5) * sizeof (uint32)) 1953bfa90b6Smrg#define SVGA_PIXMAP_INCREMENT(w,bpp) ((( ((w)*(bpp))+31 ) >> 5) * sizeof (uint32)) 1966df26cacSmrg 1976df26cacSmrg/* 1983bfa90b6Smrg * Guest memory regions (GMRs): 1993bfa90b6Smrg * 2003bfa90b6Smrg * This is a new memory mapping feature available in SVGA devices 2013bfa90b6Smrg * which have the SVGA_CAP_GMR bit set. Previously, there were two 2023bfa90b6Smrg * fixed memory regions available with which to share data between the 2033bfa90b6Smrg * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs 2043bfa90b6Smrg * are our name for an extensible way of providing arbitrary DMA 2053bfa90b6Smrg * buffers for use between the driver and the SVGA device. They are a 2063bfa90b6Smrg * new alternative to framebuffer memory, usable for both 2D and 3D 2073bfa90b6Smrg * graphics operations. 2083bfa90b6Smrg * 2093bfa90b6Smrg * Since GMR mapping must be done synchronously with guest CPU 2103bfa90b6Smrg * execution, we use a new pair of SVGA registers: 2113bfa90b6Smrg * 2123bfa90b6Smrg * SVGA_REG_GMR_ID -- 2133bfa90b6Smrg * 2143bfa90b6Smrg * Read/write. 2153bfa90b6Smrg * This register holds the 32-bit ID (a small positive integer) 2163bfa90b6Smrg * of a GMR to create, delete, or redefine. Writing this register 2173bfa90b6Smrg * has no side-effects. 2183bfa90b6Smrg * 2193bfa90b6Smrg * SVGA_REG_GMR_DESCRIPTOR -- 2203bfa90b6Smrg * 2213bfa90b6Smrg * Write-only. 2223bfa90b6Smrg * Writing this register will create, delete, or redefine the GMR 2233bfa90b6Smrg * specified by the above ID register. If this register is zero, 2243bfa90b6Smrg * the GMR is deleted. Any pointers into this GMR (including those 2253bfa90b6Smrg * currently being processed by FIFO commands) will be 2263bfa90b6Smrg * synchronously invalidated. 2273bfa90b6Smrg * 2283bfa90b6Smrg * If this register is nonzero, it must be the physical page 2293bfa90b6Smrg * number (PPN) of a data structure which describes the physical 2303bfa90b6Smrg * layout of the memory region this GMR should describe. The 2313bfa90b6Smrg * descriptor structure will be read synchronously by the SVGA 2323bfa90b6Smrg * device when this register is written. The descriptor need not 2333bfa90b6Smrg * remain allocated for the lifetime of the GMR. 2343bfa90b6Smrg * 2353bfa90b6Smrg * The guest driver should write SVGA_REG_GMR_ID first, then 2363bfa90b6Smrg * SVGA_REG_GMR_DESCRIPTOR. 2373bfa90b6Smrg * 2383bfa90b6Smrg * SVGA_REG_GMR_MAX_IDS -- 2393bfa90b6Smrg * 2403bfa90b6Smrg * Read-only. 2413bfa90b6Smrg * The SVGA device may choose to support a maximum number of 2423bfa90b6Smrg * user-defined GMR IDs. This register holds the number of supported 2433bfa90b6Smrg * IDs. (The maximum supported ID plus 1) 2443bfa90b6Smrg * 2453bfa90b6Smrg * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH -- 2463bfa90b6Smrg * 2473bfa90b6Smrg * Read-only. 2483bfa90b6Smrg * The SVGA device may choose to put a limit on the total number 2493bfa90b6Smrg * of SVGAGuestMemDescriptor structures it will read when defining 2503bfa90b6Smrg * a single GMR. 2513bfa90b6Smrg * 2523bfa90b6Smrg * The descriptor structure is an array of SVGAGuestMemDescriptor 2533bfa90b6Smrg * structures. Each structure may do one of three things: 2543bfa90b6Smrg * 2553bfa90b6Smrg * - Terminate the GMR descriptor list. 2563bfa90b6Smrg * (ppn==0, numPages==0) 2573bfa90b6Smrg * 2583bfa90b6Smrg * - Add a PPN or range of PPNs to the GMR's virtual address space. 2593bfa90b6Smrg * (ppn != 0, numPages != 0) 2603bfa90b6Smrg * 2613bfa90b6Smrg * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to 2623bfa90b6Smrg * support multi-page GMR descriptor tables without forcing the 2633bfa90b6Smrg * driver to allocate physically contiguous memory. 2643bfa90b6Smrg * (ppn != 0, numPages == 0) 2653bfa90b6Smrg * 2663bfa90b6Smrg * Note that each physical page of SVGAGuestMemDescriptor structures 2673bfa90b6Smrg * can describe at least 2MB of guest memory. If the driver needs to 2683bfa90b6Smrg * use more than one page of descriptor structures, it must use one of 2693bfa90b6Smrg * its SVGAGuestMemDescriptors to point to an additional page. The 2703bfa90b6Smrg * device will never automatically cross a page boundary. 2713bfa90b6Smrg * 2723bfa90b6Smrg * Once the driver has described a GMR, it is immediately available 2733bfa90b6Smrg * for use via any FIFO command that uses an SVGAGuestPtr structure. 2743bfa90b6Smrg * These pointers include a GMR identifier plus an offset into that 2753bfa90b6Smrg * GMR. 2763bfa90b6Smrg * 2773bfa90b6Smrg * The driver must check the SVGA_CAP_GMR bit before using the GMR 2783bfa90b6Smrg * registers. 2796df26cacSmrg */ 2806df26cacSmrg 2813bfa90b6Smrg/* 2823bfa90b6Smrg * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer 2833bfa90b6Smrg * memory as well. In the future, these IDs could even be used to 2843bfa90b6Smrg * allow legacy memory regions to be redefined by the guest as GMRs. 2853bfa90b6Smrg * 2863bfa90b6Smrg * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA 2873bfa90b6Smrg * is being phased out. Please try to use user-defined GMRs whenever 2883bfa90b6Smrg * possible. 2893bfa90b6Smrg */ 2903bfa90b6Smrg#define SVGA_GMR_NULL ((uint32) -1) 2913bfa90b6Smrg#define SVGA_GMR_FRAMEBUFFER ((uint32) -2) /* Guest Framebuffer (GFB) */ 2923bfa90b6Smrg 2933bfa90b6Smrgtypedef 2943bfa90b6Smrgstruct SVGAGuestMemDescriptor { 2953bfa90b6Smrg uint32 ppn; 2963bfa90b6Smrg uint32 numPages; 2973bfa90b6Smrg} SVGAGuestMemDescriptor; 2983bfa90b6Smrg 2993bfa90b6Smrgtypedef 3003bfa90b6Smrgstruct SVGAGuestPtr { 3013bfa90b6Smrg uint32 gmrId; 3023bfa90b6Smrg uint32 offset; 3033bfa90b6Smrg} SVGAGuestPtr; 3046df26cacSmrg 30525dbecb6Smrg#define SVGA_CB_MAX_COMMAND_SIZE (32 * 1024) /* 32 KB */ 3066df26cacSmrg 3076df26cacSmrg/* 3083bfa90b6Smrg * SVGAGMRImageFormat -- 3093bfa90b6Smrg * 3103bfa90b6Smrg * This is a packed representation of the source 2D image format 3113bfa90b6Smrg * for a GMR-to-screen blit. Currently it is defined as an encoding 3123bfa90b6Smrg * of the screen's color depth and bits-per-pixel, however, 16 bits 3133bfa90b6Smrg * are reserved for future use to identify other encodings (such as 3143bfa90b6Smrg * RGBA or higher-precision images). 3153bfa90b6Smrg * 3163bfa90b6Smrg * Currently supported formats: 3173bfa90b6Smrg * 3183bfa90b6Smrg * bpp depth Format Name 3193bfa90b6Smrg * --- ----- ----------- 3203bfa90b6Smrg * 32 24 32-bit BGRX 3213bfa90b6Smrg * 24 24 24-bit BGR 3223bfa90b6Smrg * 16 16 RGB 5-6-5 3233bfa90b6Smrg * 16 15 RGB 5-5-5 3243bfa90b6Smrg * 3256df26cacSmrg */ 3266df26cacSmrg 3273bfa90b6Smrgtypedef 3283bfa90b6Smrgstruct SVGAGMRImageFormat { 3293bfa90b6Smrg union { 3303bfa90b6Smrg struct { 3313bfa90b6Smrg uint32 bitsPerPixel : 8; 3323bfa90b6Smrg uint32 colorDepth : 8; 3333bfa90b6Smrg uint32 reserved : 16; /* Must be zero */ 3343bfa90b6Smrg }; 3356df26cacSmrg 3363bfa90b6Smrg uint32 value; 3373bfa90b6Smrg }; 3383bfa90b6Smrg} SVGAGMRImageFormat; 3396df26cacSmrg 3403bfa90b6Smrgtypedef 3413bfa90b6Smrgstruct SVGAGuestImage { 3423bfa90b6Smrg SVGAGuestPtr ptr; 3433bfa90b6Smrg 3443bfa90b6Smrg /* 3453bfa90b6Smrg * A note on interpretation of pitch: This value of pitch is the 3463bfa90b6Smrg * number of bytes between vertically adjacent image 3473bfa90b6Smrg * blocks. Normally this is the number of bytes between the first 3483bfa90b6Smrg * pixel of two adjacent scanlines. With compressed textures, 3493bfa90b6Smrg * however, this may represent the number of bytes between 3503bfa90b6Smrg * compression blocks rather than between rows of pixels. 3513bfa90b6Smrg * 3523bfa90b6Smrg * XXX: Compressed textures currently must be tightly packed in guest memory. 3533bfa90b6Smrg * 3543bfa90b6Smrg * If the image is 1-dimensional, pitch is ignored. 3553bfa90b6Smrg * 3563bfa90b6Smrg * If 'pitch' is zero, the SVGA3D device calculates a pitch value 3573bfa90b6Smrg * assuming each row of blocks is tightly packed. 3583bfa90b6Smrg */ 3593bfa90b6Smrg uint32 pitch; 3603bfa90b6Smrg} SVGAGuestImage; 3616df26cacSmrg 3626df26cacSmrg/* 3633bfa90b6Smrg * SVGAColorBGRX -- 3643bfa90b6Smrg * 3653bfa90b6Smrg * A 24-bit color format (BGRX), which does not depend on the 3663bfa90b6Smrg * format of the legacy guest framebuffer (GFB) or the current 3673bfa90b6Smrg * GMRFB state. 3683bfa90b6Smrg */ 3693bfa90b6Smrg 3703bfa90b6Smrgtypedef 3713bfa90b6Smrgstruct SVGAColorBGRX { 3723bfa90b6Smrg union { 3733bfa90b6Smrg struct { 3743bfa90b6Smrg uint32 b : 8; 3753bfa90b6Smrg uint32 g : 8; 3763bfa90b6Smrg uint32 r : 8; 3773bfa90b6Smrg uint32 x : 8; /* Unused */ 3783bfa90b6Smrg }; 3793bfa90b6Smrg 3803bfa90b6Smrg uint32 value; 3813bfa90b6Smrg }; 3823bfa90b6Smrg} SVGAColorBGRX; 3833bfa90b6Smrg 3843bfa90b6Smrg 3853bfa90b6Smrg/* 3863bfa90b6Smrg * SVGASignedRect -- 3873bfa90b6Smrg * SVGASignedPoint -- 3883bfa90b6Smrg * 3893bfa90b6Smrg * Signed rectangle and point primitives. These are used by the new 3903bfa90b6Smrg * 2D primitives for drawing to Screen Objects, which can occupy a 3913bfa90b6Smrg * signed virtual coordinate space. 3923bfa90b6Smrg * 3933bfa90b6Smrg * SVGASignedRect specifies a half-open interval: the (left, top) 3943bfa90b6Smrg * pixel is part of the rectangle, but the (right, bottom) pixel is 3953bfa90b6Smrg * not. 3963bfa90b6Smrg */ 3973bfa90b6Smrg 3983bfa90b6Smrgtypedef 3993bfa90b6Smrgstruct SVGASignedRect { 4003bfa90b6Smrg int32 left; 4013bfa90b6Smrg int32 top; 4023bfa90b6Smrg int32 right; 4033bfa90b6Smrg int32 bottom; 4043bfa90b6Smrg} SVGASignedRect; 4053bfa90b6Smrg 4063bfa90b6Smrgtypedef 4073bfa90b6Smrgstruct SVGASignedPoint { 4083bfa90b6Smrg int32 x; 4093bfa90b6Smrg int32 y; 4103bfa90b6Smrg} SVGASignedPoint; 4113bfa90b6Smrg 4123bfa90b6Smrg 4133bfa90b6Smrg/* 4143bfa90b6Smrg * Capabilities 4153bfa90b6Smrg * 4163bfa90b6Smrg * Note the holes in the bitfield. Missing bits have been deprecated, 4173bfa90b6Smrg * and must not be reused. Those capabilities will never be reported 4183bfa90b6Smrg * by new versions of the SVGA device. 4193bfa90b6Smrg * 4203bfa90b6Smrg * SVGA_CAP_GMR2 -- 4213bfa90b6Smrg * Provides asynchronous commands to define and remap guest memory 4223bfa90b6Smrg * regions. Adds device registers SVGA_REG_GMRS_MAX_PAGES and 4233bfa90b6Smrg * SVGA_REG_MEMORY_SIZE. 4243bfa90b6Smrg * 4253bfa90b6Smrg * SVGA_CAP_SCREEN_OBJECT_2 -- 4263bfa90b6Smrg * Allow screen object support, and require backing stores from the 4273bfa90b6Smrg * guest for each screen object. 4283bfa90b6Smrg */ 4293bfa90b6Smrg 4303bfa90b6Smrg#define SVGA_CAP_NONE 0x00000000 4313bfa90b6Smrg#define SVGA_CAP_RECT_COPY 0x00000002 4323bfa90b6Smrg#define SVGA_CAP_CURSOR 0x00000020 4333bfa90b6Smrg#define SVGA_CAP_CURSOR_BYPASS 0x00000040 /* Legacy (Use Cursor Bypass 3 instead) */ 4343bfa90b6Smrg#define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 /* Legacy (Use Cursor Bypass 3 instead) */ 4353bfa90b6Smrg#define SVGA_CAP_8BIT_EMULATION 0x00000100 4363bfa90b6Smrg#define SVGA_CAP_ALPHA_CURSOR 0x00000200 4373bfa90b6Smrg#define SVGA_CAP_3D 0x00004000 4383bfa90b6Smrg#define SVGA_CAP_EXTENDED_FIFO 0x00008000 4393bfa90b6Smrg#define SVGA_CAP_MULTIMON 0x00010000 /* Legacy multi-monitor support */ 4403bfa90b6Smrg#define SVGA_CAP_PITCHLOCK 0x00020000 4413bfa90b6Smrg#define SVGA_CAP_IRQMASK 0x00040000 4423bfa90b6Smrg#define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 /* Legacy multi-monitor support */ 4433bfa90b6Smrg#define SVGA_CAP_GMR 0x00100000 4443bfa90b6Smrg#define SVGA_CAP_TRACES 0x00200000 4453bfa90b6Smrg#define SVGA_CAP_GMR2 0x00400000 4463bfa90b6Smrg#define SVGA_CAP_SCREEN_OBJECT_2 0x00800000 4476df26cacSmrg 4486df26cacSmrg 4496df26cacSmrg/* 4506df26cacSmrg * FIFO register indices. 4516df26cacSmrg * 4526df26cacSmrg * The FIFO is a chunk of device memory mapped into guest physmem. It 4536df26cacSmrg * is always treated as 32-bit words. 4546df26cacSmrg * 4556df26cacSmrg * The guest driver gets to decide how to partition it between 4566df26cacSmrg * - FIFO registers (there are always at least 4, specifying where the 4576df26cacSmrg * following data area is and how much data it contains; there may be 4586df26cacSmrg * more registers following these, depending on the FIFO protocol 4596df26cacSmrg * version in use) 4606df26cacSmrg * - FIFO data, written by the guest and slurped out by the VMX. 4616df26cacSmrg * These indices are 32-bit word offsets into the FIFO. 4626df26cacSmrg */ 4636df26cacSmrg 4646df26cacSmrgenum { 4656df26cacSmrg /* 4666df26cacSmrg * Block 1 (basic registers): The originally defined FIFO registers. 4676df26cacSmrg * These exist and are valid for all versions of the FIFO protocol. 4686df26cacSmrg */ 4696df26cacSmrg 4706df26cacSmrg SVGA_FIFO_MIN = 0, 4716df26cacSmrg SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */ 4726df26cacSmrg SVGA_FIFO_NEXT_CMD, 4736df26cacSmrg SVGA_FIFO_STOP, 4746df26cacSmrg 4756df26cacSmrg /* 4766df26cacSmrg * Block 2 (extended registers): Mandatory registers for the extended 4776df26cacSmrg * FIFO. These exist if the SVGA caps register includes 4786df26cacSmrg * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their 4796df26cacSmrg * associated capability bit is enabled. 4806df26cacSmrg * 4816df26cacSmrg * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied 4826df26cacSmrg * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE. 4836df26cacSmrg * This means that the guest has to test individually (in most cases 4846df26cacSmrg * using FIFO caps) for the presence of registers after this; the VMX 4856df26cacSmrg * can define "extended FIFO" to mean whatever it wants, and currently 4866df26cacSmrg * won't enable it unless there's room for that set and much more. 4876df26cacSmrg */ 4886df26cacSmrg 4896df26cacSmrg SVGA_FIFO_CAPABILITIES = 4, 4906df26cacSmrg SVGA_FIFO_FLAGS, 4916df26cacSmrg /* Valid with SVGA_FIFO_CAP_FENCE: */ 4926df26cacSmrg SVGA_FIFO_FENCE, 4936df26cacSmrg 4946df26cacSmrg /* 4956df26cacSmrg * Block 3a (optional extended registers): Additional registers for the 4966df26cacSmrg * extended FIFO, whose presence isn't actually implied by 4976df26cacSmrg * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to 4986df26cacSmrg * leave room for them. 4996df26cacSmrg * 5006df26cacSmrg * These in block 3a, the VMX currently considers mandatory for the 5016df26cacSmrg * extended FIFO. 5026df26cacSmrg */ 5033bfa90b6Smrg 5046df26cacSmrg /* Valid if exists (i.e. if extended FIFO enabled): */ 5056df26cacSmrg SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */ 5066df26cacSmrg /* Valid with SVGA_FIFO_CAP_PITCHLOCK: */ 5076df26cacSmrg SVGA_FIFO_PITCHLOCK, 5083bfa90b6Smrg 5096df26cacSmrg /* Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: */ 5106df26cacSmrg SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */ 5116df26cacSmrg SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */ 5126df26cacSmrg SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */ 5136df26cacSmrg SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */ 5146df26cacSmrg SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */ 5153bfa90b6Smrg 5166df26cacSmrg /* Valid with SVGA_FIFO_CAP_RESERVE: */ 5176df26cacSmrg SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */ 5183bfa90b6Smrg 5193bfa90b6Smrg /* 5203bfa90b6Smrg * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2: 5213bfa90b6Smrg * 5223bfa90b6Smrg * By default this is SVGA_ID_INVALID, to indicate that the cursor 5233bfa90b6Smrg * coordinates are specified relative to the virtual root. If this 5243bfa90b6Smrg * is set to a specific screen ID, cursor position is reinterpreted 5253bfa90b6Smrg * as a signed offset relative to that screen's origin. 5263bfa90b6Smrg */ 5273bfa90b6Smrg SVGA_FIFO_CURSOR_SCREEN_ID, 5283bfa90b6Smrg 5293bfa90b6Smrg /* 5303bfa90b6Smrg * Valid with SVGA_FIFO_CAP_DEAD 5313bfa90b6Smrg * 5323bfa90b6Smrg * An arbitrary value written by the host, drivers should not use it. 5333bfa90b6Smrg */ 5343bfa90b6Smrg SVGA_FIFO_DEAD, 5353bfa90b6Smrg 5363bfa90b6Smrg /* 5373bfa90b6Smrg * Valid with SVGA_FIFO_CAP_3D_HWVERSION_REVISED: 5383bfa90b6Smrg * 5393bfa90b6Smrg * Contains 3D HWVERSION (see SVGA3dHardwareVersion in svga3d_reg.h) 5403bfa90b6Smrg * on platforms that can enforce graphics resource limits. 5413bfa90b6Smrg */ 5423bfa90b6Smrg SVGA_FIFO_3D_HWVERSION_REVISED, 5433bfa90b6Smrg 5446df26cacSmrg /* 5456df26cacSmrg * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new 5466df26cacSmrg * registers, but this must be done carefully and with judicious use of 5476df26cacSmrg * capability bits, since comparisons based on SVGA_FIFO_MIN aren't 5486df26cacSmrg * enough to tell you whether the register exists: we've shipped drivers 5496df26cacSmrg * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of 5506df26cacSmrg * the earlier ones. The actual order of introduction was: 5516df26cacSmrg * - PITCHLOCK 5526df26cacSmrg * - 3D_CAPS 5536df26cacSmrg * - CURSOR_* (cursor bypass 3) 5546df26cacSmrg * - RESERVED 5556df26cacSmrg * So, code that wants to know whether it can use any of the 5566df26cacSmrg * aforementioned registers, or anything else added after PITCHLOCK and 5576df26cacSmrg * before 3D_CAPS, needs to reason about something other than 5586df26cacSmrg * SVGA_FIFO_MIN. 5596df26cacSmrg */ 5603bfa90b6Smrg 5616df26cacSmrg /* 5626df26cacSmrg * 3D caps block space; valid with 3D hardware version >= 5636df26cacSmrg * SVGA3D_HWVERSION_WS6_B1. 5646df26cacSmrg */ 5656df26cacSmrg SVGA_FIFO_3D_CAPS = 32, 5666df26cacSmrg SVGA_FIFO_3D_CAPS_LAST = 32 + 255, 5676df26cacSmrg 5686df26cacSmrg /* 5696df26cacSmrg * End of VMX's current definition of "extended-FIFO registers". 5706df26cacSmrg * Registers before here are always enabled/disabled as a block; either 5716df26cacSmrg * the extended FIFO is enabled and includes all preceding registers, or 5726df26cacSmrg * it's disabled entirely. 5736df26cacSmrg * 5746df26cacSmrg * Block 3b (truly optional extended registers): Additional registers for 5756df26cacSmrg * the extended FIFO, which the VMX already knows how to enable and 5766df26cacSmrg * disable with correct granularity. 5776df26cacSmrg * 5786df26cacSmrg * Registers after here exist if and only if the guest SVGA driver 5796df26cacSmrg * sets SVGA_FIFO_MIN high enough to leave room for them. 5806df26cacSmrg */ 5816df26cacSmrg 5826df26cacSmrg /* Valid if register exists: */ 5836df26cacSmrg SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */ 5846df26cacSmrg SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */ 5856df26cacSmrg SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */ 5866df26cacSmrg 5876df26cacSmrg /* 5886df26cacSmrg * Always keep this last. This defines the maximum number of 5896df26cacSmrg * registers we know about. At power-on, this value is placed in 5906df26cacSmrg * the SVGA_REG_MEM_REGS register, and we expect the guest driver 5916df26cacSmrg * to allocate this much space in FIFO memory for registers. 5926df26cacSmrg */ 5936df26cacSmrg SVGA_FIFO_NUM_REGS 5946df26cacSmrg}; 5956df26cacSmrg 5966df26cacSmrg 5976df26cacSmrg/* 5986df26cacSmrg * Definition of registers included in extended FIFO support. 5996df26cacSmrg * 6006df26cacSmrg * The guest SVGA driver gets to allocate the FIFO between registers 6016df26cacSmrg * and data. It must always allocate at least 4 registers, but old 6026df26cacSmrg * drivers stopped there. 6036df26cacSmrg * 6046df26cacSmrg * The VMX will enable extended FIFO support if and only if the guest 6056df26cacSmrg * left enough room for all registers defined as part of the mandatory 6066df26cacSmrg * set for the extended FIFO. 6076df26cacSmrg * 6086df26cacSmrg * Note that the guest drivers typically allocate the FIFO only at 6096df26cacSmrg * initialization time, not at mode switches, so it's likely that the 6106df26cacSmrg * number of FIFO registers won't change without a reboot. 6116df26cacSmrg * 6126df26cacSmrg * All registers less than this value are guaranteed to be present if 6136df26cacSmrg * svgaUser->fifo.extended is set. Any later registers must be tested 6146df26cacSmrg * individually for compatibility at each use (in the VMX). 6156df26cacSmrg * 6166df26cacSmrg * This value is used only by the VMX, so it can change without 6176df26cacSmrg * affecting driver compatibility; keep it that way? 6186df26cacSmrg */ 6196df26cacSmrg#define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1) 6206df26cacSmrg 6216df26cacSmrg 6226df26cacSmrg/* 6236df26cacSmrg * FIFO Synchronization Registers 6246df26cacSmrg * 6256df26cacSmrg * This explains the relationship between the various FIFO 6266df26cacSmrg * sync-related registers in IOSpace and in FIFO space. 6276df26cacSmrg * 6286df26cacSmrg * SVGA_REG_SYNC -- 6296df26cacSmrg * 6306df26cacSmrg * The SYNC register can be used in two different ways by the guest: 6316df26cacSmrg * 6326df26cacSmrg * 1. If the guest wishes to fully sync (drain) the FIFO, 6336df26cacSmrg * it will write once to SYNC then poll on the BUSY 6346df26cacSmrg * register. The FIFO is sync'ed once BUSY is zero. 6356df26cacSmrg * 6366df26cacSmrg * 2. If the guest wants to asynchronously wake up the host, 6376df26cacSmrg * it will write once to SYNC without polling on BUSY. 6386df26cacSmrg * Ideally it will do this after some new commands have 6396df26cacSmrg * been placed in the FIFO, and after reading a zero 6406df26cacSmrg * from SVGA_FIFO_BUSY. 6416df26cacSmrg * 6426df26cacSmrg * (1) is the original behaviour that SYNC was designed to 6436df26cacSmrg * support. Originally, a write to SYNC would implicitly 6446df26cacSmrg * trigger a read from BUSY. This causes us to synchronously 6456df26cacSmrg * process the FIFO. 6466df26cacSmrg * 6476df26cacSmrg * This behaviour has since been changed so that writing SYNC 6486df26cacSmrg * will *not* implicitly cause a read from BUSY. Instead, it 6496df26cacSmrg * makes a channel call which asynchronously wakes up the MKS 6506df26cacSmrg * thread. 6516df26cacSmrg * 6526df26cacSmrg * New guests can use this new behaviour to implement (2) 6536df26cacSmrg * efficiently. This lets guests get the host's attention 6546df26cacSmrg * without waiting for the MKS to poll, which gives us much 6556df26cacSmrg * better CPU utilization on SMP hosts and on UP hosts while 6566df26cacSmrg * we're blocked on the host GPU. 6576df26cacSmrg * 6586df26cacSmrg * Old guests shouldn't notice the behaviour change. SYNC was 6596df26cacSmrg * never guaranteed to process the entire FIFO, since it was 6606df26cacSmrg * bounded to a particular number of CPU cycles. Old guests will 6616df26cacSmrg * still loop on the BUSY register until the FIFO is empty. 6626df26cacSmrg * 6636df26cacSmrg * Writing to SYNC currently has the following side-effects: 6646df26cacSmrg * 6656df26cacSmrg * - Sets SVGA_REG_BUSY to TRUE (in the monitor) 6666df26cacSmrg * - Asynchronously wakes up the MKS thread for FIFO processing 6676df26cacSmrg * - The value written to SYNC is recorded as a "reason", for 6686df26cacSmrg * stats purposes. 6696df26cacSmrg * 6706df26cacSmrg * If SVGA_FIFO_BUSY is available, drivers are advised to only 6716df26cacSmrg * write to SYNC if SVGA_FIFO_BUSY is FALSE. Drivers should set 6726df26cacSmrg * SVGA_FIFO_BUSY to TRUE after writing to SYNC. The MKS will 6736df26cacSmrg * eventually set SVGA_FIFO_BUSY on its own, but this approach 6746df26cacSmrg * lets the driver avoid sending multiple asynchronous wakeup 6756df26cacSmrg * messages to the MKS thread. 6766df26cacSmrg * 6776df26cacSmrg * SVGA_REG_BUSY -- 6786df26cacSmrg * 6796df26cacSmrg * This register is set to TRUE when SVGA_REG_SYNC is written, 6806df26cacSmrg * and it reads as FALSE when the FIFO has been completely 6816df26cacSmrg * drained. 6826df26cacSmrg * 6836df26cacSmrg * Every read from this register causes us to synchronously 6846df26cacSmrg * process FIFO commands. There is no guarantee as to how many 6856df26cacSmrg * commands each read will process. 6866df26cacSmrg * 6876df26cacSmrg * CPU time spent processing FIFO commands will be billed to 6886df26cacSmrg * the guest. 6896df26cacSmrg * 6906df26cacSmrg * New drivers should avoid using this register unless they 6916df26cacSmrg * need to guarantee that the FIFO is completely drained. It 6926df26cacSmrg * is overkill for performing a sync-to-fence. Older drivers 6936df26cacSmrg * will use this register for any type of synchronization. 6946df26cacSmrg * 6956df26cacSmrg * SVGA_FIFO_BUSY -- 6966df26cacSmrg * 6976df26cacSmrg * This register is a fast way for the guest driver to check 6986df26cacSmrg * whether the FIFO is already being processed. It reads and 6996df26cacSmrg * writes at normal RAM speeds, with no monitor intervention. 7006df26cacSmrg * 7016df26cacSmrg * If this register reads as TRUE, the host is guaranteeing that 7026df26cacSmrg * any new commands written into the FIFO will be noticed before 7036df26cacSmrg * the MKS goes back to sleep. 7046df26cacSmrg * 7056df26cacSmrg * If this register reads as FALSE, no such guarantee can be 7066df26cacSmrg * made. 7076df26cacSmrg * 7086df26cacSmrg * The guest should use this register to quickly determine 7096df26cacSmrg * whether or not it needs to wake up the host. If the guest 7106df26cacSmrg * just wrote a command or group of commands that it would like 7116df26cacSmrg * the host to begin processing, it should: 7126df26cacSmrg * 7136df26cacSmrg * 1. Read SVGA_FIFO_BUSY. If it reads as TRUE, no further 7146df26cacSmrg * action is necessary. 7156df26cacSmrg * 7166df26cacSmrg * 2. Write TRUE to SVGA_FIFO_BUSY. This informs future guest 7176df26cacSmrg * code that we've already sent a SYNC to the host and we 7186df26cacSmrg * don't need to send a duplicate. 7196df26cacSmrg * 7206df26cacSmrg * 3. Write a reason to SVGA_REG_SYNC. This will send an 7216df26cacSmrg * asynchronous wakeup to the MKS thread. 7226df26cacSmrg */ 7236df26cacSmrg 7246df26cacSmrg 7256df26cacSmrg/* 7266df26cacSmrg * FIFO Capabilities 7276df26cacSmrg * 7286df26cacSmrg * Fence -- Fence register and command are supported 7296df26cacSmrg * Accel Front -- Front buffer only commands are supported 7306df26cacSmrg * Pitch Lock -- Pitch lock register is supported 7316df26cacSmrg * Video -- SVGA Video overlay units are supported 7326df26cacSmrg * Escape -- Escape command is supported 7333bfa90b6Smrg * 7343bfa90b6Smrg * XXX: Add longer descriptions for each capability, including a list 7353bfa90b6Smrg * of the new features that each capability provides. 7363bfa90b6Smrg * 7373bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT -- 7383bfa90b6Smrg * 7393bfa90b6Smrg * Provides dynamic multi-screen rendering, for improved Unity and 7403bfa90b6Smrg * multi-monitor modes. With Screen Object, the guest can 7413bfa90b6Smrg * dynamically create and destroy 'screens', which can represent 7423bfa90b6Smrg * Unity windows or virtual monitors. Screen Object also provides 7433bfa90b6Smrg * strong guarantees that DMA operations happen only when 7443bfa90b6Smrg * guest-initiated. Screen Object deprecates the BAR1 guest 7453bfa90b6Smrg * framebuffer (GFB) and all commands that work only with the GFB. 7463bfa90b6Smrg * 7473bfa90b6Smrg * New registers: 7483bfa90b6Smrg * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID 7493bfa90b6Smrg * 7503bfa90b6Smrg * New 2D commands: 7513bfa90b6Smrg * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN, 7523bfa90b6Smrg * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY 7533bfa90b6Smrg * 7543bfa90b6Smrg * New 3D commands: 7553bfa90b6Smrg * BLIT_SURFACE_TO_SCREEN 7563bfa90b6Smrg * 7573bfa90b6Smrg * New guarantees: 7583bfa90b6Smrg * 7593bfa90b6Smrg * - The host will not read or write guest memory, including the GFB, 7603bfa90b6Smrg * except when explicitly initiated by a DMA command. 7613bfa90b6Smrg * 7623bfa90b6Smrg * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK, 7633bfa90b6Smrg * is guaranteed to complete before any subsequent FENCEs. 7643bfa90b6Smrg * 7653bfa90b6Smrg * - All legacy commands which affect a Screen (UPDATE, PRESENT, 7663bfa90b6Smrg * PRESENT_READBACK) as well as new Screen blit commands will 7673bfa90b6Smrg * all behave consistently as blits, and memory will be read 7683bfa90b6Smrg * or written in FIFO order. 7693bfa90b6Smrg * 7703bfa90b6Smrg * For example, if you PRESENT from one SVGA3D surface to multiple 7713bfa90b6Smrg * places on the screen, the data copied will always be from the 7723bfa90b6Smrg * SVGA3D surface at the time the PRESENT was issued in the FIFO. 7733bfa90b6Smrg * This was not necessarily true on devices without Screen Object. 7743bfa90b6Smrg * 7753bfa90b6Smrg * This means that on devices that support Screen Object, the 7763bfa90b6Smrg * PRESENT_READBACK command should not be necessary unless you 7773bfa90b6Smrg * actually want to read back the results of 3D rendering into 7783bfa90b6Smrg * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB 7793bfa90b6Smrg * command provides a strict superset of functionality.) 7803bfa90b6Smrg * 7813bfa90b6Smrg * - When a screen is resized, either using Screen Object commands or 7823bfa90b6Smrg * legacy multimon registers, its contents are preserved. 7833bfa90b6Smrg * 7843bfa90b6Smrg * SVGA_FIFO_CAP_GMR2 -- 7853bfa90b6Smrg * 7863bfa90b6Smrg * Provides new commands to define and remap guest memory regions (GMR). 7873bfa90b6Smrg * 7883bfa90b6Smrg * New 2D commands: 7893bfa90b6Smrg * DEFINE_GMR2, REMAP_GMR2. 7903bfa90b6Smrg * 7913bfa90b6Smrg * SVGA_FIFO_CAP_3D_HWVERSION_REVISED -- 7923bfa90b6Smrg * 7933bfa90b6Smrg * Indicates new register SVGA_FIFO_3D_HWVERSION_REVISED exists. 7943bfa90b6Smrg * This register may replace SVGA_FIFO_3D_HWVERSION on platforms 7953bfa90b6Smrg * that enforce graphics resource limits. This allows the platform 7963bfa90b6Smrg * to clear SVGA_FIFO_3D_HWVERSION and disable 3D in legacy guest 7973bfa90b6Smrg * drivers that do not limit their resources. 7983bfa90b6Smrg * 7993bfa90b6Smrg * Note this is an alias to SVGA_FIFO_CAP_GMR2 because these indicators 8003bfa90b6Smrg * are codependent (and thus we use a single capability bit). 8013bfa90b6Smrg * 8023bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT_2 -- 8033bfa90b6Smrg * 8043bfa90b6Smrg * Modifies the DEFINE_SCREEN command to include a guest provided 8053bfa90b6Smrg * backing store in GMR memory and the bytesPerLine for the backing 8063bfa90b6Smrg * store. This capability requires the use of a backing store when 8073bfa90b6Smrg * creating screen objects. However if SVGA_FIFO_CAP_SCREEN_OBJECT 8083bfa90b6Smrg * is present then backing stores are optional. 8093bfa90b6Smrg * 8103bfa90b6Smrg * SVGA_FIFO_CAP_DEAD -- 8113bfa90b6Smrg * 8123bfa90b6Smrg * Drivers should not use this cap bit. This cap bit can not be 8133bfa90b6Smrg * reused since some hosts already expose it. 8146df26cacSmrg */ 8156df26cacSmrg 8166df26cacSmrg#define SVGA_FIFO_CAP_NONE 0 8176df26cacSmrg#define SVGA_FIFO_CAP_FENCE (1<<0) 8186df26cacSmrg#define SVGA_FIFO_CAP_ACCELFRONT (1<<1) 8196df26cacSmrg#define SVGA_FIFO_CAP_PITCHLOCK (1<<2) 8206df26cacSmrg#define SVGA_FIFO_CAP_VIDEO (1<<3) 8216df26cacSmrg#define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4) 8226df26cacSmrg#define SVGA_FIFO_CAP_ESCAPE (1<<5) 8236df26cacSmrg#define SVGA_FIFO_CAP_RESERVE (1<<6) 8243bfa90b6Smrg#define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7) 8253bfa90b6Smrg#define SVGA_FIFO_CAP_GMR2 (1<<8) 8263bfa90b6Smrg#define SVGA_FIFO_CAP_3D_HWVERSION_REVISED SVGA_FIFO_CAP_GMR2 8273bfa90b6Smrg#define SVGA_FIFO_CAP_SCREEN_OBJECT_2 (1<<9) 8283bfa90b6Smrg#define SVGA_FIFO_CAP_DEAD (1<<10) 8296df26cacSmrg 8306df26cacSmrg 8316df26cacSmrg/* 8326df26cacSmrg * FIFO Flags 8336df26cacSmrg * 8346df26cacSmrg * Accel Front -- Driver should use front buffer only commands 8356df26cacSmrg */ 8366df26cacSmrg 8376df26cacSmrg#define SVGA_FIFO_FLAG_NONE 0 8386df26cacSmrg#define SVGA_FIFO_FLAG_ACCELFRONT (1<<0) 8396df26cacSmrg#define SVGA_FIFO_FLAG_RESERVED (1<<31) /* Internal use only */ 8406df26cacSmrg 8416df26cacSmrg/* 8426df26cacSmrg * FIFO reservation sentinel value 8436df26cacSmrg */ 8446df26cacSmrg 8456df26cacSmrg#define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff 8466df26cacSmrg 8476df26cacSmrg 8486df26cacSmrg/* 8496df26cacSmrg * Video overlay support 8506df26cacSmrg */ 8516df26cacSmrg 8526df26cacSmrg#define SVGA_NUM_OVERLAY_UNITS 32 8536df26cacSmrg 8546df26cacSmrg 8556df26cacSmrg/* 8566df26cacSmrg * Video capabilities that the guest is currently using 8576df26cacSmrg */ 8586df26cacSmrg 8596df26cacSmrg#define SVGA_VIDEO_FLAG_COLORKEY 0x0001 8606df26cacSmrg 8616df26cacSmrg 8626df26cacSmrg/* 8636df26cacSmrg * Offsets for the video overlay registers 8646df26cacSmrg */ 8656df26cacSmrg 8666df26cacSmrgenum { 8676df26cacSmrg SVGA_VIDEO_ENABLED = 0, 8686df26cacSmrg SVGA_VIDEO_FLAGS, 8696df26cacSmrg SVGA_VIDEO_DATA_OFFSET, 8706df26cacSmrg SVGA_VIDEO_FORMAT, 8716df26cacSmrg SVGA_VIDEO_COLORKEY, 8723bfa90b6Smrg SVGA_VIDEO_SIZE, /* Deprecated */ 8736df26cacSmrg SVGA_VIDEO_WIDTH, 8746df26cacSmrg SVGA_VIDEO_HEIGHT, 8756df26cacSmrg SVGA_VIDEO_SRC_X, 8766df26cacSmrg SVGA_VIDEO_SRC_Y, 8776df26cacSmrg SVGA_VIDEO_SRC_WIDTH, 8786df26cacSmrg SVGA_VIDEO_SRC_HEIGHT, 8793bfa90b6Smrg SVGA_VIDEO_DST_X, /* Signed int32 */ 8803bfa90b6Smrg SVGA_VIDEO_DST_Y, /* Signed int32 */ 8816df26cacSmrg SVGA_VIDEO_DST_WIDTH, 8826df26cacSmrg SVGA_VIDEO_DST_HEIGHT, 8836df26cacSmrg SVGA_VIDEO_PITCH_1, 8846df26cacSmrg SVGA_VIDEO_PITCH_2, 8856df26cacSmrg SVGA_VIDEO_PITCH_3, 8863bfa90b6Smrg SVGA_VIDEO_DATA_GMRID, /* Optional, defaults to SVGA_GMR_FRAMEBUFFER */ 8873bfa90b6Smrg SVGA_VIDEO_DST_SCREEN_ID, /* Optional, defaults to virtual coords (SVGA_ID_INVALID) */ 8886df26cacSmrg SVGA_VIDEO_NUM_REGS 8896df26cacSmrg}; 8906df26cacSmrg 8916df26cacSmrg 8926df26cacSmrg/* 8936df26cacSmrg * SVGA Overlay Units 8946df26cacSmrg * 8956df26cacSmrg * width and height relate to the entire source video frame. 8966df26cacSmrg * srcX, srcY, srcWidth and srcHeight represent subset of the source 8976df26cacSmrg * video frame to be displayed. 8986df26cacSmrg */ 8996df26cacSmrg 9006df26cacSmrgtypedef struct SVGAOverlayUnit { 9016df26cacSmrg uint32 enabled; 9026df26cacSmrg uint32 flags; 9036df26cacSmrg uint32 dataOffset; 9046df26cacSmrg uint32 format; 9056df26cacSmrg uint32 colorKey; 9066df26cacSmrg uint32 size; 9076df26cacSmrg uint32 width; 9086df26cacSmrg uint32 height; 9096df26cacSmrg uint32 srcX; 9106df26cacSmrg uint32 srcY; 9116df26cacSmrg uint32 srcWidth; 9126df26cacSmrg uint32 srcHeight; 9133bfa90b6Smrg int32 dstX; 9143bfa90b6Smrg int32 dstY; 9156df26cacSmrg uint32 dstWidth; 9166df26cacSmrg uint32 dstHeight; 9176df26cacSmrg uint32 pitches[3]; 9183bfa90b6Smrg uint32 dataGMRId; 9193bfa90b6Smrg uint32 dstScreenId; 9206df26cacSmrg} SVGAOverlayUnit; 9216df26cacSmrg 9226df26cacSmrg 9236df26cacSmrg/* 9243bfa90b6Smrg * SVGAScreenObject -- 9253bfa90b6Smrg * 9263bfa90b6Smrg * This is a new way to represent a guest's multi-monitor screen or 9273bfa90b6Smrg * Unity window. Screen objects are only supported if the 9283bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set. 9293bfa90b6Smrg * 9303bfa90b6Smrg * If Screen Objects are supported, they can be used to fully 9313bfa90b6Smrg * replace the functionality provided by the framebuffer registers 9323bfa90b6Smrg * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY. 9333bfa90b6Smrg * 9343bfa90b6Smrg * The screen object is a struct with guaranteed binary 9353bfa90b6Smrg * compatibility. New flags can be added, and the struct may grow, 9363bfa90b6Smrg * but existing fields must retain their meaning. 9373bfa90b6Smrg * 9383bfa90b6Smrg * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2 are required fields of 9393bfa90b6Smrg * a SVGAGuestPtr that is used to back the screen contents. This 9403bfa90b6Smrg * memory must come from the GFB. The guest is not allowed to 9413bfa90b6Smrg * access the memory and doing so will have undefined results. The 9423bfa90b6Smrg * backing store is required to be page aligned and the size is 94325dbecb6Smrg * padded to the next page boundary. The number of pages is: 9443bfa90b6Smrg * (bytesPerLine * size.width * 4 + PAGE_SIZE - 1) / PAGE_SIZE 9453bfa90b6Smrg * 9463bfa90b6Smrg * The pitch in the backingStore is required to be at least large 9473bfa90b6Smrg * enough to hold a 32bbp scanline. It is recommended that the 9483bfa90b6Smrg * driver pad bytesPerLine for a potential performance win. 9493bfa90b6Smrg * 9503bfa90b6Smrg * The cloneCount field is treated as a hint from the guest that 9513bfa90b6Smrg * the user wants this display to be cloned, countCount times. A 9523bfa90b6Smrg * value of zero means no cloning should happen. 9536df26cacSmrg */ 9546df26cacSmrg 9553bfa90b6Smrg#define SVGA_SCREEN_MUST_BE_SET (1 << 0) /* Must be set or results undefined */ 9563bfa90b6Smrg#define SVGA_SCREEN_HAS_ROOT SVGA_SCREEN_MUST_BE_SET /* Deprecated */ 9573bfa90b6Smrg#define SVGA_SCREEN_IS_PRIMARY (1 << 1) /* Guest considers this screen to be 'primary' */ 9583bfa90b6Smrg#define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) /* Guest is running a fullscreen app here */ 9596df26cacSmrg 9606df26cacSmrg/* 9613bfa90b6Smrg * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When the screen is 9623bfa90b6Smrg * deactivated the base layer is defined to lose all contents and 9633bfa90b6Smrg * become black. When a screen is deactivated the backing store is 9643bfa90b6Smrg * optional. When set backingPtr and bytesPerLine will be ignored. 9656df26cacSmrg */ 9663bfa90b6Smrg#define SVGA_SCREEN_DEACTIVATE (1 << 3) 9673bfa90b6Smrg 9683bfa90b6Smrg/* 9693bfa90b6Smrg * Added with SVGA_FIFO_CAP_SCREEN_OBJECT_2. When this flag is set 9703bfa90b6Smrg * the screen contents will be outputted as all black to the user 9713bfa90b6Smrg * though the base layer contents is preserved. The screen base layer 9723bfa90b6Smrg * can still be read and written to like normal though the no visible 9733bfa90b6Smrg * effect will be seen by the user. When the flag is changed the 9743bfa90b6Smrg * screen will be blanked or redrawn to the current contents as needed 9753bfa90b6Smrg * without any extra commands from the driver. This flag only has an 9763bfa90b6Smrg * effect when the screen is not deactivated. 9773bfa90b6Smrg */ 9783bfa90b6Smrg#define SVGA_SCREEN_BLANKING (1 << 4) 9793bfa90b6Smrg 9803bfa90b6Smrgtypedef 9813bfa90b6Smrgstruct SVGAScreenObject { 9823bfa90b6Smrg uint32 structSize; /* sizeof(SVGAScreenObject) */ 9833bfa90b6Smrg uint32 id; 9843bfa90b6Smrg uint32 flags; 9853bfa90b6Smrg struct { 9863bfa90b6Smrg uint32 width; 9873bfa90b6Smrg uint32 height; 9883bfa90b6Smrg } size; 9893bfa90b6Smrg struct { 9903bfa90b6Smrg int32 x; 9913bfa90b6Smrg int32 y; 9923bfa90b6Smrg } root; 9933bfa90b6Smrg 9943bfa90b6Smrg /* 9953bfa90b6Smrg * Added and required by SVGA_FIFO_CAP_SCREEN_OBJECT_2, optional 9963bfa90b6Smrg * with SVGA_FIFO_CAP_SCREEN_OBJECT. 9973bfa90b6Smrg */ 9983bfa90b6Smrg SVGAGuestImage backingStore; 9993bfa90b6Smrg uint32 cloneCount; 10003bfa90b6Smrg} SVGAScreenObject; 10016df26cacSmrg 10026df26cacSmrg 10036df26cacSmrg/* 10043bfa90b6Smrg * Commands in the command FIFO: 10053bfa90b6Smrg * 10063bfa90b6Smrg * Command IDs defined below are used for the traditional 2D FIFO 10073bfa90b6Smrg * communication (not all commands are available for all versions of the 10083bfa90b6Smrg * SVGA FIFO protocol). 10093bfa90b6Smrg * 10103bfa90b6Smrg * Note the holes in the command ID numbers: These commands have been 10113bfa90b6Smrg * deprecated, and the old IDs must not be reused. 10123bfa90b6Smrg * 10133bfa90b6Smrg * Command IDs from 1000 to 1999 are reserved for use by the SVGA3D 10143bfa90b6Smrg * protocol. 10153bfa90b6Smrg * 10163bfa90b6Smrg * Each command's parameters are described by the comments and 10173bfa90b6Smrg * structs below. 10186df26cacSmrg */ 10193bfa90b6Smrg 10203bfa90b6Smrgtypedef enum { 10213bfa90b6Smrg SVGA_CMD_INVALID_CMD = 0, 10223bfa90b6Smrg SVGA_CMD_UPDATE = 1, 10233bfa90b6Smrg SVGA_CMD_RECT_COPY = 3, 10243bfa90b6Smrg SVGA_CMD_DEFINE_CURSOR = 19, 10253bfa90b6Smrg SVGA_CMD_DEFINE_ALPHA_CURSOR = 22, 10263bfa90b6Smrg SVGA_CMD_UPDATE_VERBOSE = 25, 10273bfa90b6Smrg SVGA_CMD_FRONT_ROP_FILL = 29, 10283bfa90b6Smrg SVGA_CMD_FENCE = 30, 10293bfa90b6Smrg SVGA_CMD_ESCAPE = 33, 10303bfa90b6Smrg SVGA_CMD_DEFINE_SCREEN = 34, 10313bfa90b6Smrg SVGA_CMD_DESTROY_SCREEN = 35, 10323bfa90b6Smrg SVGA_CMD_DEFINE_GMRFB = 36, 10333bfa90b6Smrg SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37, 10343bfa90b6Smrg SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38, 10353bfa90b6Smrg SVGA_CMD_ANNOTATION_FILL = 39, 10363bfa90b6Smrg SVGA_CMD_ANNOTATION_COPY = 40, 10373bfa90b6Smrg SVGA_CMD_DEFINE_GMR2 = 41, 10383bfa90b6Smrg SVGA_CMD_REMAP_GMR2 = 42, 10393bfa90b6Smrg SVGA_CMD_MAX 10403bfa90b6Smrg} SVGAFifoCmdId; 10413bfa90b6Smrg 10423bfa90b6Smrg#define SVGA_CMD_MAX_ARGS 64 10433bfa90b6Smrg 10446df26cacSmrg 10456df26cacSmrg/* 10463bfa90b6Smrg * SVGA_CMD_UPDATE -- 10473bfa90b6Smrg * 10483bfa90b6Smrg * This is a DMA transfer which copies from the Guest Framebuffer 10493bfa90b6Smrg * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which 10503bfa90b6Smrg * intersect with the provided virtual rectangle. 10513bfa90b6Smrg * 10523bfa90b6Smrg * This command does not support using arbitrary guest memory as a 10533bfa90b6Smrg * data source- it only works with the pre-defined GFB memory. 10543bfa90b6Smrg * This command also does not support signed virtual coordinates. 10553bfa90b6Smrg * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with 10563bfa90b6Smrg * negative root x/y coordinates, the negative portion of those 10573bfa90b6Smrg * screens will not be reachable by this command. 10583bfa90b6Smrg * 10593bfa90b6Smrg * This command is not necessary when using framebuffer 10603bfa90b6Smrg * traces. Traces are automatically enabled if the SVGA FIFO is 10613bfa90b6Smrg * disabled, and you may explicitly enable/disable traces using 10623bfa90b6Smrg * SVGA_REG_TRACES. With traces enabled, any write to the GFB will 10633bfa90b6Smrg * automatically act as if a subsequent SVGA_CMD_UPDATE was issued. 10643bfa90b6Smrg * 10653bfa90b6Smrg * Traces and SVGA_CMD_UPDATE are the only supported ways to render 10663bfa90b6Smrg * pseudocolor screen updates. The newer Screen Object commands 10673bfa90b6Smrg * only support true color formats. 10683bfa90b6Smrg * 10693bfa90b6Smrg * Availability: 10703bfa90b6Smrg * Always available. 10716df26cacSmrg */ 10723bfa90b6Smrg 10733bfa90b6Smrgtypedef 10743bfa90b6Smrgstruct SVGAFifoCmdUpdate { 10753bfa90b6Smrg uint32 x; 10763bfa90b6Smrg uint32 y; 10773bfa90b6Smrg uint32 width; 10783bfa90b6Smrg uint32 height; 10793bfa90b6Smrg} SVGAFifoCmdUpdate; 10803bfa90b6Smrg 10816df26cacSmrg 10826df26cacSmrg/* 10833bfa90b6Smrg * SVGA_CMD_RECT_COPY -- 10843bfa90b6Smrg * 10853bfa90b6Smrg * Perform a rectangular DMA transfer from one area of the GFB to 10863bfa90b6Smrg * another, and copy the result to any screens which intersect it. 10873bfa90b6Smrg * 10883bfa90b6Smrg * Availability: 10893bfa90b6Smrg * SVGA_CAP_RECT_COPY 10906df26cacSmrg */ 10916df26cacSmrg 10923bfa90b6Smrgtypedef 10933bfa90b6Smrgstruct SVGAFifoCmdRectCopy { 10943bfa90b6Smrg uint32 srcX; 10953bfa90b6Smrg uint32 srcY; 10963bfa90b6Smrg uint32 destX; 10973bfa90b6Smrg uint32 destY; 10983bfa90b6Smrg uint32 width; 10993bfa90b6Smrg uint32 height; 11003bfa90b6Smrg} SVGAFifoCmdRectCopy; 11016df26cacSmrg 11026df26cacSmrg 11033bfa90b6Smrg/* 11043bfa90b6Smrg * SVGA_CMD_DEFINE_CURSOR -- 11053bfa90b6Smrg * 11063bfa90b6Smrg * Provide a new cursor image, as an AND/XOR mask. 11073bfa90b6Smrg * 11083bfa90b6Smrg * The recommended way to position the cursor overlay is by using 11093bfa90b6Smrg * the SVGA_FIFO_CURSOR_* registers, supported by the 11103bfa90b6Smrg * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability. 11113bfa90b6Smrg * 11123bfa90b6Smrg * Availability: 11133bfa90b6Smrg * SVGA_CAP_CURSOR 11143bfa90b6Smrg */ 11156df26cacSmrg 11163bfa90b6Smrgtypedef 11173bfa90b6Smrgstruct SVGAFifoCmdDefineCursor { 11183bfa90b6Smrg uint32 id; /* Reserved, must be zero. */ 11193bfa90b6Smrg uint32 hotspotX; 11203bfa90b6Smrg uint32 hotspotY; 11213bfa90b6Smrg uint32 width; 11223bfa90b6Smrg uint32 height; 11233bfa90b6Smrg uint32 andMaskDepth; /* Value must be 1 or equal to BITS_PER_PIXEL */ 11243bfa90b6Smrg uint32 xorMaskDepth; /* Value must be 1 or equal to BITS_PER_PIXEL */ 11253bfa90b6Smrg /* 11263bfa90b6Smrg * Followed by scanline data for AND mask, then XOR mask. 11273bfa90b6Smrg * Each scanline is padded to a 32-bit boundary. 11283bfa90b6Smrg */ 11293bfa90b6Smrg} SVGAFifoCmdDefineCursor; 11306df26cacSmrg 11316df26cacSmrg 11323bfa90b6Smrg/* 11333bfa90b6Smrg * SVGA_CMD_DEFINE_ALPHA_CURSOR -- 11343bfa90b6Smrg * 11353bfa90b6Smrg * Provide a new cursor image, in 32-bit BGRA format. 11363bfa90b6Smrg * 11373bfa90b6Smrg * The recommended way to position the cursor overlay is by using 11383bfa90b6Smrg * the SVGA_FIFO_CURSOR_* registers, supported by the 11393bfa90b6Smrg * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability. 11403bfa90b6Smrg * 11413bfa90b6Smrg * Availability: 11423bfa90b6Smrg * SVGA_CAP_ALPHA_CURSOR 11433bfa90b6Smrg */ 11446df26cacSmrg 11453bfa90b6Smrgtypedef 11463bfa90b6Smrgstruct SVGAFifoCmdDefineAlphaCursor { 11473bfa90b6Smrg uint32 id; /* Reserved, must be zero. */ 11483bfa90b6Smrg uint32 hotspotX; 11493bfa90b6Smrg uint32 hotspotY; 11503bfa90b6Smrg uint32 width; 11513bfa90b6Smrg uint32 height; 11523bfa90b6Smrg /* Followed by scanline data */ 11533bfa90b6Smrg} SVGAFifoCmdDefineAlphaCursor; 11546df26cacSmrg 11556df26cacSmrg 11563bfa90b6Smrg/* 11573bfa90b6Smrg * SVGA_CMD_UPDATE_VERBOSE -- 11583bfa90b6Smrg * 11593bfa90b6Smrg * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle 11603bfa90b6Smrg * 'reason' value, an opaque cookie which is used by internal 11613bfa90b6Smrg * debugging tools. Third party drivers should not use this 11623bfa90b6Smrg * command. 11633bfa90b6Smrg * 11643bfa90b6Smrg * Availability: 11653bfa90b6Smrg * SVGA_CAP_EXTENDED_FIFO 11663bfa90b6Smrg */ 11676df26cacSmrg 11683bfa90b6Smrgtypedef 11693bfa90b6Smrgstruct SVGAFifoCmdUpdateVerbose { 11703bfa90b6Smrg uint32 x; 11713bfa90b6Smrg uint32 y; 11723bfa90b6Smrg uint32 width; 11733bfa90b6Smrg uint32 height; 11743bfa90b6Smrg uint32 reason; 11753bfa90b6Smrg} SVGAFifoCmdUpdateVerbose; 11766df26cacSmrg 11776df26cacSmrg 11783bfa90b6Smrg/* 11793bfa90b6Smrg * SVGA_CMD_FRONT_ROP_FILL -- 11803bfa90b6Smrg * 11813bfa90b6Smrg * This is a hint which tells the SVGA device that the driver has 11823bfa90b6Smrg * just filled a rectangular region of the GFB with a solid 11833bfa90b6Smrg * color. Instead of reading these pixels from the GFB, the device 11843bfa90b6Smrg * can assume that they all equal 'color'. This is primarily used 11853bfa90b6Smrg * for remote desktop protocols. 11863bfa90b6Smrg * 11873bfa90b6Smrg * Availability: 11883bfa90b6Smrg * SVGA_FIFO_CAP_ACCELFRONT 11893bfa90b6Smrg */ 11903bfa90b6Smrg 11913bfa90b6Smrg#define SVGA_ROP_COPY 0x03 11926df26cacSmrg 11933bfa90b6Smrg#define SVGA_INVALID_DISPLAY_ID ((uint32)-1) 11946df26cacSmrg 11953bfa90b6Smrgtypedef 11963bfa90b6Smrgstruct SVGAFifoCmdFrontRopFill { 11973bfa90b6Smrg uint32 color; /* In the same format as the GFB */ 11983bfa90b6Smrg uint32 x; 11993bfa90b6Smrg uint32 y; 12003bfa90b6Smrg uint32 width; 12013bfa90b6Smrg uint32 height; 12023bfa90b6Smrg uint32 rop; /* Must be SVGA_ROP_COPY */ 12033bfa90b6Smrg} SVGAFifoCmdFrontRopFill; 12046df26cacSmrg 12056df26cacSmrg 12063bfa90b6Smrg/* 12073bfa90b6Smrg * SVGA_CMD_FENCE -- 12083bfa90b6Smrg * 12093bfa90b6Smrg * Insert a synchronization fence. When the SVGA device reaches 12103bfa90b6Smrg * this command, it will copy the 'fence' value into the 12113bfa90b6Smrg * SVGA_FIFO_FENCE register. It will also compare the fence against 12123bfa90b6Smrg * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the 12133bfa90b6Smrg * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will 12143bfa90b6Smrg * raise this interrupt. 12153bfa90b6Smrg * 12163bfa90b6Smrg * Availability: 12173bfa90b6Smrg * SVGA_FIFO_FENCE for this command, 12183bfa90b6Smrg * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL. 12193bfa90b6Smrg */ 12206df26cacSmrg 12213bfa90b6Smrgtypedef 12223bfa90b6Smrgstruct { 12233bfa90b6Smrg uint32 fence; 12243bfa90b6Smrg} SVGAFifoCmdFence; 12256df26cacSmrg 12266df26cacSmrg 12273bfa90b6Smrg/* 12283bfa90b6Smrg * SVGA_CMD_ESCAPE -- 12293bfa90b6Smrg * 12303bfa90b6Smrg * Send an extended or vendor-specific variable length command. 12313bfa90b6Smrg * This is used for video overlay, third party plugins, and 12323bfa90b6Smrg * internal debugging tools. See svga_escape.h 12333bfa90b6Smrg * 12343bfa90b6Smrg * Availability: 12353bfa90b6Smrg * SVGA_FIFO_CAP_ESCAPE 12363bfa90b6Smrg */ 12376df26cacSmrg 12383bfa90b6Smrgtypedef 12393bfa90b6Smrgstruct SVGAFifoCmdEscape { 12403bfa90b6Smrg uint32 nsid; 12413bfa90b6Smrg uint32 size; 12423bfa90b6Smrg /* followed by 'size' bytes of data */ 12433bfa90b6Smrg} SVGAFifoCmdEscape; 12446df26cacSmrg 12456df26cacSmrg 12463bfa90b6Smrg/* 12473bfa90b6Smrg * SVGA_CMD_DEFINE_SCREEN -- 12483bfa90b6Smrg * 12493bfa90b6Smrg * Define or redefine an SVGAScreenObject. See the description of 12503bfa90b6Smrg * SVGAScreenObject above. The video driver is responsible for 12513bfa90b6Smrg * generating new screen IDs. They should be small positive 12523bfa90b6Smrg * integers. The virtual device will have an implementation 12533bfa90b6Smrg * specific upper limit on the number of screen IDs 12543bfa90b6Smrg * supported. Drivers are responsible for recycling IDs. The first 12553bfa90b6Smrg * valid ID is zero. 12563bfa90b6Smrg * 12573bfa90b6Smrg * - Interaction with other registers: 12583bfa90b6Smrg * 12593bfa90b6Smrg * For backwards compatibility, when the GFB mode registers (WIDTH, 12603bfa90b6Smrg * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device 12613bfa90b6Smrg * deletes all screens other than screen #0, and redefines screen 12623bfa90b6Smrg * #0 according to the specified mode. Drivers that use 12633bfa90b6Smrg * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0. 12643bfa90b6Smrg * 12653bfa90b6Smrg * If you use screen objects, do not use the legacy multi-mon 12663bfa90b6Smrg * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*). 12673bfa90b6Smrg * 12683bfa90b6Smrg * Availability: 12693bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 12703bfa90b6Smrg */ 12716df26cacSmrg 12723bfa90b6Smrgtypedef 12733bfa90b6Smrgstruct { 12743bfa90b6Smrg SVGAScreenObject screen; /* Variable-length according to version */ 12753bfa90b6Smrg} SVGAFifoCmdDefineScreen; 12766df26cacSmrg 12776df26cacSmrg 12786df26cacSmrg/* 12793bfa90b6Smrg * SVGA_CMD_DESTROY_SCREEN -- 12803bfa90b6Smrg * 12813bfa90b6Smrg * Destroy an SVGAScreenObject. Its ID is immediately available for 12823bfa90b6Smrg * re-use. 12833bfa90b6Smrg * 12843bfa90b6Smrg * Availability: 12853bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 12863bfa90b6Smrg */ 12873bfa90b6Smrg 12883bfa90b6Smrgtypedef 12893bfa90b6Smrgstruct { 12903bfa90b6Smrg uint32 screenId; 12913bfa90b6Smrg} SVGAFifoCmdDestroyScreen; 12923bfa90b6Smrg 12933bfa90b6Smrg 12943bfa90b6Smrg/* 12953bfa90b6Smrg * SVGA_CMD_DEFINE_GMRFB -- 12963bfa90b6Smrg * 12973bfa90b6Smrg * This command sets a piece of SVGA device state called the 12983bfa90b6Smrg * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a 12993bfa90b6Smrg * piece of light-weight state which identifies the location and 13003bfa90b6Smrg * format of an image in guest memory or in BAR1. The GMRFB has 13013bfa90b6Smrg * an arbitrary size, and it doesn't need to match the geometry 13023bfa90b6Smrg * of the GFB or any screen object. 13033bfa90b6Smrg * 13043bfa90b6Smrg * The GMRFB can be redefined as often as you like. You could 13053bfa90b6Smrg * always use the same GMRFB, you could redefine it before 13063bfa90b6Smrg * rendering from a different guest screen, or you could even 13073bfa90b6Smrg * redefine it before every blit. 13083bfa90b6Smrg * 13093bfa90b6Smrg * There are multiple ways to use this command. The simplest way is 13103bfa90b6Smrg * to use it to move the framebuffer either to elsewhere in the GFB 13113bfa90b6Smrg * (BAR1) memory region, or to a user-defined GMR. This lets a 13123bfa90b6Smrg * driver use a framebuffer allocated entirely out of normal system 13133bfa90b6Smrg * memory, which we encourage. 13143bfa90b6Smrg * 13153bfa90b6Smrg * Another way to use this command is to set up a ring buffer of 13163bfa90b6Smrg * updates in GFB memory. If a driver wants to ensure that no 13173bfa90b6Smrg * frames are skipped by the SVGA device, it is important that the 13183bfa90b6Smrg * driver not modify the source data for a blit until the device is 13193bfa90b6Smrg * done processing the command. One efficient way to accomplish 13203bfa90b6Smrg * this is to use a ring of small DMA buffers. Each buffer is used 13213bfa90b6Smrg * for one blit, then we move on to the next buffer in the 13223bfa90b6Smrg * ring. The FENCE mechanism is used to protect each buffer from 13233bfa90b6Smrg * re-use until the device is finished with that buffer's 13243bfa90b6Smrg * corresponding blit. 13253bfa90b6Smrg * 13263bfa90b6Smrg * This command does not affect the meaning of SVGA_CMD_UPDATE. 13273bfa90b6Smrg * UPDATEs always occur from the legacy GFB memory area. This 13283bfa90b6Smrg * command has no support for pseudocolor GMRFBs. Currently only 13293bfa90b6Smrg * true-color 15, 16, and 24-bit depths are supported. Future 13303bfa90b6Smrg * devices may expose capabilities for additional framebuffer 13313bfa90b6Smrg * formats. 13323bfa90b6Smrg * 13333bfa90b6Smrg * The default GMRFB value is undefined. Drivers must always send 13343bfa90b6Smrg * this command at least once before performing any blit from the 13353bfa90b6Smrg * GMRFB. 13363bfa90b6Smrg * 13373bfa90b6Smrg * Availability: 13383bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 13393bfa90b6Smrg */ 13403bfa90b6Smrg 13413bfa90b6Smrgtypedef 13423bfa90b6Smrgstruct { 13433bfa90b6Smrg SVGAGuestPtr ptr; 13443bfa90b6Smrg uint32 bytesPerLine; 13453bfa90b6Smrg SVGAGMRImageFormat format; 13463bfa90b6Smrg} SVGAFifoCmdDefineGMRFB; 13473bfa90b6Smrg 13483bfa90b6Smrg 13493bfa90b6Smrg/* 13503bfa90b6Smrg * SVGA_CMD_BLIT_GMRFB_TO_SCREEN -- 13513bfa90b6Smrg * 13523bfa90b6Smrg * This is a guest-to-host blit. It performs a DMA operation to 13533bfa90b6Smrg * copy a rectangular region of pixels from the current GMRFB to 13543bfa90b6Smrg * one or more Screen Objects. 13553bfa90b6Smrg * 13563bfa90b6Smrg * The destination coordinate may be specified relative to a 13573bfa90b6Smrg * screen's origin (if a screen ID is specified) or relative to the 13583bfa90b6Smrg * virtual coordinate system's origin (if the screen ID is 13593bfa90b6Smrg * SVGA_ID_INVALID). The actual destination may span zero or more 13603bfa90b6Smrg * screens, in the case of a virtual destination rect or a rect 13613bfa90b6Smrg * which extends off the edge of the specified screen. 13623bfa90b6Smrg * 13633bfa90b6Smrg * This command writes to the screen's "base layer": the underlying 13643bfa90b6Smrg * framebuffer which exists below any cursor or video overlays. No 13653bfa90b6Smrg * action is necessary to explicitly hide or update any overlays 13663bfa90b6Smrg * which exist on top of the updated region. 13673bfa90b6Smrg * 13683bfa90b6Smrg * The SVGA device is guaranteed to finish reading from the GMRFB 13693bfa90b6Smrg * by the time any subsequent FENCE commands are reached. 13703bfa90b6Smrg * 13713bfa90b6Smrg * This command consumes an annotation. See the 13723bfa90b6Smrg * SVGA_CMD_ANNOTATION_* commands for details. 13733bfa90b6Smrg * 13743bfa90b6Smrg * Availability: 13753bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 13763bfa90b6Smrg */ 13773bfa90b6Smrg 13783bfa90b6Smrgtypedef 13793bfa90b6Smrgstruct { 13803bfa90b6Smrg SVGASignedPoint srcOrigin; 13813bfa90b6Smrg SVGASignedRect destRect; 13823bfa90b6Smrg uint32 destScreenId; 13833bfa90b6Smrg} SVGAFifoCmdBlitGMRFBToScreen; 13843bfa90b6Smrg 13853bfa90b6Smrg 13863bfa90b6Smrg/* 13873bfa90b6Smrg * SVGA_CMD_BLIT_SCREEN_TO_GMRFB -- 13883bfa90b6Smrg * 13893bfa90b6Smrg * This is a host-to-guest blit. It performs a DMA operation to 13903bfa90b6Smrg * copy a rectangular region of pixels from a single Screen Object 13913bfa90b6Smrg * back to the current GMRFB. 13923bfa90b6Smrg * 13933bfa90b6Smrg * Usage note: This command should be used rarely. It will 13943bfa90b6Smrg * typically be inefficient, but it is necessary for some types of 13953bfa90b6Smrg * synchronization between 3D (GPU) and 2D (CPU) rendering into 13963bfa90b6Smrg * overlapping areas of a screen. 13973bfa90b6Smrg * 13983bfa90b6Smrg * The source coordinate is specified relative to a screen's 13993bfa90b6Smrg * origin. The provided screen ID must be valid. If any parameters 14003bfa90b6Smrg * are invalid, the resulting pixel values are undefined. 14013bfa90b6Smrg * 14023bfa90b6Smrg * This command reads the screen's "base layer". Overlays like 14033bfa90b6Smrg * video and cursor are not included, but any data which was sent 14043bfa90b6Smrg * using a blit-to-screen primitive will be available, no matter 14053bfa90b6Smrg * whether the data's original source was the GMRFB or the 3D 14063bfa90b6Smrg * acceleration hardware. 14073bfa90b6Smrg * 14083bfa90b6Smrg * Note that our guest-to-host blits and host-to-guest blits aren't 14093bfa90b6Smrg * symmetric in their current implementation. While the parameters 14103bfa90b6Smrg * are identical, host-to-guest blits are a lot less featureful. 14113bfa90b6Smrg * They do not support clipping: If the source parameters don't 14123bfa90b6Smrg * fully fit within a screen, the blit fails. They must originate 14133bfa90b6Smrg * from exactly one screen. Virtual coordinates are not directly 14143bfa90b6Smrg * supported. 14153bfa90b6Smrg * 14163bfa90b6Smrg * Host-to-guest blits do support the same set of GMRFB formats 14173bfa90b6Smrg * offered by guest-to-host blits. 14183bfa90b6Smrg * 14193bfa90b6Smrg * The SVGA device is guaranteed to finish writing to the GMRFB by 14203bfa90b6Smrg * the time any subsequent FENCE commands are reached. 14213bfa90b6Smrg * 14223bfa90b6Smrg * Availability: 14233bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 14243bfa90b6Smrg */ 14253bfa90b6Smrg 14263bfa90b6Smrgtypedef 14273bfa90b6Smrgstruct { 14283bfa90b6Smrg SVGASignedPoint destOrigin; 14293bfa90b6Smrg SVGASignedRect srcRect; 14303bfa90b6Smrg uint32 srcScreenId; 14313bfa90b6Smrg} SVGAFifoCmdBlitScreenToGMRFB; 14323bfa90b6Smrg 14333bfa90b6Smrg 14343bfa90b6Smrg/* 14353bfa90b6Smrg * SVGA_CMD_ANNOTATION_FILL -- 14363bfa90b6Smrg * 14373bfa90b6Smrg * This is a blit annotation. This command stores a small piece of 14383bfa90b6Smrg * device state which is consumed by the next blit-to-screen 14393bfa90b6Smrg * command. The state is only cleared by commands which are 14403bfa90b6Smrg * specifically documented as consuming an annotation. Other 14413bfa90b6Smrg * commands (such as ESCAPEs for debugging) may intervene between 14423bfa90b6Smrg * the annotation and its associated blit. 14433bfa90b6Smrg * 14443bfa90b6Smrg * This annotation is a promise about the contents of the next 14453bfa90b6Smrg * blit: The video driver is guaranteeing that all pixels in that 14463bfa90b6Smrg * blit will have the same value, specified here as a color in 14473bfa90b6Smrg * SVGAColorBGRX format. 14483bfa90b6Smrg * 14493bfa90b6Smrg * The SVGA device can still render the blit correctly even if it 14503bfa90b6Smrg * ignores this annotation, but the annotation may allow it to 14513bfa90b6Smrg * perform the blit more efficiently, for example by ignoring the 14523bfa90b6Smrg * source data and performing a fill in hardware. 14533bfa90b6Smrg * 14543bfa90b6Smrg * This annotation is most important for performance when the 14553bfa90b6Smrg * user's display is being remoted over a network connection. 14563bfa90b6Smrg * 14573bfa90b6Smrg * Availability: 14583bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 14593bfa90b6Smrg */ 14603bfa90b6Smrg 14613bfa90b6Smrgtypedef 14623bfa90b6Smrgstruct { 14633bfa90b6Smrg SVGAColorBGRX color; 14643bfa90b6Smrg} SVGAFifoCmdAnnotationFill; 14653bfa90b6Smrg 14663bfa90b6Smrg 14673bfa90b6Smrg/* 14683bfa90b6Smrg * SVGA_CMD_ANNOTATION_COPY -- 14693bfa90b6Smrg * 14703bfa90b6Smrg * This is a blit annotation. See SVGA_CMD_ANNOTATION_FILL for more 14713bfa90b6Smrg * information about annotations. 14723bfa90b6Smrg * 14733bfa90b6Smrg * This annotation is a promise about the contents of the next 14743bfa90b6Smrg * blit: The video driver is guaranteeing that all pixels in that 14753bfa90b6Smrg * blit will have the same value as those which already exist at an 14763bfa90b6Smrg * identically-sized region on the same or a different screen. 14773bfa90b6Smrg * 14783bfa90b6Smrg * Note that the source pixels for the COPY in this annotation are 14793bfa90b6Smrg * sampled before applying the anqnotation's associated blit. They 14803bfa90b6Smrg * are allowed to overlap with the blit's destination pixels. 14813bfa90b6Smrg * 14823bfa90b6Smrg * The copy source rectangle is specified the same way as the blit 14833bfa90b6Smrg * destination: it can be a rectangle which spans zero or more 14843bfa90b6Smrg * screens, specified relative to either a screen or to the virtual 14853bfa90b6Smrg * coordinate system's origin. If the source rectangle includes 14863bfa90b6Smrg * pixels which are not from exactly one screen, the results are 14873bfa90b6Smrg * undefined. 14883bfa90b6Smrg * 14893bfa90b6Smrg * Availability: 14903bfa90b6Smrg * SVGA_FIFO_CAP_SCREEN_OBJECT or SVGA_FIFO_CAP_SCREEN_OBJECT_2 14913bfa90b6Smrg */ 14923bfa90b6Smrg 14933bfa90b6Smrgtypedef 14943bfa90b6Smrgstruct { 14953bfa90b6Smrg SVGASignedPoint srcOrigin; 14963bfa90b6Smrg uint32 srcScreenId; 14973bfa90b6Smrg} SVGAFifoCmdAnnotationCopy; 14983bfa90b6Smrg 14993bfa90b6Smrg 15003bfa90b6Smrg/* 15013bfa90b6Smrg * SVGA_CMD_DEFINE_GMR2 -- 15023bfa90b6Smrg * 15033bfa90b6Smrg * Define guest memory region v2. See the description of GMRs above. 15043bfa90b6Smrg * 15053bfa90b6Smrg * Availability: 15063bfa90b6Smrg * SVGA_CAP_GMR2 15073bfa90b6Smrg */ 15083bfa90b6Smrg 15093bfa90b6Smrgtypedef 15103bfa90b6Smrgstruct { 15113bfa90b6Smrg uint32 gmrId; 15123bfa90b6Smrg uint32 numPages; 15133bfa90b6Smrg} SVGAFifoCmdDefineGMR2; 15143bfa90b6Smrg 15153bfa90b6Smrg 15163bfa90b6Smrg/* 15173bfa90b6Smrg * SVGA_CMD_REMAP_GMR2 -- 15183bfa90b6Smrg * 15193bfa90b6Smrg * Remap guest memory region v2. See the description of GMRs above. 15203bfa90b6Smrg * 15213bfa90b6Smrg * This command allows guest to modify a portion of an existing GMR by 15223bfa90b6Smrg * invalidating it or reassigning it to different guest physical pages. 15233bfa90b6Smrg * The pages are identified by physical page number (PPN). The pages 15243bfa90b6Smrg * are assumed to be pinned and valid for DMA operations. 15253bfa90b6Smrg * 15263bfa90b6Smrg * Description of command flags: 15273bfa90b6Smrg * 15283bfa90b6Smrg * SVGA_REMAP_GMR2_VIA_GMR: If enabled, references a PPN list in a GMR. 15293bfa90b6Smrg * The PPN list must not overlap with the remap region (this can be 15303bfa90b6Smrg * handled trivially by referencing a separate GMR). If flag is 15313bfa90b6Smrg * disabled, PPN list is appended to SVGARemapGMR command. 15323bfa90b6Smrg * 15333bfa90b6Smrg * SVGA_REMAP_GMR2_PPN64: If set, PPN list is in PPN64 format, otherwise 15343bfa90b6Smrg * it is in PPN32 format. 15353bfa90b6Smrg * 15363bfa90b6Smrg * SVGA_REMAP_GMR2_SINGLE_PPN: If set, PPN list contains a single entry. 15373bfa90b6Smrg * A single PPN can be used to invalidate a portion of a GMR or 15383bfa90b6Smrg * map it to to a single guest scratch page. 15393bfa90b6Smrg * 15403bfa90b6Smrg * Availability: 15413bfa90b6Smrg * SVGA_CAP_GMR2 15423bfa90b6Smrg */ 15433bfa90b6Smrg 15443bfa90b6Smrgtypedef enum { 15453bfa90b6Smrg SVGA_REMAP_GMR2_PPN32 = 0, 15463bfa90b6Smrg SVGA_REMAP_GMR2_VIA_GMR = (1 << 0), 15473bfa90b6Smrg SVGA_REMAP_GMR2_PPN64 = (1 << 1), 15483bfa90b6Smrg SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2), 15493bfa90b6Smrg} SVGARemapGMR2Flags; 15503bfa90b6Smrg 15513bfa90b6Smrgtypedef 15523bfa90b6Smrgstruct { 15533bfa90b6Smrg uint32 gmrId; 15543bfa90b6Smrg SVGARemapGMR2Flags flags; 15553bfa90b6Smrg uint32 offsetPages; /* offset in pages to begin remap */ 15563bfa90b6Smrg uint32 numPages; /* number of pages to remap */ 15573bfa90b6Smrg /* 15583bfa90b6Smrg * Followed by additional data depending on SVGARemapGMR2Flags. 15593bfa90b6Smrg * 15603bfa90b6Smrg * If flag SVGA_REMAP_GMR2_VIA_GMR is set, single SVGAGuestPtr follows. 15613bfa90b6Smrg * Otherwise an array of page descriptors in PPN32 or PPN64 format 15623bfa90b6Smrg * (according to flag SVGA_REMAP_GMR2_PPN64) follows. If flag 15633bfa90b6Smrg * SVGA_REMAP_GMR2_SINGLE_PPN is set, array contains a single entry. 15643bfa90b6Smrg */ 15653bfa90b6Smrg} SVGAFifoCmdRemapGMR2; 15666df26cacSmrg 15676df26cacSmrg#endif 1568