diff options
Diffstat (limited to 'xorg-server/exa/exa_priv.h')
-rw-r--r-- | xorg-server/exa/exa_priv.h | 228 |
1 files changed, 202 insertions, 26 deletions
diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h index 0911c6d8a..869cf1772 100644 --- a/xorg-server/exa/exa_priv.h +++ b/xorg-server/exa/exa_priv.h @@ -33,7 +33,6 @@ #include "exa.h" #include <X11/X.h> -#define NEED_EVENTS #include <X11/Xproto.h> #ifdef MITSHM #include "shmint.h" @@ -86,6 +85,18 @@ exaDrawableLocation(DrawablePtr pDrawable); #define EXA_MAX_FB FB_OVERLAY_MAX #endif +#ifdef DEBUG +#define EXA_FatalErrorDebug(x) FatalError x +#define EXA_FatalErrorDebugWithRet(x, ret) FatalError x +#else +#define EXA_FatalErrorDebug(x) ErrorF x +#define EXA_FatalErrorDebugWithRet(x, ret) \ +do { \ + ErrorF x; \ + return ret; \ +} while (0) +#endif + /** * This is the list of migration heuristics supported by EXA. See * exaDoMigration() for what their implementations do. @@ -128,9 +139,21 @@ typedef struct { #define EXA_NUM_GLYPH_CACHES 4 +#define EXA_FALLBACK_COPYWINDOW (1 << 0) +#define EXA_ACCEL_COPYWINDOW (1 << 1) + +typedef struct _ExaMigrationRec { + Bool as_dst; + Bool as_src; + PixmapPtr pPix; + RegionPtr pReg; +} ExaMigrationRec, *ExaMigrationPtr; + typedef void (*EnableDisableFBAccessProcPtr)(int, Bool); typedef struct { ExaDriverPtr info; + ScreenBlockHandlerProcPtr SavedBlockHandler; + ScreenWakeupHandlerProcPtr SavedWakeupHandler; CreateGCProcPtr SavedCreateGC; CloseScreenProcPtr SavedCloseScreen; GetImageProcPtr SavedGetImage; @@ -149,13 +172,29 @@ typedef struct { TrapezoidsProcPtr SavedTrapezoids; AddTrapsProcPtr SavedAddTraps; #endif - + void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); + Bool (*pixmap_is_offscreen) (PixmapPtr pPixmap); + void (*do_move_in_pixmap) (PixmapPtr pPixmap); + void (*do_move_out_pixmap) (PixmapPtr pPixmap); + Bool swappedOut; enum ExaMigrationHeuristic migration; Bool checkDirtyCorrectness; unsigned disableFbCount; Bool optimize_migration; unsigned offScreenCounter; + unsigned numOffscreenAvailable; + CARD32 lastDefragment; + CARD32 nextDefragment; + + /* Reference counting for accessed pixmaps */ + struct { + PixmapPtr pixmap; + int count; + } access[EXA_NUM_PREPARE_INDICES]; + + /* Holds information on fallbacks that cannot be relayed otherwise. */ + unsigned int fallback_flags; ExaGlyphCacheRec glyphCaches[EXA_NUM_GLYPH_CACHES]; } ExaScreenPrivRec, *ExaScreenPrivPtr; @@ -174,9 +213,40 @@ typedef struct { extern DevPrivateKey exaScreenPrivateKey; extern DevPrivateKey exaPixmapPrivateKey; +extern DevPrivateKey exaGCPrivateKey; #define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey)) #define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s) +#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixLookupPrivate(&(gc)->devPrivates, exaGCPrivateKey)) +#define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc) + +/* + * Some macros to deal with function wrapping. + */ +#define wrap(priv, real, mem, func) {\ + priv->Saved##mem = real->mem; \ + real->mem = func; \ +} + +#define unwrap(priv, real, mem) {\ + real->mem = priv->Saved##mem; \ +} + +#define swap(priv, real, mem) {\ + void *tmp = priv->Saved##mem; \ + priv->Saved##mem = real->mem; \ + real->mem = tmp; \ +} + +#define EXA_GC_PROLOGUE(_gc_) \ + ExaGCPriv(_gc_); \ + swap(pExaGC, _gc_, funcs); \ + swap(pExaGC, _gc_, ops); + +#define EXA_GC_EPILOGUE(_gc_) \ + swap(pExaGC, _gc_, funcs); \ + swap(pExaGC, _gc_, ops); + /** Align an offset to an arbitrary alignment */ #define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \ (((offset) + (align) - 1) % (align))) @@ -237,17 +307,19 @@ typedef struct { */ void *driverPriv; } ExaPixmapPrivRec, *ExaPixmapPrivPtr; - -typedef struct _ExaMigrationRec { - Bool as_dst; - Bool as_src; - PixmapPtr pPix; - RegionPtr pReg; -} ExaMigrationRec, *ExaMigrationPtr; typedef struct { + /* GC values from the layer below. */ + GCOps *Savedops; + GCFuncs *Savedfuncs; +} ExaGCPrivRec, *ExaGCPrivPtr; + +typedef struct { + PicturePtr pDst; INT16 xSrc; INT16 ySrc; + INT16 xMask; + INT16 yMask; INT16 xDst; INT16 yDst; INT16 width; @@ -280,6 +352,11 @@ ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *bits); +void +ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, + Bool upsidedown, Pixel bitplane, void *closure); + RegionPtr ExaCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty); @@ -325,6 +402,13 @@ ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap, int w, int h, int x, int y); void +ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); + +void +ExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int format, unsigned long planeMask, char *d); + +void ExaCheckGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, @@ -363,6 +447,34 @@ void exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *d); +RegionPtr +exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, + int srcx, int srcy, int width, int height, int dstx, int dsty); + +Bool +exaHWCopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown); + +void +exaCopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure); + extern const GCOps exaOps; #ifdef RENDER @@ -388,6 +500,9 @@ ExaOffscreenSwapOut (ScreenPtr pScreen); void ExaOffscreenSwapIn (ScreenPtr pScreen); +ExaOffscreenArea* +ExaOffscreenDefragment (ScreenPtr pScreen); + Bool exaOffscreenInit(ScreenPtr pScreen); @@ -395,7 +510,7 @@ void ExaOffscreenFini (ScreenPtr pScreen); /* exa.c */ -void +Bool ExaDoPrepareAccess(DrawablePtr pDrawable, int index); void @@ -423,22 +538,76 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp); PixmapPtr exaGetDrawablePixmap(DrawablePtr pDrawable); -RegionPtr -exaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty); +void +exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, + int w, int h, int bpp); void -exaCopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure); +exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, + int w, int h, int bpp); + +void +exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); + +Bool +exaPixmapIsPinned (PixmapPtr pPix); + +extern const GCFuncs exaGCFuncs; + +/* exa_classic.c */ +PixmapPtr +exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth, + unsigned usage_hint); + +Bool +exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData); + +Bool +exaDestroyPixmap_classic (PixmapPtr pPixmap); + +Bool +exaPixmapIsOffscreen_classic(PixmapPtr pPixmap); + +/* exa_driver.c */ +PixmapPtr +exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth, + unsigned usage_hint); + +Bool +exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData); + +Bool +exaDestroyPixmap_driver (PixmapPtr pPixmap); + +Bool +exaPixmapIsOffscreen_driver(PixmapPtr pPixmap); + +/* exa_mixed.c */ +PixmapPtr +exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, + unsigned usage_hint); + +Bool +exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData); + +Bool +exaDestroyPixmap_mixed(PixmapPtr pPixmap); + +Bool +exaPixmapIsOffscreen_mixed(PixmapPtr pPixmap); + +/* exa_migration_mixed.c */ +void +exaCreateDriverPixmap_mixed(PixmapPtr pPixmap); + +void +exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); + +void +exaMoveInPixmap_mixed(PixmapPtr pPixmap); /* exa_render.c */ Bool @@ -461,6 +630,7 @@ exaComposite(CARD8 op, void exaCompositeRects(CARD8 op, PicturePtr Src, + PicturePtr pMask, PicturePtr pDst, int nrect, ExaCompositeRectPtr rects); @@ -493,11 +663,17 @@ exaGlyphs (CARD8 op, GlyphListPtr list, GlyphPtr *glyphs); -/* exa_migration.c */ +/* exa_migration_classic.c */ void -exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); +exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel); void exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area); +void +exaMoveOutPixmap_classic (PixmapPtr pPixmap); + +void +exaMoveInPixmap_classic (PixmapPtr pPixmap); + #endif /* EXAPRIV_H */ |