exa_priv.h revision 792ba0ea
105b261ecSmrg/*
205b261ecSmrg *
305b261ecSmrg * Copyright (C) 2000 Keith Packard, member of The XFree86 Project, Inc.
405b261ecSmrg *               2005 Zack Rusin, Trolltech
505b261ecSmrg *
605b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
705b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
805b261ecSmrg * the above copyright notice appear in all copies and that both that
905b261ecSmrg * copyright notice and this permission notice appear in supporting
1005b261ecSmrg * documentation, and that the name of Keith Packard not be used in
1105b261ecSmrg * advertising or publicity pertaining to distribution of the software without
1205b261ecSmrg * specific, written prior permission.  Keith Packard makes no
1305b261ecSmrg * representations about the suitability of this software for any purpose.  It
1405b261ecSmrg * is provided "as is" without express or implied warranty.
1505b261ecSmrg *
1605b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
1705b261ecSmrg * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1805b261ecSmrg * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
1905b261ecSmrg * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2005b261ecSmrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
2105b261ecSmrg * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
2205b261ecSmrg * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
2305b261ecSmrg * SOFTWARE.
2405b261ecSmrg */
2505b261ecSmrg
2605b261ecSmrg#ifndef EXAPRIV_H
2705b261ecSmrg#define EXAPRIV_H
2805b261ecSmrg
2905b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
3005b261ecSmrg#include <dix-config.h>
3105b261ecSmrg#endif
3205b261ecSmrg
3305b261ecSmrg#include "exa.h"
3405b261ecSmrg
3505b261ecSmrg#include <X11/X.h>
3605b261ecSmrg#include <X11/Xproto.h>
374642e01fSmrg#ifdef MITSHM
384642e01fSmrg#include "shmint.h"
394642e01fSmrg#endif
4005b261ecSmrg#include "scrnintstr.h"
4105b261ecSmrg#include "pixmapstr.h"
4205b261ecSmrg#include "windowstr.h"
4305b261ecSmrg#include "servermd.h"
4405b261ecSmrg#include "mibstore.h"
4505b261ecSmrg#include "colormapst.h"
4605b261ecSmrg#include "gcstruct.h"
4705b261ecSmrg#include "input.h"
4805b261ecSmrg#include "mipointer.h"
4905b261ecSmrg#include "mi.h"
5005b261ecSmrg#include "dix.h"
5105b261ecSmrg#include "fb.h"
5205b261ecSmrg#include "fboverlay.h"
5305b261ecSmrg#include "fbpict.h"
544642e01fSmrg#include "glyphstr.h"
5505b261ecSmrg#include "damage.h"
5605b261ecSmrg
5705b261ecSmrg#define DEBUG_TRACE_FALL	0
5805b261ecSmrg#define DEBUG_MIGRATE		0
5905b261ecSmrg#define DEBUG_PIXMAP		0
6005b261ecSmrg#define DEBUG_OFFSCREEN		0
614642e01fSmrg#define DEBUG_GLYPH_CACHE	0
6205b261ecSmrg
6305b261ecSmrg#if DEBUG_TRACE_FALL
6405b261ecSmrg#define EXA_FALLBACK(x)     					\
6505b261ecSmrgdo {								\
6605b261ecSmrg	ErrorF("EXA fallback at %s: ", __FUNCTION__);		\
6705b261ecSmrg	ErrorF x;						\
6805b261ecSmrg} while (0)
6905b261ecSmrg
7005b261ecSmrgchar
7105b261ecSmrgexaDrawableLocation(DrawablePtr pDrawable);
7205b261ecSmrg#else
7305b261ecSmrg#define EXA_FALLBACK(x)
7405b261ecSmrg#endif
7505b261ecSmrg
7605b261ecSmrg#if DEBUG_PIXMAP
7705b261ecSmrg#define DBG_PIXMAP(a) ErrorF a
7805b261ecSmrg#else
7905b261ecSmrg#define DBG_PIXMAP(a)
8005b261ecSmrg#endif
8105b261ecSmrg
8205b261ecSmrg#ifndef EXA_MAX_FB
8305b261ecSmrg#define EXA_MAX_FB   FB_OVERLAY_MAX
8405b261ecSmrg#endif
8505b261ecSmrg
866747b715Smrg#ifdef DEBUG
876747b715Smrg#define EXA_FatalErrorDebug(x) FatalError x
886747b715Smrg#define EXA_FatalErrorDebugWithRet(x, ret) FatalError x
896747b715Smrg#else
906747b715Smrg#define EXA_FatalErrorDebug(x) ErrorF x
916747b715Smrg#define EXA_FatalErrorDebugWithRet(x, ret) \
926747b715Smrgdo { \
936747b715Smrg    ErrorF x; \
946747b715Smrg    return ret; \
956747b715Smrg} while (0)
966747b715Smrg#endif
976747b715Smrg
9805b261ecSmrg/**
9905b261ecSmrg * This is the list of migration heuristics supported by EXA.  See
10005b261ecSmrg * exaDoMigration() for what their implementations do.
10105b261ecSmrg */
10205b261ecSmrgenum ExaMigrationHeuristic {
10305b261ecSmrg    ExaMigrationGreedy,
10405b261ecSmrg    ExaMigrationAlways,
10505b261ecSmrg    ExaMigrationSmart
10605b261ecSmrg};
10705b261ecSmrg
1084642e01fSmrgtypedef struct {
1094642e01fSmrg    unsigned char sha1[20];
1104642e01fSmrg} ExaCachedGlyphRec, *ExaCachedGlyphPtr;
1114642e01fSmrg
1124642e01fSmrgtypedef struct {
1134642e01fSmrg    /* The identity of the cache, statically configured at initialization */
1144642e01fSmrg    unsigned int format;
1154642e01fSmrg    int glyphWidth;
1164642e01fSmrg    int glyphHeight;
1174642e01fSmrg
1184642e01fSmrg    int size; /* Size of cache; eventually this should be dynamically determined */
1194642e01fSmrg
1204642e01fSmrg    /* Hash table mapping from glyph sha1 to position in the glyph; we use
1214642e01fSmrg     * open addressing with a hash table size determined based on size and large
1224642e01fSmrg     * enough so that we always have a good amount of free space, so we can
1234642e01fSmrg     * use linear probing. (Linear probing is preferrable to double hashing
1244642e01fSmrg     * here because it allows us to easily remove entries.)
1254642e01fSmrg     */
1264642e01fSmrg    int *hashEntries;
1274642e01fSmrg    int hashSize;
1284642e01fSmrg
1294642e01fSmrg    ExaCachedGlyphPtr glyphs;
1304642e01fSmrg    int glyphCount; /* Current number of glyphs */
1314642e01fSmrg
1324642e01fSmrg    PicturePtr picture;   /* Where the glyphs of the cache are stored */
1334642e01fSmrg    int yOffset;          /* y location within the picture where the cache starts */
1344642e01fSmrg    int columns;          /* Number of columns the glyphs are layed out in */
1354642e01fSmrg    int evictionPosition; /* Next random position to evict a glyph */
1364642e01fSmrg} ExaGlyphCacheRec, *ExaGlyphCachePtr;
1374642e01fSmrg
1384642e01fSmrg#define EXA_NUM_GLYPH_CACHES 4
1394642e01fSmrg
1406747b715Smrg#define EXA_FALLBACK_COPYWINDOW (1 << 0)
1416747b715Smrg#define EXA_ACCEL_COPYWINDOW (1 << 1)
1426747b715Smrg
1436747b715Smrgtypedef struct _ExaMigrationRec {
1446747b715Smrg    Bool as_dst;
1456747b715Smrg    Bool as_src;
1466747b715Smrg    PixmapPtr pPix;
1476747b715Smrg    RegionPtr pReg;
1486747b715Smrg} ExaMigrationRec, *ExaMigrationPtr;
1496747b715Smrg
15005b261ecSmrgtypedef void (*EnableDisableFBAccessProcPtr)(int, Bool);
15105b261ecSmrgtypedef struct {
15205b261ecSmrg    ExaDriverPtr info;
1536747b715Smrg    ScreenBlockHandlerProcPtr	 SavedBlockHandler;
1546747b715Smrg    ScreenWakeupHandlerProcPtr	 SavedWakeupHandler;
15505b261ecSmrg    CreateGCProcPtr 		 SavedCreateGC;
15605b261ecSmrg    CloseScreenProcPtr 		 SavedCloseScreen;
15705b261ecSmrg    GetImageProcPtr 		 SavedGetImage;
15805b261ecSmrg    GetSpansProcPtr 		 SavedGetSpans;
15905b261ecSmrg    CreatePixmapProcPtr 	 SavedCreatePixmap;
16005b261ecSmrg    DestroyPixmapProcPtr 	 SavedDestroyPixmap;
16105b261ecSmrg    CopyWindowProcPtr 		 SavedCopyWindow;
1624642e01fSmrg    ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
1634642e01fSmrg    BitmapToRegionProcPtr        SavedBitmapToRegion;
1644642e01fSmrg    CreateScreenResourcesProcPtr SavedCreateScreenResources;
1654642e01fSmrg    ModifyPixmapHeaderProcPtr    SavedModifyPixmapHeader;
1666747b715Smrg    SourceValidateProcPtr        SavedSourceValidate;
16705b261ecSmrg    CompositeProcPtr             SavedComposite;
1684642e01fSmrg    TrianglesProcPtr		 SavedTriangles;
16905b261ecSmrg    GlyphsProcPtr                SavedGlyphs;
17005b261ecSmrg    TrapezoidsProcPtr            SavedTrapezoids;
1714642e01fSmrg    AddTrapsProcPtr		 SavedAddTraps;
1726747b715Smrg    void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
1736747b715Smrg    Bool (*pixmap_has_gpu_copy) (PixmapPtr pPixmap);
1746747b715Smrg    void (*do_move_in_pixmap) (PixmapPtr pPixmap);
1756747b715Smrg    void (*do_move_out_pixmap) (PixmapPtr pPixmap);
1766747b715Smrg    void (*prepare_access_reg)(PixmapPtr pPixmap, int index, RegionPtr pReg);
1776747b715Smrg
17805b261ecSmrg    Bool			 swappedOut;
17905b261ecSmrg    enum ExaMigrationHeuristic	 migration;
18005b261ecSmrg    Bool			 checkDirtyCorrectness;
18105b261ecSmrg    unsigned			 disableFbCount;
1824642e01fSmrg    Bool			 optimize_migration;
1834642e01fSmrg    unsigned			 offScreenCounter;
1846747b715Smrg    unsigned			 numOffscreenAvailable;
1856747b715Smrg    CARD32			 lastDefragment;
1866747b715Smrg    CARD32			 nextDefragment;
1876747b715Smrg    PixmapPtr			 deferred_mixed_pixmap;
1886747b715Smrg
1896747b715Smrg    /* Reference counting for accessed pixmaps */
1906747b715Smrg    struct {
1916747b715Smrg	PixmapPtr pixmap;
1926747b715Smrg	int count;
1936747b715Smrg	Bool retval;
1946747b715Smrg    } access[EXA_NUM_PREPARE_INDICES];
1956747b715Smrg
1966747b715Smrg    /* Holds information on fallbacks that cannot be relayed otherwise. */
1976747b715Smrg    unsigned int fallback_flags;
1986747b715Smrg    unsigned int fallback_counter;
1994642e01fSmrg
2004642e01fSmrg    ExaGlyphCacheRec             glyphCaches[EXA_NUM_GLYPH_CACHES];
2016747b715Smrg
2026747b715Smrg    /**
2036747b715Smrg     * Regions affected by fallback composite source / mask operations.
2046747b715Smrg     */
2056747b715Smrg
2066747b715Smrg    RegionRec srcReg;
2076747b715Smrg    RegionRec maskReg;
2086747b715Smrg    PixmapPtr srcPix;
209792ba0eaSabs    PixmapPtr maskPix;
2106747b715Smrg
21105b261ecSmrg} ExaScreenPrivRec, *ExaScreenPrivPtr;
21205b261ecSmrg
21305b261ecSmrg/*
21405b261ecSmrg * This is the only completely portable way to
21505b261ecSmrg * compute this info.
21605b261ecSmrg */
21705b261ecSmrg#ifndef BitsPerPixel
21805b261ecSmrg#define BitsPerPixel(d) (\
21905b261ecSmrg    PixmapWidthPaddingInfo[d].notPower2 ? \
22005b261ecSmrg    (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
22105b261ecSmrg    ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
22205b261ecSmrg    (PixmapWidthPaddingInfo[d].padRoundUp+1)))
22305b261ecSmrg#endif
22405b261ecSmrg
2256747b715Smrgextern DevPrivateKeyRec exaScreenPrivateKeyRec;
2266747b715Smrg#define exaScreenPrivateKey (&exaScreenPrivateKeyRec)
2276747b715Smrgextern DevPrivateKeyRec exaPixmapPrivateKeyRec;
2286747b715Smrg#define exaPixmapPrivateKey (&exaPixmapPrivateKeyRec)
2296747b715Smrgextern DevPrivateKeyRec exaGCPrivateKeyRec;
2306747b715Smrg#define exaGCPrivateKey (&exaGCPrivateKeyRec)
2316747b715Smrg
2324642e01fSmrg#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
23305b261ecSmrg#define ExaScreenPriv(s)	ExaScreenPrivPtr    pExaScr = ExaGetScreenPriv(s)
23405b261ecSmrg
2356747b715Smrg#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixLookupPrivate(&(gc)->devPrivates, exaGCPrivateKey))
2366747b715Smrg#define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc)
2376747b715Smrg
2386747b715Smrg/*
2396747b715Smrg * Some macros to deal with function wrapping.
2406747b715Smrg */
2416747b715Smrg#define wrap(priv, real, mem, func) {\
2426747b715Smrg    priv->Saved##mem = real->mem; \
2436747b715Smrg    real->mem = func; \
2446747b715Smrg}
2456747b715Smrg
2466747b715Smrg#define unwrap(priv, real, mem) {\
2476747b715Smrg    real->mem = priv->Saved##mem; \
2486747b715Smrg}
2496747b715Smrg
2506747b715Smrg#define swap(priv, real, mem) {\
2516747b715Smrg    void *tmp = priv->Saved##mem; \
2526747b715Smrg    priv->Saved##mem = real->mem; \
2536747b715Smrg    real->mem = tmp; \
2546747b715Smrg}
2556747b715Smrg
2566747b715Smrg#define EXA_PRE_FALLBACK(_screen_) \
2576747b715Smrg    ExaScreenPriv(_screen_); \
2586747b715Smrg    pExaScr->fallback_counter++;
2596747b715Smrg
2606747b715Smrg#define EXA_POST_FALLBACK(_screen_) \
2616747b715Smrg    pExaScr->fallback_counter--;
2626747b715Smrg
2636747b715Smrg#define EXA_PRE_FALLBACK_GC(_gc_) \
2646747b715Smrg    ExaScreenPriv(_gc_->pScreen); \
2656747b715Smrg    ExaGCPriv(_gc_); \
2666747b715Smrg    pExaScr->fallback_counter++; \
2676747b715Smrg    swap(pExaGC, _gc_, ops);
2686747b715Smrg
2696747b715Smrg#define EXA_POST_FALLBACK_GC(_gc_) \
2706747b715Smrg    pExaScr->fallback_counter--; \
2716747b715Smrg    swap(pExaGC, _gc_, ops);
2726747b715Smrg
27305b261ecSmrg/** Align an offset to an arbitrary alignment */
27405b261ecSmrg#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
27505b261ecSmrg	(((offset) + (align) - 1) % (align)))
27605b261ecSmrg/** Align an offset to a power-of-two alignment */
27705b261ecSmrg#define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
27805b261ecSmrg
27905b261ecSmrg#define EXA_PIXMAP_SCORE_MOVE_IN    10
28005b261ecSmrg#define EXA_PIXMAP_SCORE_MAX	    20
28105b261ecSmrg#define EXA_PIXMAP_SCORE_MOVE_OUT   -10
28205b261ecSmrg#define EXA_PIXMAP_SCORE_MIN	    -20
28305b261ecSmrg#define EXA_PIXMAP_SCORE_PINNED	    1000
28405b261ecSmrg#define EXA_PIXMAP_SCORE_INIT	    1001
28505b261ecSmrg
2864642e01fSmrg#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey))
2874642e01fSmrg#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a)
28805b261ecSmrg#define ExaPixmapPriv(p)	ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
28905b261ecSmrg
2904642e01fSmrg#define EXA_RANGE_PITCH (1 << 0)
2914642e01fSmrg#define EXA_RANGE_WIDTH (1 << 1)
2924642e01fSmrg#define EXA_RANGE_HEIGHT (1 << 2)
2934642e01fSmrg
29405b261ecSmrgtypedef struct {
29505b261ecSmrg    ExaOffscreenArea *area;
29605b261ecSmrg    int		    score;	/**< score for the move-in vs move-out heuristic */
2976747b715Smrg    Bool	    use_gpu_copy;
29805b261ecSmrg
29905b261ecSmrg    CARD8	    *sys_ptr;	/**< pointer to pixmap data in system memory */
30005b261ecSmrg    int		    sys_pitch;	/**< pitch of pixmap in system memory */
30105b261ecSmrg
30205b261ecSmrg    CARD8	    *fb_ptr;	/**< pointer to pixmap data in framebuffer memory */
30305b261ecSmrg    int		    fb_pitch;	/**< pitch of pixmap in framebuffer memory */
30405b261ecSmrg    unsigned int    fb_size;	/**< size of pixmap in framebuffer memory */
30505b261ecSmrg
3064642e01fSmrg    /**
3074642e01fSmrg     * Holds information about whether this pixmap can be used for
3084642e01fSmrg     * acceleration (== 0) or not (> 0).
3094642e01fSmrg     *
3104642e01fSmrg     * Contains a OR'ed combination of the following values:
3114642e01fSmrg     * EXA_RANGE_PITCH - set if the pixmap's pitch is out of range
3124642e01fSmrg     * EXA_RANGE_WIDTH - set if the pixmap's width is out of range
3134642e01fSmrg     * EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
3144642e01fSmrg     */
3154642e01fSmrg    unsigned int    accel_blocked;
3164642e01fSmrg
31705b261ecSmrg    /**
31805b261ecSmrg     * The damage record contains the areas of the pixmap's current location
31905b261ecSmrg     * (framebuffer or system) that have been damaged compared to the other
32005b261ecSmrg     * location.
32105b261ecSmrg     */
32205b261ecSmrg    DamagePtr	    pDamage;
32305b261ecSmrg    /**
3244642e01fSmrg     * The valid regions mark the valid bits (at least, as they're derived from
3254642e01fSmrg     * damage, which may be overreported) of a pixmap's system and FB copies.
3264642e01fSmrg     */
3274642e01fSmrg    RegionRec	    validSys, validFB;
3284642e01fSmrg    /**
3294642e01fSmrg     * Driver private storage per EXA pixmap
33005b261ecSmrg     */
3314642e01fSmrg    void *driverPriv;
33205b261ecSmrg} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
33305b261ecSmrg
3344642e01fSmrgtypedef struct {
3356747b715Smrg    /* GC values from the layer below. */
3366747b715Smrg    GCOps *Savedops;
3376747b715Smrg    GCFuncs *Savedfuncs;
3386747b715Smrg} ExaGCPrivRec, *ExaGCPrivPtr;
3396747b715Smrg
3406747b715Smrgtypedef struct {
3416747b715Smrg    PicturePtr pDst;
3424642e01fSmrg    INT16 xSrc;
3434642e01fSmrg    INT16 ySrc;
3446747b715Smrg    INT16 xMask;
3456747b715Smrg    INT16 yMask;
3464642e01fSmrg    INT16 xDst;
3474642e01fSmrg    INT16 yDst;
3484642e01fSmrg    INT16 width;
3494642e01fSmrg    INT16 height;
3504642e01fSmrg} ExaCompositeRectRec, *ExaCompositeRectPtr;
3514642e01fSmrg
35205b261ecSmrg/**
35305b261ecSmrg * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
35405b261ecSmrg * to set EXA options or hook in screen functions to handle using EXA as the AA.
35505b261ecSmrg  */
35605b261ecSmrgvoid exaDDXDriverInit (ScreenPtr pScreen);
35705b261ecSmrg
35805b261ecSmrg/* exa_unaccel.c */
35905b261ecSmrgvoid
36005b261ecSmrgexaPrepareAccessGC(GCPtr pGC);
36105b261ecSmrg
36205b261ecSmrgvoid
36305b261ecSmrgexaFinishAccessGC(GCPtr pGC);
36405b261ecSmrg
36505b261ecSmrgvoid
36605b261ecSmrgExaCheckFillSpans  (DrawablePtr pDrawable, GCPtr pGC, int nspans,
36705b261ecSmrg		   DDXPointPtr ppt, int *pwidth, int fSorted);
36805b261ecSmrg
36905b261ecSmrgvoid
37005b261ecSmrgExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
37105b261ecSmrg		 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
37205b261ecSmrg
37305b261ecSmrgvoid
37405b261ecSmrgExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
37505b261ecSmrg		 int x, int y, int w, int h, int leftPad, int format,
37605b261ecSmrg		 char *bits);
37705b261ecSmrg
3786747b715Smrgvoid
3796747b715SmrgExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst,  GCPtr pGC,
3806747b715Smrg	     BoxPtr	pbox, int nbox, int dx, int dy, Bool	reverse,
3816747b715Smrg	     Bool upsidedown, Pixel bitplane, void *closure);
3826747b715Smrg
38305b261ecSmrgRegionPtr
38405b261ecSmrgExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
38505b261ecSmrg		 int srcx, int srcy, int w, int h, int dstx, int dsty);
38605b261ecSmrg
38705b261ecSmrgRegionPtr
38805b261ecSmrgExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
38905b261ecSmrg		  int srcx, int srcy, int w, int h, int dstx, int dsty,
39005b261ecSmrg		  unsigned long bitPlane);
39105b261ecSmrg
39205b261ecSmrgvoid
39305b261ecSmrgExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
39405b261ecSmrg		  DDXPointPtr pptInit);
39505b261ecSmrg
39605b261ecSmrgvoid
39705b261ecSmrgExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
39805b261ecSmrg		  int mode, int npt, DDXPointPtr ppt);
39905b261ecSmrg
40005b261ecSmrgvoid
40105b261ecSmrgExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
40205b261ecSmrg		    int nsegInit, xSegment *pSegInit);
40305b261ecSmrg
40405b261ecSmrgvoid
40505b261ecSmrgExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
40605b261ecSmrg		int narcs, xArc *pArcs);
40705b261ecSmrg
40805b261ecSmrgvoid
40905b261ecSmrgExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
41005b261ecSmrg		     int nrect, xRectangle *prect);
41105b261ecSmrg
41205b261ecSmrgvoid
41305b261ecSmrgExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
41405b261ecSmrg		      int x, int y, unsigned int nglyph,
41505b261ecSmrg		      CharInfoPtr *ppci, pointer pglyphBase);
41605b261ecSmrg
41705b261ecSmrgvoid
41805b261ecSmrgExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
41905b261ecSmrg		     int x, int y, unsigned int nglyph,
42005b261ecSmrg		     CharInfoPtr *ppci, pointer pglyphBase);
42105b261ecSmrg
42205b261ecSmrgvoid
42305b261ecSmrgExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
42405b261ecSmrg		   DrawablePtr pDrawable,
42505b261ecSmrg		   int w, int h, int x, int y);
42605b261ecSmrg
4276747b715Smrgvoid
4286747b715SmrgExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
4296747b715Smrg
4306747b715Smrgvoid
4316747b715SmrgExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
4326747b715Smrg		unsigned int format, unsigned long planeMask, char *d);
4336747b715Smrg
43405b261ecSmrgvoid
43505b261ecSmrgExaCheckGetSpans (DrawablePtr pDrawable,
43605b261ecSmrg		 int wMax,
43705b261ecSmrg		 DDXPointPtr ppt,
43805b261ecSmrg		 int *pwidth,
43905b261ecSmrg		 int nspans,
44005b261ecSmrg		 char *pdstStart);
44105b261ecSmrg
44205b261ecSmrgvoid
4434642e01fSmrgExaCheckAddTraps (PicturePtr	pPicture,
4444642e01fSmrg		  INT16		x_off,
4454642e01fSmrg		  INT16		y_off,
4464642e01fSmrg		  int		ntrap,
4474642e01fSmrg		  xTrap		*traps);
44805b261ecSmrg
4494642e01fSmrg/* exa_accel.c */
45005b261ecSmrg
4514642e01fSmrgstatic _X_INLINE Bool
4524642e01fSmrgexaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
45352397711Smrg		      unsigned int fillStyle, unsigned char alu,
45452397711Smrg		      unsigned int clientClipType)
4554642e01fSmrg{
45652397711Smrg    return ((alu != GXcopy && alu != GXclear && alu != GXset &&
4574642e01fSmrg	     alu != GXcopyInverted) || fillStyle == FillStippled ||
45852397711Smrg	    clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable, planemask));
4594642e01fSmrg}
46005b261ecSmrg
46105b261ecSmrgvoid
46205b261ecSmrgexaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
46305b261ecSmrg
46405b261ecSmrgBool
46505b261ecSmrgexaFillRegionTiled (DrawablePtr	pDrawable, RegionPtr pRegion, PixmapPtr pTile,
46652397711Smrg		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
46752397711Smrg		    unsigned int clientClipType);
46805b261ecSmrg
46905b261ecSmrgvoid
47005b261ecSmrgexaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
47105b261ecSmrg	     unsigned int format, unsigned long planeMask, char *d);
47205b261ecSmrg
4736747b715SmrgRegionPtr
4746747b715SmrgexaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
4756747b715Smrg	    int srcx, int srcy, int width, int height, int dstx, int dsty);
4766747b715Smrg
4776747b715SmrgBool
4786747b715SmrgexaHWCopyNtoN (DrawablePtr    pSrcDrawable,
4796747b715Smrg	     DrawablePtr    pDstDrawable,
4806747b715Smrg	     GCPtr	    pGC,
4816747b715Smrg	     BoxPtr	    pbox,
4826747b715Smrg	     int	    nbox,
4836747b715Smrg	     int	    dx,
4846747b715Smrg	     int	    dy,
4856747b715Smrg	     Bool	    reverse,
4866747b715Smrg	     Bool	    upsidedown);
4876747b715Smrg
4886747b715Smrgvoid
4896747b715SmrgexaCopyNtoN (DrawablePtr    pSrcDrawable,
4906747b715Smrg	     DrawablePtr    pDstDrawable,
4916747b715Smrg	     GCPtr	    pGC,
4926747b715Smrg	     BoxPtr	    pbox,
4936747b715Smrg	     int	    nbox,
4946747b715Smrg	     int	    dx,
4956747b715Smrg	     int	    dy,
4966747b715Smrg	     Bool	    reverse,
4976747b715Smrg	     Bool	    upsidedown,
4986747b715Smrg	     Pixel	    bitplane,
4996747b715Smrg	     void	    *closure);
5006747b715Smrg
50105b261ecSmrgextern const GCOps exaOps;
50205b261ecSmrg
50305b261ecSmrgvoid
50405b261ecSmrgExaCheckComposite (CARD8      op,
50505b261ecSmrg		  PicturePtr pSrc,
50605b261ecSmrg		  PicturePtr pMask,
50705b261ecSmrg		  PicturePtr pDst,
50805b261ecSmrg		  INT16      xSrc,
50905b261ecSmrg		  INT16      ySrc,
51005b261ecSmrg		  INT16      xMask,
51105b261ecSmrg		  INT16      yMask,
51205b261ecSmrg		  INT16      xDst,
51305b261ecSmrg		  INT16      yDst,
51405b261ecSmrg		  CARD16     width,
51505b261ecSmrg		  CARD16     height);
5166747b715Smrg
5176747b715Smrgvoid
5186747b715SmrgExaCheckGlyphs (CARD8	      op,
5196747b715Smrg		PicturePtr    pSrc,
5206747b715Smrg		PicturePtr    pDst,
5216747b715Smrg		PictFormatPtr maskFormat,
5226747b715Smrg		INT16	      xSrc,
5236747b715Smrg		INT16	      ySrc,
5246747b715Smrg		int	      nlist,
5256747b715Smrg		GlyphListPtr  list,
5266747b715Smrg		GlyphPtr      *glyphs);
52705b261ecSmrg
52805b261ecSmrg/* exa_offscreen.c */
52905b261ecSmrgvoid
53005b261ecSmrgExaOffscreenSwapOut (ScreenPtr pScreen);
53105b261ecSmrg
53205b261ecSmrgvoid
53305b261ecSmrgExaOffscreenSwapIn (ScreenPtr pScreen);
53405b261ecSmrg
5356747b715SmrgExaOffscreenArea*
5366747b715SmrgExaOffscreenDefragment (ScreenPtr pScreen);
5376747b715Smrg
53805b261ecSmrgBool
53905b261ecSmrgexaOffscreenInit(ScreenPtr pScreen);
54005b261ecSmrg
54105b261ecSmrgvoid
54205b261ecSmrgExaOffscreenFini (ScreenPtr pScreen);
54305b261ecSmrg
54405b261ecSmrg/* exa.c */
5456747b715SmrgBool
5466747b715SmrgExaDoPrepareAccess(PixmapPtr pPixmap, int index);
5474642e01fSmrg
54805b261ecSmrgvoid
54905b261ecSmrgexaPrepareAccess(DrawablePtr pDrawable, int index);
55005b261ecSmrg
55105b261ecSmrgvoid
55205b261ecSmrgexaFinishAccess(DrawablePtr pDrawable, int index);
55305b261ecSmrg
5546747b715Smrgvoid
5556747b715SmrgexaDestroyPixmap(PixmapPtr pPixmap);
5566747b715Smrg
55705b261ecSmrgvoid
55805b261ecSmrgexaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
55905b261ecSmrg
56005b261ecSmrgvoid
56105b261ecSmrgexaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
56205b261ecSmrg		      int *xp, int *yp);
56305b261ecSmrg
56405b261ecSmrgBool
5656747b715SmrgexaPixmapHasGpuCopy(PixmapPtr p);
56605b261ecSmrg
56705b261ecSmrgPixmapPtr
56805b261ecSmrgexaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
56905b261ecSmrg
57005b261ecSmrgPixmapPtr
57105b261ecSmrgexaGetDrawablePixmap(DrawablePtr pDrawable);
57205b261ecSmrg
5736747b715Smrgvoid
5746747b715SmrgexaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
5756747b715Smrg              int w, int h, int bpp);
57605b261ecSmrg
57705b261ecSmrgvoid
5786747b715SmrgexaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
5796747b715Smrg                 int w, int h, int bpp);
5806747b715Smrg
5816747b715Smrgvoid
5826747b715SmrgexaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
5836747b715Smrg
5846747b715SmrgBool
5856747b715SmrgexaPixmapIsPinned (PixmapPtr pPix);
5866747b715Smrg
5876747b715Smrgextern const GCFuncs exaGCFuncs;
5886747b715Smrg
5896747b715Smrg/* exa_classic.c */
5906747b715SmrgPixmapPtr
5916747b715SmrgexaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
5926747b715Smrg		unsigned usage_hint);
5936747b715Smrg
5946747b715SmrgBool
5956747b715SmrgexaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
5966747b715Smrg		      int bitsPerPixel, int devKind, pointer pPixData);
5976747b715Smrg
5986747b715SmrgBool
5996747b715SmrgexaDestroyPixmap_classic (PixmapPtr pPixmap);
6006747b715Smrg
6016747b715SmrgBool
6026747b715SmrgexaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
6036747b715Smrg
6046747b715Smrg/* exa_driver.c */
6056747b715SmrgPixmapPtr
6066747b715SmrgexaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
6076747b715Smrg		unsigned usage_hint);
6086747b715Smrg
6096747b715SmrgBool
6106747b715SmrgexaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
6116747b715Smrg		      int bitsPerPixel, int devKind, pointer pPixData);
6126747b715Smrg
6136747b715SmrgBool
6146747b715SmrgexaDestroyPixmap_driver (PixmapPtr pPixmap);
6156747b715Smrg
6166747b715SmrgBool
6176747b715SmrgexaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
6186747b715Smrg
6196747b715Smrg/* exa_mixed.c */
6206747b715SmrgPixmapPtr
6216747b715SmrgexaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
6226747b715Smrg		unsigned usage_hint);
6236747b715Smrg
6246747b715SmrgBool
6256747b715SmrgexaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
6266747b715Smrg		      int bitsPerPixel, int devKind, pointer pPixData);
6276747b715Smrg
6286747b715SmrgBool
6296747b715SmrgexaDestroyPixmap_mixed(PixmapPtr pPixmap);
6306747b715Smrg
6316747b715SmrgBool
6326747b715SmrgexaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
6336747b715Smrg
6346747b715Smrg/* exa_migration_mixed.c */
6356747b715Smrgvoid
6366747b715SmrgexaCreateDriverPixmap_mixed(PixmapPtr pPixmap);
6376747b715Smrg
6386747b715Smrgvoid
6396747b715SmrgexaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
6406747b715Smrg
6416747b715Smrgvoid
6426747b715SmrgexaMoveInPixmap_mixed(PixmapPtr pPixmap);
6436747b715Smrg
6446747b715Smrgvoid
6456747b715SmrgexaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure);
6466747b715Smrg
6476747b715Smrgvoid
6486747b715SmrgexaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
64905b261ecSmrg
65005b261ecSmrg/* exa_render.c */
6514642e01fSmrgBool
6524642e01fSmrgexaOpReadsDestination (CARD8 op);
6534642e01fSmrg
65405b261ecSmrgvoid
65505b261ecSmrgexaComposite(CARD8	op,
65605b261ecSmrg	     PicturePtr pSrc,
65705b261ecSmrg	     PicturePtr pMask,
65805b261ecSmrg	     PicturePtr pDst,
65905b261ecSmrg	     INT16	xSrc,
66005b261ecSmrg	     INT16	ySrc,
66105b261ecSmrg	     INT16	xMask,
66205b261ecSmrg	     INT16	yMask,
66305b261ecSmrg	     INT16	xDst,
66405b261ecSmrg	     INT16	yDst,
66505b261ecSmrg	     CARD16	width,
66605b261ecSmrg	     CARD16	height);
66705b261ecSmrg
6684642e01fSmrgvoid
6694642e01fSmrgexaCompositeRects(CARD8	              op,
6704642e01fSmrg		  PicturePtr	      Src,
6716747b715Smrg		  PicturePtr	      pMask,
6724642e01fSmrg		  PicturePtr	      pDst,
6734642e01fSmrg		  int                 nrect,
6744642e01fSmrg		  ExaCompositeRectPtr rects);
6754642e01fSmrg
67605b261ecSmrgvoid
67705b261ecSmrgexaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
67805b261ecSmrg               PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
67905b261ecSmrg               int ntrap, xTrapezoid *traps);
68005b261ecSmrg
68105b261ecSmrgvoid
6824642e01fSmrgexaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
6834642e01fSmrg	      PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
6844642e01fSmrg	      int ntri, xTriangle *tris);
6854642e01fSmrg
6864642e01fSmrg/* exa_glyph.c */
6874642e01fSmrgvoid
6884642e01fSmrgexaGlyphsInit(ScreenPtr pScreen);
68905b261ecSmrg
69005b261ecSmrgvoid
6914642e01fSmrgexaGlyphsFini (ScreenPtr pScreen);
69205b261ecSmrg
69305b261ecSmrgvoid
69405b261ecSmrgexaGlyphs (CARD8	op,
69505b261ecSmrg	  PicturePtr	pSrc,
69605b261ecSmrg	  PicturePtr	pDst,
69705b261ecSmrg	  PictFormatPtr	maskFormat,
69805b261ecSmrg	  INT16		xSrc,
69905b261ecSmrg	  INT16		ySrc,
70005b261ecSmrg	  int		nlist,
70105b261ecSmrg	  GlyphListPtr	list,
70205b261ecSmrg	  GlyphPtr	*glyphs);
70305b261ecSmrg
7046747b715Smrg/* exa_migration_classic.c */
70505b261ecSmrgvoid
7066747b715SmrgexaCopyDirtyToSys (ExaMigrationPtr migrate);
7076747b715Smrg
7086747b715Smrgvoid
7096747b715SmrgexaCopyDirtyToFb (ExaMigrationPtr migrate);
7106747b715Smrg
7116747b715Smrgvoid
7126747b715SmrgexaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
71305b261ecSmrg
71405b261ecSmrgvoid
71505b261ecSmrgexaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
71605b261ecSmrg
7176747b715Smrgvoid
7186747b715SmrgexaMoveOutPixmap_classic (PixmapPtr pPixmap);
7196747b715Smrg
7206747b715Smrgvoid
7216747b715SmrgexaMoveInPixmap_classic (PixmapPtr pPixmap);
7226747b715Smrg
7236747b715Smrgvoid
7246747b715SmrgexaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg);
7256747b715Smrg
72605b261ecSmrg#endif /* EXAPRIV_H */
727