···11+config DRM_VMWGFX22+ tristate "DRM driver for VMware Virtual GPU"33+ depends on DRM && PCI44+ select FB_DEFERRED_IO55+ select FB_CFB_FILLRECT66+ select FB_CFB_COPYAREA77+ select FB_CFB_IMAGEBLIT88+ select DRM_TTM99+ help1010+ KMS enabled DRM driver for SVGA2 virtual hardware.1111+1212+ If unsure say n. The compiled module will be1313+ called vmwgfx.ko
···11+/**********************************************************22+ * Copyright 1998-2009 VMware, Inc. All rights reserved.33+ *44+ * Permission is hereby granted, free of charge, to any person55+ * obtaining a copy of this software and associated documentation66+ * files (the "Software"), to deal in the Software without77+ * restriction, including without limitation the rights to use, copy,88+ * modify, merge, publish, distribute, sublicense, and/or sell copies99+ * of the Software, and to permit persons to whom the Software is1010+ * furnished to do so, subject to the following conditions:1111+ *1212+ * The above copyright notice and this permission notice shall be1313+ * included in all copies or substantial portions of the Software.1414+ *1515+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,1616+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF1717+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND1818+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS1919+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN2020+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN2121+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE2222+ * SOFTWARE.2323+ *2424+ **********************************************************/2525+2626+/*2727+ * svga3d_reg.h --2828+ *2929+ * SVGA 3D hardware definitions3030+ */3131+3232+#ifndef _SVGA3D_REG_H_3333+#define _SVGA3D_REG_H_3434+3535+#include "svga_reg.h"3636+3737+3838+/*3939+ * 3D Hardware Version4040+ *4141+ * The hardware version is stored in the SVGA_FIFO_3D_HWVERSION fifo4242+ * register. Is set by the host and read by the guest. This lets4343+ * us make new guest drivers which are backwards-compatible with old4444+ * SVGA hardware revisions. It does not let us support old guest4545+ * drivers. Good enough for now.4646+ *4747+ */4848+4949+#define SVGA3D_MAKE_HWVERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))5050+#define SVGA3D_MAJOR_HWVERSION(version) ((version) >> 16)5151+#define SVGA3D_MINOR_HWVERSION(version) ((version) & 0xFF)5252+5353+typedef enum {5454+ SVGA3D_HWVERSION_WS5_RC1 = SVGA3D_MAKE_HWVERSION(0, 1),5555+ SVGA3D_HWVERSION_WS5_RC2 = SVGA3D_MAKE_HWVERSION(0, 2),5656+ SVGA3D_HWVERSION_WS51_RC1 = SVGA3D_MAKE_HWVERSION(0, 3),5757+ SVGA3D_HWVERSION_WS6_B1 = SVGA3D_MAKE_HWVERSION(1, 1),5858+ SVGA3D_HWVERSION_FUSION_11 = SVGA3D_MAKE_HWVERSION(1, 4),5959+ SVGA3D_HWVERSION_WS65_B1 = SVGA3D_MAKE_HWVERSION(2, 0),6060+ SVGA3D_HWVERSION_CURRENT = SVGA3D_HWVERSION_WS65_B1,6161+} SVGA3dHardwareVersion;6262+6363+/*6464+ * Generic Types6565+ */6666+6767+typedef uint32 SVGA3dBool; /* 32-bit Bool definition */6868+#define SVGA3D_NUM_CLIPPLANES 66969+#define SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS 87070+7171+7272+/*7373+ * Surface formats.7474+ *7575+ * If you modify this list, be sure to keep GLUtil.c in sync. It7676+ * includes the internal format definition of each surface in7777+ * GLUtil_ConvertSurfaceFormat, and it contains a table of7878+ * human-readable names in GLUtil_GetFormatName.7979+ */8080+8181+typedef enum SVGA3dSurfaceFormat {8282+ SVGA3D_FORMAT_INVALID = 0,8383+8484+ SVGA3D_X8R8G8B8 = 1,8585+ SVGA3D_A8R8G8B8 = 2,8686+8787+ SVGA3D_R5G6B5 = 3,8888+ SVGA3D_X1R5G5B5 = 4,8989+ SVGA3D_A1R5G5B5 = 5,9090+ SVGA3D_A4R4G4B4 = 6,9191+9292+ SVGA3D_Z_D32 = 7,9393+ SVGA3D_Z_D16 = 8,9494+ SVGA3D_Z_D24S8 = 9,9595+ SVGA3D_Z_D15S1 = 10,9696+9797+ SVGA3D_LUMINANCE8 = 11,9898+ SVGA3D_LUMINANCE4_ALPHA4 = 12,9999+ SVGA3D_LUMINANCE16 = 13,100100+ SVGA3D_LUMINANCE8_ALPHA8 = 14,101101+102102+ SVGA3D_DXT1 = 15,103103+ SVGA3D_DXT2 = 16,104104+ SVGA3D_DXT3 = 17,105105+ SVGA3D_DXT4 = 18,106106+ SVGA3D_DXT5 = 19,107107+108108+ SVGA3D_BUMPU8V8 = 20,109109+ SVGA3D_BUMPL6V5U5 = 21,110110+ SVGA3D_BUMPX8L8V8U8 = 22,111111+ SVGA3D_BUMPL8V8U8 = 23,112112+113113+ SVGA3D_ARGB_S10E5 = 24, /* 16-bit floating-point ARGB */114114+ SVGA3D_ARGB_S23E8 = 25, /* 32-bit floating-point ARGB */115115+116116+ SVGA3D_A2R10G10B10 = 26,117117+118118+ /* signed formats */119119+ SVGA3D_V8U8 = 27,120120+ SVGA3D_Q8W8V8U8 = 28,121121+ SVGA3D_CxV8U8 = 29,122122+123123+ /* mixed formats */124124+ SVGA3D_X8L8V8U8 = 30,125125+ SVGA3D_A2W10V10U10 = 31,126126+127127+ SVGA3D_ALPHA8 = 32,128128+129129+ /* Single- and dual-component floating point formats */130130+ SVGA3D_R_S10E5 = 33,131131+ SVGA3D_R_S23E8 = 34,132132+ SVGA3D_RG_S10E5 = 35,133133+ SVGA3D_RG_S23E8 = 36,134134+135135+ /*136136+ * Any surface can be used as a buffer object, but SVGA3D_BUFFER is137137+ * the most efficient format to use when creating new surfaces138138+ * expressly for index or vertex data.139139+ */140140+ SVGA3D_BUFFER = 37,141141+142142+ SVGA3D_Z_D24X8 = 38,143143+144144+ SVGA3D_V16U16 = 39,145145+146146+ SVGA3D_G16R16 = 40,147147+ SVGA3D_A16B16G16R16 = 41,148148+149149+ /* Packed Video formats */150150+ SVGA3D_UYVY = 42,151151+ SVGA3D_YUY2 = 43,152152+153153+ SVGA3D_FORMAT_MAX154154+} SVGA3dSurfaceFormat;155155+156156+typedef uint32 SVGA3dColor; /* a, r, g, b */157157+158158+/*159159+ * These match the D3DFORMAT_OP definitions used by Direct3D. We need160160+ * them so that we can query the host for what the supported surface161161+ * operations are (when we're using the D3D backend, in particular),162162+ * and so we can send those operations to the guest.163163+ */164164+typedef enum {165165+ SVGA3DFORMAT_OP_TEXTURE = 0x00000001,166166+ SVGA3DFORMAT_OP_VOLUMETEXTURE = 0x00000002,167167+ SVGA3DFORMAT_OP_CUBETEXTURE = 0x00000004,168168+ SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET = 0x00000008,169169+ SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET = 0x00000010,170170+ SVGA3DFORMAT_OP_ZSTENCIL = 0x00000040,171171+ SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH = 0x00000080,172172+173173+/*174174+ * This format can be used as a render target if the current display mode175175+ * is the same depth if the alpha channel is ignored. e.g. if the device176176+ * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the177177+ * format op list entry for A8R8G8B8 should have this cap.178178+ */179179+ SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET = 0x00000100,180180+181181+/*182182+ * This format contains DirectDraw support (including Flip). This flag183183+ * should not to be set on alpha formats.184184+ */185185+ SVGA3DFORMAT_OP_DISPLAYMODE = 0x00000400,186186+187187+/*188188+ * The rasterizer can support some level of Direct3D support in this format189189+ * and implies that the driver can create a Context in this mode (for some190190+ * render target format). When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE191191+ * flag must also be set.192192+ */193193+ SVGA3DFORMAT_OP_3DACCELERATION = 0x00000800,194194+195195+/*196196+ * This is set for a private format when the driver has put the bpp in197197+ * the structure.198198+ */199199+ SVGA3DFORMAT_OP_PIXELSIZE = 0x00001000,200200+201201+/*202202+ * Indicates that this format can be converted to any RGB format for which203203+ * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified204204+ */205205+ SVGA3DFORMAT_OP_CONVERT_TO_ARGB = 0x00002000,206206+207207+/*208208+ * Indicates that this format can be used to create offscreen plain surfaces.209209+ */210210+ SVGA3DFORMAT_OP_OFFSCREENPLAIN = 0x00004000,211211+212212+/*213213+ * Indicated that this format can be read as an SRGB texture (meaning that the214214+ * sampler will linearize the looked up data)215215+ */216216+ SVGA3DFORMAT_OP_SRGBREAD = 0x00008000,217217+218218+/*219219+ * Indicates that this format can be used in the bumpmap instructions220220+ */221221+ SVGA3DFORMAT_OP_BUMPMAP = 0x00010000,222222+223223+/*224224+ * Indicates that this format can be sampled by the displacement map sampler225225+ */226226+ SVGA3DFORMAT_OP_DMAP = 0x00020000,227227+228228+/*229229+ * Indicates that this format cannot be used with texture filtering230230+ */231231+ SVGA3DFORMAT_OP_NOFILTER = 0x00040000,232232+233233+/*234234+ * Indicates that format conversions are supported to this RGB format if235235+ * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format.236236+ */237237+ SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB = 0x00080000,238238+239239+/*240240+ * Indicated that this format can be written as an SRGB target (meaning that the241241+ * pixel pipe will DE-linearize data on output to format)242242+ */243243+ SVGA3DFORMAT_OP_SRGBWRITE = 0x00100000,244244+245245+/*246246+ * Indicates that this format cannot be used with alpha blending247247+ */248248+ SVGA3DFORMAT_OP_NOALPHABLEND = 0x00200000,249249+250250+/*251251+ * Indicates that the device can auto-generated sublevels for resources252252+ * of this format253253+ */254254+ SVGA3DFORMAT_OP_AUTOGENMIPMAP = 0x00400000,255255+256256+/*257257+ * Indicates that this format can be used by vertex texture sampler258258+ */259259+ SVGA3DFORMAT_OP_VERTEXTEXTURE = 0x00800000,260260+261261+/*262262+ * Indicates that this format supports neither texture coordinate wrap263263+ * modes, nor mipmapping264264+ */265265+ SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP = 0x01000000266266+} SVGA3dFormatOp;267267+268268+/*269269+ * This structure is a conversion of SVGA3DFORMAT_OP_*.270270+ * Entries must be located at the same position.271271+ */272272+typedef union {273273+ uint32 value;274274+ struct {275275+ uint32 texture : 1;276276+ uint32 volumeTexture : 1;277277+ uint32 cubeTexture : 1;278278+ uint32 offscreenRenderTarget : 1;279279+ uint32 sameFormatRenderTarget : 1;280280+ uint32 unknown1 : 1;281281+ uint32 zStencil : 1;282282+ uint32 zStencilArbitraryDepth : 1;283283+ uint32 sameFormatUpToAlpha : 1;284284+ uint32 unknown2 : 1;285285+ uint32 displayMode : 1;286286+ uint32 acceleration3d : 1;287287+ uint32 pixelSize : 1;288288+ uint32 convertToARGB : 1;289289+ uint32 offscreenPlain : 1;290290+ uint32 sRGBRead : 1;291291+ uint32 bumpMap : 1;292292+ uint32 dmap : 1;293293+ uint32 noFilter : 1;294294+ uint32 memberOfGroupARGB : 1;295295+ uint32 sRGBWrite : 1;296296+ uint32 noAlphaBlend : 1;297297+ uint32 autoGenMipMap : 1;298298+ uint32 vertexTexture : 1;299299+ uint32 noTexCoordWrapNorMip : 1;300300+ };301301+} SVGA3dSurfaceFormatCaps;302302+303303+/*304304+ * SVGA_3D_CMD_SETRENDERSTATE Types. All value types305305+ * must fit in a uint32.306306+ */307307+308308+typedef enum {309309+ SVGA3D_RS_INVALID = 0,310310+ SVGA3D_RS_ZENABLE = 1, /* SVGA3dBool */311311+ SVGA3D_RS_ZWRITEENABLE = 2, /* SVGA3dBool */312312+ SVGA3D_RS_ALPHATESTENABLE = 3, /* SVGA3dBool */313313+ SVGA3D_RS_DITHERENABLE = 4, /* SVGA3dBool */314314+ SVGA3D_RS_BLENDENABLE = 5, /* SVGA3dBool */315315+ SVGA3D_RS_FOGENABLE = 6, /* SVGA3dBool */316316+ SVGA3D_RS_SPECULARENABLE = 7, /* SVGA3dBool */317317+ SVGA3D_RS_STENCILENABLE = 8, /* SVGA3dBool */318318+ SVGA3D_RS_LIGHTINGENABLE = 9, /* SVGA3dBool */319319+ SVGA3D_RS_NORMALIZENORMALS = 10, /* SVGA3dBool */320320+ SVGA3D_RS_POINTSPRITEENABLE = 11, /* SVGA3dBool */321321+ SVGA3D_RS_POINTSCALEENABLE = 12, /* SVGA3dBool */322322+ SVGA3D_RS_STENCILREF = 13, /* uint32 */323323+ SVGA3D_RS_STENCILMASK = 14, /* uint32 */324324+ SVGA3D_RS_STENCILWRITEMASK = 15, /* uint32 */325325+ SVGA3D_RS_FOGSTART = 16, /* float */326326+ SVGA3D_RS_FOGEND = 17, /* float */327327+ SVGA3D_RS_FOGDENSITY = 18, /* float */328328+ SVGA3D_RS_POINTSIZE = 19, /* float */329329+ SVGA3D_RS_POINTSIZEMIN = 20, /* float */330330+ SVGA3D_RS_POINTSIZEMAX = 21, /* float */331331+ SVGA3D_RS_POINTSCALE_A = 22, /* float */332332+ SVGA3D_RS_POINTSCALE_B = 23, /* float */333333+ SVGA3D_RS_POINTSCALE_C = 24, /* float */334334+ SVGA3D_RS_FOGCOLOR = 25, /* SVGA3dColor */335335+ SVGA3D_RS_AMBIENT = 26, /* SVGA3dColor */336336+ SVGA3D_RS_CLIPPLANEENABLE = 27, /* SVGA3dClipPlanes */337337+ SVGA3D_RS_FOGMODE = 28, /* SVGA3dFogMode */338338+ SVGA3D_RS_FILLMODE = 29, /* SVGA3dFillMode */339339+ SVGA3D_RS_SHADEMODE = 30, /* SVGA3dShadeMode */340340+ SVGA3D_RS_LINEPATTERN = 31, /* SVGA3dLinePattern */341341+ SVGA3D_RS_SRCBLEND = 32, /* SVGA3dBlendOp */342342+ SVGA3D_RS_DSTBLEND = 33, /* SVGA3dBlendOp */343343+ SVGA3D_RS_BLENDEQUATION = 34, /* SVGA3dBlendEquation */344344+ SVGA3D_RS_CULLMODE = 35, /* SVGA3dFace */345345+ SVGA3D_RS_ZFUNC = 36, /* SVGA3dCmpFunc */346346+ SVGA3D_RS_ALPHAFUNC = 37, /* SVGA3dCmpFunc */347347+ SVGA3D_RS_STENCILFUNC = 38, /* SVGA3dCmpFunc */348348+ SVGA3D_RS_STENCILFAIL = 39, /* SVGA3dStencilOp */349349+ SVGA3D_RS_STENCILZFAIL = 40, /* SVGA3dStencilOp */350350+ SVGA3D_RS_STENCILPASS = 41, /* SVGA3dStencilOp */351351+ SVGA3D_RS_ALPHAREF = 42, /* float (0.0 .. 1.0) */352352+ SVGA3D_RS_FRONTWINDING = 43, /* SVGA3dFrontWinding */353353+ SVGA3D_RS_COORDINATETYPE = 44, /* SVGA3dCoordinateType */354354+ SVGA3D_RS_ZBIAS = 45, /* float */355355+ SVGA3D_RS_RANGEFOGENABLE = 46, /* SVGA3dBool */356356+ SVGA3D_RS_COLORWRITEENABLE = 47, /* SVGA3dColorMask */357357+ SVGA3D_RS_VERTEXMATERIALENABLE = 48, /* SVGA3dBool */358358+ SVGA3D_RS_DIFFUSEMATERIALSOURCE = 49, /* SVGA3dVertexMaterial */359359+ SVGA3D_RS_SPECULARMATERIALSOURCE = 50, /* SVGA3dVertexMaterial */360360+ SVGA3D_RS_AMBIENTMATERIALSOURCE = 51, /* SVGA3dVertexMaterial */361361+ SVGA3D_RS_EMISSIVEMATERIALSOURCE = 52, /* SVGA3dVertexMaterial */362362+ SVGA3D_RS_TEXTUREFACTOR = 53, /* SVGA3dColor */363363+ SVGA3D_RS_LOCALVIEWER = 54, /* SVGA3dBool */364364+ SVGA3D_RS_SCISSORTESTENABLE = 55, /* SVGA3dBool */365365+ SVGA3D_RS_BLENDCOLOR = 56, /* SVGA3dColor */366366+ SVGA3D_RS_STENCILENABLE2SIDED = 57, /* SVGA3dBool */367367+ SVGA3D_RS_CCWSTENCILFUNC = 58, /* SVGA3dCmpFunc */368368+ SVGA3D_RS_CCWSTENCILFAIL = 59, /* SVGA3dStencilOp */369369+ SVGA3D_RS_CCWSTENCILZFAIL = 60, /* SVGA3dStencilOp */370370+ SVGA3D_RS_CCWSTENCILPASS = 61, /* SVGA3dStencilOp */371371+ SVGA3D_RS_VERTEXBLEND = 62, /* SVGA3dVertexBlendFlags */372372+ SVGA3D_RS_SLOPESCALEDEPTHBIAS = 63, /* float */373373+ SVGA3D_RS_DEPTHBIAS = 64, /* float */374374+375375+376376+ /*377377+ * Output Gamma Level378378+ *379379+ * Output gamma effects the gamma curve of colors that are output from the380380+ * rendering pipeline. A value of 1.0 specifies a linear color space. If the381381+ * value is <= 0.0, gamma correction is ignored and linear color space is382382+ * used.383383+ */384384+385385+ SVGA3D_RS_OUTPUTGAMMA = 65, /* float */386386+ SVGA3D_RS_ZVISIBLE = 66, /* SVGA3dBool */387387+ SVGA3D_RS_LASTPIXEL = 67, /* SVGA3dBool */388388+ SVGA3D_RS_CLIPPING = 68, /* SVGA3dBool */389389+ SVGA3D_RS_WRAP0 = 69, /* SVGA3dWrapFlags */390390+ SVGA3D_RS_WRAP1 = 70, /* SVGA3dWrapFlags */391391+ SVGA3D_RS_WRAP2 = 71, /* SVGA3dWrapFlags */392392+ SVGA3D_RS_WRAP3 = 72, /* SVGA3dWrapFlags */393393+ SVGA3D_RS_WRAP4 = 73, /* SVGA3dWrapFlags */394394+ SVGA3D_RS_WRAP5 = 74, /* SVGA3dWrapFlags */395395+ SVGA3D_RS_WRAP6 = 75, /* SVGA3dWrapFlags */396396+ SVGA3D_RS_WRAP7 = 76, /* SVGA3dWrapFlags */397397+ SVGA3D_RS_WRAP8 = 77, /* SVGA3dWrapFlags */398398+ SVGA3D_RS_WRAP9 = 78, /* SVGA3dWrapFlags */399399+ SVGA3D_RS_WRAP10 = 79, /* SVGA3dWrapFlags */400400+ SVGA3D_RS_WRAP11 = 80, /* SVGA3dWrapFlags */401401+ SVGA3D_RS_WRAP12 = 81, /* SVGA3dWrapFlags */402402+ SVGA3D_RS_WRAP13 = 82, /* SVGA3dWrapFlags */403403+ SVGA3D_RS_WRAP14 = 83, /* SVGA3dWrapFlags */404404+ SVGA3D_RS_WRAP15 = 84, /* SVGA3dWrapFlags */405405+ SVGA3D_RS_MULTISAMPLEANTIALIAS = 85, /* SVGA3dBool */406406+ SVGA3D_RS_MULTISAMPLEMASK = 86, /* uint32 */407407+ SVGA3D_RS_INDEXEDVERTEXBLENDENABLE = 87, /* SVGA3dBool */408408+ SVGA3D_RS_TWEENFACTOR = 88, /* float */409409+ SVGA3D_RS_ANTIALIASEDLINEENABLE = 89, /* SVGA3dBool */410410+ SVGA3D_RS_COLORWRITEENABLE1 = 90, /* SVGA3dColorMask */411411+ SVGA3D_RS_COLORWRITEENABLE2 = 91, /* SVGA3dColorMask */412412+ SVGA3D_RS_COLORWRITEENABLE3 = 92, /* SVGA3dColorMask */413413+ SVGA3D_RS_SEPARATEALPHABLENDENABLE = 93, /* SVGA3dBool */414414+ SVGA3D_RS_SRCBLENDALPHA = 94, /* SVGA3dBlendOp */415415+ SVGA3D_RS_DSTBLENDALPHA = 95, /* SVGA3dBlendOp */416416+ SVGA3D_RS_BLENDEQUATIONALPHA = 96, /* SVGA3dBlendEquation */417417+ SVGA3D_RS_MAX418418+} SVGA3dRenderStateName;419419+420420+typedef enum {421421+ SVGA3D_VERTEXMATERIAL_NONE = 0, /* Use the value in the current material */422422+ SVGA3D_VERTEXMATERIAL_DIFFUSE = 1, /* Use the value in the diffuse component */423423+ SVGA3D_VERTEXMATERIAL_SPECULAR = 2, /* Use the value in the specular component */424424+} SVGA3dVertexMaterial;425425+426426+typedef enum {427427+ SVGA3D_FILLMODE_INVALID = 0,428428+ SVGA3D_FILLMODE_POINT = 1,429429+ SVGA3D_FILLMODE_LINE = 2,430430+ SVGA3D_FILLMODE_FILL = 3,431431+ SVGA3D_FILLMODE_MAX432432+} SVGA3dFillModeType;433433+434434+435435+typedef436436+union {437437+ struct {438438+ uint16 mode; /* SVGA3dFillModeType */439439+ uint16 face; /* SVGA3dFace */440440+ };441441+ uint32 uintValue;442442+} SVGA3dFillMode;443443+444444+typedef enum {445445+ SVGA3D_SHADEMODE_INVALID = 0,446446+ SVGA3D_SHADEMODE_FLAT = 1,447447+ SVGA3D_SHADEMODE_SMOOTH = 2,448448+ SVGA3D_SHADEMODE_PHONG = 3, /* Not supported */449449+ SVGA3D_SHADEMODE_MAX450450+} SVGA3dShadeMode;451451+452452+typedef453453+union {454454+ struct {455455+ uint16 repeat;456456+ uint16 pattern;457457+ };458458+ uint32 uintValue;459459+} SVGA3dLinePattern;460460+461461+typedef enum {462462+ SVGA3D_BLENDOP_INVALID = 0,463463+ SVGA3D_BLENDOP_ZERO = 1,464464+ SVGA3D_BLENDOP_ONE = 2,465465+ SVGA3D_BLENDOP_SRCCOLOR = 3,466466+ SVGA3D_BLENDOP_INVSRCCOLOR = 4,467467+ SVGA3D_BLENDOP_SRCALPHA = 5,468468+ SVGA3D_BLENDOP_INVSRCALPHA = 6,469469+ SVGA3D_BLENDOP_DESTALPHA = 7,470470+ SVGA3D_BLENDOP_INVDESTALPHA = 8,471471+ SVGA3D_BLENDOP_DESTCOLOR = 9,472472+ SVGA3D_BLENDOP_INVDESTCOLOR = 10,473473+ SVGA3D_BLENDOP_SRCALPHASAT = 11,474474+ SVGA3D_BLENDOP_BLENDFACTOR = 12,475475+ SVGA3D_BLENDOP_INVBLENDFACTOR = 13,476476+ SVGA3D_BLENDOP_MAX477477+} SVGA3dBlendOp;478478+479479+typedef enum {480480+ SVGA3D_BLENDEQ_INVALID = 0,481481+ SVGA3D_BLENDEQ_ADD = 1,482482+ SVGA3D_BLENDEQ_SUBTRACT = 2,483483+ SVGA3D_BLENDEQ_REVSUBTRACT = 3,484484+ SVGA3D_BLENDEQ_MINIMUM = 4,485485+ SVGA3D_BLENDEQ_MAXIMUM = 5,486486+ SVGA3D_BLENDEQ_MAX487487+} SVGA3dBlendEquation;488488+489489+typedef enum {490490+ SVGA3D_FRONTWINDING_INVALID = 0,491491+ SVGA3D_FRONTWINDING_CW = 1,492492+ SVGA3D_FRONTWINDING_CCW = 2,493493+ SVGA3D_FRONTWINDING_MAX494494+} SVGA3dFrontWinding;495495+496496+typedef enum {497497+ SVGA3D_FACE_INVALID = 0,498498+ SVGA3D_FACE_NONE = 1,499499+ SVGA3D_FACE_FRONT = 2,500500+ SVGA3D_FACE_BACK = 3,501501+ SVGA3D_FACE_FRONT_BACK = 4,502502+ SVGA3D_FACE_MAX503503+} SVGA3dFace;504504+505505+/*506506+ * The order and the values should not be changed507507+ */508508+509509+typedef enum {510510+ SVGA3D_CMP_INVALID = 0,511511+ SVGA3D_CMP_NEVER = 1,512512+ SVGA3D_CMP_LESS = 2,513513+ SVGA3D_CMP_EQUAL = 3,514514+ SVGA3D_CMP_LESSEQUAL = 4,515515+ SVGA3D_CMP_GREATER = 5,516516+ SVGA3D_CMP_NOTEQUAL = 6,517517+ SVGA3D_CMP_GREATEREQUAL = 7,518518+ SVGA3D_CMP_ALWAYS = 8,519519+ SVGA3D_CMP_MAX520520+} SVGA3dCmpFunc;521521+522522+/*523523+ * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows524524+ * the fog factor to be specified in the alpha component of the specular525525+ * (a.k.a. secondary) vertex color.526526+ */527527+typedef enum {528528+ SVGA3D_FOGFUNC_INVALID = 0,529529+ SVGA3D_FOGFUNC_EXP = 1,530530+ SVGA3D_FOGFUNC_EXP2 = 2,531531+ SVGA3D_FOGFUNC_LINEAR = 3,532532+ SVGA3D_FOGFUNC_PER_VERTEX = 4533533+} SVGA3dFogFunction;534534+535535+/*536536+ * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex537537+ * or per-pixel basis.538538+ */539539+typedef enum {540540+ SVGA3D_FOGTYPE_INVALID = 0,541541+ SVGA3D_FOGTYPE_VERTEX = 1,542542+ SVGA3D_FOGTYPE_PIXEL = 2,543543+ SVGA3D_FOGTYPE_MAX = 3544544+} SVGA3dFogType;545545+546546+/*547547+ * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is548548+ * computed using the eye Z value of each pixel (or vertex), whereas range-549549+ * based fog is computed using the actual distance (range) to the eye.550550+ */551551+typedef enum {552552+ SVGA3D_FOGBASE_INVALID = 0,553553+ SVGA3D_FOGBASE_DEPTHBASED = 1,554554+ SVGA3D_FOGBASE_RANGEBASED = 2,555555+ SVGA3D_FOGBASE_MAX = 3556556+} SVGA3dFogBase;557557+558558+typedef enum {559559+ SVGA3D_STENCILOP_INVALID = 0,560560+ SVGA3D_STENCILOP_KEEP = 1,561561+ SVGA3D_STENCILOP_ZERO = 2,562562+ SVGA3D_STENCILOP_REPLACE = 3,563563+ SVGA3D_STENCILOP_INCRSAT = 4,564564+ SVGA3D_STENCILOP_DECRSAT = 5,565565+ SVGA3D_STENCILOP_INVERT = 6,566566+ SVGA3D_STENCILOP_INCR = 7,567567+ SVGA3D_STENCILOP_DECR = 8,568568+ SVGA3D_STENCILOP_MAX569569+} SVGA3dStencilOp;570570+571571+typedef enum {572572+ SVGA3D_CLIPPLANE_0 = (1 << 0),573573+ SVGA3D_CLIPPLANE_1 = (1 << 1),574574+ SVGA3D_CLIPPLANE_2 = (1 << 2),575575+ SVGA3D_CLIPPLANE_3 = (1 << 3),576576+ SVGA3D_CLIPPLANE_4 = (1 << 4),577577+ SVGA3D_CLIPPLANE_5 = (1 << 5),578578+} SVGA3dClipPlanes;579579+580580+typedef enum {581581+ SVGA3D_CLEAR_COLOR = 0x1,582582+ SVGA3D_CLEAR_DEPTH = 0x2,583583+ SVGA3D_CLEAR_STENCIL = 0x4584584+} SVGA3dClearFlag;585585+586586+typedef enum {587587+ SVGA3D_RT_DEPTH = 0,588588+ SVGA3D_RT_STENCIL = 1,589589+ SVGA3D_RT_COLOR0 = 2,590590+ SVGA3D_RT_COLOR1 = 3,591591+ SVGA3D_RT_COLOR2 = 4,592592+ SVGA3D_RT_COLOR3 = 5,593593+ SVGA3D_RT_COLOR4 = 6,594594+ SVGA3D_RT_COLOR5 = 7,595595+ SVGA3D_RT_COLOR6 = 8,596596+ SVGA3D_RT_COLOR7 = 9,597597+ SVGA3D_RT_MAX,598598+ SVGA3D_RT_INVALID = ((uint32)-1),599599+} SVGA3dRenderTargetType;600600+601601+#define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1)602602+603603+typedef604604+union {605605+ struct {606606+ uint32 red : 1;607607+ uint32 green : 1;608608+ uint32 blue : 1;609609+ uint32 alpha : 1;610610+ };611611+ uint32 uintValue;612612+} SVGA3dColorMask;613613+614614+typedef enum {615615+ SVGA3D_VBLEND_DISABLE = 0,616616+ SVGA3D_VBLEND_1WEIGHT = 1,617617+ SVGA3D_VBLEND_2WEIGHT = 2,618618+ SVGA3D_VBLEND_3WEIGHT = 3,619619+} SVGA3dVertexBlendFlags;620620+621621+typedef enum {622622+ SVGA3D_WRAPCOORD_0 = 1 << 0,623623+ SVGA3D_WRAPCOORD_1 = 1 << 1,624624+ SVGA3D_WRAPCOORD_2 = 1 << 2,625625+ SVGA3D_WRAPCOORD_3 = 1 << 3,626626+ SVGA3D_WRAPCOORD_ALL = 0xF,627627+} SVGA3dWrapFlags;628628+629629+/*630630+ * SVGA_3D_CMD_TEXTURESTATE Types. All value types631631+ * must fit in a uint32.632632+ */633633+634634+typedef enum {635635+ SVGA3D_TS_INVALID = 0,636636+ SVGA3D_TS_BIND_TEXTURE = 1, /* SVGA3dSurfaceId */637637+ SVGA3D_TS_COLOROP = 2, /* SVGA3dTextureCombiner */638638+ SVGA3D_TS_COLORARG1 = 3, /* SVGA3dTextureArgData */639639+ SVGA3D_TS_COLORARG2 = 4, /* SVGA3dTextureArgData */640640+ SVGA3D_TS_ALPHAOP = 5, /* SVGA3dTextureCombiner */641641+ SVGA3D_TS_ALPHAARG1 = 6, /* SVGA3dTextureArgData */642642+ SVGA3D_TS_ALPHAARG2 = 7, /* SVGA3dTextureArgData */643643+ SVGA3D_TS_ADDRESSU = 8, /* SVGA3dTextureAddress */644644+ SVGA3D_TS_ADDRESSV = 9, /* SVGA3dTextureAddress */645645+ SVGA3D_TS_MIPFILTER = 10, /* SVGA3dTextureFilter */646646+ SVGA3D_TS_MAGFILTER = 11, /* SVGA3dTextureFilter */647647+ SVGA3D_TS_MINFILTER = 12, /* SVGA3dTextureFilter */648648+ SVGA3D_TS_BORDERCOLOR = 13, /* SVGA3dColor */649649+ SVGA3D_TS_TEXCOORDINDEX = 14, /* uint32 */650650+ SVGA3D_TS_TEXTURETRANSFORMFLAGS = 15, /* SVGA3dTexTransformFlags */651651+ SVGA3D_TS_TEXCOORDGEN = 16, /* SVGA3dTextureCoordGen */652652+ SVGA3D_TS_BUMPENVMAT00 = 17, /* float */653653+ SVGA3D_TS_BUMPENVMAT01 = 18, /* float */654654+ SVGA3D_TS_BUMPENVMAT10 = 19, /* float */655655+ SVGA3D_TS_BUMPENVMAT11 = 20, /* float */656656+ SVGA3D_TS_TEXTURE_MIPMAP_LEVEL = 21, /* uint32 */657657+ SVGA3D_TS_TEXTURE_LOD_BIAS = 22, /* float */658658+ SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL = 23, /* uint32 */659659+ SVGA3D_TS_ADDRESSW = 24, /* SVGA3dTextureAddress */660660+661661+662662+ /*663663+ * Sampler Gamma Level664664+ *665665+ * Sampler gamma effects the color of samples taken from the sampler. A666666+ * value of 1.0 will produce linear samples. If the value is <= 0.0 the667667+ * gamma value is ignored and a linear space is used.668668+ */669669+670670+ SVGA3D_TS_GAMMA = 25, /* float */671671+ SVGA3D_TS_BUMPENVLSCALE = 26, /* float */672672+ SVGA3D_TS_BUMPENVLOFFSET = 27, /* float */673673+ SVGA3D_TS_COLORARG0 = 28, /* SVGA3dTextureArgData */674674+ SVGA3D_TS_ALPHAARG0 = 29, /* SVGA3dTextureArgData */675675+ SVGA3D_TS_MAX676676+} SVGA3dTextureStateName;677677+678678+typedef enum {679679+ SVGA3D_TC_INVALID = 0,680680+ SVGA3D_TC_DISABLE = 1,681681+ SVGA3D_TC_SELECTARG1 = 2,682682+ SVGA3D_TC_SELECTARG2 = 3,683683+ SVGA3D_TC_MODULATE = 4,684684+ SVGA3D_TC_ADD = 5,685685+ SVGA3D_TC_ADDSIGNED = 6,686686+ SVGA3D_TC_SUBTRACT = 7,687687+ SVGA3D_TC_BLENDTEXTUREALPHA = 8,688688+ SVGA3D_TC_BLENDDIFFUSEALPHA = 9,689689+ SVGA3D_TC_BLENDCURRENTALPHA = 10,690690+ SVGA3D_TC_BLENDFACTORALPHA = 11,691691+ SVGA3D_TC_MODULATE2X = 12,692692+ SVGA3D_TC_MODULATE4X = 13,693693+ SVGA3D_TC_DSDT = 14,694694+ SVGA3D_TC_DOTPRODUCT3 = 15,695695+ SVGA3D_TC_BLENDTEXTUREALPHAPM = 16,696696+ SVGA3D_TC_ADDSIGNED2X = 17,697697+ SVGA3D_TC_ADDSMOOTH = 18,698698+ SVGA3D_TC_PREMODULATE = 19,699699+ SVGA3D_TC_MODULATEALPHA_ADDCOLOR = 20,700700+ SVGA3D_TC_MODULATECOLOR_ADDALPHA = 21,701701+ SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22,702702+ SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23,703703+ SVGA3D_TC_BUMPENVMAPLUMINANCE = 24,704704+ SVGA3D_TC_MULTIPLYADD = 25,705705+ SVGA3D_TC_LERP = 26,706706+ SVGA3D_TC_MAX707707+} SVGA3dTextureCombiner;708708+709709+#define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0)710710+711711+typedef enum {712712+ SVGA3D_TEX_ADDRESS_INVALID = 0,713713+ SVGA3D_TEX_ADDRESS_WRAP = 1,714714+ SVGA3D_TEX_ADDRESS_MIRROR = 2,715715+ SVGA3D_TEX_ADDRESS_CLAMP = 3,716716+ SVGA3D_TEX_ADDRESS_BORDER = 4,717717+ SVGA3D_TEX_ADDRESS_MIRRORONCE = 5,718718+ SVGA3D_TEX_ADDRESS_EDGE = 6,719719+ SVGA3D_TEX_ADDRESS_MAX720720+} SVGA3dTextureAddress;721721+722722+/*723723+ * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is724724+ * disabled, and the rasterizer should use the magnification filter instead.725725+ */726726+typedef enum {727727+ SVGA3D_TEX_FILTER_NONE = 0,728728+ SVGA3D_TEX_FILTER_NEAREST = 1,729729+ SVGA3D_TEX_FILTER_LINEAR = 2,730730+ SVGA3D_TEX_FILTER_ANISOTROPIC = 3,731731+ SVGA3D_TEX_FILTER_FLATCUBIC = 4, // Deprecated, not implemented732732+ SVGA3D_TEX_FILTER_GAUSSIANCUBIC = 5, // Deprecated, not implemented733733+ SVGA3D_TEX_FILTER_PYRAMIDALQUAD = 6, // Not currently implemented734734+ SVGA3D_TEX_FILTER_GAUSSIANQUAD = 7, // Not currently implemented735735+ SVGA3D_TEX_FILTER_MAX736736+} SVGA3dTextureFilter;737737+738738+typedef enum {739739+ SVGA3D_TEX_TRANSFORM_OFF = 0,740740+ SVGA3D_TEX_TRANSFORM_S = (1 << 0),741741+ SVGA3D_TEX_TRANSFORM_T = (1 << 1),742742+ SVGA3D_TEX_TRANSFORM_R = (1 << 2),743743+ SVGA3D_TEX_TRANSFORM_Q = (1 << 3),744744+ SVGA3D_TEX_PROJECTED = (1 << 15),745745+} SVGA3dTexTransformFlags;746746+747747+typedef enum {748748+ SVGA3D_TEXCOORD_GEN_OFF = 0,749749+ SVGA3D_TEXCOORD_GEN_EYE_POSITION = 1,750750+ SVGA3D_TEXCOORD_GEN_EYE_NORMAL = 2,751751+ SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3,752752+ SVGA3D_TEXCOORD_GEN_SPHERE = 4,753753+ SVGA3D_TEXCOORD_GEN_MAX754754+} SVGA3dTextureCoordGen;755755+756756+/*757757+ * Texture argument constants for texture combiner758758+ */759759+typedef enum {760760+ SVGA3D_TA_INVALID = 0,761761+ SVGA3D_TA_CONSTANT = 1,762762+ SVGA3D_TA_PREVIOUS = 2,763763+ SVGA3D_TA_DIFFUSE = 3,764764+ SVGA3D_TA_TEXTURE = 4,765765+ SVGA3D_TA_SPECULAR = 5,766766+ SVGA3D_TA_MAX767767+} SVGA3dTextureArgData;768768+769769+#define SVGA3D_TM_MASK_LEN 4770770+771771+/* Modifiers for texture argument constants defined above. */772772+typedef enum {773773+ SVGA3D_TM_NONE = 0,774774+ SVGA3D_TM_ALPHA = (1 << SVGA3D_TM_MASK_LEN),775775+ SVGA3D_TM_ONE_MINUS = (2 << SVGA3D_TM_MASK_LEN),776776+} SVGA3dTextureArgModifier;777777+778778+#define SVGA3D_INVALID_ID ((uint32)-1)779779+#define SVGA3D_MAX_CLIP_PLANES 6780780+781781+/*782782+ * This is the limit to the number of fixed-function texture783783+ * transforms and texture coordinates we can support. It does *not*784784+ * correspond to the number of texture image units (samplers) we785785+ * support!786786+ */787787+#define SVGA3D_MAX_TEXTURE_COORDS 8788788+789789+/*790790+ * Vertex declarations791791+ *792792+ * Notes:793793+ *794794+ * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you795795+ * draw with any POSITIONT vertex arrays, the programmable vertex796796+ * pipeline will be implicitly disabled. Drawing will take place as if797797+ * no vertex shader was bound.798798+ */799799+800800+typedef enum {801801+ SVGA3D_DECLUSAGE_POSITION = 0,802802+ SVGA3D_DECLUSAGE_BLENDWEIGHT, // 1803803+ SVGA3D_DECLUSAGE_BLENDINDICES, // 2804804+ SVGA3D_DECLUSAGE_NORMAL, // 3805805+ SVGA3D_DECLUSAGE_PSIZE, // 4806806+ SVGA3D_DECLUSAGE_TEXCOORD, // 5807807+ SVGA3D_DECLUSAGE_TANGENT, // 6808808+ SVGA3D_DECLUSAGE_BINORMAL, // 7809809+ SVGA3D_DECLUSAGE_TESSFACTOR, // 8810810+ SVGA3D_DECLUSAGE_POSITIONT, // 9811811+ SVGA3D_DECLUSAGE_COLOR, // 10812812+ SVGA3D_DECLUSAGE_FOG, // 11813813+ SVGA3D_DECLUSAGE_DEPTH, // 12814814+ SVGA3D_DECLUSAGE_SAMPLE, // 13815815+ SVGA3D_DECLUSAGE_MAX816816+} SVGA3dDeclUsage;817817+818818+typedef enum {819819+ SVGA3D_DECLMETHOD_DEFAULT = 0,820820+ SVGA3D_DECLMETHOD_PARTIALU,821821+ SVGA3D_DECLMETHOD_PARTIALV,822822+ SVGA3D_DECLMETHOD_CROSSUV, // Normal823823+ SVGA3D_DECLMETHOD_UV,824824+ SVGA3D_DECLMETHOD_LOOKUP, // Lookup a displacement map825825+ SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map826826+} SVGA3dDeclMethod;827827+828828+typedef enum {829829+ SVGA3D_DECLTYPE_FLOAT1 = 0,830830+ SVGA3D_DECLTYPE_FLOAT2 = 1,831831+ SVGA3D_DECLTYPE_FLOAT3 = 2,832832+ SVGA3D_DECLTYPE_FLOAT4 = 3,833833+ SVGA3D_DECLTYPE_D3DCOLOR = 4,834834+ SVGA3D_DECLTYPE_UBYTE4 = 5,835835+ SVGA3D_DECLTYPE_SHORT2 = 6,836836+ SVGA3D_DECLTYPE_SHORT4 = 7,837837+ SVGA3D_DECLTYPE_UBYTE4N = 8,838838+ SVGA3D_DECLTYPE_SHORT2N = 9,839839+ SVGA3D_DECLTYPE_SHORT4N = 10,840840+ SVGA3D_DECLTYPE_USHORT2N = 11,841841+ SVGA3D_DECLTYPE_USHORT4N = 12,842842+ SVGA3D_DECLTYPE_UDEC3 = 13,843843+ SVGA3D_DECLTYPE_DEC3N = 14,844844+ SVGA3D_DECLTYPE_FLOAT16_2 = 15,845845+ SVGA3D_DECLTYPE_FLOAT16_4 = 16,846846+ SVGA3D_DECLTYPE_MAX,847847+} SVGA3dDeclType;848848+849849+/*850850+ * This structure is used for the divisor for geometry instancing;851851+ * it's a direct translation of the Direct3D equivalent.852852+ */853853+typedef union {854854+ struct {855855+ /*856856+ * For index data, this number represents the number of instances to draw.857857+ * For instance data, this number represents the number of858858+ * instances/vertex in this stream859859+ */860860+ uint32 count : 30;861861+862862+ /*863863+ * This is 1 if this is supposed to be the data that is repeated for864864+ * every instance.865865+ */866866+ uint32 indexedData : 1;867867+868868+ /*869869+ * This is 1 if this is supposed to be the per-instance data.870870+ */871871+ uint32 instanceData : 1;872872+ };873873+874874+ uint32 value;875875+} SVGA3dVertexDivisor;876876+877877+typedef enum {878878+ SVGA3D_PRIMITIVE_INVALID = 0,879879+ SVGA3D_PRIMITIVE_TRIANGLELIST = 1,880880+ SVGA3D_PRIMITIVE_POINTLIST = 2,881881+ SVGA3D_PRIMITIVE_LINELIST = 3,882882+ SVGA3D_PRIMITIVE_LINESTRIP = 4,883883+ SVGA3D_PRIMITIVE_TRIANGLESTRIP = 5,884884+ SVGA3D_PRIMITIVE_TRIANGLEFAN = 6,885885+ SVGA3D_PRIMITIVE_MAX886886+} SVGA3dPrimitiveType;887887+888888+typedef enum {889889+ SVGA3D_COORDINATE_INVALID = 0,890890+ SVGA3D_COORDINATE_LEFTHANDED = 1,891891+ SVGA3D_COORDINATE_RIGHTHANDED = 2,892892+ SVGA3D_COORDINATE_MAX893893+} SVGA3dCoordinateType;894894+895895+typedef enum {896896+ SVGA3D_TRANSFORM_INVALID = 0,897897+ SVGA3D_TRANSFORM_WORLD = 1,898898+ SVGA3D_TRANSFORM_VIEW = 2,899899+ SVGA3D_TRANSFORM_PROJECTION = 3,900900+ SVGA3D_TRANSFORM_TEXTURE0 = 4,901901+ SVGA3D_TRANSFORM_TEXTURE1 = 5,902902+ SVGA3D_TRANSFORM_TEXTURE2 = 6,903903+ SVGA3D_TRANSFORM_TEXTURE3 = 7,904904+ SVGA3D_TRANSFORM_TEXTURE4 = 8,905905+ SVGA3D_TRANSFORM_TEXTURE5 = 9,906906+ SVGA3D_TRANSFORM_TEXTURE6 = 10,907907+ SVGA3D_TRANSFORM_TEXTURE7 = 11,908908+ SVGA3D_TRANSFORM_WORLD1 = 12,909909+ SVGA3D_TRANSFORM_WORLD2 = 13,910910+ SVGA3D_TRANSFORM_WORLD3 = 14,911911+ SVGA3D_TRANSFORM_MAX912912+} SVGA3dTransformType;913913+914914+typedef enum {915915+ SVGA3D_LIGHTTYPE_INVALID = 0,916916+ SVGA3D_LIGHTTYPE_POINT = 1,917917+ SVGA3D_LIGHTTYPE_SPOT1 = 2, /* 1-cone, in degrees */918918+ SVGA3D_LIGHTTYPE_SPOT2 = 3, /* 2-cone, in radians */919919+ SVGA3D_LIGHTTYPE_DIRECTIONAL = 4,920920+ SVGA3D_LIGHTTYPE_MAX921921+} SVGA3dLightType;922922+923923+typedef enum {924924+ SVGA3D_CUBEFACE_POSX = 0,925925+ SVGA3D_CUBEFACE_NEGX = 1,926926+ SVGA3D_CUBEFACE_POSY = 2,927927+ SVGA3D_CUBEFACE_NEGY = 3,928928+ SVGA3D_CUBEFACE_POSZ = 4,929929+ SVGA3D_CUBEFACE_NEGZ = 5,930930+} SVGA3dCubeFace;931931+932932+typedef enum {933933+ SVGA3D_SHADERTYPE_COMPILED_DX8 = 0,934934+ SVGA3D_SHADERTYPE_VS = 1,935935+ SVGA3D_SHADERTYPE_PS = 2,936936+ SVGA3D_SHADERTYPE_MAX937937+} SVGA3dShaderType;938938+939939+typedef enum {940940+ SVGA3D_CONST_TYPE_FLOAT = 0,941941+ SVGA3D_CONST_TYPE_INT = 1,942942+ SVGA3D_CONST_TYPE_BOOL = 2,943943+} SVGA3dShaderConstType;944944+945945+#define SVGA3D_MAX_SURFACE_FACES 6946946+947947+typedef enum {948948+ SVGA3D_STRETCH_BLT_POINT = 0,949949+ SVGA3D_STRETCH_BLT_LINEAR = 1,950950+ SVGA3D_STRETCH_BLT_MAX951951+} SVGA3dStretchBltMode;952952+953953+typedef enum {954954+ SVGA3D_QUERYTYPE_OCCLUSION = 0,955955+ SVGA3D_QUERYTYPE_MAX956956+} SVGA3dQueryType;957957+958958+typedef enum {959959+ SVGA3D_QUERYSTATE_PENDING = 0, /* Waiting on the host (set by guest) */960960+ SVGA3D_QUERYSTATE_SUCCEEDED = 1, /* Completed successfully (set by host) */961961+ SVGA3D_QUERYSTATE_FAILED = 2, /* Completed unsuccessfully (set by host) */962962+ SVGA3D_QUERYSTATE_NEW = 3, /* Never submitted (For guest use only) */963963+} SVGA3dQueryState;964964+965965+typedef enum {966966+ SVGA3D_WRITE_HOST_VRAM = 1,967967+ SVGA3D_READ_HOST_VRAM = 2,968968+} SVGA3dTransferType;969969+970970+/*971971+ * The maximum number vertex arrays we're guaranteed to support in972972+ * SVGA_3D_CMD_DRAWPRIMITIVES.973973+ */974974+#define SVGA3D_MAX_VERTEX_ARRAYS 32975975+976976+/*977977+ * Identifiers for commands in the command FIFO.978978+ *979979+ * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of980980+ * the SVGA3D protocol and remain reserved; they should not be used in the981981+ * future.982982+ *983983+ * IDs between 1040 and 1999 (inclusive) are available for use by the984984+ * current SVGA3D protocol.985985+ *986986+ * FIFO clients other than SVGA3D should stay below 1000, or at 2000987987+ * and up.988988+ */989989+990990+#define SVGA_3D_CMD_LEGACY_BASE 1000991991+#define SVGA_3D_CMD_BASE 1040992992+993993+#define SVGA_3D_CMD_SURFACE_DEFINE SVGA_3D_CMD_BASE + 0994994+#define SVGA_3D_CMD_SURFACE_DESTROY SVGA_3D_CMD_BASE + 1995995+#define SVGA_3D_CMD_SURFACE_COPY SVGA_3D_CMD_BASE + 2996996+#define SVGA_3D_CMD_SURFACE_STRETCHBLT SVGA_3D_CMD_BASE + 3997997+#define SVGA_3D_CMD_SURFACE_DMA SVGA_3D_CMD_BASE + 4998998+#define SVGA_3D_CMD_CONTEXT_DEFINE SVGA_3D_CMD_BASE + 5999999+#define SVGA_3D_CMD_CONTEXT_DESTROY SVGA_3D_CMD_BASE + 610001000+#define SVGA_3D_CMD_SETTRANSFORM SVGA_3D_CMD_BASE + 710011001+#define SVGA_3D_CMD_SETZRANGE SVGA_3D_CMD_BASE + 810021002+#define SVGA_3D_CMD_SETRENDERSTATE SVGA_3D_CMD_BASE + 910031003+#define SVGA_3D_CMD_SETRENDERTARGET SVGA_3D_CMD_BASE + 1010041004+#define SVGA_3D_CMD_SETTEXTURESTATE SVGA_3D_CMD_BASE + 1110051005+#define SVGA_3D_CMD_SETMATERIAL SVGA_3D_CMD_BASE + 1210061006+#define SVGA_3D_CMD_SETLIGHTDATA SVGA_3D_CMD_BASE + 1310071007+#define SVGA_3D_CMD_SETLIGHTENABLED SVGA_3D_CMD_BASE + 1410081008+#define SVGA_3D_CMD_SETVIEWPORT SVGA_3D_CMD_BASE + 1510091009+#define SVGA_3D_CMD_SETCLIPPLANE SVGA_3D_CMD_BASE + 1610101010+#define SVGA_3D_CMD_CLEAR SVGA_3D_CMD_BASE + 1710111011+#define SVGA_3D_CMD_PRESENT SVGA_3D_CMD_BASE + 18 // Deprecated10121012+#define SVGA_3D_CMD_SHADER_DEFINE SVGA_3D_CMD_BASE + 1910131013+#define SVGA_3D_CMD_SHADER_DESTROY SVGA_3D_CMD_BASE + 2010141014+#define SVGA_3D_CMD_SET_SHADER SVGA_3D_CMD_BASE + 2110151015+#define SVGA_3D_CMD_SET_SHADER_CONST SVGA_3D_CMD_BASE + 2210161016+#define SVGA_3D_CMD_DRAW_PRIMITIVES SVGA_3D_CMD_BASE + 2310171017+#define SVGA_3D_CMD_SETSCISSORRECT SVGA_3D_CMD_BASE + 2410181018+#define SVGA_3D_CMD_BEGIN_QUERY SVGA_3D_CMD_BASE + 2510191019+#define SVGA_3D_CMD_END_QUERY SVGA_3D_CMD_BASE + 2610201020+#define SVGA_3D_CMD_WAIT_FOR_QUERY SVGA_3D_CMD_BASE + 2710211021+#define SVGA_3D_CMD_PRESENT_READBACK SVGA_3D_CMD_BASE + 28 // Deprecated10221022+#define SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN SVGA_3D_CMD_BASE + 2910231023+#define SVGA_3D_CMD_MAX SVGA_3D_CMD_BASE + 3010241024+10251025+#define SVGA_3D_CMD_FUTURE_MAX 200010261026+10271027+/*10281028+ * Common substructures used in multiple FIFO commands:10291029+ */10301030+10311031+typedef struct {10321032+ union {10331033+ struct {10341034+ uint16 function; // SVGA3dFogFunction10351035+ uint8 type; // SVGA3dFogType10361036+ uint8 base; // SVGA3dFogBase10371037+ };10381038+ uint32 uintValue;10391039+ };10401040+} SVGA3dFogMode;10411041+10421042+/*10431043+ * Uniquely identify one image (a 1D/2D/3D array) from a surface. This10441044+ * is a surface ID as well as face/mipmap indices.10451045+ */10461046+10471047+typedef10481048+struct SVGA3dSurfaceImageId {10491049+ uint32 sid;10501050+ uint32 face;10511051+ uint32 mipmap;10521052+} SVGA3dSurfaceImageId;10531053+10541054+typedef10551055+struct SVGA3dGuestImage {10561056+ SVGAGuestPtr ptr;10571057+10581058+ /*10591059+ * A note on interpretation of pitch: This value of pitch is the10601060+ * number of bytes between vertically adjacent image10611061+ * blocks. Normally this is the number of bytes between the first10621062+ * pixel of two adjacent scanlines. With compressed textures,10631063+ * however, this may represent the number of bytes between10641064+ * compression blocks rather than between rows of pixels.10651065+ *10661066+ * XXX: Compressed textures currently must be tightly packed in guest memory.10671067+ *10681068+ * If the image is 1-dimensional, pitch is ignored.10691069+ *10701070+ * If 'pitch' is zero, the SVGA3D device calculates a pitch value10711071+ * assuming each row of blocks is tightly packed.10721072+ */10731073+ uint32 pitch;10741074+} SVGA3dGuestImage;10751075+10761076+10771077+/*10781078+ * FIFO command format definitions:10791079+ */10801080+10811081+/*10821082+ * The data size header following cmdNum for every 3d command10831083+ */10841084+typedef10851085+struct {10861086+ uint32 id;10871087+ uint32 size;10881088+} SVGA3dCmdHeader;10891089+10901090+/*10911091+ * A surface is a hierarchy of host VRAM surfaces: 1D, 2D, or 3D, with10921092+ * optional mipmaps and cube faces.10931093+ */10941094+10951095+typedef10961096+struct {10971097+ uint32 width;10981098+ uint32 height;10991099+ uint32 depth;11001100+} SVGA3dSize;11011101+11021102+typedef enum {11031103+ SVGA3D_SURFACE_CUBEMAP = (1 << 0),11041104+ SVGA3D_SURFACE_HINT_STATIC = (1 << 1),11051105+ SVGA3D_SURFACE_HINT_DYNAMIC = (1 << 2),11061106+ SVGA3D_SURFACE_HINT_INDEXBUFFER = (1 << 3),11071107+ SVGA3D_SURFACE_HINT_VERTEXBUFFER = (1 << 4),11081108+ SVGA3D_SURFACE_HINT_TEXTURE = (1 << 5),11091109+ SVGA3D_SURFACE_HINT_RENDERTARGET = (1 << 6),11101110+ SVGA3D_SURFACE_HINT_DEPTHSTENCIL = (1 << 7),11111111+ SVGA3D_SURFACE_HINT_WRITEONLY = (1 << 8),11121112+} SVGA3dSurfaceFlags;11131113+11141114+typedef11151115+struct {11161116+ uint32 numMipLevels;11171117+} SVGA3dSurfaceFace;11181118+11191119+typedef11201120+struct {11211121+ uint32 sid;11221122+ SVGA3dSurfaceFlags surfaceFlags;11231123+ SVGA3dSurfaceFormat format;11241124+ SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES];11251125+ /*11261126+ * Followed by an SVGA3dSize structure for each mip level in each face.11271127+ *11281128+ * A note on surface sizes: Sizes are always specified in pixels,11291129+ * even if the true surface size is not a multiple of the minimum11301130+ * block size of the surface's format. For example, a 3x3x1 DXT111311131+ * compressed texture would actually be stored as a 4x4x1 image in11321132+ * memory.11331133+ */11341134+} SVGA3dCmdDefineSurface; /* SVGA_3D_CMD_SURFACE_DEFINE */11351135+11361136+typedef11371137+struct {11381138+ uint32 sid;11391139+} SVGA3dCmdDestroySurface; /* SVGA_3D_CMD_SURFACE_DESTROY */11401140+11411141+typedef11421142+struct {11431143+ uint32 cid;11441144+} SVGA3dCmdDefineContext; /* SVGA_3D_CMD_CONTEXT_DEFINE */11451145+11461146+typedef11471147+struct {11481148+ uint32 cid;11491149+} SVGA3dCmdDestroyContext; /* SVGA_3D_CMD_CONTEXT_DESTROY */11501150+11511151+typedef11521152+struct {11531153+ uint32 cid;11541154+ SVGA3dClearFlag clearFlag;11551155+ uint32 color;11561156+ float depth;11571157+ uint32 stencil;11581158+ /* Followed by variable number of SVGA3dRect structures */11591159+} SVGA3dCmdClear; /* SVGA_3D_CMD_CLEAR */11601160+11611161+typedef11621162+struct SVGA3dCopyRect {11631163+ uint32 x;11641164+ uint32 y;11651165+ uint32 w;11661166+ uint32 h;11671167+ uint32 srcx;11681168+ uint32 srcy;11691169+} SVGA3dCopyRect;11701170+11711171+typedef11721172+struct SVGA3dCopyBox {11731173+ uint32 x;11741174+ uint32 y;11751175+ uint32 z;11761176+ uint32 w;11771177+ uint32 h;11781178+ uint32 d;11791179+ uint32 srcx;11801180+ uint32 srcy;11811181+ uint32 srcz;11821182+} SVGA3dCopyBox;11831183+11841184+typedef11851185+struct {11861186+ uint32 x;11871187+ uint32 y;11881188+ uint32 w;11891189+ uint32 h;11901190+} SVGA3dRect;11911191+11921192+typedef11931193+struct {11941194+ uint32 x;11951195+ uint32 y;11961196+ uint32 z;11971197+ uint32 w;11981198+ uint32 h;11991199+ uint32 d;12001200+} SVGA3dBox;12011201+12021202+typedef12031203+struct {12041204+ uint32 x;12051205+ uint32 y;12061206+ uint32 z;12071207+} SVGA3dPoint;12081208+12091209+typedef12101210+struct {12111211+ SVGA3dLightType type;12121212+ SVGA3dBool inWorldSpace;12131213+ float diffuse[4];12141214+ float specular[4];12151215+ float ambient[4];12161216+ float position[4];12171217+ float direction[4];12181218+ float range;12191219+ float falloff;12201220+ float attenuation0;12211221+ float attenuation1;12221222+ float attenuation2;12231223+ float theta;12241224+ float phi;12251225+} SVGA3dLightData;12261226+12271227+typedef12281228+struct {12291229+ uint32 sid;12301230+ /* Followed by variable number of SVGA3dCopyRect structures */12311231+} SVGA3dCmdPresent; /* SVGA_3D_CMD_PRESENT */12321232+12331233+typedef12341234+struct {12351235+ SVGA3dRenderStateName state;12361236+ union {12371237+ uint32 uintValue;12381238+ float floatValue;12391239+ };12401240+} SVGA3dRenderState;12411241+12421242+typedef12431243+struct {12441244+ uint32 cid;12451245+ /* Followed by variable number of SVGA3dRenderState structures */12461246+} SVGA3dCmdSetRenderState; /* SVGA_3D_CMD_SETRENDERSTATE */12471247+12481248+typedef12491249+struct {12501250+ uint32 cid;12511251+ SVGA3dRenderTargetType type;12521252+ SVGA3dSurfaceImageId target;12531253+} SVGA3dCmdSetRenderTarget; /* SVGA_3D_CMD_SETRENDERTARGET */12541254+12551255+typedef12561256+struct {12571257+ SVGA3dSurfaceImageId src;12581258+ SVGA3dSurfaceImageId dest;12591259+ /* Followed by variable number of SVGA3dCopyBox structures */12601260+} SVGA3dCmdSurfaceCopy; /* SVGA_3D_CMD_SURFACE_COPY */12611261+12621262+typedef12631263+struct {12641264+ SVGA3dSurfaceImageId src;12651265+ SVGA3dSurfaceImageId dest;12661266+ SVGA3dBox boxSrc;12671267+ SVGA3dBox boxDest;12681268+ SVGA3dStretchBltMode mode;12691269+} SVGA3dCmdSurfaceStretchBlt; /* SVGA_3D_CMD_SURFACE_STRETCHBLT */12701270+12711271+typedef12721272+struct {12731273+ /*12741274+ * If the discard flag is present in a surface DMA operation, the host may12751275+ * discard the contents of the current mipmap level and face of the target12761276+ * surface before applying the surface DMA contents.12771277+ */12781278+ uint32 discard : 1;12791279+12801280+ /*12811281+ * If the unsynchronized flag is present, the host may perform this upload12821282+ * without syncing to pending reads on this surface.12831283+ */12841284+ uint32 unsynchronized : 1;12851285+12861286+ /*12871287+ * Guests *MUST* set the reserved bits to 0 before submitting the command12881288+ * suffix as future flags may occupy these bits.12891289+ */12901290+ uint32 reserved : 30;12911291+} SVGA3dSurfaceDMAFlags;12921292+12931293+typedef12941294+struct {12951295+ SVGA3dGuestImage guest;12961296+ SVGA3dSurfaceImageId host;12971297+ SVGA3dTransferType transfer;12981298+ /*12991299+ * Followed by variable number of SVGA3dCopyBox structures. For consistency13001300+ * in all clipping logic and coordinate translation, we define the13011301+ * "source" in each copyBox as the guest image and the13021302+ * "destination" as the host image, regardless of transfer13031303+ * direction.13041304+ *13051305+ * For efficiency, the SVGA3D device is free to copy more data than13061306+ * specified. For example, it may round copy boxes outwards such13071307+ * that they lie on particular alignment boundaries.13081308+ */13091309+} SVGA3dCmdSurfaceDMA; /* SVGA_3D_CMD_SURFACE_DMA */13101310+13111311+/*13121312+ * SVGA3dCmdSurfaceDMASuffix --13131313+ *13141314+ * This is a command suffix that will appear after a SurfaceDMA command in13151315+ * the FIFO. It contains some extra information that hosts may use to13161316+ * optimize performance or protect the guest. This suffix exists to preserve13171317+ * backwards compatibility while also allowing for new functionality to be13181318+ * implemented.13191319+ */13201320+13211321+typedef13221322+struct {13231323+ uint32 suffixSize;13241324+13251325+ /*13261326+ * The maximum offset is used to determine the maximum offset from the13271327+ * guestPtr base address that will be accessed or written to during this13281328+ * surfaceDMA. If the suffix is supported, the host will respect this13291329+ * boundary while performing surface DMAs.13301330+ *13311331+ * Defaults to MAX_UINT3213321332+ */13331333+ uint32 maximumOffset;13341334+13351335+ /*13361336+ * A set of flags that describes optimizations that the host may perform13371337+ * while performing this surface DMA operation. The guest should never rely13381338+ * on behaviour that is different when these flags are set for correctness.13391339+ *13401340+ * Defaults to 013411341+ */13421342+ SVGA3dSurfaceDMAFlags flags;13431343+} SVGA3dCmdSurfaceDMASuffix;13441344+13451345+/*13461346+ * SVGA_3D_CMD_DRAW_PRIMITIVES --13471347+ *13481348+ * This command is the SVGA3D device's generic drawing entry point.13491349+ * It can draw multiple ranges of primitives, optionally using an13501350+ * index buffer, using an arbitrary collection of vertex buffers.13511351+ *13521352+ * Each SVGA3dVertexDecl defines a distinct vertex array to bind13531353+ * during this draw call. The declarations specify which surface13541354+ * the vertex data lives in, what that vertex data is used for,13551355+ * and how to interpret it.13561356+ *13571357+ * Each SVGA3dPrimitiveRange defines a collection of primitives13581358+ * to render using the same vertex arrays. An index buffer is13591359+ * optional.13601360+ */13611361+13621362+typedef13631363+struct {13641364+ /*13651365+ * A range hint is an optional specification for the range of indices13661366+ * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed13671367+ * that the entire array will be used.13681368+ *13691369+ * These are only hints. The SVGA3D device may use them for13701370+ * performance optimization if possible, but it's also allowed to13711371+ * ignore these values.13721372+ */13731373+ uint32 first;13741374+ uint32 last;13751375+} SVGA3dArrayRangeHint;13761376+13771377+typedef13781378+struct {13791379+ /*13801380+ * Define the origin and shape of a vertex or index array. Both13811381+ * 'offset' and 'stride' are in bytes. The provided surface will be13821382+ * reinterpreted as a flat array of bytes in the same format used13831383+ * by surface DMA operations. To avoid unnecessary conversions, the13841384+ * surface should be created with the SVGA3D_BUFFER format.13851385+ *13861386+ * Index 0 in the array starts 'offset' bytes into the surface.13871387+ * Index 1 begins at byte 'offset + stride', etc. Array indices may13881388+ * not be negative.13891389+ */13901390+ uint32 surfaceId;13911391+ uint32 offset;13921392+ uint32 stride;13931393+} SVGA3dArray;13941394+13951395+typedef13961396+struct {13971397+ /*13981398+ * Describe a vertex array's data type, and define how it is to be13991399+ * used by the fixed function pipeline or the vertex shader. It14001400+ * isn't useful to have two VertexDecls with the same14011401+ * VertexArrayIdentity in one draw call.14021402+ */14031403+ SVGA3dDeclType type;14041404+ SVGA3dDeclMethod method;14051405+ SVGA3dDeclUsage usage;14061406+ uint32 usageIndex;14071407+} SVGA3dVertexArrayIdentity;14081408+14091409+typedef14101410+struct {14111411+ SVGA3dVertexArrayIdentity identity;14121412+ SVGA3dArray array;14131413+ SVGA3dArrayRangeHint rangeHint;14141414+} SVGA3dVertexDecl;14151415+14161416+typedef14171417+struct {14181418+ /*14191419+ * Define a group of primitives to render, from sequential indices.14201420+ *14211421+ * The value of 'primitiveType' and 'primitiveCount' imply the14221422+ * total number of vertices that will be rendered.14231423+ */14241424+ SVGA3dPrimitiveType primType;14251425+ uint32 primitiveCount;14261426+14271427+ /*14281428+ * Optional index buffer. If indexArray.surfaceId is14291429+ * SVGA3D_INVALID_ID, we render without an index buffer. Rendering14301430+ * without an index buffer is identical to rendering with an index14311431+ * buffer containing the sequence [0, 1, 2, 3, ...].14321432+ *14331433+ * If an index buffer is in use, indexWidth specifies the width in14341434+ * bytes of each index value. It must be less than or equal to14351435+ * indexArray.stride.14361436+ *14371437+ * (Currently, the SVGA3D device requires index buffers to be tightly14381438+ * packed. In other words, indexWidth == indexArray.stride)14391439+ */14401440+ SVGA3dArray indexArray;14411441+ uint32 indexWidth;14421442+14431443+ /*14441444+ * Optional index bias. This number is added to all indices from14451445+ * indexArray before they are used as vertex array indices. This14461446+ * can be used in multiple ways:14471447+ *14481448+ * - When not using an indexArray, this bias can be used to14491449+ * specify where in the vertex arrays to begin rendering.14501450+ *14511451+ * - A positive number here is equivalent to increasing the14521452+ * offset in each vertex array.14531453+ *14541454+ * - A negative number can be used to render using a small14551455+ * vertex array and an index buffer that contains large14561456+ * values. This may be used by some applications that14571457+ * crop a vertex buffer without modifying their index14581458+ * buffer.14591459+ *14601460+ * Note that rendering with a negative bias value may be slower and14611461+ * use more memory than rendering with a positive or zero bias.14621462+ */14631463+ int32 indexBias;14641464+} SVGA3dPrimitiveRange;14651465+14661466+typedef14671467+struct {14681468+ uint32 cid;14691469+ uint32 numVertexDecls;14701470+ uint32 numRanges;14711471+14721472+ /*14731473+ * There are two variable size arrays after the14741474+ * SVGA3dCmdDrawPrimitives structure. In order,14751475+ * they are:14761476+ *14771477+ * 1. SVGA3dVertexDecl, quantity 'numVertexDecls'14781478+ * 2. SVGA3dPrimitiveRange, quantity 'numRanges'14791479+ * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains14801480+ * the frequency divisor for this the corresponding vertex decl)14811481+ */14821482+} SVGA3dCmdDrawPrimitives; /* SVGA_3D_CMD_DRAWPRIMITIVES */14831483+14841484+typedef14851485+struct {14861486+ uint32 stage;14871487+ SVGA3dTextureStateName name;14881488+ union {14891489+ uint32 value;14901490+ float floatValue;14911491+ };14921492+} SVGA3dTextureState;14931493+14941494+typedef14951495+struct {14961496+ uint32 cid;14971497+ /* Followed by variable number of SVGA3dTextureState structures */14981498+} SVGA3dCmdSetTextureState; /* SVGA_3D_CMD_SETTEXTURESTATE */14991499+15001500+typedef15011501+struct {15021502+ uint32 cid;15031503+ SVGA3dTransformType type;15041504+ float matrix[16];15051505+} SVGA3dCmdSetTransform; /* SVGA_3D_CMD_SETTRANSFORM */15061506+15071507+typedef15081508+struct {15091509+ float min;15101510+ float max;15111511+} SVGA3dZRange;15121512+15131513+typedef15141514+struct {15151515+ uint32 cid;15161516+ SVGA3dZRange zRange;15171517+} SVGA3dCmdSetZRange; /* SVGA_3D_CMD_SETZRANGE */15181518+15191519+typedef15201520+struct {15211521+ float diffuse[4];15221522+ float ambient[4];15231523+ float specular[4];15241524+ float emissive[4];15251525+ float shininess;15261526+} SVGA3dMaterial;15271527+15281528+typedef15291529+struct {15301530+ uint32 cid;15311531+ SVGA3dFace face;15321532+ SVGA3dMaterial material;15331533+} SVGA3dCmdSetMaterial; /* SVGA_3D_CMD_SETMATERIAL */15341534+15351535+typedef15361536+struct {15371537+ uint32 cid;15381538+ uint32 index;15391539+ SVGA3dLightData data;15401540+} SVGA3dCmdSetLightData; /* SVGA_3D_CMD_SETLIGHTDATA */15411541+15421542+typedef15431543+struct {15441544+ uint32 cid;15451545+ uint32 index;15461546+ uint32 enabled;15471547+} SVGA3dCmdSetLightEnabled; /* SVGA_3D_CMD_SETLIGHTENABLED */15481548+15491549+typedef15501550+struct {15511551+ uint32 cid;15521552+ SVGA3dRect rect;15531553+} SVGA3dCmdSetViewport; /* SVGA_3D_CMD_SETVIEWPORT */15541554+15551555+typedef15561556+struct {15571557+ uint32 cid;15581558+ SVGA3dRect rect;15591559+} SVGA3dCmdSetScissorRect; /* SVGA_3D_CMD_SETSCISSORRECT */15601560+15611561+typedef15621562+struct {15631563+ uint32 cid;15641564+ uint32 index;15651565+ float plane[4];15661566+} SVGA3dCmdSetClipPlane; /* SVGA_3D_CMD_SETCLIPPLANE */15671567+15681568+typedef15691569+struct {15701570+ uint32 cid;15711571+ uint32 shid;15721572+ SVGA3dShaderType type;15731573+ /* Followed by variable number of DWORDs for shader bycode */15741574+} SVGA3dCmdDefineShader; /* SVGA_3D_CMD_SHADER_DEFINE */15751575+15761576+typedef15771577+struct {15781578+ uint32 cid;15791579+ uint32 shid;15801580+ SVGA3dShaderType type;15811581+} SVGA3dCmdDestroyShader; /* SVGA_3D_CMD_SHADER_DESTROY */15821582+15831583+typedef15841584+struct {15851585+ uint32 cid;15861586+ uint32 reg; /* register number */15871587+ SVGA3dShaderType type;15881588+ SVGA3dShaderConstType ctype;15891589+ uint32 values[4];15901590+} SVGA3dCmdSetShaderConst; /* SVGA_3D_CMD_SET_SHADER_CONST */15911591+15921592+typedef15931593+struct {15941594+ uint32 cid;15951595+ SVGA3dShaderType type;15961596+ uint32 shid;15971597+} SVGA3dCmdSetShader; /* SVGA_3D_CMD_SET_SHADER */15981598+15991599+typedef16001600+struct {16011601+ uint32 cid;16021602+ SVGA3dQueryType type;16031603+} SVGA3dCmdBeginQuery; /* SVGA_3D_CMD_BEGIN_QUERY */16041604+16051605+typedef16061606+struct {16071607+ uint32 cid;16081608+ SVGA3dQueryType type;16091609+ SVGAGuestPtr guestResult; /* Points to an SVGA3dQueryResult structure */16101610+} SVGA3dCmdEndQuery; /* SVGA_3D_CMD_END_QUERY */16111611+16121612+typedef16131613+struct {16141614+ uint32 cid; /* Same parameters passed to END_QUERY */16151615+ SVGA3dQueryType type;16161616+ SVGAGuestPtr guestResult;16171617+} SVGA3dCmdWaitForQuery; /* SVGA_3D_CMD_WAIT_FOR_QUERY */16181618+16191619+typedef16201620+struct {16211621+ uint32 totalSize; /* Set by guest before query is ended. */16221622+ SVGA3dQueryState state; /* Set by host or guest. See SVGA3dQueryState. */16231623+ union { /* Set by host on exit from PENDING state */16241624+ uint32 result32;16251625+ };16261626+} SVGA3dQueryResult;16271627+16281628+/*16291629+ * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN --16301630+ *16311631+ * This is a blit from an SVGA3D surface to a Screen Object. Just16321632+ * like GMR-to-screen blits, this blit may be directed at a16331633+ * specific screen or to the virtual coordinate space.16341634+ *16351635+ * The blit copies from a rectangular region of an SVGA3D surface16361636+ * image to a rectangular region of a screen or screens.16371637+ *16381638+ * This command takes an optional variable-length list of clipping16391639+ * rectangles after the body of the command. If no rectangles are16401640+ * specified, there is no clipping region. The entire destRect is16411641+ * drawn to. If one or more rectangles are included, they describe16421642+ * a clipping region. The clip rectangle coordinates are measured16431643+ * relative to the top-left corner of destRect.16441644+ *16451645+ * This clipping region serves multiple purposes:16461646+ *16471647+ * - It can be used to perform an irregularly shaped blit more16481648+ * efficiently than by issuing many separate blit commands.16491649+ *16501650+ * - It is equivalent to allowing blits with non-integer16511651+ * source coordinates. You could blit just one half-pixel16521652+ * of a source, for example, by specifying a larger16531653+ * destination rectangle than you need, then removing16541654+ * part of it using a clip rectangle.16551655+ *16561656+ * Availability:16571657+ * SVGA_FIFO_CAP_SCREEN_OBJECT16581658+ *16591659+ * Limitations:16601660+ *16611661+ * - Currently, no backend supports blits from a mipmap or face16621662+ * other than the first one.16631663+ */16641664+16651665+typedef16661666+struct {16671667+ SVGA3dSurfaceImageId srcImage;16681668+ SVGASignedRect srcRect;16691669+ uint32 destScreenId; /* Screen ID or SVGA_ID_INVALID for virt. coords */16701670+ SVGASignedRect destRect; /* Supports scaling if src/rest different size */16711671+ /* Clipping: zero or more SVGASignedRects follow */16721672+} SVGA3dCmdBlitSurfaceToScreen; /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */16731673+16741674+16751675+/*16761676+ * Capability query index.16771677+ *16781678+ * Notes:16791679+ *16801680+ * 1. SVGA3D_DEVCAP_MAX_TEXTURES reflects the maximum number of16811681+ * fixed-function texture units available. Each of these units16821682+ * work in both FFP and Shader modes, and they support texture16831683+ * transforms and texture coordinates. The host may have additional16841684+ * texture image units that are only usable with shaders.16851685+ *16861686+ * 2. The BUFFER_FORMAT capabilities are deprecated, and they always16871687+ * return TRUE. Even on physical hardware that does not support16881688+ * these formats natively, the SVGA3D device will provide an emulation16891689+ * which should be invisible to the guest OS.16901690+ *16911691+ * In general, the SVGA3D device should support any operation on16921692+ * any surface format, it just may perform some of these16931693+ * operations in software depending on the capabilities of the16941694+ * available physical hardware.16951695+ *16961696+ * XXX: In the future, we will add capabilities that describe in16971697+ * detail what formats are supported in hardware for what kinds16981698+ * of operations.16991699+ */17001700+17011701+typedef enum {17021702+ SVGA3D_DEVCAP_3D = 0,17031703+ SVGA3D_DEVCAP_MAX_LIGHTS = 1,17041704+ SVGA3D_DEVCAP_MAX_TEXTURES = 2, /* See note (1) */17051705+ SVGA3D_DEVCAP_MAX_CLIP_PLANES = 3,17061706+ SVGA3D_DEVCAP_VERTEX_SHADER_VERSION = 4,17071707+ SVGA3D_DEVCAP_VERTEX_SHADER = 5,17081708+ SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION = 6,17091709+ SVGA3D_DEVCAP_FRAGMENT_SHADER = 7,17101710+ SVGA3D_DEVCAP_MAX_RENDER_TARGETS = 8,17111711+ SVGA3D_DEVCAP_S23E8_TEXTURES = 9,17121712+ SVGA3D_DEVCAP_S10E5_TEXTURES = 10,17131713+ SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND = 11,17141714+ SVGA3D_DEVCAP_D16_BUFFER_FORMAT = 12, /* See note (2) */17151715+ SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT = 13, /* See note (2) */17161716+ SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT = 14, /* See note (2) */17171717+ SVGA3D_DEVCAP_QUERY_TYPES = 15,17181718+ SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING = 16,17191719+ SVGA3D_DEVCAP_MAX_POINT_SIZE = 17,17201720+ SVGA3D_DEVCAP_MAX_SHADER_TEXTURES = 18,17211721+ SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH = 19,17221722+ SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT = 20,17231723+ SVGA3D_DEVCAP_MAX_VOLUME_EXTENT = 21,17241724+ SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT = 22,17251725+ SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO = 23,17261726+ SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY = 24,17271727+ SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT = 25,17281728+ SVGA3D_DEVCAP_MAX_VERTEX_INDEX = 26,17291729+ SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS = 27,17301730+ SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS = 28,17311731+ SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS = 29,17321732+ SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS = 30,17331733+ SVGA3D_DEVCAP_TEXTURE_OPS = 31,17341734+ SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8 = 32,17351735+ SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8 = 33,17361736+ SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10 = 34,17371737+ SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5 = 35,17381738+ SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5 = 36,17391739+ SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4 = 37,17401740+ SVGA3D_DEVCAP_SURFACEFMT_R5G6B5 = 38,17411741+ SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16 = 39,17421742+ SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8 = 40,17431743+ SVGA3D_DEVCAP_SURFACEFMT_ALPHA8 = 41,17441744+ SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8 = 42,17451745+ SVGA3D_DEVCAP_SURFACEFMT_Z_D16 = 43,17461746+ SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8 = 44,17471747+ SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8 = 45,17481748+ SVGA3D_DEVCAP_SURFACEFMT_DXT1 = 46,17491749+ SVGA3D_DEVCAP_SURFACEFMT_DXT2 = 47,17501750+ SVGA3D_DEVCAP_SURFACEFMT_DXT3 = 48,17511751+ SVGA3D_DEVCAP_SURFACEFMT_DXT4 = 49,17521752+ SVGA3D_DEVCAP_SURFACEFMT_DXT5 = 50,17531753+ SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8 = 51,17541754+ SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10 = 52,17551755+ SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8 = 53,17561756+ SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8 = 54,17571757+ SVGA3D_DEVCAP_SURFACEFMT_CxV8U8 = 55,17581758+ SVGA3D_DEVCAP_SURFACEFMT_R_S10E5 = 56,17591759+ SVGA3D_DEVCAP_SURFACEFMT_R_S23E8 = 57,17601760+ SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5 = 58,17611761+ SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8 = 59,17621762+ SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5 = 60,17631763+ SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8 = 61,17641764+ SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES = 63,17651765+17661766+ /*17671767+ * Note that MAX_SIMULTANEOUS_RENDER_TARGETS is a maximum count of color17681768+ * render targets. This does no include the depth or stencil targets.17691769+ */17701770+ SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS = 64,17711771+17721772+ SVGA3D_DEVCAP_SURFACEFMT_V16U16 = 65,17731773+ SVGA3D_DEVCAP_SURFACEFMT_G16R16 = 66,17741774+ SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16 = 67,17751775+ SVGA3D_DEVCAP_SURFACEFMT_UYVY = 68,17761776+ SVGA3D_DEVCAP_SURFACEFMT_YUY2 = 69,17771777+17781778+ /*17791779+ * Don't add new caps into the previous section; the values in this17801780+ * enumeration must not change. You can put new values right before17811781+ * SVGA3D_DEVCAP_MAX.17821782+ */17831783+ SVGA3D_DEVCAP_MAX /* This must be the last index. */17841784+} SVGA3dDevCapIndex;17851785+17861786+typedef union {17871787+ Bool b;17881788+ uint32 u;17891789+ int32 i;17901790+ float f;17911791+} SVGA3dDevCapResult;17921792+17931793+#endif /* _SVGA3D_REG_H_ */
+89
drivers/gpu/drm/vmwgfx/svga_escape.h
···11+/**********************************************************22+ * Copyright 2007-2009 VMware, Inc. All rights reserved.33+ *44+ * Permission is hereby granted, free of charge, to any person55+ * obtaining a copy of this software and associated documentation66+ * files (the "Software"), to deal in the Software without77+ * restriction, including without limitation the rights to use, copy,88+ * modify, merge, publish, distribute, sublicense, and/or sell copies99+ * of the Software, and to permit persons to whom the Software is1010+ * furnished to do so, subject to the following conditions:1111+ *1212+ * The above copyright notice and this permission notice shall be1313+ * included in all copies or substantial portions of the Software.1414+ *1515+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,1616+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF1717+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND1818+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS1919+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN2020+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN2121+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE2222+ * SOFTWARE.2323+ *2424+ **********************************************************/2525+2626+/*2727+ * svga_escape.h --2828+ *2929+ * Definitions for our own (vendor-specific) SVGA Escape commands.3030+ */3131+3232+#ifndef _SVGA_ESCAPE_H_3333+#define _SVGA_ESCAPE_H_3434+3535+3636+/*3737+ * Namespace IDs for the escape command3838+ */3939+4040+#define SVGA_ESCAPE_NSID_VMWARE 0x000000004141+#define SVGA_ESCAPE_NSID_DEVEL 0xFFFFFFFF4242+4343+4444+/*4545+ * Within SVGA_ESCAPE_NSID_VMWARE, we multiplex commands according to4646+ * the first DWORD of escape data (after the nsID and size). As a4747+ * guideline we're using the high word and low word as a major and4848+ * minor command number, respectively.4949+ *5050+ * Major command number allocation:5151+ *5252+ * 0000: Reserved5353+ * 0001: SVGA_ESCAPE_VMWARE_LOG (svga_binary_logger.h)5454+ * 0002: SVGA_ESCAPE_VMWARE_VIDEO (svga_overlay.h)5555+ * 0003: SVGA_ESCAPE_VMWARE_HINT (svga_escape.h)5656+ */5757+5858+#define SVGA_ESCAPE_VMWARE_MAJOR_MASK 0xFFFF00005959+6060+6161+/*6262+ * SVGA Hint commands.6363+ *6464+ * These escapes let the SVGA driver provide optional information to6565+ * he host about the state of the guest or guest applications. The6666+ * host can use these hints to make user interface or performance6767+ * decisions.6868+ *6969+ * Notes:7070+ *7171+ * - SVGA_ESCAPE_VMWARE_HINT_FULLSCREEN is deprecated for guests7272+ * that use the SVGA Screen Object extension. Instead of sending7373+ * this escape, use the SVGA_SCREEN_FULLSCREEN_HINT flag on your7474+ * Screen Object.7575+ */7676+7777+#define SVGA_ESCAPE_VMWARE_HINT 0x000300007878+#define SVGA_ESCAPE_VMWARE_HINT_FULLSCREEN 0x00030001 // Deprecated7979+8080+typedef8181+struct {8282+ uint32 command;8383+ uint32 fullscreen;8484+ struct {8585+ int32 x, y;8686+ } monitorPosition;8787+} SVGAEscapeHintFullscreen;8888+8989+#endif /* _SVGA_ESCAPE_H_ */
+201
drivers/gpu/drm/vmwgfx/svga_overlay.h
···11+/**********************************************************22+ * Copyright 2007-2009 VMware, Inc. All rights reserved.33+ *44+ * Permission is hereby granted, free of charge, to any person55+ * obtaining a copy of this software and associated documentation66+ * files (the "Software"), to deal in the Software without77+ * restriction, including without limitation the rights to use, copy,88+ * modify, merge, publish, distribute, sublicense, and/or sell copies99+ * of the Software, and to permit persons to whom the Software is1010+ * furnished to do so, subject to the following conditions:1111+ *1212+ * The above copyright notice and this permission notice shall be1313+ * included in all copies or substantial portions of the Software.1414+ *1515+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,1616+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF1717+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND1818+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS1919+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN2020+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN2121+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE2222+ * SOFTWARE.2323+ *2424+ **********************************************************/2525+2626+/*2727+ * svga_overlay.h --2828+ *2929+ * Definitions for video-overlay support.3030+ */3131+3232+#ifndef _SVGA_OVERLAY_H_3333+#define _SVGA_OVERLAY_H_3434+3535+#include "svga_reg.h"3636+3737+/*3838+ * Video formats we support3939+ */4040+4141+#define VMWARE_FOURCC_YV12 0x32315659 // 'Y' 'V' '1' '2'4242+#define VMWARE_FOURCC_YUY2 0x32595559 // 'Y' 'U' 'Y' '2'4343+#define VMWARE_FOURCC_UYVY 0x59565955 // 'U' 'Y' 'V' 'Y'4444+4545+typedef enum {4646+ SVGA_OVERLAY_FORMAT_INVALID = 0,4747+ SVGA_OVERLAY_FORMAT_YV12 = VMWARE_FOURCC_YV12,4848+ SVGA_OVERLAY_FORMAT_YUY2 = VMWARE_FOURCC_YUY2,4949+ SVGA_OVERLAY_FORMAT_UYVY = VMWARE_FOURCC_UYVY,5050+} SVGAOverlayFormat;5151+5252+#define SVGA_VIDEO_COLORKEY_MASK 0x00ffffff5353+5454+#define SVGA_ESCAPE_VMWARE_VIDEO 0x000200005555+5656+#define SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS 0x000200015757+ /* FIFO escape layout:5858+ * Type, Stream Id, (Register Id, Value) pairs */5959+6060+#define SVGA_ESCAPE_VMWARE_VIDEO_FLUSH 0x000200026161+ /* FIFO escape layout:6262+ * Type, Stream Id */6363+6464+typedef6565+struct SVGAEscapeVideoSetRegs {6666+ struct {6767+ uint32 cmdType;6868+ uint32 streamId;6969+ } header;7070+7171+ // May include zero or more items.7272+ struct {7373+ uint32 registerId;7474+ uint32 value;7575+ } items[1];7676+} SVGAEscapeVideoSetRegs;7777+7878+typedef7979+struct SVGAEscapeVideoFlush {8080+ uint32 cmdType;8181+ uint32 streamId;8282+} SVGAEscapeVideoFlush;8383+8484+8585+/*8686+ * Struct definitions for the video overlay commands built on8787+ * SVGAFifoCmdEscape.8888+ */8989+typedef9090+struct {9191+ uint32 command;9292+ uint32 overlay;9393+} SVGAFifoEscapeCmdVideoBase;9494+9595+typedef9696+struct {9797+ SVGAFifoEscapeCmdVideoBase videoCmd;9898+} SVGAFifoEscapeCmdVideoFlush;9999+100100+typedef101101+struct {102102+ SVGAFifoEscapeCmdVideoBase videoCmd;103103+ struct {104104+ uint32 regId;105105+ uint32 value;106106+ } items[1];107107+} SVGAFifoEscapeCmdVideoSetRegs;108108+109109+typedef110110+struct {111111+ SVGAFifoEscapeCmdVideoBase videoCmd;112112+ struct {113113+ uint32 regId;114114+ uint32 value;115115+ } items[SVGA_VIDEO_NUM_REGS];116116+} SVGAFifoEscapeCmdVideoSetAllRegs;117117+118118+119119+/*120120+ *----------------------------------------------------------------------121121+ *122122+ * VMwareVideoGetAttributes --123123+ *124124+ * Computes the size, pitches and offsets for YUV frames.125125+ *126126+ * Results:127127+ * TRUE on success; otherwise FALSE on failure.128128+ *129129+ * Side effects:130130+ * Pitches and offsets for the given YUV frame are put in 'pitches'131131+ * and 'offsets' respectively. They are both optional though.132132+ *133133+ *----------------------------------------------------------------------134134+ */135135+136136+static inline bool137137+VMwareVideoGetAttributes(const SVGAOverlayFormat format, // IN138138+ uint32 *width, // IN / OUT139139+ uint32 *height, // IN / OUT140140+ uint32 *size, // OUT141141+ uint32 *pitches, // OUT (optional)142142+ uint32 *offsets) // OUT (optional)143143+{144144+ int tmp;145145+146146+ *width = (*width + 1) & ~1;147147+148148+ if (offsets) {149149+ offsets[0] = 0;150150+ }151151+152152+ switch (format) {153153+ case VMWARE_FOURCC_YV12:154154+ *height = (*height + 1) & ~1;155155+ *size = (*width + 3) & ~3;156156+157157+ if (pitches) {158158+ pitches[0] = *size;159159+ }160160+161161+ *size *= *height;162162+163163+ if (offsets) {164164+ offsets[1] = *size;165165+ }166166+167167+ tmp = ((*width >> 1) + 3) & ~3;168168+169169+ if (pitches) {170170+ pitches[1] = pitches[2] = tmp;171171+ }172172+173173+ tmp *= (*height >> 1);174174+ *size += tmp;175175+176176+ if (offsets) {177177+ offsets[2] = *size;178178+ }179179+180180+ *size += tmp;181181+ break;182182+183183+ case VMWARE_FOURCC_YUY2:184184+ case VMWARE_FOURCC_UYVY:185185+ *size = *width * 2;186186+187187+ if (pitches) {188188+ pitches[0] = *size;189189+ }190190+191191+ *size *= *height;192192+ break;193193+194194+ default:195195+ return false;196196+ }197197+198198+ return true;199199+}200200+201201+#endif // _SVGA_OVERLAY_H_
+1346
drivers/gpu/drm/vmwgfx/svga_reg.h
···11+/**********************************************************22+ * Copyright 1998-2009 VMware, Inc. All rights reserved.33+ *44+ * Permission is hereby granted, free of charge, to any person55+ * obtaining a copy of this software and associated documentation66+ * files (the "Software"), to deal in the Software without77+ * restriction, including without limitation the rights to use, copy,88+ * modify, merge, publish, distribute, sublicense, and/or sell copies99+ * of the Software, and to permit persons to whom the Software is1010+ * furnished to do so, subject to the following conditions:1111+ *1212+ * The above copyright notice and this permission notice shall be1313+ * included in all copies or substantial portions of the Software.1414+ *1515+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,1616+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF1717+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND1818+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS1919+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN2020+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN2121+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE2222+ * SOFTWARE.2323+ *2424+ **********************************************************/2525+2626+/*2727+ * svga_reg.h --2828+ *2929+ * Virtual hardware definitions for the VMware SVGA II device.3030+ */3131+3232+#ifndef _SVGA_REG_H_3333+#define _SVGA_REG_H_3434+3535+/*3636+ * PCI device IDs.3737+ */3838+#define PCI_VENDOR_ID_VMWARE 0x15AD3939+#define PCI_DEVICE_ID_VMWARE_SVGA2 0x04054040+4141+/*4242+ * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned4343+ * cursor bypass mode. This is still supported, but no new guest4444+ * drivers should use it.4545+ */4646+#define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */4747+#define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */4848+#define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */4949+#define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */5050+5151+/*5252+ * The maximum framebuffer size that can traced for e.g. guests in VESA mode.5353+ * The changeMap in the monitor is proportional to this number. Therefore, we'd5454+ * like to keep it as small as possible to reduce monitor overhead (using5555+ * SVGA_VRAM_MAX_SIZE for this increases the size of the shared area by over5656+ * 4k!).5757+ *5858+ * NB: For compatibility reasons, this value must be greater than 0xff0000.5959+ * See bug 335072.6060+ */6161+#define SVGA_FB_MAX_TRACEABLE_SIZE 0x10000006262+6363+#define SVGA_MAX_PSEUDOCOLOR_DEPTH 86464+#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH)6565+#define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS)6666+6767+#define SVGA_MAGIC 0x900000UL6868+#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))6969+7070+/* Version 2 let the address of the frame buffer be unsigned on Win32 */7171+#define SVGA_VERSION_2 27272+#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)7373+7474+/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so7575+ PALETTE_BASE has moved */7676+#define SVGA_VERSION_1 17777+#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1)7878+7979+/* Version 0 is the initial version */8080+#define SVGA_VERSION_0 08181+#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0)8282+8383+/* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */8484+#define SVGA_ID_INVALID 0xFFFFFFFF8585+8686+/* Port offsets, relative to BAR0 */8787+#define SVGA_INDEX_PORT 0x08888+#define SVGA_VALUE_PORT 0x18989+#define SVGA_BIOS_PORT 0x29090+#define SVGA_IRQSTATUS_PORT 0x89191+9292+/*9393+ * Interrupt source flags for IRQSTATUS_PORT and IRQMASK.9494+ *9595+ * Interrupts are only supported when the9696+ * SVGA_CAP_IRQMASK capability is present.9797+ */9898+#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */9999+#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */100100+#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */101101+102102+/*103103+ * Registers104104+ */105105+106106+enum {107107+ SVGA_REG_ID = 0,108108+ SVGA_REG_ENABLE = 1,109109+ SVGA_REG_WIDTH = 2,110110+ SVGA_REG_HEIGHT = 3,111111+ SVGA_REG_MAX_WIDTH = 4,112112+ SVGA_REG_MAX_HEIGHT = 5,113113+ SVGA_REG_DEPTH = 6,114114+ SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */115115+ SVGA_REG_PSEUDOCOLOR = 8,116116+ SVGA_REG_RED_MASK = 9,117117+ SVGA_REG_GREEN_MASK = 10,118118+ SVGA_REG_BLUE_MASK = 11,119119+ SVGA_REG_BYTES_PER_LINE = 12,120120+ SVGA_REG_FB_START = 13, /* (Deprecated) */121121+ SVGA_REG_FB_OFFSET = 14,122122+ SVGA_REG_VRAM_SIZE = 15,123123+ SVGA_REG_FB_SIZE = 16,124124+125125+ /* ID 0 implementation only had the above registers, then the palette */126126+127127+ SVGA_REG_CAPABILITIES = 17,128128+ SVGA_REG_MEM_START = 18, /* (Deprecated) */129129+ SVGA_REG_MEM_SIZE = 19,130130+ SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */131131+ SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */132132+ SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */133133+ SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */134134+ SVGA_REG_CURSOR_ID = 24, /* (Deprecated) */135135+ SVGA_REG_CURSOR_X = 25, /* (Deprecated) */136136+ SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */137137+ SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */138138+ SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */139139+ SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */140140+ SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */141141+ SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */142142+ SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */143143+ SVGA_REG_IRQMASK = 33, /* Interrupt mask */144144+145145+ /* Legacy multi-monitor support */146146+ SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */147147+ SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */148148+ SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */149149+ SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */150150+ SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */151151+ SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */152152+ SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */153153+154154+ /* See "Guest memory regions" below. */155155+ SVGA_REG_GMR_ID = 41,156156+ SVGA_REG_GMR_DESCRIPTOR = 42,157157+ SVGA_REG_GMR_MAX_IDS = 43,158158+ SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,159159+160160+ SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */161161+ SVGA_REG_TOP = 46, /* Must be 1 more than the last register */162162+163163+ SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */164164+ /* Next 768 (== 256*3) registers exist for colormap */165165+166166+ SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS167167+ /* Base of scratch registers */168168+ /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage:169169+ First 4 are reserved for VESA BIOS Extension; any remaining are for170170+ the use of the current SVGA driver. */171171+};172172+173173+174174+/*175175+ * Guest memory regions (GMRs):176176+ *177177+ * This is a new memory mapping feature available in SVGA devices178178+ * which have the SVGA_CAP_GMR bit set. Previously, there were two179179+ * fixed memory regions available with which to share data between the180180+ * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs181181+ * are our name for an extensible way of providing arbitrary DMA182182+ * buffers for use between the driver and the SVGA device. They are a183183+ * new alternative to framebuffer memory, usable for both 2D and 3D184184+ * graphics operations.185185+ *186186+ * Since GMR mapping must be done synchronously with guest CPU187187+ * execution, we use a new pair of SVGA registers:188188+ *189189+ * SVGA_REG_GMR_ID --190190+ *191191+ * Read/write.192192+ * This register holds the 32-bit ID (a small positive integer)193193+ * of a GMR to create, delete, or redefine. Writing this register194194+ * has no side-effects.195195+ *196196+ * SVGA_REG_GMR_DESCRIPTOR --197197+ *198198+ * Write-only.199199+ * Writing this register will create, delete, or redefine the GMR200200+ * specified by the above ID register. If this register is zero,201201+ * the GMR is deleted. Any pointers into this GMR (including those202202+ * currently being processed by FIFO commands) will be203203+ * synchronously invalidated.204204+ *205205+ * If this register is nonzero, it must be the physical page206206+ * number (PPN) of a data structure which describes the physical207207+ * layout of the memory region this GMR should describe. The208208+ * descriptor structure will be read synchronously by the SVGA209209+ * device when this register is written. The descriptor need not210210+ * remain allocated for the lifetime of the GMR.211211+ *212212+ * The guest driver should write SVGA_REG_GMR_ID first, then213213+ * SVGA_REG_GMR_DESCRIPTOR.214214+ *215215+ * SVGA_REG_GMR_MAX_IDS --216216+ *217217+ * Read-only.218218+ * The SVGA device may choose to support a maximum number of219219+ * user-defined GMR IDs. This register holds the number of supported220220+ * IDs. (The maximum supported ID plus 1)221221+ *222222+ * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH --223223+ *224224+ * Read-only.225225+ * The SVGA device may choose to put a limit on the total number226226+ * of SVGAGuestMemDescriptor structures it will read when defining227227+ * a single GMR.228228+ *229229+ * The descriptor structure is an array of SVGAGuestMemDescriptor230230+ * structures. Each structure may do one of three things:231231+ *232232+ * - Terminate the GMR descriptor list.233233+ * (ppn==0, numPages==0)234234+ *235235+ * - Add a PPN or range of PPNs to the GMR's virtual address space.236236+ * (ppn != 0, numPages != 0)237237+ *238238+ * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to239239+ * support multi-page GMR descriptor tables without forcing the240240+ * driver to allocate physically contiguous memory.241241+ * (ppn != 0, numPages == 0)242242+ *243243+ * Note that each physical page of SVGAGuestMemDescriptor structures244244+ * can describe at least 2MB of guest memory. If the driver needs to245245+ * use more than one page of descriptor structures, it must use one of246246+ * its SVGAGuestMemDescriptors to point to an additional page. The247247+ * device will never automatically cross a page boundary.248248+ *249249+ * Once the driver has described a GMR, it is immediately available250250+ * for use via any FIFO command that uses an SVGAGuestPtr structure.251251+ * These pointers include a GMR identifier plus an offset into that252252+ * GMR.253253+ *254254+ * The driver must check the SVGA_CAP_GMR bit before using the GMR255255+ * registers.256256+ */257257+258258+/*259259+ * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer260260+ * memory as well. In the future, these IDs could even be used to261261+ * allow legacy memory regions to be redefined by the guest as GMRs.262262+ *263263+ * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA264264+ * is being phased out. Please try to use user-defined GMRs whenever265265+ * possible.266266+ */267267+#define SVGA_GMR_NULL ((uint32) -1)268268+#define SVGA_GMR_FRAMEBUFFER ((uint32) -2) // Guest Framebuffer (GFB)269269+270270+typedef271271+struct SVGAGuestMemDescriptor {272272+ uint32 ppn;273273+ uint32 numPages;274274+} SVGAGuestMemDescriptor;275275+276276+typedef277277+struct SVGAGuestPtr {278278+ uint32 gmrId;279279+ uint32 offset;280280+} SVGAGuestPtr;281281+282282+283283+/*284284+ * SVGAGMRImageFormat --285285+ *286286+ * This is a packed representation of the source 2D image format287287+ * for a GMR-to-screen blit. Currently it is defined as an encoding288288+ * of the screen's color depth and bits-per-pixel, however, 16 bits289289+ * are reserved for future use to identify other encodings (such as290290+ * RGBA or higher-precision images).291291+ *292292+ * Currently supported formats:293293+ *294294+ * bpp depth Format Name295295+ * --- ----- -----------296296+ * 32 24 32-bit BGRX297297+ * 24 24 24-bit BGR298298+ * 16 16 RGB 5-6-5299299+ * 16 15 RGB 5-5-5300300+ *301301+ */302302+303303+typedef304304+struct SVGAGMRImageFormat {305305+ union {306306+ struct {307307+ uint32 bitsPerPixel : 8;308308+ uint32 colorDepth : 8;309309+ uint32 reserved : 16; // Must be zero310310+ };311311+312312+ uint32 value;313313+ };314314+} SVGAGMRImageFormat;315315+316316+/*317317+ * SVGAColorBGRX --318318+ *319319+ * A 24-bit color format (BGRX), which does not depend on the320320+ * format of the legacy guest framebuffer (GFB) or the current321321+ * GMRFB state.322322+ */323323+324324+typedef325325+struct SVGAColorBGRX {326326+ union {327327+ struct {328328+ uint32 b : 8;329329+ uint32 g : 8;330330+ uint32 r : 8;331331+ uint32 x : 8; // Unused332332+ };333333+334334+ uint32 value;335335+ };336336+} SVGAColorBGRX;337337+338338+339339+/*340340+ * SVGASignedRect --341341+ * SVGASignedPoint --342342+ *343343+ * Signed rectangle and point primitives. These are used by the new344344+ * 2D primitives for drawing to Screen Objects, which can occupy a345345+ * signed virtual coordinate space.346346+ *347347+ * SVGASignedRect specifies a half-open interval: the (left, top)348348+ * pixel is part of the rectangle, but the (right, bottom) pixel is349349+ * not.350350+ */351351+352352+typedef353353+struct SVGASignedRect {354354+ int32 left;355355+ int32 top;356356+ int32 right;357357+ int32 bottom;358358+} SVGASignedRect;359359+360360+typedef361361+struct SVGASignedPoint {362362+ int32 x;363363+ int32 y;364364+} SVGASignedPoint;365365+366366+367367+/*368368+ * Capabilities369369+ *370370+ * Note the holes in the bitfield. Missing bits have been deprecated,371371+ * and must not be reused. Those capabilities will never be reported372372+ * by new versions of the SVGA device.373373+ */374374+375375+#define SVGA_CAP_NONE 0x00000000376376+#define SVGA_CAP_RECT_COPY 0x00000002377377+#define SVGA_CAP_CURSOR 0x00000020378378+#define SVGA_CAP_CURSOR_BYPASS 0x00000040 // Legacy (Use Cursor Bypass 3 instead)379379+#define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 // Legacy (Use Cursor Bypass 3 instead)380380+#define SVGA_CAP_8BIT_EMULATION 0x00000100381381+#define SVGA_CAP_ALPHA_CURSOR 0x00000200382382+#define SVGA_CAP_3D 0x00004000383383+#define SVGA_CAP_EXTENDED_FIFO 0x00008000384384+#define SVGA_CAP_MULTIMON 0x00010000 // Legacy multi-monitor support385385+#define SVGA_CAP_PITCHLOCK 0x00020000386386+#define SVGA_CAP_IRQMASK 0x00040000387387+#define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 // Legacy multi-monitor support388388+#define SVGA_CAP_GMR 0x00100000389389+#define SVGA_CAP_TRACES 0x00200000390390+391391+392392+/*393393+ * FIFO register indices.394394+ *395395+ * The FIFO is a chunk of device memory mapped into guest physmem. It396396+ * is always treated as 32-bit words.397397+ *398398+ * The guest driver gets to decide how to partition it between399399+ * - FIFO registers (there are always at least 4, specifying where the400400+ * following data area is and how much data it contains; there may be401401+ * more registers following these, depending on the FIFO protocol402402+ * version in use)403403+ * - FIFO data, written by the guest and slurped out by the VMX.404404+ * These indices are 32-bit word offsets into the FIFO.405405+ */406406+407407+enum {408408+ /*409409+ * Block 1 (basic registers): The originally defined FIFO registers.410410+ * These exist and are valid for all versions of the FIFO protocol.411411+ */412412+413413+ SVGA_FIFO_MIN = 0,414414+ SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */415415+ SVGA_FIFO_NEXT_CMD,416416+ SVGA_FIFO_STOP,417417+418418+ /*419419+ * Block 2 (extended registers): Mandatory registers for the extended420420+ * FIFO. These exist if the SVGA caps register includes421421+ * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their422422+ * associated capability bit is enabled.423423+ *424424+ * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied425425+ * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE.426426+ * This means that the guest has to test individually (in most cases427427+ * using FIFO caps) for the presence of registers after this; the VMX428428+ * can define "extended FIFO" to mean whatever it wants, and currently429429+ * won't enable it unless there's room for that set and much more.430430+ */431431+432432+ SVGA_FIFO_CAPABILITIES = 4,433433+ SVGA_FIFO_FLAGS,434434+ // Valid with SVGA_FIFO_CAP_FENCE:435435+ SVGA_FIFO_FENCE,436436+437437+ /*438438+ * Block 3a (optional extended registers): Additional registers for the439439+ * extended FIFO, whose presence isn't actually implied by440440+ * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to441441+ * leave room for them.442442+ *443443+ * These in block 3a, the VMX currently considers mandatory for the444444+ * extended FIFO.445445+ */446446+447447+ // Valid if exists (i.e. if extended FIFO enabled):448448+ SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */449449+ // Valid with SVGA_FIFO_CAP_PITCHLOCK:450450+ SVGA_FIFO_PITCHLOCK,451451+452452+ // Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3:453453+ SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */454454+ SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */455455+ SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */456456+ SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */457457+ SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */458458+459459+ // Valid with SVGA_FIFO_CAP_RESERVE:460460+ SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */461461+462462+ /*463463+ * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT:464464+ *465465+ * By default this is SVGA_ID_INVALID, to indicate that the cursor466466+ * coordinates are specified relative to the virtual root. If this467467+ * is set to a specific screen ID, cursor position is reinterpreted468468+ * as a signed offset relative to that screen's origin. This is the469469+ * only way to place the cursor on a non-rooted screen.470470+ */471471+ SVGA_FIFO_CURSOR_SCREEN_ID,472472+473473+ /*474474+ * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new475475+ * registers, but this must be done carefully and with judicious use of476476+ * capability bits, since comparisons based on SVGA_FIFO_MIN aren't477477+ * enough to tell you whether the register exists: we've shipped drivers478478+ * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of479479+ * the earlier ones. The actual order of introduction was:480480+ * - PITCHLOCK481481+ * - 3D_CAPS482482+ * - CURSOR_* (cursor bypass 3)483483+ * - RESERVED484484+ * So, code that wants to know whether it can use any of the485485+ * aforementioned registers, or anything else added after PITCHLOCK and486486+ * before 3D_CAPS, needs to reason about something other than487487+ * SVGA_FIFO_MIN.488488+ */489489+490490+ /*491491+ * 3D caps block space; valid with 3D hardware version >=492492+ * SVGA3D_HWVERSION_WS6_B1.493493+ */494494+ SVGA_FIFO_3D_CAPS = 32,495495+ SVGA_FIFO_3D_CAPS_LAST = 32 + 255,496496+497497+ /*498498+ * End of VMX's current definition of "extended-FIFO registers".499499+ * Registers before here are always enabled/disabled as a block; either500500+ * the extended FIFO is enabled and includes all preceding registers, or501501+ * it's disabled entirely.502502+ *503503+ * Block 3b (truly optional extended registers): Additional registers for504504+ * the extended FIFO, which the VMX already knows how to enable and505505+ * disable with correct granularity.506506+ *507507+ * Registers after here exist if and only if the guest SVGA driver508508+ * sets SVGA_FIFO_MIN high enough to leave room for them.509509+ */510510+511511+ // Valid if register exists:512512+ SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */513513+ SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */514514+ SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */515515+516516+ /*517517+ * Always keep this last. This defines the maximum number of518518+ * registers we know about. At power-on, this value is placed in519519+ * the SVGA_REG_MEM_REGS register, and we expect the guest driver520520+ * to allocate this much space in FIFO memory for registers.521521+ */522522+ SVGA_FIFO_NUM_REGS523523+};524524+525525+526526+/*527527+ * Definition of registers included in extended FIFO support.528528+ *529529+ * The guest SVGA driver gets to allocate the FIFO between registers530530+ * and data. It must always allocate at least 4 registers, but old531531+ * drivers stopped there.532532+ *533533+ * The VMX will enable extended FIFO support if and only if the guest534534+ * left enough room for all registers defined as part of the mandatory535535+ * set for the extended FIFO.536536+ *537537+ * Note that the guest drivers typically allocate the FIFO only at538538+ * initialization time, not at mode switches, so it's likely that the539539+ * number of FIFO registers won't change without a reboot.540540+ *541541+ * All registers less than this value are guaranteed to be present if542542+ * svgaUser->fifo.extended is set. Any later registers must be tested543543+ * individually for compatibility at each use (in the VMX).544544+ *545545+ * This value is used only by the VMX, so it can change without546546+ * affecting driver compatibility; keep it that way?547547+ */548548+#define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1)549549+550550+551551+/*552552+ * FIFO Synchronization Registers553553+ *554554+ * This explains the relationship between the various FIFO555555+ * sync-related registers in IOSpace and in FIFO space.556556+ *557557+ * SVGA_REG_SYNC --558558+ *559559+ * The SYNC register can be used in two different ways by the guest:560560+ *561561+ * 1. If the guest wishes to fully sync (drain) the FIFO,562562+ * it will write once to SYNC then poll on the BUSY563563+ * register. The FIFO is sync'ed once BUSY is zero.564564+ *565565+ * 2. If the guest wants to asynchronously wake up the host,566566+ * it will write once to SYNC without polling on BUSY.567567+ * Ideally it will do this after some new commands have568568+ * been placed in the FIFO, and after reading a zero569569+ * from SVGA_FIFO_BUSY.570570+ *571571+ * (1) is the original behaviour that SYNC was designed to572572+ * support. Originally, a write to SYNC would implicitly573573+ * trigger a read from BUSY. This causes us to synchronously574574+ * process the FIFO.575575+ *576576+ * This behaviour has since been changed so that writing SYNC577577+ * will *not* implicitly cause a read from BUSY. Instead, it578578+ * makes a channel call which asynchronously wakes up the MKS579579+ * thread.580580+ *581581+ * New guests can use this new behaviour to implement (2)582582+ * efficiently. This lets guests get the host's attention583583+ * without waiting for the MKS to poll, which gives us much584584+ * better CPU utilization on SMP hosts and on UP hosts while585585+ * we're blocked on the host GPU.586586+ *587587+ * Old guests shouldn't notice the behaviour change. SYNC was588588+ * never guaranteed to process the entire FIFO, since it was589589+ * bounded to a particular number of CPU cycles. Old guests will590590+ * still loop on the BUSY register until the FIFO is empty.591591+ *592592+ * Writing to SYNC currently has the following side-effects:593593+ *594594+ * - Sets SVGA_REG_BUSY to TRUE (in the monitor)595595+ * - Asynchronously wakes up the MKS thread for FIFO processing596596+ * - The value written to SYNC is recorded as a "reason", for597597+ * stats purposes.598598+ *599599+ * If SVGA_FIFO_BUSY is available, drivers are advised to only600600+ * write to SYNC if SVGA_FIFO_BUSY is FALSE. Drivers should set601601+ * SVGA_FIFO_BUSY to TRUE after writing to SYNC. The MKS will602602+ * eventually set SVGA_FIFO_BUSY on its own, but this approach603603+ * lets the driver avoid sending multiple asynchronous wakeup604604+ * messages to the MKS thread.605605+ *606606+ * SVGA_REG_BUSY --607607+ *608608+ * This register is set to TRUE when SVGA_REG_SYNC is written,609609+ * and it reads as FALSE when the FIFO has been completely610610+ * drained.611611+ *612612+ * Every read from this register causes us to synchronously613613+ * process FIFO commands. There is no guarantee as to how many614614+ * commands each read will process.615615+ *616616+ * CPU time spent processing FIFO commands will be billed to617617+ * the guest.618618+ *619619+ * New drivers should avoid using this register unless they620620+ * need to guarantee that the FIFO is completely drained. It621621+ * is overkill for performing a sync-to-fence. Older drivers622622+ * will use this register for any type of synchronization.623623+ *624624+ * SVGA_FIFO_BUSY --625625+ *626626+ * This register is a fast way for the guest driver to check627627+ * whether the FIFO is already being processed. It reads and628628+ * writes at normal RAM speeds, with no monitor intervention.629629+ *630630+ * If this register reads as TRUE, the host is guaranteeing that631631+ * any new commands written into the FIFO will be noticed before632632+ * the MKS goes back to sleep.633633+ *634634+ * If this register reads as FALSE, no such guarantee can be635635+ * made.636636+ *637637+ * The guest should use this register to quickly determine638638+ * whether or not it needs to wake up the host. If the guest639639+ * just wrote a command or group of commands that it would like640640+ * the host to begin processing, it should:641641+ *642642+ * 1. Read SVGA_FIFO_BUSY. If it reads as TRUE, no further643643+ * action is necessary.644644+ *645645+ * 2. Write TRUE to SVGA_FIFO_BUSY. This informs future guest646646+ * code that we've already sent a SYNC to the host and we647647+ * don't need to send a duplicate.648648+ *649649+ * 3. Write a reason to SVGA_REG_SYNC. This will send an650650+ * asynchronous wakeup to the MKS thread.651651+ */652652+653653+654654+/*655655+ * FIFO Capabilities656656+ *657657+ * Fence -- Fence register and command are supported658658+ * Accel Front -- Front buffer only commands are supported659659+ * Pitch Lock -- Pitch lock register is supported660660+ * Video -- SVGA Video overlay units are supported661661+ * Escape -- Escape command is supported662662+ *663663+ * XXX: Add longer descriptions for each capability, including a list664664+ * of the new features that each capability provides.665665+ *666666+ * SVGA_FIFO_CAP_SCREEN_OBJECT --667667+ *668668+ * Provides dynamic multi-screen rendering, for improved Unity and669669+ * multi-monitor modes. With Screen Object, the guest can670670+ * dynamically create and destroy 'screens', which can represent671671+ * Unity windows or virtual monitors. Screen Object also provides672672+ * strong guarantees that DMA operations happen only when673673+ * guest-initiated. Screen Object deprecates the BAR1 guest674674+ * framebuffer (GFB) and all commands that work only with the GFB.675675+ *676676+ * New registers:677677+ * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID678678+ *679679+ * New 2D commands:680680+ * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN,681681+ * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY682682+ *683683+ * New 3D commands:684684+ * BLIT_SURFACE_TO_SCREEN685685+ *686686+ * New guarantees:687687+ *688688+ * - The host will not read or write guest memory, including the GFB,689689+ * except when explicitly initiated by a DMA command.690690+ *691691+ * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK,692692+ * is guaranteed to complete before any subsequent FENCEs.693693+ *694694+ * - All legacy commands which affect a Screen (UPDATE, PRESENT,695695+ * PRESENT_READBACK) as well as new Screen blit commands will696696+ * all behave consistently as blits, and memory will be read697697+ * or written in FIFO order.698698+ *699699+ * For example, if you PRESENT from one SVGA3D surface to multiple700700+ * places on the screen, the data copied will always be from the701701+ * SVGA3D surface at the time the PRESENT was issued in the FIFO.702702+ * This was not necessarily true on devices without Screen Object.703703+ *704704+ * This means that on devices that support Screen Object, the705705+ * PRESENT_READBACK command should not be necessary unless you706706+ * actually want to read back the results of 3D rendering into707707+ * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB708708+ * command provides a strict superset of functionality.)709709+ *710710+ * - When a screen is resized, either using Screen Object commands or711711+ * legacy multimon registers, its contents are preserved.712712+ */713713+714714+#define SVGA_FIFO_CAP_NONE 0715715+#define SVGA_FIFO_CAP_FENCE (1<<0)716716+#define SVGA_FIFO_CAP_ACCELFRONT (1<<1)717717+#define SVGA_FIFO_CAP_PITCHLOCK (1<<2)718718+#define SVGA_FIFO_CAP_VIDEO (1<<3)719719+#define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4)720720+#define SVGA_FIFO_CAP_ESCAPE (1<<5)721721+#define SVGA_FIFO_CAP_RESERVE (1<<6)722722+#define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7)723723+724724+725725+/*726726+ * FIFO Flags727727+ *728728+ * Accel Front -- Driver should use front buffer only commands729729+ */730730+731731+#define SVGA_FIFO_FLAG_NONE 0732732+#define SVGA_FIFO_FLAG_ACCELFRONT (1<<0)733733+#define SVGA_FIFO_FLAG_RESERVED (1<<31) // Internal use only734734+735735+/*736736+ * FIFO reservation sentinel value737737+ */738738+739739+#define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff740740+741741+742742+/*743743+ * Video overlay support744744+ */745745+746746+#define SVGA_NUM_OVERLAY_UNITS 32747747+748748+749749+/*750750+ * Video capabilities that the guest is currently using751751+ */752752+753753+#define SVGA_VIDEO_FLAG_COLORKEY 0x0001754754+755755+756756+/*757757+ * Offsets for the video overlay registers758758+ */759759+760760+enum {761761+ SVGA_VIDEO_ENABLED = 0,762762+ SVGA_VIDEO_FLAGS,763763+ SVGA_VIDEO_DATA_OFFSET,764764+ SVGA_VIDEO_FORMAT,765765+ SVGA_VIDEO_COLORKEY,766766+ SVGA_VIDEO_SIZE, // Deprecated767767+ SVGA_VIDEO_WIDTH,768768+ SVGA_VIDEO_HEIGHT,769769+ SVGA_VIDEO_SRC_X,770770+ SVGA_VIDEO_SRC_Y,771771+ SVGA_VIDEO_SRC_WIDTH,772772+ SVGA_VIDEO_SRC_HEIGHT,773773+ SVGA_VIDEO_DST_X, // Signed int32774774+ SVGA_VIDEO_DST_Y, // Signed int32775775+ SVGA_VIDEO_DST_WIDTH,776776+ SVGA_VIDEO_DST_HEIGHT,777777+ SVGA_VIDEO_PITCH_1,778778+ SVGA_VIDEO_PITCH_2,779779+ SVGA_VIDEO_PITCH_3,780780+ SVGA_VIDEO_DATA_GMRID, // Optional, defaults to SVGA_GMR_FRAMEBUFFER781781+ SVGA_VIDEO_DST_SCREEN_ID, // Optional, defaults to virtual coords (SVGA_ID_INVALID)782782+ SVGA_VIDEO_NUM_REGS783783+};784784+785785+786786+/*787787+ * SVGA Overlay Units788788+ *789789+ * width and height relate to the entire source video frame.790790+ * srcX, srcY, srcWidth and srcHeight represent subset of the source791791+ * video frame to be displayed.792792+ */793793+794794+typedef struct SVGAOverlayUnit {795795+ uint32 enabled;796796+ uint32 flags;797797+ uint32 dataOffset;798798+ uint32 format;799799+ uint32 colorKey;800800+ uint32 size;801801+ uint32 width;802802+ uint32 height;803803+ uint32 srcX;804804+ uint32 srcY;805805+ uint32 srcWidth;806806+ uint32 srcHeight;807807+ int32 dstX;808808+ int32 dstY;809809+ uint32 dstWidth;810810+ uint32 dstHeight;811811+ uint32 pitches[3];812812+ uint32 dataGMRId;813813+ uint32 dstScreenId;814814+} SVGAOverlayUnit;815815+816816+817817+/*818818+ * SVGAScreenObject --819819+ *820820+ * This is a new way to represent a guest's multi-monitor screen or821821+ * Unity window. Screen objects are only supported if the822822+ * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set.823823+ *824824+ * If Screen Objects are supported, they can be used to fully825825+ * replace the functionality provided by the framebuffer registers826826+ * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY.827827+ *828828+ * The screen object is a struct with guaranteed binary829829+ * compatibility. New flags can be added, and the struct may grow,830830+ * but existing fields must retain their meaning.831831+ *832832+ */833833+834834+#define SVGA_SCREEN_HAS_ROOT (1 << 0) // Screen is present in the virtual coord space835835+#define SVGA_SCREEN_IS_PRIMARY (1 << 1) // Guest considers this screen to be 'primary'836836+#define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) // Guest is running a fullscreen app here837837+838838+typedef839839+struct SVGAScreenObject {840840+ uint32 structSize; // sizeof(SVGAScreenObject)841841+ uint32 id;842842+ uint32 flags;843843+ struct {844844+ uint32 width;845845+ uint32 height;846846+ } size;847847+ struct {848848+ int32 x;849849+ int32 y;850850+ } root; // Only used if SVGA_SCREEN_HAS_ROOT is set.851851+} SVGAScreenObject;852852+853853+854854+/*855855+ * Commands in the command FIFO:856856+ *857857+ * Command IDs defined below are used for the traditional 2D FIFO858858+ * communication (not all commands are available for all versions of the859859+ * SVGA FIFO protocol).860860+ *861861+ * Note the holes in the command ID numbers: These commands have been862862+ * deprecated, and the old IDs must not be reused.863863+ *864864+ * Command IDs from 1000 to 1999 are reserved for use by the SVGA3D865865+ * protocol.866866+ *867867+ * Each command's parameters are described by the comments and868868+ * structs below.869869+ */870870+871871+typedef enum {872872+ SVGA_CMD_INVALID_CMD = 0,873873+ SVGA_CMD_UPDATE = 1,874874+ SVGA_CMD_RECT_COPY = 3,875875+ SVGA_CMD_DEFINE_CURSOR = 19,876876+ SVGA_CMD_DEFINE_ALPHA_CURSOR = 22,877877+ SVGA_CMD_UPDATE_VERBOSE = 25,878878+ SVGA_CMD_FRONT_ROP_FILL = 29,879879+ SVGA_CMD_FENCE = 30,880880+ SVGA_CMD_ESCAPE = 33,881881+ SVGA_CMD_DEFINE_SCREEN = 34,882882+ SVGA_CMD_DESTROY_SCREEN = 35,883883+ SVGA_CMD_DEFINE_GMRFB = 36,884884+ SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37,885885+ SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38,886886+ SVGA_CMD_ANNOTATION_FILL = 39,887887+ SVGA_CMD_ANNOTATION_COPY = 40,888888+ SVGA_CMD_MAX889889+} SVGAFifoCmdId;890890+891891+#define SVGA_CMD_MAX_ARGS 64892892+893893+894894+/*895895+ * SVGA_CMD_UPDATE --896896+ *897897+ * This is a DMA transfer which copies from the Guest Framebuffer898898+ * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which899899+ * intersect with the provided virtual rectangle.900900+ *901901+ * This command does not support using arbitrary guest memory as a902902+ * data source- it only works with the pre-defined GFB memory.903903+ * This command also does not support signed virtual coordinates.904904+ * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with905905+ * negative root x/y coordinates, the negative portion of those906906+ * screens will not be reachable by this command.907907+ *908908+ * This command is not necessary when using framebuffer909909+ * traces. Traces are automatically enabled if the SVGA FIFO is910910+ * disabled, and you may explicitly enable/disable traces using911911+ * SVGA_REG_TRACES. With traces enabled, any write to the GFB will912912+ * automatically act as if a subsequent SVGA_CMD_UPDATE was issued.913913+ *914914+ * Traces and SVGA_CMD_UPDATE are the only supported ways to render915915+ * pseudocolor screen updates. The newer Screen Object commands916916+ * only support true color formats.917917+ *918918+ * Availability:919919+ * Always available.920920+ */921921+922922+typedef923923+struct {924924+ uint32 x;925925+ uint32 y;926926+ uint32 width;927927+ uint32 height;928928+} SVGAFifoCmdUpdate;929929+930930+931931+/*932932+ * SVGA_CMD_RECT_COPY --933933+ *934934+ * Perform a rectangular DMA transfer from one area of the GFB to935935+ * another, and copy the result to any screens which intersect it.936936+ *937937+ * Availability:938938+ * SVGA_CAP_RECT_COPY939939+ */940940+941941+typedef942942+struct {943943+ uint32 srcX;944944+ uint32 srcY;945945+ uint32 destX;946946+ uint32 destY;947947+ uint32 width;948948+ uint32 height;949949+} SVGAFifoCmdRectCopy;950950+951951+952952+/*953953+ * SVGA_CMD_DEFINE_CURSOR --954954+ *955955+ * Provide a new cursor image, as an AND/XOR mask.956956+ *957957+ * The recommended way to position the cursor overlay is by using958958+ * the SVGA_FIFO_CURSOR_* registers, supported by the959959+ * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.960960+ *961961+ * Availability:962962+ * SVGA_CAP_CURSOR963963+ */964964+965965+typedef966966+struct {967967+ uint32 id; // Reserved, must be zero.968968+ uint32 hotspotX;969969+ uint32 hotspotY;970970+ uint32 width;971971+ uint32 height;972972+ uint32 andMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL973973+ uint32 xorMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL974974+ /*975975+ * Followed by scanline data for AND mask, then XOR mask.976976+ * Each scanline is padded to a 32-bit boundary.977977+ */978978+} SVGAFifoCmdDefineCursor;979979+980980+981981+/*982982+ * SVGA_CMD_DEFINE_ALPHA_CURSOR --983983+ *984984+ * Provide a new cursor image, in 32-bit BGRA format.985985+ *986986+ * The recommended way to position the cursor overlay is by using987987+ * the SVGA_FIFO_CURSOR_* registers, supported by the988988+ * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability.989989+ *990990+ * Availability:991991+ * SVGA_CAP_ALPHA_CURSOR992992+ */993993+994994+typedef995995+struct {996996+ uint32 id; // Reserved, must be zero.997997+ uint32 hotspotX;998998+ uint32 hotspotY;999999+ uint32 width;10001000+ uint32 height;10011001+ /* Followed by scanline data */10021002+} SVGAFifoCmdDefineAlphaCursor;10031003+10041004+10051005+/*10061006+ * SVGA_CMD_UPDATE_VERBOSE --10071007+ *10081008+ * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle10091009+ * 'reason' value, an opaque cookie which is used by internal10101010+ * debugging tools. Third party drivers should not use this10111011+ * command.10121012+ *10131013+ * Availability:10141014+ * SVGA_CAP_EXTENDED_FIFO10151015+ */10161016+10171017+typedef10181018+struct {10191019+ uint32 x;10201020+ uint32 y;10211021+ uint32 width;10221022+ uint32 height;10231023+ uint32 reason;10241024+} SVGAFifoCmdUpdateVerbose;10251025+10261026+10271027+/*10281028+ * SVGA_CMD_FRONT_ROP_FILL --10291029+ *10301030+ * This is a hint which tells the SVGA device that the driver has10311031+ * just filled a rectangular region of the GFB with a solid10321032+ * color. Instead of reading these pixels from the GFB, the device10331033+ * can assume that they all equal 'color'. This is primarily used10341034+ * for remote desktop protocols.10351035+ *10361036+ * Availability:10371037+ * SVGA_FIFO_CAP_ACCELFRONT10381038+ */10391039+10401040+#define SVGA_ROP_COPY 0x0310411041+10421042+typedef10431043+struct {10441044+ uint32 color; // In the same format as the GFB10451045+ uint32 x;10461046+ uint32 y;10471047+ uint32 width;10481048+ uint32 height;10491049+ uint32 rop; // Must be SVGA_ROP_COPY10501050+} SVGAFifoCmdFrontRopFill;10511051+10521052+10531053+/*10541054+ * SVGA_CMD_FENCE --10551055+ *10561056+ * Insert a synchronization fence. When the SVGA device reaches10571057+ * this command, it will copy the 'fence' value into the10581058+ * SVGA_FIFO_FENCE register. It will also compare the fence against10591059+ * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the10601060+ * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will10611061+ * raise this interrupt.10621062+ *10631063+ * Availability:10641064+ * SVGA_FIFO_FENCE for this command,10651065+ * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL.10661066+ */10671067+10681068+typedef10691069+struct {10701070+ uint32 fence;10711071+} SVGAFifoCmdFence;10721072+10731073+10741074+/*10751075+ * SVGA_CMD_ESCAPE --10761076+ *10771077+ * Send an extended or vendor-specific variable length command.10781078+ * This is used for video overlay, third party plugins, and10791079+ * internal debugging tools. See svga_escape.h10801080+ *10811081+ * Availability:10821082+ * SVGA_FIFO_CAP_ESCAPE10831083+ */10841084+10851085+typedef10861086+struct {10871087+ uint32 nsid;10881088+ uint32 size;10891089+ /* followed by 'size' bytes of data */10901090+} SVGAFifoCmdEscape;10911091+10921092+10931093+/*10941094+ * SVGA_CMD_DEFINE_SCREEN --10951095+ *10961096+ * Define or redefine an SVGAScreenObject. See the description of10971097+ * SVGAScreenObject above. The video driver is responsible for10981098+ * generating new screen IDs. They should be small positive10991099+ * integers. The virtual device will have an implementation11001100+ * specific upper limit on the number of screen IDs11011101+ * supported. Drivers are responsible for recycling IDs. The first11021102+ * valid ID is zero.11031103+ *11041104+ * - Interaction with other registers:11051105+ *11061106+ * For backwards compatibility, when the GFB mode registers (WIDTH,11071107+ * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device11081108+ * deletes all screens other than screen #0, and redefines screen11091109+ * #0 according to the specified mode. Drivers that use11101110+ * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0.11111111+ *11121112+ * If you use screen objects, do not use the legacy multi-mon11131113+ * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*).11141114+ *11151115+ * Availability:11161116+ * SVGA_FIFO_CAP_SCREEN_OBJECT11171117+ */11181118+11191119+typedef11201120+struct {11211121+ SVGAScreenObject screen; // Variable-length according to version11221122+} SVGAFifoCmdDefineScreen;11231123+11241124+11251125+/*11261126+ * SVGA_CMD_DESTROY_SCREEN --11271127+ *11281128+ * Destroy an SVGAScreenObject. Its ID is immediately available for11291129+ * re-use.11301130+ *11311131+ * Availability:11321132+ * SVGA_FIFO_CAP_SCREEN_OBJECT11331133+ */11341134+11351135+typedef11361136+struct {11371137+ uint32 screenId;11381138+} SVGAFifoCmdDestroyScreen;11391139+11401140+11411141+/*11421142+ * SVGA_CMD_DEFINE_GMRFB --11431143+ *11441144+ * This command sets a piece of SVGA device state called the11451145+ * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a11461146+ * piece of light-weight state which identifies the location and11471147+ * format of an image in guest memory or in BAR1. The GMRFB has11481148+ * an arbitrary size, and it doesn't need to match the geometry11491149+ * of the GFB or any screen object.11501150+ *11511151+ * The GMRFB can be redefined as often as you like. You could11521152+ * always use the same GMRFB, you could redefine it before11531153+ * rendering from a different guest screen, or you could even11541154+ * redefine it before every blit.11551155+ *11561156+ * There are multiple ways to use this command. The simplest way is11571157+ * to use it to move the framebuffer either to elsewhere in the GFB11581158+ * (BAR1) memory region, or to a user-defined GMR. This lets a11591159+ * driver use a framebuffer allocated entirely out of normal system11601160+ * memory, which we encourage.11611161+ *11621162+ * Another way to use this command is to set up a ring buffer of11631163+ * updates in GFB memory. If a driver wants to ensure that no11641164+ * frames are skipped by the SVGA device, it is important that the11651165+ * driver not modify the source data for a blit until the device is11661166+ * done processing the command. One efficient way to accomplish11671167+ * this is to use a ring of small DMA buffers. Each buffer is used11681168+ * for one blit, then we move on to the next buffer in the11691169+ * ring. The FENCE mechanism is used to protect each buffer from11701170+ * re-use until the device is finished with that buffer's11711171+ * corresponding blit.11721172+ *11731173+ * This command does not affect the meaning of SVGA_CMD_UPDATE.11741174+ * UPDATEs always occur from the legacy GFB memory area. This11751175+ * command has no support for pseudocolor GMRFBs. Currently only11761176+ * true-color 15, 16, and 24-bit depths are supported. Future11771177+ * devices may expose capabilities for additional framebuffer11781178+ * formats.11791179+ *11801180+ * The default GMRFB value is undefined. Drivers must always send11811181+ * this command at least once before performing any blit from the11821182+ * GMRFB.11831183+ *11841184+ * Availability:11851185+ * SVGA_FIFO_CAP_SCREEN_OBJECT11861186+ */11871187+11881188+typedef11891189+struct {11901190+ SVGAGuestPtr ptr;11911191+ uint32 bytesPerLine;11921192+ SVGAGMRImageFormat format;11931193+} SVGAFifoCmdDefineGMRFB;11941194+11951195+11961196+/*11971197+ * SVGA_CMD_BLIT_GMRFB_TO_SCREEN --11981198+ *11991199+ * This is a guest-to-host blit. It performs a DMA operation to12001200+ * copy a rectangular region of pixels from the current GMRFB to12011201+ * one or more Screen Objects.12021202+ *12031203+ * The destination coordinate may be specified relative to a12041204+ * screen's origin (if a screen ID is specified) or relative to the12051205+ * virtual coordinate system's origin (if the screen ID is12061206+ * SVGA_ID_INVALID). The actual destination may span zero or more12071207+ * screens, in the case of a virtual destination rect or a rect12081208+ * which extends off the edge of the specified screen.12091209+ *12101210+ * This command writes to the screen's "base layer": the underlying12111211+ * framebuffer which exists below any cursor or video overlays. No12121212+ * action is necessary to explicitly hide or update any overlays12131213+ * which exist on top of the updated region.12141214+ *12151215+ * The SVGA device is guaranteed to finish reading from the GMRFB12161216+ * by the time any subsequent FENCE commands are reached.12171217+ *12181218+ * This command consumes an annotation. See the12191219+ * SVGA_CMD_ANNOTATION_* commands for details.12201220+ *12211221+ * Availability:12221222+ * SVGA_FIFO_CAP_SCREEN_OBJECT12231223+ */12241224+12251225+typedef12261226+struct {12271227+ SVGASignedPoint srcOrigin;12281228+ SVGASignedRect destRect;12291229+ uint32 destScreenId;12301230+} SVGAFifoCmdBlitGMRFBToScreen;12311231+12321232+12331233+/*12341234+ * SVGA_CMD_BLIT_SCREEN_TO_GMRFB --12351235+ *12361236+ * This is a host-to-guest blit. It performs a DMA operation to12371237+ * copy a rectangular region of pixels from a single Screen Object12381238+ * back to the current GMRFB.12391239+ *12401240+ * Usage note: This command should be used rarely. It will12411241+ * typically be inefficient, but it is necessary for some types of12421242+ * synchronization between 3D (GPU) and 2D (CPU) rendering into12431243+ * overlapping areas of a screen.12441244+ *12451245+ * The source coordinate is specified relative to a screen's12461246+ * origin. The provided screen ID must be valid. If any parameters12471247+ * are invalid, the resulting pixel values are undefined.12481248+ *12491249+ * This command reads the screen's "base layer". Overlays like12501250+ * video and cursor are not included, but any data which was sent12511251+ * using a blit-to-screen primitive will be available, no matter12521252+ * whether the data's original source was the GMRFB or the 3D12531253+ * acceleration hardware.12541254+ *12551255+ * Note that our guest-to-host blits and host-to-guest blits aren't12561256+ * symmetric in their current implementation. While the parameters12571257+ * are identical, host-to-guest blits are a lot less featureful.12581258+ * They do not support clipping: If the source parameters don't12591259+ * fully fit within a screen, the blit fails. They must originate12601260+ * from exactly one screen. Virtual coordinates are not directly12611261+ * supported.12621262+ *12631263+ * Host-to-guest blits do support the same set of GMRFB formats12641264+ * offered by guest-to-host blits.12651265+ *12661266+ * The SVGA device is guaranteed to finish writing to the GMRFB by12671267+ * the time any subsequent FENCE commands are reached.12681268+ *12691269+ * Availability:12701270+ * SVGA_FIFO_CAP_SCREEN_OBJECT12711271+ */12721272+12731273+typedef12741274+struct {12751275+ SVGASignedPoint destOrigin;12761276+ SVGASignedRect srcRect;12771277+ uint32 srcScreenId;12781278+} SVGAFifoCmdBlitScreenToGMRFB;12791279+12801280+12811281+/*12821282+ * SVGA_CMD_ANNOTATION_FILL --12831283+ *12841284+ * This is a blit annotation. This command stores a small piece of12851285+ * device state which is consumed by the next blit-to-screen12861286+ * command. The state is only cleared by commands which are12871287+ * specifically documented as consuming an annotation. Other12881288+ * commands (such as ESCAPEs for debugging) may intervene between12891289+ * the annotation and its associated blit.12901290+ *12911291+ * This annotation is a promise about the contents of the next12921292+ * blit: The video driver is guaranteeing that all pixels in that12931293+ * blit will have the same value, specified here as a color in12941294+ * SVGAColorBGRX format.12951295+ *12961296+ * The SVGA device can still render the blit correctly even if it12971297+ * ignores this annotation, but the annotation may allow it to12981298+ * perform the blit more efficiently, for example by ignoring the12991299+ * source data and performing a fill in hardware.13001300+ *13011301+ * This annotation is most important for performance when the13021302+ * user's display is being remoted over a network connection.13031303+ *13041304+ * Availability:13051305+ * SVGA_FIFO_CAP_SCREEN_OBJECT13061306+ */13071307+13081308+typedef13091309+struct {13101310+ SVGAColorBGRX color;13111311+} SVGAFifoCmdAnnotationFill;13121312+13131313+13141314+/*13151315+ * SVGA_CMD_ANNOTATION_COPY --13161316+ *13171317+ * This is a blit annotation. See SVGA_CMD_ANNOTATION_FILL for more13181318+ * information about annotations.13191319+ *13201320+ * This annotation is a promise about the contents of the next13211321+ * blit: The video driver is guaranteeing that all pixels in that13221322+ * blit will have the same value as those which already exist at an13231323+ * identically-sized region on the same or a different screen.13241324+ *13251325+ * Note that the source pixels for the COPY in this annotation are13261326+ * sampled before applying the anqnotation's associated blit. They13271327+ * are allowed to overlap with the blit's destination pixels.13281328+ *13291329+ * The copy source rectangle is specified the same way as the blit13301330+ * destination: it can be a rectangle which spans zero or more13311331+ * screens, specified relative to either a screen or to the virtual13321332+ * coordinate system's origin. If the source rectangle includes13331333+ * pixels which are not from exactly one screen, the results are13341334+ * undefined.13351335+ *13361336+ * Availability:13371337+ * SVGA_FIFO_CAP_SCREEN_OBJECT13381338+ */13391339+13401340+typedef13411341+struct {13421342+ SVGASignedPoint srcOrigin;13431343+ uint32 srcScreenId;13441344+} SVGAFifoCmdAnnotationCopy;13451345+13461346+#endif