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
exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
{
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
ExaPixmapPriv(pPixmap);
if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[1];
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_src = TRUE;
}
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = pReg;
exaDoMigration(pixmaps, 1, FALSE);
}
ExaDoPrepareAccess(pDrawable, index);
}

View File

@ -50,12 +50,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
int fullX1, fullX2, fullY1;
int partX1, partX2;
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 ||
pGC->fillStyle != FillSolid ||
@ -63,7 +57,14 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
{
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
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);
}
@ -375,7 +376,6 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
ExaPixmapPrivPtr pSrcExaPixmap, pDstExaPixmap;
int src_off_x, src_off_y;
int dst_off_x, dst_off_y;
ExaMigrationRec pixmaps[2];
RegionPtr srcregion = NULL, dstregion = NULL;
xRectangle *rects;
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);
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);
}
/* Mixed directions must be handled specially if the card is lame */
if ((pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
@ -766,7 +770,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
int xoff, yoff;
int xorg, yorg;
int n;
ExaMigrationRec pixmaps[2];
RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
/* Compute intersection of rects and clip region */
@ -777,11 +780,6 @@ exaPolyFillRect(DrawablePtr pDrawable,
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);
if (pExaScr->swappedOut || pExaPixmap->accel_blocked)
@ -814,7 +812,16 @@ exaPolyFillRect(DrawablePtr pDrawable,
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);
}
if (!exaPixmapIsOffscreen (pPixmap) ||
!(*pExaScr->info->PrepareSolid) (pPixmap,
@ -972,9 +979,17 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
ExaPixmapPriv (pPixmap);
int xoff, yoff;
ExaMigrationRec pixmaps[1];
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_src = FALSE;
pixmaps[0].pPix = pPixmap;
@ -982,13 +997,6 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
alu, clientClipType)
? NULL : pRegion;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (pExaPixmap->accel_blocked)
{
goto out;
} else {
exaDoMigration (pixmaps, 1, TRUE);
}
@ -1053,7 +1061,6 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
ExaPixmapPrivPtr pTileExaPixmap = ExaGetPixmapPriv(pTile);
int xoff, yoff;
int tileWidth, tileHeight;
ExaMigrationRec pixmaps[2];
int nbox = REGION_NUM_RECTS (pRegion);
BoxPtr pBox = REGION_RECTS (pRegion);
Bool ret = FALSE;
@ -1070,9 +1077,18 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
exaGetPixmapFirstPixel (pTile), planemask,
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_src = FALSE;
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
alu, clientClipType)
? NULL : pRegion;
@ -1081,12 +1097,6 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
pixmaps[1].pPix = pTile;
pixmaps[1].pReg = NULL;
pExaPixmap = ExaGetPixmapPriv (pPixmap);
if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked)
{
return FALSE;
} else {
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)
{
ExaScreenPriv (pDrawable->pScreen);
ExaMigrationRec pixmaps[1];
BoxRec Box;
RegionRec Reg;
PixmapPtr pPix;
PixmapPtr pPix = exaGetDrawablePixmap (pDrawable);
int xoff, yoff;
Bool ok;
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = &Reg;
if (pExaScr->swappedOut)
goto fallback;
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
BoxRec Box;
RegionRec Reg;
ExaMigrationRec pixmaps[1];
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);
if (pExaScr->swappedOut)
goto fallback;
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = &Reg;
exaDoMigration(pixmaps, 1, FALSE);
REGION_UNINIT(pScreen, &Reg);
}
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
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));
if (ok) {
exaWaitSync(pDrawable->pScreen);
goto out;
return;
}
fallback:
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;
ExaPixmapPriv(pGlyphPixmap);
PixmapPtr pCachePixmap = (PixmapPtr)cache->picture->pDrawable;
ExaMigrationRec pixmaps[1];
if (!pExaScr->info->UploadToScreen || pExaScr->swappedOut || pExaPixmap->accel_blocked)
goto composite;
@ -387,11 +386,15 @@ exaGlyphCacheUploadGlyph(ScreenPtr pScreen,
goto composite;
/* cache pixmap must be offscreen. */
if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[1];
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pCachePixmap;
pixmaps[0].pReg = NULL;
exaDoMigration (pixmaps, 1, TRUE);
}
if (!exaPixmapIsOffscreen(pCachePixmap))
goto composite;

View File

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