1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * 3*4882a593Smuzhiyun * Copyright (C) 2000 Keith Packard 4*4882a593Smuzhiyun * 2004 Eric Anholt 5*4882a593Smuzhiyun * 2005 Zack Rusin 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its 8*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that 9*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that 10*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting 11*4882a593Smuzhiyun * documentation, and that the name of copyright holders not be used in 12*4882a593Smuzhiyun * advertising or publicity pertaining to distribution of the software without 13*4882a593Smuzhiyun * specific, written prior permission. Copyright holders make no 14*4882a593Smuzhiyun * representations about the suitability of this software for any purpose. It 15*4882a593Smuzhiyun * is provided "as is" without express or implied warranty. 16*4882a593Smuzhiyun * 17*4882a593Smuzhiyun * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 18*4882a593Smuzhiyun * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 19*4882a593Smuzhiyun * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY 20*4882a593Smuzhiyun * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 21*4882a593Smuzhiyun * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 22*4882a593Smuzhiyun * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 23*4882a593Smuzhiyun * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 24*4882a593Smuzhiyun * SOFTWARE. 25*4882a593Smuzhiyun */ 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun /** @file 28*4882a593Smuzhiyun * This is the header containing the public API of EXA for exa drivers. 29*4882a593Smuzhiyun */ 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #ifndef EXA_H 32*4882a593Smuzhiyun #define EXA_H 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun #include "scrnintstr.h" 35*4882a593Smuzhiyun #include "pixmapstr.h" 36*4882a593Smuzhiyun #include "windowstr.h" 37*4882a593Smuzhiyun #include "gcstruct.h" 38*4882a593Smuzhiyun #include "picturestr.h" 39*4882a593Smuzhiyun #include "fb.h" 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun #define EXA_VERSION_MAJOR 2 42*4882a593Smuzhiyun #define EXA_VERSION_MINOR 6 43*4882a593Smuzhiyun #define EXA_VERSION_RELEASE 0 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun typedef struct _ExaOffscreenArea ExaOffscreenArea; 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun typedef void (*ExaOffscreenSaveProc) (ScreenPtr pScreen, 48*4882a593Smuzhiyun ExaOffscreenArea * area); 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun typedef enum _ExaOffscreenState { 51*4882a593Smuzhiyun ExaOffscreenAvail, 52*4882a593Smuzhiyun ExaOffscreenRemovable, 53*4882a593Smuzhiyun ExaOffscreenLocked 54*4882a593Smuzhiyun } ExaOffscreenState; 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun struct _ExaOffscreenArea { 57*4882a593Smuzhiyun int base_offset; /* allocation base */ 58*4882a593Smuzhiyun int offset; /* aligned offset */ 59*4882a593Smuzhiyun int size; /* total allocation size */ 60*4882a593Smuzhiyun unsigned last_use; 61*4882a593Smuzhiyun void *privData; 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun ExaOffscreenSaveProc save; 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun ExaOffscreenState state; 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun ExaOffscreenArea *next; 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun unsigned eviction_cost; 70*4882a593Smuzhiyun 71*4882a593Smuzhiyun ExaOffscreenArea *prev; /* Double-linked list for defragmentation */ 72*4882a593Smuzhiyun int align; /* required alignment */ 73*4882a593Smuzhiyun }; 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun /** 76*4882a593Smuzhiyun * The ExaDriver structure is allocated through exaDriverAlloc(), and then 77*4882a593Smuzhiyun * fllled in by drivers. 78*4882a593Smuzhiyun */ 79*4882a593Smuzhiyun typedef struct _ExaDriver { 80*4882a593Smuzhiyun /** 81*4882a593Smuzhiyun * exa_major and exa_minor should be set by the driver to the version of 82*4882a593Smuzhiyun * EXA which the driver was compiled for (or configures itself at runtime 83*4882a593Smuzhiyun * to support). This allows EXA to extend the structure for new features 84*4882a593Smuzhiyun * without breaking ABI for drivers compiled against older versions. 85*4882a593Smuzhiyun */ 86*4882a593Smuzhiyun int exa_major, exa_minor; 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun /** 89*4882a593Smuzhiyun * memoryBase is the address of the beginning of framebuffer memory. 90*4882a593Smuzhiyun * The visible screen should be within memoryBase to memoryBase + 91*4882a593Smuzhiyun * memorySize. 92*4882a593Smuzhiyun */ 93*4882a593Smuzhiyun CARD8 *memoryBase; 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun /** 96*4882a593Smuzhiyun * offScreenBase is the offset from memoryBase of the beginning of the area 97*4882a593Smuzhiyun * to be managed by EXA's linear offscreen memory manager. 98*4882a593Smuzhiyun * 99*4882a593Smuzhiyun * In XFree86 DDX drivers, this is probably: 100*4882a593Smuzhiyun * (pScrn->displayWidth * cpp * pScrn->virtualY) 101*4882a593Smuzhiyun */ 102*4882a593Smuzhiyun unsigned long offScreenBase; 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun /** 105*4882a593Smuzhiyun * memorySize is the length (in bytes) of framebuffer memory beginning 106*4882a593Smuzhiyun * from memoryBase. 107*4882a593Smuzhiyun * 108*4882a593Smuzhiyun * The offscreen memory manager will manage the area beginning at 109*4882a593Smuzhiyun * (memoryBase + offScreenBase), with a length of (memorySize - 110*4882a593Smuzhiyun * offScreenBase) 111*4882a593Smuzhiyun * 112*4882a593Smuzhiyun * In XFree86 DDX drivers, this is probably (pScrn->videoRam * 1024) 113*4882a593Smuzhiyun */ 114*4882a593Smuzhiyun unsigned long memorySize; 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun /** 117*4882a593Smuzhiyun * pixmapOffsetAlign is the byte alignment necessary for pixmap offsets 118*4882a593Smuzhiyun * within framebuffer. 119*4882a593Smuzhiyun * 120*4882a593Smuzhiyun * Hardware typically has a required alignment of offsets, which may or may 121*4882a593Smuzhiyun * not be a power of two. EXA will ensure that pixmaps managed by the 122*4882a593Smuzhiyun * offscreen memory manager meet this alignment requirement. 123*4882a593Smuzhiyun */ 124*4882a593Smuzhiyun int pixmapOffsetAlign; 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun /** 127*4882a593Smuzhiyun * pixmapPitchAlign is the byte alignment necessary for pixmap pitches 128*4882a593Smuzhiyun * within the framebuffer. 129*4882a593Smuzhiyun * 130*4882a593Smuzhiyun * Hardware typically has a required alignment of pitches for acceleration. 131*4882a593Smuzhiyun * For 3D hardware, Composite acceleration often requires that source and 132*4882a593Smuzhiyun * mask pixmaps (textures) have a power-of-two pitch, which can be demanded 133*4882a593Smuzhiyun * using EXA_OFFSCREEN_ALIGN_POT. These pitch requirements only apply to 134*4882a593Smuzhiyun * pixmaps managed by the offscreen memory manager. Thus, it is up to the 135*4882a593Smuzhiyun * driver to ensure that the visible screen has an appropriate pitch for 136*4882a593Smuzhiyun * acceleration. 137*4882a593Smuzhiyun */ 138*4882a593Smuzhiyun int pixmapPitchAlign; 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun /** 141*4882a593Smuzhiyun * The flags field is bitfield of boolean values controlling EXA's behavior. 142*4882a593Smuzhiyun * 143*4882a593Smuzhiyun * The flags in clude EXA_OFFSCREEN_PIXMAPS, EXA_OFFSCREEN_ALIGN_POT, and 144*4882a593Smuzhiyun * EXA_TWO_BITBLT_DIRECTIONS. 145*4882a593Smuzhiyun */ 146*4882a593Smuzhiyun int flags; 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun /** @{ */ 149*4882a593Smuzhiyun /** 150*4882a593Smuzhiyun * maxX controls the X coordinate limitation for rendering from the card. 151*4882a593Smuzhiyun * The driver should never receive a request for rendering beyond maxX 152*4882a593Smuzhiyun * in the X direction from the origin of a pixmap. 153*4882a593Smuzhiyun */ 154*4882a593Smuzhiyun int maxX; 155*4882a593Smuzhiyun 156*4882a593Smuzhiyun /** 157*4882a593Smuzhiyun * maxY controls the Y coordinate limitation for rendering from the card. 158*4882a593Smuzhiyun * The driver should never receive a request for rendering beyond maxY 159*4882a593Smuzhiyun * in the Y direction from the origin of a pixmap. 160*4882a593Smuzhiyun */ 161*4882a593Smuzhiyun int maxY; 162*4882a593Smuzhiyun /** @} */ 163*4882a593Smuzhiyun 164*4882a593Smuzhiyun /* private */ 165*4882a593Smuzhiyun ExaOffscreenArea *offScreenAreas; 166*4882a593Smuzhiyun Bool needsSync; 167*4882a593Smuzhiyun int lastMarker; 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun /** @name Solid 170*4882a593Smuzhiyun * @{ 171*4882a593Smuzhiyun */ 172*4882a593Smuzhiyun /** 173*4882a593Smuzhiyun * PrepareSolid() sets up the driver for doing a solid fill. 174*4882a593Smuzhiyun * @param pPixmap Destination pixmap 175*4882a593Smuzhiyun * @param alu raster operation 176*4882a593Smuzhiyun * @param planemask write mask for the fill 177*4882a593Smuzhiyun * @param fg "foreground" color for the fill 178*4882a593Smuzhiyun * 179*4882a593Smuzhiyun * This call should set up the driver for doing a series of solid fills 180*4882a593Smuzhiyun * through the Solid() call. The alu raster op is one of the GX* 181*4882a593Smuzhiyun * graphics functions listed in X.h, and typically maps to a similar 182*4882a593Smuzhiyun * single-byte "ROP" setting in all hardware. The planemask controls 183*4882a593Smuzhiyun * which bits of the destination should be affected, and will only represent 184*4882a593Smuzhiyun * the bits up to the depth of pPixmap. The fg is the pixel value of the 185*4882a593Smuzhiyun * foreground color referred to in ROP descriptions. 186*4882a593Smuzhiyun * 187*4882a593Smuzhiyun * Note that many drivers will need to store some of the data in the driver 188*4882a593Smuzhiyun * private record, for sending to the hardware with each drawing command. 189*4882a593Smuzhiyun * 190*4882a593Smuzhiyun * The PrepareSolid() call is required of all drivers, but it may fail for any 191*4882a593Smuzhiyun * reason. Failure results in a fallback to software rendering. 192*4882a593Smuzhiyun */ 193*4882a593Smuzhiyun Bool (*PrepareSolid) (PixmapPtr pPixmap, 194*4882a593Smuzhiyun int alu, Pixel planemask, Pixel fg); 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun /** 197*4882a593Smuzhiyun * Solid() performs a solid fill set up in the last PrepareSolid() call. 198*4882a593Smuzhiyun * 199*4882a593Smuzhiyun * @param pPixmap destination pixmap 200*4882a593Smuzhiyun * @param x1 left coordinate 201*4882a593Smuzhiyun * @param y1 top coordinate 202*4882a593Smuzhiyun * @param x2 right coordinate 203*4882a593Smuzhiyun * @param y2 bottom coordinate 204*4882a593Smuzhiyun * 205*4882a593Smuzhiyun * Performs the fill set up by the last PrepareSolid() call, covering the 206*4882a593Smuzhiyun * area from (x1,y1) to (x2,y2) in pPixmap. Note that the coordinates are 207*4882a593Smuzhiyun * in the coordinate space of the destination pixmap, so the driver will 208*4882a593Smuzhiyun * need to set up the hardware's offset and pitch for the destination 209*4882a593Smuzhiyun * coordinates according to the pixmap's offset and pitch within 210*4882a593Smuzhiyun * framebuffer. This likely means using exaGetPixmapOffset() and 211*4882a593Smuzhiyun * exaGetPixmapPitch(). 212*4882a593Smuzhiyun * 213*4882a593Smuzhiyun * This call is required if PrepareSolid() ever succeeds. 214*4882a593Smuzhiyun */ 215*4882a593Smuzhiyun void (*Solid) (PixmapPtr pPixmap, int x1, int y1, int x2, int y2); 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun /** 218*4882a593Smuzhiyun * DoneSolid() finishes a set of solid fills. 219*4882a593Smuzhiyun * 220*4882a593Smuzhiyun * @param pPixmap destination pixmap. 221*4882a593Smuzhiyun * 222*4882a593Smuzhiyun * The DoneSolid() call is called at the end of a series of consecutive 223*4882a593Smuzhiyun * Solid() calls following a successful PrepareSolid(). This allows drivers 224*4882a593Smuzhiyun * to finish up emitting drawing commands that were buffered, or clean up 225*4882a593Smuzhiyun * state from PrepareSolid(). 226*4882a593Smuzhiyun * 227*4882a593Smuzhiyun * This call is required if PrepareSolid() ever succeeds. 228*4882a593Smuzhiyun */ 229*4882a593Smuzhiyun void (*DoneSolid) (PixmapPtr pPixmap); 230*4882a593Smuzhiyun /** @} */ 231*4882a593Smuzhiyun 232*4882a593Smuzhiyun /** @name Copy 233*4882a593Smuzhiyun * @{ 234*4882a593Smuzhiyun */ 235*4882a593Smuzhiyun /** 236*4882a593Smuzhiyun * PrepareCopy() sets up the driver for doing a copy within video 237*4882a593Smuzhiyun * memory. 238*4882a593Smuzhiyun * 239*4882a593Smuzhiyun * @param pSrcPixmap source pixmap 240*4882a593Smuzhiyun * @param pDstPixmap destination pixmap 241*4882a593Smuzhiyun * @param dx X copy direction 242*4882a593Smuzhiyun * @param dy Y copy direction 243*4882a593Smuzhiyun * @param alu raster operation 244*4882a593Smuzhiyun * @param planemask write mask for the fill 245*4882a593Smuzhiyun * 246*4882a593Smuzhiyun * This call should set up the driver for doing a series of copies from the 247*4882a593Smuzhiyun * the pSrcPixmap to the pDstPixmap. The dx flag will be positive if the 248*4882a593Smuzhiyun * hardware should do the copy from the left to the right, and dy will be 249*4882a593Smuzhiyun * positive if the copy should be done from the top to the bottom. This 250*4882a593Smuzhiyun * is to deal with self-overlapping copies when pSrcPixmap == pDstPixmap. 251*4882a593Smuzhiyun * If your hardware can only support blits that are (left to right, top to 252*4882a593Smuzhiyun * bottom) or (right to left, bottom to top), then you should set 253*4882a593Smuzhiyun * #EXA_TWO_BITBLT_DIRECTIONS, and EXA will break down Copy operations to 254*4882a593Smuzhiyun * ones that meet those requirements. The alu raster op is one of the GX* 255*4882a593Smuzhiyun * graphics functions listed in X.h, and typically maps to a similar 256*4882a593Smuzhiyun * single-byte "ROP" setting in all hardware. The planemask controls which 257*4882a593Smuzhiyun * bits of the destination should be affected, and will only represent the 258*4882a593Smuzhiyun * bits up to the depth of pPixmap. 259*4882a593Smuzhiyun * 260*4882a593Smuzhiyun * Note that many drivers will need to store some of the data in the driver 261*4882a593Smuzhiyun * private record, for sending to the hardware with each drawing command. 262*4882a593Smuzhiyun * 263*4882a593Smuzhiyun * The PrepareCopy() call is required of all drivers, but it may fail for any 264*4882a593Smuzhiyun * reason. Failure results in a fallback to software rendering. 265*4882a593Smuzhiyun */ 266*4882a593Smuzhiyun Bool (*PrepareCopy) (PixmapPtr pSrcPixmap, 267*4882a593Smuzhiyun PixmapPtr pDstPixmap, 268*4882a593Smuzhiyun int dx, int dy, int alu, Pixel planemask); 269*4882a593Smuzhiyun 270*4882a593Smuzhiyun /** 271*4882a593Smuzhiyun * Copy() performs a copy set up in the last PrepareCopy call. 272*4882a593Smuzhiyun * 273*4882a593Smuzhiyun * @param pDstPixmap destination pixmap 274*4882a593Smuzhiyun * @param srcX source X coordinate 275*4882a593Smuzhiyun * @param srcY source Y coordinate 276*4882a593Smuzhiyun * @param dstX destination X coordinate 277*4882a593Smuzhiyun * @param dstY destination Y coordinate 278*4882a593Smuzhiyun * @param width width of the rectangle to be copied 279*4882a593Smuzhiyun * @param height height of the rectangle to be copied. 280*4882a593Smuzhiyun * 281*4882a593Smuzhiyun * Performs the copy set up by the last PrepareCopy() call, copying the 282*4882a593Smuzhiyun * rectangle from (srcX, srcY) to (srcX + width, srcY + width) in the source 283*4882a593Smuzhiyun * pixmap to the same-sized rectangle at (dstX, dstY) in the destination 284*4882a593Smuzhiyun * pixmap. Those rectangles may overlap in memory, if 285*4882a593Smuzhiyun * pSrcPixmap == pDstPixmap. Note that this call does not receive the 286*4882a593Smuzhiyun * pSrcPixmap as an argument -- if it's needed in this function, it should 287*4882a593Smuzhiyun * be stored in the driver private during PrepareCopy(). As with Solid(), 288*4882a593Smuzhiyun * the coordinates are in the coordinate space of each pixmap, so the driver 289*4882a593Smuzhiyun * will need to set up source and destination pitches and offsets from those 290*4882a593Smuzhiyun * pixmaps, probably using exaGetPixmapOffset() and exaGetPixmapPitch(). 291*4882a593Smuzhiyun * 292*4882a593Smuzhiyun * This call is required if PrepareCopy ever succeeds. 293*4882a593Smuzhiyun */ 294*4882a593Smuzhiyun void (*Copy) (PixmapPtr pDstPixmap, 295*4882a593Smuzhiyun int srcX, 296*4882a593Smuzhiyun int srcY, int dstX, int dstY, int width, int height); 297*4882a593Smuzhiyun 298*4882a593Smuzhiyun /** 299*4882a593Smuzhiyun * DoneCopy() finishes a set of copies. 300*4882a593Smuzhiyun * 301*4882a593Smuzhiyun * @param pPixmap destination pixmap. 302*4882a593Smuzhiyun * 303*4882a593Smuzhiyun * The DoneCopy() call is called at the end of a series of consecutive 304*4882a593Smuzhiyun * Copy() calls following a successful PrepareCopy(). This allows drivers 305*4882a593Smuzhiyun * to finish up emitting drawing commands that were buffered, or clean up 306*4882a593Smuzhiyun * state from PrepareCopy(). 307*4882a593Smuzhiyun * 308*4882a593Smuzhiyun * This call is required if PrepareCopy() ever succeeds. 309*4882a593Smuzhiyun */ 310*4882a593Smuzhiyun void (*DoneCopy) (PixmapPtr pDstPixmap); 311*4882a593Smuzhiyun /** @} */ 312*4882a593Smuzhiyun 313*4882a593Smuzhiyun /** @name Composite 314*4882a593Smuzhiyun * @{ 315*4882a593Smuzhiyun */ 316*4882a593Smuzhiyun /** 317*4882a593Smuzhiyun * CheckComposite() checks to see if a composite operation could be 318*4882a593Smuzhiyun * accelerated. 319*4882a593Smuzhiyun * 320*4882a593Smuzhiyun * @param op Render operation 321*4882a593Smuzhiyun * @param pSrcPicture source Picture 322*4882a593Smuzhiyun * @param pMaskPicture mask picture 323*4882a593Smuzhiyun * @param pDstPicture destination Picture 324*4882a593Smuzhiyun * 325*4882a593Smuzhiyun * The CheckComposite() call checks if the driver could handle acceleration 326*4882a593Smuzhiyun * of op with the given source, mask, and destination pictures. This allows 327*4882a593Smuzhiyun * drivers to check source and destination formats, supported operations, 328*4882a593Smuzhiyun * transformations, and component alpha state, and send operations it can't 329*4882a593Smuzhiyun * support to software rendering early on. This avoids costly pixmap 330*4882a593Smuzhiyun * migration to the wrong places when the driver can't accelerate 331*4882a593Smuzhiyun * operations. Note that because migration hasn't happened, the driver 332*4882a593Smuzhiyun * can't know during CheckComposite() what the offsets and pitches of the 333*4882a593Smuzhiyun * pixmaps are going to be. 334*4882a593Smuzhiyun * 335*4882a593Smuzhiyun * See PrepareComposite() for more details on likely issues that drivers 336*4882a593Smuzhiyun * will have in accelerating Composite operations. 337*4882a593Smuzhiyun * 338*4882a593Smuzhiyun * The CheckComposite() call is recommended if PrepareComposite() is 339*4882a593Smuzhiyun * implemented, but is not required. 340*4882a593Smuzhiyun */ 341*4882a593Smuzhiyun Bool (*CheckComposite) (int op, 342*4882a593Smuzhiyun PicturePtr pSrcPicture, 343*4882a593Smuzhiyun PicturePtr pMaskPicture, PicturePtr pDstPicture); 344*4882a593Smuzhiyun 345*4882a593Smuzhiyun /** 346*4882a593Smuzhiyun * PrepareComposite() sets up the driver for doing a Composite operation 347*4882a593Smuzhiyun * described in the Render extension protocol spec. 348*4882a593Smuzhiyun * 349*4882a593Smuzhiyun * @param op Render operation 350*4882a593Smuzhiyun * @param pSrcPicture source Picture 351*4882a593Smuzhiyun * @param pMaskPicture mask picture 352*4882a593Smuzhiyun * @param pDstPicture destination Picture 353*4882a593Smuzhiyun * @param pSrc source pixmap 354*4882a593Smuzhiyun * @param pMask mask pixmap 355*4882a593Smuzhiyun * @param pDst destination pixmap 356*4882a593Smuzhiyun * 357*4882a593Smuzhiyun * This call should set up the driver for doing a series of Composite 358*4882a593Smuzhiyun * operations, as described in the Render protocol spec, with the given 359*4882a593Smuzhiyun * pSrcPicture, pMaskPicture, and pDstPicture. The pSrc, pMask, and 360*4882a593Smuzhiyun * pDst are the pixmaps containing the pixel data, and should be used for 361*4882a593Smuzhiyun * setting the offset and pitch used for the coordinate spaces for each of 362*4882a593Smuzhiyun * the Pictures. 363*4882a593Smuzhiyun * 364*4882a593Smuzhiyun * Notes on interpreting Picture structures: 365*4882a593Smuzhiyun * - The Picture structures will always have a valid pDrawable. 366*4882a593Smuzhiyun * - The Picture structures will never have alphaMap set. 367*4882a593Smuzhiyun * - The mask Picture (and therefore pMask) may be NULL, in which case the 368*4882a593Smuzhiyun * operation is simply src OP dst instead of src IN mask OP dst, and 369*4882a593Smuzhiyun * mask coordinates should be ignored. 370*4882a593Smuzhiyun * - pMarkPicture may have componentAlpha set, which greatly changes 371*4882a593Smuzhiyun * the behavior of the Composite operation. componentAlpha has no effect 372*4882a593Smuzhiyun * when set on pSrcPicture or pDstPicture. 373*4882a593Smuzhiyun * - The source and mask Pictures may have a transformation set 374*4882a593Smuzhiyun * (Picture->transform != NULL), which means that the source coordinates 375*4882a593Smuzhiyun * should be transformed by that transformation, resulting in scaling, 376*4882a593Smuzhiyun * rotation, etc. The PictureTransformPoint() call can transform 377*4882a593Smuzhiyun * coordinates for you. Transforms have no effect on Pictures when used 378*4882a593Smuzhiyun * as a destination. 379*4882a593Smuzhiyun * - The source and mask pictures may have a filter set. PictFilterNearest 380*4882a593Smuzhiyun * and PictFilterBilinear are defined in the Render protocol, but others 381*4882a593Smuzhiyun * may be encountered, and must be handled correctly (usually by 382*4882a593Smuzhiyun * PrepareComposite failing, and falling back to software). Filters have 383*4882a593Smuzhiyun * no effect on Pictures when used as a destination. 384*4882a593Smuzhiyun * - The source and mask Pictures may have repeating set, which must be 385*4882a593Smuzhiyun * respected. Many chipsets will be unable to support repeating on 386*4882a593Smuzhiyun * pixmaps that have a width or height that is not a power of two. 387*4882a593Smuzhiyun * 388*4882a593Smuzhiyun * If your hardware can't support source pictures (textures) with 389*4882a593Smuzhiyun * non-power-of-two pitches, you should set #EXA_OFFSCREEN_ALIGN_POT. 390*4882a593Smuzhiyun * 391*4882a593Smuzhiyun * Note that many drivers will need to store some of the data in the driver 392*4882a593Smuzhiyun * private record, for sending to the hardware with each drawing command. 393*4882a593Smuzhiyun * 394*4882a593Smuzhiyun * The PrepareComposite() call is not required. However, it is highly 395*4882a593Smuzhiyun * recommended for performance of antialiased font rendering and performance 396*4882a593Smuzhiyun * of cairo applications. Failure results in a fallback to software 397*4882a593Smuzhiyun * rendering. 398*4882a593Smuzhiyun */ 399*4882a593Smuzhiyun Bool (*PrepareComposite) (int op, 400*4882a593Smuzhiyun PicturePtr pSrcPicture, 401*4882a593Smuzhiyun PicturePtr pMaskPicture, 402*4882a593Smuzhiyun PicturePtr pDstPicture, 403*4882a593Smuzhiyun PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst); 404*4882a593Smuzhiyun 405*4882a593Smuzhiyun /** 406*4882a593Smuzhiyun * Composite() performs a Composite operation set up in the last 407*4882a593Smuzhiyun * PrepareComposite() call. 408*4882a593Smuzhiyun * 409*4882a593Smuzhiyun * @param pDstPixmap destination pixmap 410*4882a593Smuzhiyun * @param srcX source X coordinate 411*4882a593Smuzhiyun * @param srcY source Y coordinate 412*4882a593Smuzhiyun * @param maskX source X coordinate 413*4882a593Smuzhiyun * @param maskY source Y coordinate 414*4882a593Smuzhiyun * @param dstX destination X coordinate 415*4882a593Smuzhiyun * @param dstY destination Y coordinate 416*4882a593Smuzhiyun * @param width destination rectangle width 417*4882a593Smuzhiyun * @param height destination rectangle height 418*4882a593Smuzhiyun * 419*4882a593Smuzhiyun * Performs the Composite operation set up by the last PrepareComposite() 420*4882a593Smuzhiyun * call, to the rectangle from (dstX, dstY) to (dstX + width, dstY + height) 421*4882a593Smuzhiyun * in the destination Pixmap. Note that if a transformation was set on 422*4882a593Smuzhiyun * the source or mask Pictures, the source rectangles may not be the same 423*4882a593Smuzhiyun * size as the destination rectangles and filtering. Getting the coordinate 424*4882a593Smuzhiyun * transformation right at the subpixel level can be tricky, and rendercheck 425*4882a593Smuzhiyun * can test this for you. 426*4882a593Smuzhiyun * 427*4882a593Smuzhiyun * This call is required if PrepareComposite() ever succeeds. 428*4882a593Smuzhiyun */ 429*4882a593Smuzhiyun void (*Composite) (PixmapPtr pDst, 430*4882a593Smuzhiyun int srcX, 431*4882a593Smuzhiyun int srcY, 432*4882a593Smuzhiyun int maskX, 433*4882a593Smuzhiyun int maskY, int dstX, int dstY, int width, int height); 434*4882a593Smuzhiyun 435*4882a593Smuzhiyun /** 436*4882a593Smuzhiyun * DoneComposite() finishes a set of Composite operations. 437*4882a593Smuzhiyun * 438*4882a593Smuzhiyun * @param pPixmap destination pixmap. 439*4882a593Smuzhiyun * 440*4882a593Smuzhiyun * The DoneComposite() call is called at the end of a series of consecutive 441*4882a593Smuzhiyun * Composite() calls following a successful PrepareComposite(). This allows 442*4882a593Smuzhiyun * drivers to finish up emitting drawing commands that were buffered, or 443*4882a593Smuzhiyun * clean up state from PrepareComposite(). 444*4882a593Smuzhiyun * 445*4882a593Smuzhiyun * This call is required if PrepareComposite() ever succeeds. 446*4882a593Smuzhiyun */ 447*4882a593Smuzhiyun void (*DoneComposite) (PixmapPtr pDst); 448*4882a593Smuzhiyun /** @} */ 449*4882a593Smuzhiyun 450*4882a593Smuzhiyun /** 451*4882a593Smuzhiyun * UploadToScreen() loads a rectangle of data from src into pDst. 452*4882a593Smuzhiyun * 453*4882a593Smuzhiyun * @param pDst destination pixmap 454*4882a593Smuzhiyun * @param x destination X coordinate. 455*4882a593Smuzhiyun * @param y destination Y coordinate 456*4882a593Smuzhiyun * @param width width of the rectangle to be copied 457*4882a593Smuzhiyun * @param height height of the rectangle to be copied 458*4882a593Smuzhiyun * @param src pointer to the beginning of the source data 459*4882a593Smuzhiyun * @param src_pitch pitch (in bytes) of the lines of source data. 460*4882a593Smuzhiyun * 461*4882a593Smuzhiyun * UploadToScreen() copies data in system memory beginning at src (with 462*4882a593Smuzhiyun * pitch src_pitch) into the destination pixmap from (x, y) to 463*4882a593Smuzhiyun * (x + width, y + height). This is typically done with hostdata uploads, 464*4882a593Smuzhiyun * where the CPU sets up a blit command on the hardware with instructions 465*4882a593Smuzhiyun * that the blit data will be fed through some sort of aperture on the card. 466*4882a593Smuzhiyun * 467*4882a593Smuzhiyun * If UploadToScreen() is performed asynchronously, it is up to the driver 468*4882a593Smuzhiyun * to call exaMarkSync(). This is in contrast to most other acceleration 469*4882a593Smuzhiyun * calls in EXA. 470*4882a593Smuzhiyun * 471*4882a593Smuzhiyun * UploadToScreen() can aid in pixmap migration, but is most important for 472*4882a593Smuzhiyun * the performance of exaGlyphs() (antialiased font drawing) by allowing 473*4882a593Smuzhiyun * pipelining of data uploads, avoiding a sync of the card after each glyph. 474*4882a593Smuzhiyun * 475*4882a593Smuzhiyun * @return TRUE if the driver successfully uploaded the data. FALSE 476*4882a593Smuzhiyun * indicates that EXA should fall back to doing the upload in software. 477*4882a593Smuzhiyun * 478*4882a593Smuzhiyun * UploadToScreen() is not required, but is recommended if Composite 479*4882a593Smuzhiyun * acceleration is supported. 480*4882a593Smuzhiyun */ 481*4882a593Smuzhiyun Bool (*UploadToScreen) (PixmapPtr pDst, 482*4882a593Smuzhiyun int x, 483*4882a593Smuzhiyun int y, int w, int h, char *src, int src_pitch); 484*4882a593Smuzhiyun 485*4882a593Smuzhiyun /** 486*4882a593Smuzhiyun * UploadToScratch() is no longer used and will be removed next time the EXA 487*4882a593Smuzhiyun * major version needs to be bumped. 488*4882a593Smuzhiyun */ 489*4882a593Smuzhiyun Bool (*UploadToScratch) (PixmapPtr pSrc, PixmapPtr pDst); 490*4882a593Smuzhiyun 491*4882a593Smuzhiyun /** 492*4882a593Smuzhiyun * DownloadFromScreen() loads a rectangle of data from pSrc into dst 493*4882a593Smuzhiyun * 494*4882a593Smuzhiyun * @param pSrc source pixmap 495*4882a593Smuzhiyun * @param x source X coordinate. 496*4882a593Smuzhiyun * @param y source Y coordinate 497*4882a593Smuzhiyun * @param width width of the rectangle to be copied 498*4882a593Smuzhiyun * @param height height of the rectangle to be copied 499*4882a593Smuzhiyun * @param dst pointer to the beginning of the destination data 500*4882a593Smuzhiyun * @param dst_pitch pitch (in bytes) of the lines of destination data. 501*4882a593Smuzhiyun * 502*4882a593Smuzhiyun * DownloadFromScreen() copies data from offscreen memory in pSrc from 503*4882a593Smuzhiyun * (x, y) to (x + width, y + height), to system memory starting at 504*4882a593Smuzhiyun * dst (with pitch dst_pitch). This would usually be done 505*4882a593Smuzhiyun * using scatter-gather DMA, supported by a DRM call, or by blitting to AGP 506*4882a593Smuzhiyun * and then synchronously reading from AGP. Because the implementation 507*4882a593Smuzhiyun * might be synchronous, EXA leaves it up to the driver to call 508*4882a593Smuzhiyun * exaMarkSync() if DownloadFromScreen() was asynchronous. This is in 509*4882a593Smuzhiyun * contrast to most other acceleration calls in EXA. 510*4882a593Smuzhiyun * 511*4882a593Smuzhiyun * DownloadFromScreen() can aid in the largest bottleneck in pixmap 512*4882a593Smuzhiyun * migration, which is the read from framebuffer when evicting pixmaps from 513*4882a593Smuzhiyun * framebuffer memory. Thus, it is highly recommended, even though 514*4882a593Smuzhiyun * implementations are typically complicated. 515*4882a593Smuzhiyun * 516*4882a593Smuzhiyun * @return TRUE if the driver successfully downloaded the data. FALSE 517*4882a593Smuzhiyun * indicates that EXA should fall back to doing the download in software. 518*4882a593Smuzhiyun * 519*4882a593Smuzhiyun * DownloadFromScreen() is not required, but is highly recommended. 520*4882a593Smuzhiyun */ 521*4882a593Smuzhiyun Bool (*DownloadFromScreen) (PixmapPtr pSrc, 522*4882a593Smuzhiyun int x, int y, 523*4882a593Smuzhiyun int w, int h, char *dst, int dst_pitch); 524*4882a593Smuzhiyun 525*4882a593Smuzhiyun /** 526*4882a593Smuzhiyun * MarkSync() requests that the driver mark a synchronization point, 527*4882a593Smuzhiyun * returning an driver-defined integer marker which could be requested for 528*4882a593Smuzhiyun * synchronization to later in WaitMarker(). This might be used in the 529*4882a593Smuzhiyun * future to avoid waiting for full hardware stalls before accessing pixmap 530*4882a593Smuzhiyun * data with the CPU, but is not important in the current incarnation of 531*4882a593Smuzhiyun * EXA. 532*4882a593Smuzhiyun * 533*4882a593Smuzhiyun * Note that drivers should call exaMarkSync() when they have done some 534*4882a593Smuzhiyun * acceleration, rather than their own MarkSync() handler, as otherwise EXA 535*4882a593Smuzhiyun * will be unaware of the driver's acceleration and not sync to it during 536*4882a593Smuzhiyun * fallbacks. 537*4882a593Smuzhiyun * 538*4882a593Smuzhiyun * MarkSync() is optional. 539*4882a593Smuzhiyun */ 540*4882a593Smuzhiyun int (*MarkSync) (ScreenPtr pScreen); 541*4882a593Smuzhiyun 542*4882a593Smuzhiyun /** 543*4882a593Smuzhiyun * WaitMarker() waits for all rendering before the given marker to have 544*4882a593Smuzhiyun * completed. If the driver does not implement MarkSync(), marker is 545*4882a593Smuzhiyun * meaningless, and all rendering by the hardware should be completed before 546*4882a593Smuzhiyun * WaitMarker() returns. 547*4882a593Smuzhiyun * 548*4882a593Smuzhiyun * Note that drivers should call exaWaitSync() to wait for all acceleration 549*4882a593Smuzhiyun * to finish, as otherwise EXA will be unaware of the driver having 550*4882a593Smuzhiyun * synchronized, resulting in excessive WaitMarker() calls. 551*4882a593Smuzhiyun * 552*4882a593Smuzhiyun * WaitMarker() is required of all drivers. 553*4882a593Smuzhiyun */ 554*4882a593Smuzhiyun void (*WaitMarker) (ScreenPtr pScreen, int marker); 555*4882a593Smuzhiyun 556*4882a593Smuzhiyun /** @{ */ 557*4882a593Smuzhiyun /** 558*4882a593Smuzhiyun * PrepareAccess() is called before CPU access to an offscreen pixmap. 559*4882a593Smuzhiyun * 560*4882a593Smuzhiyun * @param pPix the pixmap being accessed 561*4882a593Smuzhiyun * @param index the index of the pixmap being accessed. 562*4882a593Smuzhiyun * 563*4882a593Smuzhiyun * PrepareAccess() will be called before CPU access to an offscreen pixmap. 564*4882a593Smuzhiyun * This can be used to set up hardware surfaces for byteswapping or 565*4882a593Smuzhiyun * untiling, or to adjust the pixmap's devPrivate.ptr for the purpose of 566*4882a593Smuzhiyun * making CPU access use a different aperture. 567*4882a593Smuzhiyun * 568*4882a593Smuzhiyun * The index is one of #EXA_PREPARE_DEST, #EXA_PREPARE_SRC, 569*4882a593Smuzhiyun * #EXA_PREPARE_MASK, #EXA_PREPARE_AUX_DEST, #EXA_PREPARE_AUX_SRC, or 570*4882a593Smuzhiyun * #EXA_PREPARE_AUX_MASK. Since only up to #EXA_NUM_PREPARE_INDICES pixmaps 571*4882a593Smuzhiyun * will have PrepareAccess() called on them per operation, drivers can have 572*4882a593Smuzhiyun * a small, statically-allocated space to maintain state for PrepareAccess() 573*4882a593Smuzhiyun * and FinishAccess() in. Note that PrepareAccess() is only called once per 574*4882a593Smuzhiyun * pixmap and operation, regardless of whether the pixmap is used as a 575*4882a593Smuzhiyun * destination and/or source, and the index may not reflect the usage. 576*4882a593Smuzhiyun * 577*4882a593Smuzhiyun * PrepareAccess() may fail. An example might be the case of hardware that 578*4882a593Smuzhiyun * can set up 1 or 2 surfaces for CPU access, but not 3. If PrepareAccess() 579*4882a593Smuzhiyun * fails, EXA will migrate the pixmap to system memory. 580*4882a593Smuzhiyun * DownloadFromScreen() must be implemented and must not fail if a driver 581*4882a593Smuzhiyun * wishes to fail in PrepareAccess(). PrepareAccess() must not fail when 582*4882a593Smuzhiyun * pPix is the visible screen, because the visible screen can not be 583*4882a593Smuzhiyun * migrated. 584*4882a593Smuzhiyun * 585*4882a593Smuzhiyun * @return TRUE if PrepareAccess() successfully prepared the pixmap for CPU 586*4882a593Smuzhiyun * drawing. 587*4882a593Smuzhiyun * @return FALSE if PrepareAccess() is unsuccessful and EXA should use 588*4882a593Smuzhiyun * DownloadFromScreen() to migate the pixmap out. 589*4882a593Smuzhiyun */ 590*4882a593Smuzhiyun Bool (*PrepareAccess) (PixmapPtr pPix, int index); 591*4882a593Smuzhiyun 592*4882a593Smuzhiyun /** 593*4882a593Smuzhiyun * FinishAccess() is called after CPU access to an offscreen pixmap. 594*4882a593Smuzhiyun * 595*4882a593Smuzhiyun * @param pPix the pixmap being accessed 596*4882a593Smuzhiyun * @param index the index of the pixmap being accessed. 597*4882a593Smuzhiyun * 598*4882a593Smuzhiyun * FinishAccess() will be called after finishing CPU access of an offscreen 599*4882a593Smuzhiyun * pixmap set up by PrepareAccess(). Note that the FinishAccess() will not be 600*4882a593Smuzhiyun * called if PrepareAccess() failed and the pixmap was migrated out. 601*4882a593Smuzhiyun */ 602*4882a593Smuzhiyun void (*FinishAccess) (PixmapPtr pPix, int index); 603*4882a593Smuzhiyun 604*4882a593Smuzhiyun /** 605*4882a593Smuzhiyun * PixmapIsOffscreen() is an optional driver replacement to 606*4882a593Smuzhiyun * exaPixmapHasGpuCopy(). Set to NULL if you want the standard behaviour 607*4882a593Smuzhiyun * of exaPixmapHasGpuCopy(). 608*4882a593Smuzhiyun * 609*4882a593Smuzhiyun * @param pPix the pixmap 610*4882a593Smuzhiyun * @return TRUE if the given drawable is in framebuffer memory. 611*4882a593Smuzhiyun * 612*4882a593Smuzhiyun * exaPixmapHasGpuCopy() is used to determine if a pixmap is in offscreen 613*4882a593Smuzhiyun * memory, meaning that acceleration could probably be done to it, and that it 614*4882a593Smuzhiyun * will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it 615*4882a593Smuzhiyun * with the CPU. 616*4882a593Smuzhiyun * 617*4882a593Smuzhiyun * 618*4882a593Smuzhiyun */ 619*4882a593Smuzhiyun Bool (*PixmapIsOffscreen) (PixmapPtr pPix); 620*4882a593Smuzhiyun 621*4882a593Smuzhiyun /** @name PrepareAccess() and FinishAccess() indices 622*4882a593Smuzhiyun * @{ 623*4882a593Smuzhiyun */ 624*4882a593Smuzhiyun /** 625*4882a593Smuzhiyun * EXA_PREPARE_DEST is the index for a pixmap that may be drawn to or 626*4882a593Smuzhiyun * read from. 627*4882a593Smuzhiyun */ 628*4882a593Smuzhiyun #define EXA_PREPARE_DEST 0 629*4882a593Smuzhiyun /** 630*4882a593Smuzhiyun * EXA_PREPARE_SRC is the index for a pixmap that may be read from 631*4882a593Smuzhiyun */ 632*4882a593Smuzhiyun #define EXA_PREPARE_SRC 1 633*4882a593Smuzhiyun /** 634*4882a593Smuzhiyun * EXA_PREPARE_SRC is the index for a second pixmap that may be read 635*4882a593Smuzhiyun * from. 636*4882a593Smuzhiyun */ 637*4882a593Smuzhiyun #define EXA_PREPARE_MASK 2 638*4882a593Smuzhiyun /** 639*4882a593Smuzhiyun * EXA_PREPARE_AUX* are additional indices for other purposes, e.g. 640*4882a593Smuzhiyun * separate alpha maps with Composite operations. 641*4882a593Smuzhiyun */ 642*4882a593Smuzhiyun #define EXA_PREPARE_AUX_DEST 3 643*4882a593Smuzhiyun #define EXA_PREPARE_AUX_SRC 4 644*4882a593Smuzhiyun #define EXA_PREPARE_AUX_MASK 5 645*4882a593Smuzhiyun #define EXA_NUM_PREPARE_INDICES 6 646*4882a593Smuzhiyun /** @} */ 647*4882a593Smuzhiyun 648*4882a593Smuzhiyun /** 649*4882a593Smuzhiyun * maxPitchPixels controls the pitch limitation for rendering from 650*4882a593Smuzhiyun * the card. 651*4882a593Smuzhiyun * The driver should never receive a request for rendering a pixmap 652*4882a593Smuzhiyun * that has a pitch (in pixels) beyond maxPitchPixels. 653*4882a593Smuzhiyun * 654*4882a593Smuzhiyun * Setting this field is optional -- if your hardware doesn't have 655*4882a593Smuzhiyun * a pitch limitation in pixels, don't set this. If neither this value 656*4882a593Smuzhiyun * nor maxPitchBytes is set, then maxPitchPixels is set to maxX. 657*4882a593Smuzhiyun * If set, it must not be smaller than maxX. 658*4882a593Smuzhiyun * 659*4882a593Smuzhiyun * @sa maxPitchBytes 660*4882a593Smuzhiyun */ 661*4882a593Smuzhiyun int maxPitchPixels; 662*4882a593Smuzhiyun 663*4882a593Smuzhiyun /** 664*4882a593Smuzhiyun * maxPitchBytes controls the pitch limitation for rendering from 665*4882a593Smuzhiyun * the card. 666*4882a593Smuzhiyun * The driver should never receive a request for rendering a pixmap 667*4882a593Smuzhiyun * that has a pitch (in bytes) beyond maxPitchBytes. 668*4882a593Smuzhiyun * 669*4882a593Smuzhiyun * Setting this field is optional -- if your hardware doesn't have 670*4882a593Smuzhiyun * a pitch limitation in bytes, don't set this. 671*4882a593Smuzhiyun * If set, it must not be smaller than maxX * 4. 672*4882a593Smuzhiyun * There's no default value for maxPitchBytes. 673*4882a593Smuzhiyun * 674*4882a593Smuzhiyun * @sa maxPitchPixels 675*4882a593Smuzhiyun */ 676*4882a593Smuzhiyun int maxPitchBytes; 677*4882a593Smuzhiyun 678*4882a593Smuzhiyun /* Hooks to allow driver to its own pixmap memory management */ 679*4882a593Smuzhiyun void *(*CreatePixmap) (ScreenPtr pScreen, int size, int align); 680*4882a593Smuzhiyun void (*DestroyPixmap) (ScreenPtr pScreen, void *driverPriv); 681*4882a593Smuzhiyun /** 682*4882a593Smuzhiyun * Returning a pixmap with non-NULL devPrivate.ptr implies a pixmap which is 683*4882a593Smuzhiyun * not offscreen, which will never be accelerated and Prepare/FinishAccess won't 684*4882a593Smuzhiyun * be called. 685*4882a593Smuzhiyun */ 686*4882a593Smuzhiyun Bool (*ModifyPixmapHeader) (PixmapPtr pPixmap, int width, int height, 687*4882a593Smuzhiyun int depth, int bitsPerPixel, int devKind, 688*4882a593Smuzhiyun void *pPixData); 689*4882a593Smuzhiyun 690*4882a593Smuzhiyun /* hooks for drivers with tiling support: 691*4882a593Smuzhiyun * driver MUST fill out new_fb_pitch with valid pitch of pixmap 692*4882a593Smuzhiyun */ 693*4882a593Smuzhiyun void *(*CreatePixmap2) (ScreenPtr pScreen, int width, int height, 694*4882a593Smuzhiyun int depth, int usage_hint, int bitsPerPixel, 695*4882a593Smuzhiyun int *new_fb_pitch); 696*4882a593Smuzhiyun /** @} */ 697*4882a593Smuzhiyun Bool (*SharePixmapBacking)(PixmapPtr pPixmap, ScreenPtr slave, void **handle_p); 698*4882a593Smuzhiyun 699*4882a593Smuzhiyun Bool (*SetSharedPixmapBacking)(PixmapPtr pPixmap, void *handle); 700*4882a593Smuzhiyun 701*4882a593Smuzhiyun } ExaDriverRec, *ExaDriverPtr; 702*4882a593Smuzhiyun 703*4882a593Smuzhiyun /** @name EXA driver flags 704*4882a593Smuzhiyun * @{ 705*4882a593Smuzhiyun */ 706*4882a593Smuzhiyun /** 707*4882a593Smuzhiyun * EXA_OFFSCREEN_PIXMAPS indicates to EXA that the driver can support 708*4882a593Smuzhiyun * offscreen pixmaps. 709*4882a593Smuzhiyun */ 710*4882a593Smuzhiyun #define EXA_OFFSCREEN_PIXMAPS (1 << 0) 711*4882a593Smuzhiyun 712*4882a593Smuzhiyun /** 713*4882a593Smuzhiyun * EXA_OFFSCREEN_ALIGN_POT indicates to EXA that the driver needs pixmaps 714*4882a593Smuzhiyun * to have a power-of-two pitch. 715*4882a593Smuzhiyun */ 716*4882a593Smuzhiyun #define EXA_OFFSCREEN_ALIGN_POT (1 << 1) 717*4882a593Smuzhiyun 718*4882a593Smuzhiyun /** 719*4882a593Smuzhiyun * EXA_TWO_BITBLT_DIRECTIONS indicates to EXA that the driver can only 720*4882a593Smuzhiyun * support copies that are (left-to-right, top-to-bottom) or 721*4882a593Smuzhiyun * (right-to-left, bottom-to-top). 722*4882a593Smuzhiyun */ 723*4882a593Smuzhiyun #define EXA_TWO_BITBLT_DIRECTIONS (1 << 2) 724*4882a593Smuzhiyun 725*4882a593Smuzhiyun /** 726*4882a593Smuzhiyun * EXA_HANDLES_PIXMAPS indicates to EXA that the driver can handle 727*4882a593Smuzhiyun * all pixmap addressing and migration. 728*4882a593Smuzhiyun */ 729*4882a593Smuzhiyun #define EXA_HANDLES_PIXMAPS (1 << 3) 730*4882a593Smuzhiyun 731*4882a593Smuzhiyun /** 732*4882a593Smuzhiyun * EXA_SUPPORTS_PREPARE_AUX indicates to EXA that the driver can handle the 733*4882a593Smuzhiyun * EXA_PREPARE_AUX* indices in the Prepare/FinishAccess hooks. If there are no 734*4882a593Smuzhiyun * such hooks, this flag has no effect. 735*4882a593Smuzhiyun */ 736*4882a593Smuzhiyun #define EXA_SUPPORTS_PREPARE_AUX (1 << 4) 737*4882a593Smuzhiyun 738*4882a593Smuzhiyun /** 739*4882a593Smuzhiyun * EXA_SUPPORTS_OFFSCREEN_OVERLAPS indicates to EXA that the driver Copy hooks 740*4882a593Smuzhiyun * can handle the source and destination occupying overlapping offscreen memory 741*4882a593Smuzhiyun * areas. This allows the offscreen memory defragmentation code to defragment 742*4882a593Smuzhiyun * areas where the defragmented position overlaps the fragmented position. 743*4882a593Smuzhiyun * 744*4882a593Smuzhiyun * Typically this is supported by traditional 2D engines but not by 3D engines. 745*4882a593Smuzhiyun */ 746*4882a593Smuzhiyun #define EXA_SUPPORTS_OFFSCREEN_OVERLAPS (1 << 5) 747*4882a593Smuzhiyun 748*4882a593Smuzhiyun /** 749*4882a593Smuzhiyun * EXA_MIXED_PIXMAPS will hide unacceleratable pixmaps from drivers and manage the 750*4882a593Smuzhiyun * problem known software fallbacks like trapezoids. This only migrates pixmaps one way 751*4882a593Smuzhiyun * into a driver pixmap and then pins it. 752*4882a593Smuzhiyun */ 753*4882a593Smuzhiyun #define EXA_MIXED_PIXMAPS (1 << 6) 754*4882a593Smuzhiyun 755*4882a593Smuzhiyun /** @} */ 756*4882a593Smuzhiyun 757*4882a593Smuzhiyun /* in exa.c */ 758*4882a593Smuzhiyun extern _X_EXPORT ExaDriverPtr exaDriverAlloc(void); 759*4882a593Smuzhiyun 760*4882a593Smuzhiyun extern _X_EXPORT Bool 761*4882a593Smuzhiyun exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo); 762*4882a593Smuzhiyun 763*4882a593Smuzhiyun extern _X_EXPORT void 764*4882a593Smuzhiyun exaDriverFini(ScreenPtr pScreen); 765*4882a593Smuzhiyun 766*4882a593Smuzhiyun extern _X_EXPORT void 767*4882a593Smuzhiyun exaMarkSync(ScreenPtr pScreen); 768*4882a593Smuzhiyun extern _X_EXPORT void 769*4882a593Smuzhiyun exaWaitSync(ScreenPtr pScreen); 770*4882a593Smuzhiyun 771*4882a593Smuzhiyun extern _X_EXPORT unsigned long 772*4882a593Smuzhiyun exaGetPixmapOffset(PixmapPtr pPix); 773*4882a593Smuzhiyun 774*4882a593Smuzhiyun extern _X_EXPORT unsigned long 775*4882a593Smuzhiyun exaGetPixmapPitch(PixmapPtr pPix); 776*4882a593Smuzhiyun 777*4882a593Smuzhiyun extern _X_EXPORT unsigned long 778*4882a593Smuzhiyun exaGetPixmapSize(PixmapPtr pPix); 779*4882a593Smuzhiyun 780*4882a593Smuzhiyun extern _X_EXPORT void *exaGetPixmapDriverPrivate(PixmapPtr p); 781*4882a593Smuzhiyun 782*4882a593Smuzhiyun /* in exa_offscreen.c */ 783*4882a593Smuzhiyun extern _X_EXPORT ExaOffscreenArea *exaOffscreenAlloc(ScreenPtr pScreen, 784*4882a593Smuzhiyun int size, int align, 785*4882a593Smuzhiyun Bool locked, 786*4882a593Smuzhiyun ExaOffscreenSaveProc save, 787*4882a593Smuzhiyun void *privData); 788*4882a593Smuzhiyun 789*4882a593Smuzhiyun extern _X_EXPORT ExaOffscreenArea *exaOffscreenFree(ScreenPtr pScreen, 790*4882a593Smuzhiyun ExaOffscreenArea * area); 791*4882a593Smuzhiyun 792*4882a593Smuzhiyun extern _X_EXPORT void 793*4882a593Smuzhiyun ExaOffscreenMarkUsed(PixmapPtr pPixmap); 794*4882a593Smuzhiyun 795*4882a593Smuzhiyun extern _X_EXPORT void 796*4882a593Smuzhiyun exaEnableDisableFBAccess(ScreenPtr pScreen, Bool enable); 797*4882a593Smuzhiyun 798*4882a593Smuzhiyun extern _X_EXPORT Bool 799*4882a593Smuzhiyun exaDrawableIsOffscreen(DrawablePtr pDrawable); 800*4882a593Smuzhiyun 801*4882a593Smuzhiyun /* in exa.c */ 802*4882a593Smuzhiyun extern _X_EXPORT void 803*4882a593Smuzhiyun exaMoveInPixmap(PixmapPtr pPixmap); 804*4882a593Smuzhiyun 805*4882a593Smuzhiyun extern _X_EXPORT void 806*4882a593Smuzhiyun exaMoveOutPixmap(PixmapPtr pPixmap); 807*4882a593Smuzhiyun 808*4882a593Smuzhiyun /* in exa_unaccel.c */ 809*4882a593Smuzhiyun extern _X_EXPORT CARD32 810*4882a593Smuzhiyun exaGetPixmapFirstPixel(PixmapPtr pPixmap); 811*4882a593Smuzhiyun 812*4882a593Smuzhiyun /** 813*4882a593Smuzhiyun * Returns TRUE if the given planemask covers all the significant bits in the 814*4882a593Smuzhiyun * pixel values for pDrawable. 815*4882a593Smuzhiyun */ 816*4882a593Smuzhiyun #define EXA_PM_IS_SOLID(_pDrawable, _pm) \ 817*4882a593Smuzhiyun (((_pm) & FbFullMask((_pDrawable)->depth)) == \ 818*4882a593Smuzhiyun FbFullMask((_pDrawable)->depth)) 819*4882a593Smuzhiyun 820*4882a593Smuzhiyun #endif /* EXA_H */ 821