EXA: Completely eliminate exaDoMigration calls for drivers that manage pixmaps.

This commit is contained in:
Michel Dänzer 2009-07-20 02:04:40 +02:00
parent 7b9915b11e
commit 00fe4a2977
4 changed files with 156 additions and 127 deletions

View File

@ -616,6 +616,10 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
void void
exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg) exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
{ {
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
ExaPixmapPriv(pPixmap);
if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) { if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
@ -625,10 +629,11 @@ exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
pixmaps[0].as_dst = FALSE; pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
} }
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = pReg; pixmaps[0].pReg = pReg;
exaDoMigration(pixmaps, 1, FALSE); exaDoMigration(pixmaps, 1, FALSE);
}
ExaDoPrepareAccess(pDrawable, index); ExaDoPrepareAccess(pDrawable, index);
} }

View File

@ -50,12 +50,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
int fullX1, fullX2, fullY1; int fullX1, fullX2, fullY1;
int partX1, partX2; int partX1, partX2;
int off_x, off_y; int off_x, off_y;
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = NULL;
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid || pGC->fillStyle != FillSolid ||
@ -63,7 +57,14 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
{ {
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
return; return;
} else { } else if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = NULL;
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
} }
@ -375,7 +376,6 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
ExaPixmapPrivPtr pSrcExaPixmap, pDstExaPixmap; ExaPixmapPrivPtr pSrcExaPixmap, pDstExaPixmap;
int src_off_x, src_off_y; int src_off_x, src_off_y;
int dst_off_x, dst_off_y; int dst_off_x, dst_off_y;
ExaMigrationRec pixmaps[2];
RegionPtr srcregion = NULL, dstregion = NULL; RegionPtr srcregion = NULL, dstregion = NULL;
xRectangle *rects; xRectangle *rects;
Bool ret = TRUE; Bool ret = TRUE;
@ -425,14 +425,6 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
} }
} }
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pDstPixmap;
pixmaps[0].pReg = dstregion;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pSrcPixmap;
pixmaps[1].pReg = srcregion;
pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap); pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap);
pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap); pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
@ -466,7 +458,19 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
} }
} }
if (pDstExaPixmap->pDamage) {
ExaMigrationRec pixmaps[2];
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pDstPixmap;
pixmaps[0].pReg = dstregion;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pSrcPixmap;
pixmaps[1].pReg = srcregion;
exaDoMigration (pixmaps, 2, TRUE); exaDoMigration (pixmaps, 2, TRUE);
}
/* Mixed directions must be handled specially if the card is lame */ /* Mixed directions must be handled specially if the card is lame */
if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) && if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
@ -766,7 +770,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
int xoff, yoff; int xoff, yoff;
int xorg, yorg; int xorg, yorg;
int n; int n;
ExaMigrationRec pixmaps[2];
RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED); RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
/* Compute intersection of rects and clip region */ /* Compute intersection of rects and clip region */
@ -777,11 +780,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
goto out; goto out;
} }
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = NULL;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff); exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
if (pExaScr->swappedOut || pExaPixmap->accel_blocked) if (pExaScr->swappedOut || pExaPixmap->accel_blocked)
@ -814,7 +812,16 @@ exaPolyFillRect(DrawablePtr pDrawable,
goto fallback; goto fallback;
} }
if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[2];
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = NULL;
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
}
if (!exaPixmapIsOffscreen (pPixmap) || if (!exaPixmapIsOffscreen (pPixmap) ||
!(*pExaScr->info->PrepareSolid) (pPixmap, !(*pExaScr->info->PrepareSolid) (pPixmap,
@ -972,9 +979,17 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable); PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
ExaPixmapPriv (pPixmap); ExaPixmapPriv (pPixmap);
int xoff, yoff; int xoff, yoff;
ExaMigrationRec pixmaps[1];
Bool ret = FALSE; Bool ret = FALSE;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (pExaPixmap->accel_blocked)
{
goto out;
} else if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap; pixmaps[0].pPix = pPixmap;
@ -982,13 +997,6 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
alu, clientClipType) alu, clientClipType)
? NULL : pRegion; ? NULL : pRegion;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (pExaPixmap->accel_blocked)
{
goto out;
} else {
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
} }
@ -1053,7 +1061,6 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
ExaPixmapPrivPtr pTileExaPixmap = ExaGetPixmapPriv(pTile); ExaPixmapPrivPtr pTileExaPixmap = ExaGetPixmapPriv(pTile);
int xoff, yoff; int xoff, yoff;
int tileWidth, tileHeight; int tileWidth, tileHeight;
ExaMigrationRec pixmaps[2];
int nbox = REGION_NUM_RECTS (pRegion); int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion); BoxPtr pBox = REGION_RECTS (pRegion);
Bool ret = FALSE; Bool ret = FALSE;
@ -1070,9 +1077,18 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
exaGetPixmapFirstPixel (pTile), planemask, exaGetPixmapFirstPixel (pTile), planemask,
alu, clientClipType); alu, clientClipType);
pPixmap = exaGetDrawablePixmap (pDrawable);
pExaPixmap = ExaGetPixmapPriv (pPixmap);
if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked)
{
return FALSE;
} else if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[2];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled, pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
alu, clientClipType) alu, clientClipType)
? NULL : pRegion; ? NULL : pRegion;
@ -1081,12 +1097,6 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
pixmaps[1].pPix = pTile; pixmaps[1].pPix = pTile;
pixmaps[1].pReg = NULL; pixmaps[1].pReg = NULL;
pExaPixmap = ExaGetPixmapPriv (pPixmap);
if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked)
{
return FALSE;
} else {
exaDoMigration (pixmaps, 2, TRUE); exaDoMigration (pixmaps, 2, TRUE);
} }
@ -1225,17 +1235,17 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d) unsigned int format, unsigned long planeMask, char *d)
{ {
ExaScreenPriv (pDrawable->pScreen); ExaScreenPriv (pDrawable->pScreen);
ExaMigrationRec pixmaps[1]; PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
BoxRec Box;
RegionRec Reg;
PixmapPtr pPix;
int xoff, yoff; int xoff, yoff;
Bool ok; Bool ok;
pixmaps[0].as_dst = FALSE; if (pExaScr->swappedOut)
pixmaps[0].as_src = TRUE; goto fallback;
pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = &Reg; if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
BoxRec Box;
RegionRec Reg;
ExaMigrationRec pixmaps[1];
exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff); exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff);
@ -1246,11 +1256,16 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
REGION_INIT(pScreen, &Reg, &Box, 1); REGION_INIT(pScreen, &Reg, &Box, 1);
if (pExaScr->swappedOut) pixmaps[0].as_dst = FALSE;
goto fallback; pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = &Reg;
exaDoMigration(pixmaps, 1, FALSE); exaDoMigration(pixmaps, 1, FALSE);
REGION_UNINIT(pScreen, &Reg);
}
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
if (pPix == NULL || pExaScr->info->DownloadFromScreen == NULL) if (pPix == NULL || pExaScr->info->DownloadFromScreen == NULL)
@ -1271,12 +1286,9 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
PixmapBytePad(w, pDrawable->depth)); PixmapBytePad(w, pDrawable->depth));
if (ok) { if (ok) {
exaWaitSync(pDrawable->pScreen); exaWaitSync(pDrawable->pScreen);
goto out; return;
} }
fallback: fallback:
ExaCheckGetImage(pDrawable, x, y, w, h, format, planeMask, d); ExaCheckGetImage(pDrawable, x, y, w, h, format, planeMask, d);
out:
REGION_UNINIT(pScreen, &Reg);
} }

View File

@ -372,7 +372,6 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
PixmapPtr pGlyphPixmap = (PixmapPtr)pGlyphPicture->pDrawable; PixmapPtr pGlyphPixmap = (PixmapPtr)pGlyphPicture->pDrawable;
ExaPixmapPriv(pGlyphPixmap); ExaPixmapPriv(pGlyphPixmap);
PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable; PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
ExaMigrationRec pixmaps[1];
if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked) if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
goto composite; goto composite;
@ -387,11 +386,15 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
goto composite; goto composite;
/* cache pixmap must be offscreen. */ /* cache pixmap must be offscreen. */
if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pCachePixmap; pixmaps[0].pPix = pCachePixmap;
pixmaps[0].pReg = NULL; pixmaps[0].pReg = NULL;
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
}
if (!exaPixmapIsOffscreen(pCachePixmap)) if (!exaPixmapIsOffscreen(pCachePixmap))
goto composite; goto composite;

View File

@ -253,7 +253,6 @@ exaTryDriverSolidFill(PicturePtr pSrc,
ExaPixmapPrivPtr pSrcExaPix, pDstExaPix; ExaPixmapPrivPtr pSrcExaPix, pDstExaPix;
CARD32 pixel; CARD32 pixel;
CARD16 red, green, blue, alpha; CARD16 red, green, blue, alpha;
ExaMigrationRec pixmaps[1];
pDstPix = exaGetDrawablePixmap (pDst->pDrawable); pDstPix = exaGetDrawablePixmap (pDst->pDrawable);
pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable); pSrcPix = exaGetDrawablePixmap (pSrc->pDrawable);
@ -284,11 +283,15 @@ exaTryDriverSolidFill(PicturePtr pSrc,
pixel = exaGetPixmapFirstPixel (pSrcPix); pixel = exaGetPixmapFirstPixel (pSrcPix);
if (pDstExaPix->pDamage) {
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pDstPix; pixmaps[0].pPix = pDstPix;
pixmaps[0].pReg = &region; pixmaps[0].pReg = &region;
exaDoMigration(pixmaps, 1, TRUE); exaDoMigration(pixmaps, 1, TRUE);
}
if (!exaPixmapIsOffscreen(pDstPix)) { if (!exaPixmapIsOffscreen(pDstPix)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
@ -343,7 +346,6 @@ exaTryDriverCompositeRects(CARD8 op,
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y; int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix; ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix;
ExaMigrationRec pixmaps[3];
if (!pExaScr->info->PrepareComposite) if (!pExaScr->info->PrepareComposite)
return -1; return -1;
@ -375,6 +377,9 @@ exaTryDriverCompositeRects(CARD8 op,
return -1; return -1;
} }
if (pDstExaPix->pDamage) {
ExaMigrationRec pixmaps[3];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = exaOpReadsDestination(op); pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[0].pPix = pDstPix; pixmaps[0].pPix = pDstPix;
@ -391,6 +396,7 @@ exaTryDriverCompositeRects(CARD8 op,
exaDoMigration(pixmaps, 3, TRUE); exaDoMigration(pixmaps, 3, TRUE);
} else } else
exaDoMigration(pixmaps, 2, TRUE); exaDoMigration(pixmaps, 2, TRUE);
}
pDstPix = exaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y); pDstPix = exaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix) if (!pDstPix)
@ -615,7 +621,6 @@ exaTryDriverComposite(CARD8 op,
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y; int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix; ExaPixmapPrivPtr pSrcExaPix, pMaskExaPix = NULL, pDstExaPix;
ExaMigrationRec pixmaps[3];
pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable); pSrcPix = exaGetDrawablePixmap(pSrc->pDrawable);
pSrcExaPix = ExaGetPixmapPriv(pSrcPix); pSrcExaPix = ExaGetPixmapPriv(pSrcPix);
@ -665,6 +670,9 @@ exaTryDriverComposite(CARD8 op,
REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y); REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
if (pDstExaPix->pDamage) {
ExaMigrationRec pixmaps[3];
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = exaOpReadsDestination(op); pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[0].pPix = pDstPix; pixmaps[0].pPix = pDstPix;
@ -682,6 +690,7 @@ exaTryDriverComposite(CARD8 op,
} else { } else {
exaDoMigration(pixmaps, 2, TRUE); exaDoMigration(pixmaps, 2, TRUE);
} }
}
pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y); pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
if (pMask) if (pMask)