diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-06-25 18:08:15 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2011-12-14 18:30:27 -0800 |
commit | 86603e5d987a3ec2377b2caf113a93528a16808d (patch) | |
tree | 99df6b8a4af4653bb458948939a7fa18b81d1159 | |
parent | 7eb2e4ec06787ef4902186fefdf8309629e49d6e (diff) |
XAA: Merge pixmap GC ops into fallback GC ops.cleanup-xaa
They were already doing nearly identical work, although now the ops may
short-circuit in the pixmap case if pGC->pCompositeClip is an empty
region; before, only the fallback ops could do that.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r-- | hw/xfree86/xaa/xaaFallback.c | 67 | ||||
-rw-r--r-- | hw/xfree86/xaa/xaaGC.c | 328 | ||||
-rw-r--r-- | hw/xfree86/xaa/xaawrap.h | 25 |
3 files changed, 51 insertions, 369 deletions
diff --git a/hw/xfree86/xaa/xaaFallback.c b/hw/xfree86/xaa/xaaFallback.c index 1b05d9616..aef06d6c4 100644 --- a/hw/xfree86/xaa/xaaFallback.c +++ b/hw/xfree86/xaa/xaaFallback.c @@ -29,7 +29,7 @@ XAAFillSpansFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -44,7 +44,7 @@ XAASetSpansFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -60,7 +60,7 @@ XAAPutImageFallback( XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static RegionPtr @@ -72,12 +72,33 @@ XAACopyAreaFallback( int width, int height, int dstx, int dsty ) { + XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); RegionPtr ret; - XAA_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyArea)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - XAA_GC_OP_EPILOGUE(pGC); + if(infoRec->pScrn->vtSema && + (pDst->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDst) && + ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) + { + if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && + (pSrc->bitsPerPixel == pDst->bitsPerPixel) && + ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1]) + == infoRec->FullPlanemasks[pSrc->depth - 1])) + { + XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst)); + pixPriv->flags |= DIRTY; + + return (XAABitBlt( pSrc, pDst, pGC, + srcx, srcy, width, height, dstx, dsty, + XAADoImageRead, 0L)); + } + } + + { + XAA_GC_OP_PROLOGUE(pGC); + ret = (*pGC->ops->CopyArea)(pSrc, pDst, + pGC, srcx, srcy, width, height, dstx, dsty); + XAA_GC_OP_EPILOGUE(pGC, pDst); + } return ret; } @@ -96,7 +117,7 @@ XAACopyPlaneFallback( XAA_GC_OP_PROLOGUE(pGC); ret = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDst); return ret; } @@ -110,7 +131,7 @@ XAAPolyPointFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } @@ -124,7 +145,7 @@ XAAPolylinesFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -136,7 +157,7 @@ XAAPolySegmentFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -148,7 +169,7 @@ XAAPolyRectangleFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -160,7 +181,7 @@ XAAPolyArcFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -174,7 +195,7 @@ XAAFillPolygonFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } @@ -187,7 +208,7 @@ XAAPolyFillRectFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } @@ -200,7 +221,7 @@ XAAPolyFillArcFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static int @@ -216,7 +237,7 @@ XAAPolyText8Fallback( XAA_GC_OP_PROLOGUE(pGC); ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); return ret; } @@ -233,7 +254,7 @@ XAAPolyText16Fallback( XAA_GC_OP_PROLOGUE(pGC); ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); return ret; } @@ -248,7 +269,7 @@ XAAImageText8Fallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -262,7 +283,7 @@ XAAImageText16Fallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } @@ -277,7 +298,7 @@ XAAImageGlyphBltFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -291,7 +312,7 @@ XAAPolyGlyphBltFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } static void @@ -303,7 +324,7 @@ XAAPushPixelsFallback( { XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC); (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - XAA_GC_OP_EPILOGUE(pGC); + XAA_GC_OP_EPILOGUE(pGC, pDraw); } GCOps XAAFallbackOps = { diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c index a1a5c8831..02af37aa8 100644 --- a/hw/xfree86/xaa/xaaGC.c +++ b/hw/xfree86/xaa/xaaGC.c @@ -28,8 +28,6 @@ GCFuncs XAAGCFuncs = { XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC, }; -extern GCOps XAAPixmapOps; - Bool XAACreateGC(GCPtr pGC) { @@ -277,329 +275,3 @@ XAACopyGC ( (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); XAA_GC_FUNC_EPILOGUE (pGCDst); } - -/**** Pixmap Wrappers ****/ - - - -static void -XAAFillSpansPixmap( - DrawablePtr pDraw, - GC *pGC, - int nInit, - DDXPointPtr pptInit, - int *pwidthInit, - int fSorted -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAASetSpansPixmap( - DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - register DDXPointPtr ppt, - int *pwidth, - int nspans, - int fSorted -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPutImagePixmap( - DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, - int format, - char *pImage -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static RegionPtr -XAACopyAreaPixmap( - DrawablePtr pSrc, - DrawablePtr pDst, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - RegionPtr ret; - - if(infoRec->pScrn->vtSema && - ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) - { - if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && - (pSrc->bitsPerPixel == pDst->bitsPerPixel) && - ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1]) - == infoRec->FullPlanemasks[pSrc->depth - 1])) - { - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst)); - pixPriv->flags |= DIRTY; - - return (XAABitBlt( pSrc, pDst, pGC, - srcx, srcy, width, height, dstx, dsty, - XAADoImageRead, 0L)); - } - } - - { - XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); - ret = (*pGC->ops->CopyArea)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - XAA_PIXMAP_OP_EPILOGUE(pGC); - } - return ret; -} - -static RegionPtr -XAACopyPlanePixmap( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - unsigned long bitPlane -){ - RegionPtr ret; - - XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); - ret = (*pGC->ops->CopyPlane)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - XAA_PIXMAP_OP_EPILOGUE(pGC); - return ret; -} - -static void -XAAPolyPointPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - xPoint *pptInit -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - - -static void -XAAPolylinesPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pptInit -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolySegmentPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyRectanglePixmap( - DrawablePtr pDraw, - GCPtr pGC, - int nRectsInit, - xRectangle *pRectsInit -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyArcPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAFillPolygonPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int shape, - int mode, - int count, - DDXPointPtr ptsIn -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - - -static void -XAAPolyFillRectPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int nrectFill, - xRectangle *prectInit -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - - -static void -XAAPolyFillArcPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static int -XAAPolyText8Pixmap( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - int ret; - - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); - return ret; -} - -static int -XAAPolyText16Pixmap( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - int ret; - - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); - return ret; -} - -static void -XAAImageText8Pixmap( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} -static void -XAAImageText16Pixmap( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - - -static void -XAAImageGlyphBltPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPolyGlyphBltPixmap( - DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -static void -XAAPushPixelsPixmap( - GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg -){ - XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw); - (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - XAA_PIXMAP_OP_EPILOGUE(pGC); -} - -GCOps XAAPixmapOps = { - XAAFillSpansPixmap, XAASetSpansPixmap, - XAAPutImagePixmap, XAACopyAreaPixmap, - XAACopyPlanePixmap, XAAPolyPointPixmap, - XAAPolylinesPixmap, XAAPolySegmentPixmap, - XAAPolyRectanglePixmap, XAAPolyArcPixmap, - XAAFillPolygonPixmap, XAAPolyFillRectPixmap, - XAAPolyFillArcPixmap, XAAPolyText8Pixmap, - XAAPolyText16Pixmap, XAAImageText8Pixmap, - XAAImageText16Pixmap, XAAImageGlyphBltPixmap, - XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap, -}; diff --git a/hw/xfree86/xaa/xaawrap.h b/hw/xfree86/xaa/xaawrap.h index 3e410db86..2b991f0c0 100644 --- a/hw/xfree86/xaa/xaawrap.h +++ b/hw/xfree86/xaa/xaawrap.h @@ -19,7 +19,7 @@ if(pGCPriv->flags) {\ pGCPriv->wrapOps = (pGC)->ops;\ (pGC)->ops = (pGCPriv->flags & OPS_ARE_ACCEL) ? pGCPriv->XAAOps :\ - &XAAPixmapOps;\ + &XAAFallbackOps;\ } @@ -39,25 +39,14 @@ SYNC_CHECK(pGC) -#define XAA_GC_OP_EPILOGUE(pGC)\ +#define XAA_GC_OP_EPILOGUE(pGC, pDraw)\ pGCPriv->wrapOps = pGC->ops;\ pGC->funcs = oldFuncs;\ - pGC->ops = pGCPriv->XAAOps - - -#define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\ - XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ - XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\ - GCFuncs *oldFuncs = pGC->funcs;\ - pGC->funcs = pGCPriv->wrapFuncs;\ - pGC->ops = pGCPriv->wrapOps; \ - SYNC_CHECK(pGC) - -#define XAA_PIXMAP_OP_EPILOGUE(pGC)\ - pGCPriv->wrapOps = pGC->ops;\ - pGC->funcs = oldFuncs;\ - pGC->ops = &XAAPixmapOps;\ - pixPriv->flags |= DIRTY + pGC->ops = pGCPriv->XAAOps;\ + if(pDraw->type == DRAWABLE_PIXMAP && !IS_OFFSCREEN_PIXMAP(pDraw)) {\ + XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\ + pixPriv->flags |= DIRTY;\ + } #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> |