Subversion Repositories Kolibri OS

Rev

Rev 4075 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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