exa_priv.h revision 6747b715
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;
2096747b715Smrg
21005b261ecSmrg} ExaScreenPrivRec, *ExaScreenPrivPtr;
21105b261ecSmrg
21205b261ecSmrg/*
21305b261ecSmrg * This is the only completely portable way to
21405b261ecSmrg * compute this info.
21505b261ecSmrg */
21605b261ecSmrg#ifndef BitsPerPixel
21705b261ecSmrg#define BitsPerPixel(d) (\
21805b261ecSmrg    PixmapWidthPaddingInfo[d].notPower2 ? \
21905b261ecSmrg    (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \
22005b261ecSmrg    ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
22105b261ecSmrg    (PixmapWidthPaddingInfo[d].padRoundUp+1)))
22205b261ecSmrg#endif
22305b261ecSmrg
2246747b715Smrgextern DevPrivateKeyRec exaScreenPrivateKeyRec;
2256747b715Smrg#define exaScreenPrivateKey (&exaScreenPrivateKeyRec)
2266747b715Smrgextern DevPrivateKeyRec exaPixmapPrivateKeyRec;
2276747b715Smrg#define exaPixmapPrivateKey (&exaPixmapPrivateKeyRec)
2286747b715Smrgextern DevPrivateKeyRec exaGCPrivateKeyRec;
2296747b715Smrg#define exaGCPrivateKey (&exaGCPrivateKeyRec)
2306747b715Smrg
2314642e01fSmrg#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
23205b261ecSmrg#define ExaScreenPriv(s)	ExaScreenPrivPtr    pExaScr = ExaGetScreenPriv(s)
23305b261ecSmrg
2346747b715Smrg#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixLookupPrivate(&(gc)->devPrivates, exaGCPrivateKey))
2356747b715Smrg#define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc)
2366747b715Smrg
2376747b715Smrg/*
2386747b715Smrg * Some macros to deal with function wrapping.
2396747b715Smrg */
2406747b715Smrg#define wrap(priv, real, mem, func) {\
2416747b715Smrg    priv->Saved##mem = real->mem; \
2426747b715Smrg    real->mem = func; \
2436747b715Smrg}
2446747b715Smrg
2456747b715Smrg#define unwrap(priv, real, mem) {\
2466747b715Smrg    real->mem = priv->Saved##mem; \
2476747b715Smrg}
2486747b715Smrg
2496747b715Smrg#define swap(priv, real, mem) {\
2506747b715Smrg    void *tmp = priv->Saved##mem; \
2516747b715Smrg    priv->Saved##mem = real->mem; \
2526747b715Smrg    real->mem = tmp; \
2536747b715Smrg}
2546747b715Smrg
2556747b715Smrg#define EXA_PRE_FALLBACK(_screen_) \
2566747b715Smrg    ExaScreenPriv(_screen_); \
2576747b715Smrg    pExaScr->fallback_counter++;
2586747b715Smrg
2596747b715Smrg#define EXA_POST_FALLBACK(_screen_) \
2606747b715Smrg    pExaScr->fallback_counter--;
2616747b715Smrg
2626747b715Smrg#define EXA_PRE_FALLBACK_GC(_gc_) \
2636747b715Smrg    ExaScreenPriv(_gc_->pScreen); \
2646747b715Smrg    ExaGCPriv(_gc_); \
2656747b715Smrg    pExaScr->fallback_counter++; \
2666747b715Smrg    swap(pExaGC, _gc_, ops);
2676747b715Smrg
2686747b715Smrg#define EXA_POST_FALLBACK_GC(_gc_) \
2696747b715Smrg    pExaScr->fallback_counter--; \
2706747b715Smrg    swap(pExaGC, _gc_, ops);
2716747b715Smrg
27205b261ecSmrg/** Align an offset to an arbitrary alignment */
27305b261ecSmrg#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
27405b261ecSmrg	(((offset) + (align) - 1) % (align)))
27505b261ecSmrg/** Align an offset to a power-of-two alignment */
27605b261ecSmrg#define EXA_ALIGN2(offset, align) (((offset) + (align) - 1) & ~((align) - 1))
27705b261ecSmrg
27805b261ecSmrg#define EXA_PIXMAP_SCORE_MOVE_IN    10
27905b261ecSmrg#define EXA_PIXMAP_SCORE_MAX	    20
28005b261ecSmrg#define EXA_PIXMAP_SCORE_MOVE_OUT   -10
28105b261ecSmrg#define EXA_PIXMAP_SCORE_MIN	    -20
28205b261ecSmrg#define EXA_PIXMAP_SCORE_PINNED	    1000
28305b261ecSmrg#define EXA_PIXMAP_SCORE_INIT	    1001
28405b261ecSmrg
2854642e01fSmrg#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey))
2864642e01fSmrg#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a)
28705b261ecSmrg#define ExaPixmapPriv(p)	ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
28805b261ecSmrg
2894642e01fSmrg#define EXA_RANGE_PITCH (1 << 0)
2904642e01fSmrg#define EXA_RANGE_WIDTH (1 << 1)
2914642e01fSmrg#define EXA_RANGE_HEIGHT (1 << 2)
2924642e01fSmrg
29305b261ecSmrgtypedef struct {
29405b261ecSmrg    ExaOffscreenArea *area;
29505b261ecSmrg    int		    score;	/**< score for the move-in vs move-out heuristic */
2966747b715Smrg    Bool	    use_gpu_copy;
29705b261ecSmrg
29805b261ecSmrg    CARD8	    *sys_ptr;	/**< pointer to pixmap data in system memory */
29905b261ecSmrg    int		    sys_pitch;	/**< pitch of pixmap in system memory */
30005b261ecSmrg
30105b261ecSmrg    CARD8	    *fb_ptr;	/**< pointer to pixmap data in framebuffer memory */
30205b261ecSmrg    int		    fb_pitch;	/**< pitch of pixmap in framebuffer memory */
30305b261ecSmrg    unsigned int    fb_size;	/**< size of pixmap in framebuffer memory */
30405b261ecSmrg
3054642e01fSmrg    /**
3064642e01fSmrg     * Holds information about whether this pixmap can be used for
3074642e01fSmrg     * acceleration (== 0) or not (> 0).
3084642e01fSmrg     *
3094642e01fSmrg     * Contains a OR'ed combination of the following values:
3104642e01fSmrg     * EXA_RANGE_PITCH - set if the pixmap's pitch is out of range
3114642e01fSmrg     * EXA_RANGE_WIDTH - set if the pixmap's width is out of range
3124642e01fSmrg     * EXA_RANGE_HEIGHT - set if the pixmap's height is out of range
3134642e01fSmrg     */
3144642e01fSmrg    unsigned int    accel_blocked;
3154642e01fSmrg
31605b261ecSmrg    /**
31705b261ecSmrg     * The damage record contains the areas of the pixmap's current location
31805b261ecSmrg     * (framebuffer or system) that have been damaged compared to the other
31905b261ecSmrg     * location.
32005b261ecSmrg     */
32105b261ecSmrg    DamagePtr	    pDamage;
32205b261ecSmrg    /**
3234642e01fSmrg     * The valid regions mark the valid bits (at least, as they're derived from
3244642e01fSmrg     * damage, which may be overreported) of a pixmap's system and FB copies.
3254642e01fSmrg     */
3264642e01fSmrg    RegionRec	    validSys, validFB;
3274642e01fSmrg    /**
3284642e01fSmrg     * Driver private storage per EXA pixmap
32905b261ecSmrg     */
3304642e01fSmrg    void *driverPriv;
33105b261ecSmrg} ExaPixmapPrivRec, *ExaPixmapPrivPtr;
33205b261ecSmrg
3334642e01fSmrgtypedef struct {
3346747b715Smrg    /* GC values from the layer below. */
3356747b715Smrg    GCOps *Savedops;
3366747b715Smrg    GCFuncs *Savedfuncs;
3376747b715Smrg} ExaGCPrivRec, *ExaGCPrivPtr;
3386747b715Smrg
3396747b715Smrgtypedef struct {
3406747b715Smrg    PicturePtr pDst;
3414642e01fSmrg    INT16 xSrc;
3424642e01fSmrg    INT16 ySrc;
3436747b715Smrg    INT16 xMask;
3446747b715Smrg    INT16 yMask;
3454642e01fSmrg    INT16 xDst;
3464642e01fSmrg    INT16 yDst;
3474642e01fSmrg    INT16 width;
3484642e01fSmrg    INT16 height;
3494642e01fSmrg} ExaCompositeRectRec, *ExaCompositeRectPtr;
3504642e01fSmrg
35105b261ecSmrg/**
35205b261ecSmrg * exaDDXDriverInit must be implemented by the DDX using EXA, and is the place
35305b261ecSmrg * to set EXA options or hook in screen functions to handle using EXA as the AA.
35405b261ecSmrg  */
35505b261ecSmrgvoid exaDDXDriverInit (ScreenPtr pScreen);
35605b261ecSmrg
35705b261ecSmrg/* exa_unaccel.c */
35805b261ecSmrgvoid
35905b261ecSmrgexaPrepareAccessGC(GCPtr pGC);
36005b261ecSmrg
36105b261ecSmrgvoid
36205b261ecSmrgexaFinishAccessGC(GCPtr pGC);
36305b261ecSmrg
36405b261ecSmrgvoid
36505b261ecSmrgExaCheckFillSpans  (DrawablePtr pDrawable, GCPtr pGC, int nspans,
36605b261ecSmrg		   DDXPointPtr ppt, int *pwidth, int fSorted);
36705b261ecSmrg
36805b261ecSmrgvoid
36905b261ecSmrgExaCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
37005b261ecSmrg		 DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
37105b261ecSmrg
37205b261ecSmrgvoid
37305b261ecSmrgExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
37405b261ecSmrg		 int x, int y, int w, int h, int leftPad, int format,
37505b261ecSmrg		 char *bits);
37605b261ecSmrg
3776747b715Smrgvoid
3786747b715SmrgExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst,  GCPtr pGC,
3796747b715Smrg	     BoxPtr	pbox, int nbox, int dx, int dy, Bool	reverse,
3806747b715Smrg	     Bool upsidedown, Pixel bitplane, void *closure);
3816747b715Smrg
38205b261ecSmrgRegionPtr
38305b261ecSmrgExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
38405b261ecSmrg		 int srcx, int srcy, int w, int h, int dstx, int dsty);
38505b261ecSmrg
38605b261ecSmrgRegionPtr
38705b261ecSmrgExaCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
38805b261ecSmrg		  int srcx, int srcy, int w, int h, int dstx, int dsty,
38905b261ecSmrg		  unsigned long bitPlane);
39005b261ecSmrg
39105b261ecSmrgvoid
39205b261ecSmrgExaCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
39305b261ecSmrg		  DDXPointPtr pptInit);
39405b261ecSmrg
39505b261ecSmrgvoid
39605b261ecSmrgExaCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
39705b261ecSmrg		  int mode, int npt, DDXPointPtr ppt);
39805b261ecSmrg
39905b261ecSmrgvoid
40005b261ecSmrgExaCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
40105b261ecSmrg		    int nsegInit, xSegment *pSegInit);
40205b261ecSmrg
40305b261ecSmrgvoid
40405b261ecSmrgExaCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
40505b261ecSmrg		int narcs, xArc *pArcs);
40605b261ecSmrg
40705b261ecSmrgvoid
40805b261ecSmrgExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
40905b261ecSmrg		     int nrect, xRectangle *prect);
41005b261ecSmrg
41105b261ecSmrgvoid
41205b261ecSmrgExaCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
41305b261ecSmrg		      int x, int y, unsigned int nglyph,
41405b261ecSmrg		      CharInfoPtr *ppci, pointer pglyphBase);
41505b261ecSmrg
41605b261ecSmrgvoid
41705b261ecSmrgExaCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
41805b261ecSmrg		     int x, int y, unsigned int nglyph,
41905b261ecSmrg		     CharInfoPtr *ppci, pointer pglyphBase);
42005b261ecSmrg
42105b261ecSmrgvoid
42205b261ecSmrgExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
42305b261ecSmrg		   DrawablePtr pDrawable,
42405b261ecSmrg		   int w, int h, int x, int y);
42505b261ecSmrg
4266747b715Smrgvoid
4276747b715SmrgExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
4286747b715Smrg
4296747b715Smrgvoid
4306747b715SmrgExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
4316747b715Smrg		unsigned int format, unsigned long planeMask, char *d);
4326747b715Smrg
43305b261ecSmrgvoid
43405b261ecSmrgExaCheckGetSpans (DrawablePtr pDrawable,
43505b261ecSmrg		 int wMax,
43605b261ecSmrg		 DDXPointPtr ppt,
43705b261ecSmrg		 int *pwidth,
43805b261ecSmrg		 int nspans,
43905b261ecSmrg		 char *pdstStart);
44005b261ecSmrg
44105b261ecSmrgvoid
4424642e01fSmrgExaCheckAddTraps (PicturePtr	pPicture,
4434642e01fSmrg		  INT16		x_off,
4444642e01fSmrg		  INT16		y_off,
4454642e01fSmrg		  int		ntrap,
4464642e01fSmrg		  xTrap		*traps);
44705b261ecSmrg
4484642e01fSmrg/* exa_accel.c */
44905b261ecSmrg
4504642e01fSmrgstatic _X_INLINE Bool
4514642e01fSmrgexaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
45252397711Smrg		      unsigned int fillStyle, unsigned char alu,
45352397711Smrg		      unsigned int clientClipType)
4544642e01fSmrg{
45552397711Smrg    return ((alu != GXcopy && alu != GXclear && alu != GXset &&
4564642e01fSmrg	     alu != GXcopyInverted) || fillStyle == FillStippled ||
45752397711Smrg	    clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable, planemask));
4584642e01fSmrg}
45905b261ecSmrg
46005b261ecSmrgvoid
46105b261ecSmrgexaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
46205b261ecSmrg
46305b261ecSmrgBool
46405b261ecSmrgexaFillRegionTiled (DrawablePtr	pDrawable, RegionPtr pRegion, PixmapPtr pTile,
46552397711Smrg		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
46652397711Smrg		    unsigned int clientClipType);
46705b261ecSmrg
46805b261ecSmrgvoid
46905b261ecSmrgexaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
47005b261ecSmrg	     unsigned int format, unsigned long planeMask, char *d);
47105b261ecSmrg
4726747b715SmrgRegionPtr
4736747b715SmrgexaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
4746747b715Smrg	    int srcx, int srcy, int width, int height, int dstx, int dsty);
4756747b715Smrg
4766747b715SmrgBool
4776747b715SmrgexaHWCopyNtoN (DrawablePtr    pSrcDrawable,
4786747b715Smrg	     DrawablePtr    pDstDrawable,
4796747b715Smrg	     GCPtr	    pGC,
4806747b715Smrg	     BoxPtr	    pbox,
4816747b715Smrg	     int	    nbox,
4826747b715Smrg	     int	    dx,
4836747b715Smrg	     int	    dy,
4846747b715Smrg	     Bool	    reverse,
4856747b715Smrg	     Bool	    upsidedown);
4866747b715Smrg
4876747b715Smrgvoid
4886747b715SmrgexaCopyNtoN (DrawablePtr    pSrcDrawable,
4896747b715Smrg	     DrawablePtr    pDstDrawable,
4906747b715Smrg	     GCPtr	    pGC,
4916747b715Smrg	     BoxPtr	    pbox,
4926747b715Smrg	     int	    nbox,
4936747b715Smrg	     int	    dx,
4946747b715Smrg	     int	    dy,
4956747b715Smrg	     Bool	    reverse,
4966747b715Smrg	     Bool	    upsidedown,
4976747b715Smrg	     Pixel	    bitplane,
4986747b715Smrg	     void	    *closure);
4996747b715Smrg
50005b261ecSmrgextern const GCOps exaOps;
50105b261ecSmrg
50205b261ecSmrgvoid
50305b261ecSmrgExaCheckComposite (CARD8      op,
50405b261ecSmrg		  PicturePtr pSrc,
50505b261ecSmrg		  PicturePtr pMask,
50605b261ecSmrg		  PicturePtr pDst,
50705b261ecSmrg		  INT16      xSrc,
50805b261ecSmrg		  INT16      ySrc,
50905b261ecSmrg		  INT16      xMask,
51005b261ecSmrg		  INT16      yMask,
51105b261ecSmrg		  INT16      xDst,
51205b261ecSmrg		  INT16      yDst,
51305b261ecSmrg		  CARD16     width,
51405b261ecSmrg		  CARD16     height);
5156747b715Smrg
5166747b715Smrgvoid
5176747b715SmrgExaCheckGlyphs (CARD8	      op,
5186747b715Smrg		PicturePtr    pSrc,
5196747b715Smrg		PicturePtr    pDst,
5206747b715Smrg		PictFormatPtr maskFormat,
5216747b715Smrg		INT16	      xSrc,
5226747b715Smrg		INT16	      ySrc,
5236747b715Smrg		int	      nlist,
5246747b715Smrg		GlyphListPtr  list,
5256747b715Smrg		GlyphPtr      *glyphs);
52605b261ecSmrg
52705b261ecSmrg/* exa_offscreen.c */
52805b261ecSmrgvoid
52905b261ecSmrgExaOffscreenSwapOut (ScreenPtr pScreen);
53005b261ecSmrg
53105b261ecSmrgvoid
53205b261ecSmrgExaOffscreenSwapIn (ScreenPtr pScreen);
53305b261ecSmrg
5346747b715SmrgExaOffscreenArea*
5356747b715SmrgExaOffscreenDefragment (ScreenPtr pScreen);
5366747b715Smrg
53705b261ecSmrgBool
53805b261ecSmrgexaOffscreenInit(ScreenPtr pScreen);
53905b261ecSmrg
54005b261ecSmrgvoid
54105b261ecSmrgExaOffscreenFini (ScreenPtr pScreen);
54205b261ecSmrg
54305b261ecSmrg/* exa.c */
5446747b715SmrgBool
5456747b715SmrgExaDoPrepareAccess(PixmapPtr pPixmap, int index);
5464642e01fSmrg
54705b261ecSmrgvoid
54805b261ecSmrgexaPrepareAccess(DrawablePtr pDrawable, int index);
54905b261ecSmrg
55005b261ecSmrgvoid
55105b261ecSmrgexaFinishAccess(DrawablePtr pDrawable, int index);
55205b261ecSmrg
5536747b715Smrgvoid
5546747b715SmrgexaDestroyPixmap(PixmapPtr pPixmap);
5556747b715Smrg
55605b261ecSmrgvoid
55705b261ecSmrgexaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
55805b261ecSmrg
55905b261ecSmrgvoid
56005b261ecSmrgexaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
56105b261ecSmrg		      int *xp, int *yp);
56205b261ecSmrg
56305b261ecSmrgBool
5646747b715SmrgexaPixmapHasGpuCopy(PixmapPtr p);
56505b261ecSmrg
56605b261ecSmrgPixmapPtr
56705b261ecSmrgexaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
56805b261ecSmrg
56905b261ecSmrgPixmapPtr
57005b261ecSmrgexaGetDrawablePixmap(DrawablePtr pDrawable);
57105b261ecSmrg
5726747b715Smrgvoid
5736747b715SmrgexaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
5746747b715Smrg              int w, int h, int bpp);
57505b261ecSmrg
57605b261ecSmrgvoid
5776747b715SmrgexaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
5786747b715Smrg                 int w, int h, int bpp);
5796747b715Smrg
5806747b715Smrgvoid
5816747b715SmrgexaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
5826747b715Smrg
5836747b715SmrgBool
5846747b715SmrgexaPixmapIsPinned (PixmapPtr pPix);
5856747b715Smrg
5866747b715Smrgextern const GCFuncs exaGCFuncs;
5876747b715Smrg
5886747b715Smrg/* exa_classic.c */
5896747b715SmrgPixmapPtr
5906747b715SmrgexaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
5916747b715Smrg		unsigned usage_hint);
5926747b715Smrg
5936747b715SmrgBool
5946747b715SmrgexaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth,
5956747b715Smrg		      int bitsPerPixel, int devKind, pointer pPixData);
5966747b715Smrg
5976747b715SmrgBool
5986747b715SmrgexaDestroyPixmap_classic (PixmapPtr pPixmap);
5996747b715Smrg
6006747b715SmrgBool
6016747b715SmrgexaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
6026747b715Smrg
6036747b715Smrg/* exa_driver.c */
6046747b715SmrgPixmapPtr
6056747b715SmrgexaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
6066747b715Smrg		unsigned usage_hint);
6076747b715Smrg
6086747b715SmrgBool
6096747b715SmrgexaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth,
6106747b715Smrg		      int bitsPerPixel, int devKind, pointer pPixData);
6116747b715Smrg
6126747b715SmrgBool
6136747b715SmrgexaDestroyPixmap_driver (PixmapPtr pPixmap);
6146747b715Smrg
6156747b715SmrgBool
6166747b715SmrgexaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
6176747b715Smrg
6186747b715Smrg/* exa_mixed.c */
6196747b715SmrgPixmapPtr
6206747b715SmrgexaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
6216747b715Smrg		unsigned usage_hint);
6226747b715Smrg
6236747b715SmrgBool
6246747b715SmrgexaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
6256747b715Smrg		      int bitsPerPixel, int devKind, pointer pPixData);
6266747b715Smrg
6276747b715SmrgBool
6286747b715SmrgexaDestroyPixmap_mixed(PixmapPtr pPixmap);
6296747b715Smrg
6306747b715SmrgBool
6316747b715SmrgexaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
6326747b715Smrg
6336747b715Smrg/* exa_migration_mixed.c */
6346747b715Smrgvoid
6356747b715SmrgexaCreateDriverPixmap_mixed(PixmapPtr pPixmap);
6366747b715Smrg
6376747b715Smrgvoid
6386747b715SmrgexaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
6396747b715Smrg
6406747b715Smrgvoid
6416747b715SmrgexaMoveInPixmap_mixed(PixmapPtr pPixmap);
6426747b715Smrg
6436747b715Smrgvoid
6446747b715SmrgexaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure);
6456747b715Smrg
6466747b715Smrgvoid
6476747b715SmrgexaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg);
64805b261ecSmrg
64905b261ecSmrg/* exa_render.c */
6504642e01fSmrgBool
6514642e01fSmrgexaOpReadsDestination (CARD8 op);
6524642e01fSmrg
65305b261ecSmrgvoid
65405b261ecSmrgexaComposite(CARD8	op,
65505b261ecSmrg	     PicturePtr pSrc,
65605b261ecSmrg	     PicturePtr pMask,
65705b261ecSmrg	     PicturePtr pDst,
65805b261ecSmrg	     INT16	xSrc,
65905b261ecSmrg	     INT16	ySrc,
66005b261ecSmrg	     INT16	xMask,
66105b261ecSmrg	     INT16	yMask,
66205b261ecSmrg	     INT16	xDst,
66305b261ecSmrg	     INT16	yDst,
66405b261ecSmrg	     CARD16	width,
66505b261ecSmrg	     CARD16	height);
66605b261ecSmrg
6674642e01fSmrgvoid
6684642e01fSmrgexaCompositeRects(CARD8	              op,
6694642e01fSmrg		  PicturePtr	      Src,
6706747b715Smrg		  PicturePtr	      pMask,
6714642e01fSmrg		  PicturePtr	      pDst,
6724642e01fSmrg		  int                 nrect,
6734642e01fSmrg		  ExaCompositeRectPtr rects);
6744642e01fSmrg
67505b261ecSmrgvoid
67605b261ecSmrgexaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
67705b261ecSmrg               PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
67805b261ecSmrg               int ntrap, xTrapezoid *traps);
67905b261ecSmrg
68005b261ecSmrgvoid
6814642e01fSmrgexaTriangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
6824642e01fSmrg	      PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
6834642e01fSmrg	      int ntri, xTriangle *tris);
6844642e01fSmrg
6854642e01fSmrg/* exa_glyph.c */
6864642e01fSmrgvoid
6874642e01fSmrgexaGlyphsInit(ScreenPtr pScreen);
68805b261ecSmrg
68905b261ecSmrgvoid
6904642e01fSmrgexaGlyphsFini (ScreenPtr pScreen);
69105b261ecSmrg
69205b261ecSmrgvoid
69305b261ecSmrgexaGlyphs (CARD8	op,
69405b261ecSmrg	  PicturePtr	pSrc,
69505b261ecSmrg	  PicturePtr	pDst,
69605b261ecSmrg	  PictFormatPtr	maskFormat,
69705b261ecSmrg	  INT16		xSrc,
69805b261ecSmrg	  INT16		ySrc,
69905b261ecSmrg	  int		nlist,
70005b261ecSmrg	  GlyphListPtr	list,
70105b261ecSmrg	  GlyphPtr	*glyphs);
70205b261ecSmrg
7036747b715Smrg/* exa_migration_classic.c */
70405b261ecSmrgvoid
7056747b715SmrgexaCopyDirtyToSys (ExaMigrationPtr migrate);
7066747b715Smrg
7076747b715Smrgvoid
7086747b715SmrgexaCopyDirtyToFb (ExaMigrationPtr migrate);
7096747b715Smrg
7106747b715Smrgvoid
7116747b715SmrgexaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
71205b261ecSmrg
71305b261ecSmrgvoid
71405b261ecSmrgexaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
71505b261ecSmrg
7166747b715Smrgvoid
7176747b715SmrgexaMoveOutPixmap_classic (PixmapPtr pPixmap);
7186747b715Smrg
7196747b715Smrgvoid
7206747b715SmrgexaMoveInPixmap_classic (PixmapPtr pPixmap);
7216747b715Smrg
7226747b715Smrgvoid
7236747b715SmrgexaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg);
7246747b715Smrg
72505b261ecSmrg#endif /* EXAPRIV_H */
726