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,19 +616,24 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
void void
exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg) exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
{ {
ExaMigrationRec pixmaps[1]; PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
ExaPixmapPriv(pPixmap);
if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) { if (pExaPixmap->pDamage) {
pixmaps[0].as_dst = TRUE; ExaMigrationRec pixmaps[1];
pixmaps[0].as_src = FALSE;
} else { if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
pixmaps[0].as_dst = FALSE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = FALSE;
} else {
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
}
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = pReg;
exaDoMigration(pixmaps, 1, FALSE);
} }
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = pReg;
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,
} }
} }
exaDoMigration (pixmaps, 2, TRUE); 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 */ /* 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;
} }
exaDoMigration (pixmaps, 1, TRUE); 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) || if (!exaPixmapIsOffscreen (pPixmap) ||
!(*pExaScr->info->PrepareSolid) (pPixmap, !(*pExaScr->info->PrepareSolid) (pPixmap,
@ -972,23 +979,24 @@ 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;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
alu, clientClipType)
? NULL : pRegion;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff); exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff); REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (pExaPixmap->accel_blocked) if (pExaPixmap->accel_blocked)
{ {
goto out; goto out;
} 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 = exaGCReadsDestination(pDrawable, planemask, FillSolid,
alu, clientClipType)
? NULL : pRegion;
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,23 +1077,26 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
exaGetPixmapFirstPixel (pTile), planemask, exaGetPixmapFirstPixel (pTile), planemask,
alu, clientClipType); alu, clientClipType);
pixmaps[0].as_dst = TRUE; pPixmap = exaGetDrawablePixmap (pDrawable);
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
alu, clientClipType)
? NULL : pRegion;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pTile;
pixmaps[1].pReg = NULL;
pExaPixmap = ExaGetPixmapPriv (pPixmap); pExaPixmap = ExaGetPixmapPriv (pPixmap);
if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked) if (pExaPixmap->accel_blocked || pTileExaPixmap->accel_blocked)
{ {
return FALSE; return FALSE;
} else { } else if (pExaPixmap->pDamage) {
ExaMigrationRec pixmaps[2];
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
alu, clientClipType)
? NULL : pRegion;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pTile;
pixmaps[1].pReg = NULL;
exaDoMigration (pixmaps, 2, TRUE); exaDoMigration (pixmaps, 2, TRUE);
} }
@ -1225,31 +1235,36 @@ 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;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPix = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = &Reg;
exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff);
Box.x1 = pDrawable->y + x + xoff;
Box.y1 = pDrawable->y + y + yoff;
Box.x2 = Box.x1 + w;
Box.y2 = Box.y1 + h;
REGION_INIT(pScreen, &Reg, &Box, 1);
if (pExaScr->swappedOut) if (pExaScr->swappedOut)
goto fallback; goto fallback;
exaDoMigration(pixmaps, 1, FALSE); if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
BoxRec Box;
RegionRec Reg;
ExaMigrationRec pixmaps[1];
exaGetDrawableDeltas (pDrawable, pPix, &xoff, &yoff);
Box.x1 = pDrawable->y + x + xoff;
Box.y1 = pDrawable->y + y + yoff;
Box.x2 = Box.x1 + w;
Box.y2 = Box.y1 + h;
REGION_INIT(pScreen, &Reg, &Box, 1);
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); pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
@ -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. */
pixmaps[0].as_dst = TRUE; if (pExaPixmap->pDamage) {
pixmaps[0].as_src = FALSE; ExaMigrationRec pixmaps[1];
pixmaps[0].pPix = pCachePixmap;
pixmaps[0].pReg = NULL; pixmaps[0].as_dst = TRUE;
exaDoMigration (pixmaps, 1, TRUE); pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pCachePixmap;
pixmaps[0].pReg = NULL;
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);
pixmaps[0].as_dst = TRUE; if (pDstExaPix->pDamage) {
pixmaps[0].as_src = FALSE; ExaMigrationRec pixmaps[1];
pixmaps[0].pPix = pDstPix;
pixmaps[0].pReg = &region; pixmaps[0].as_dst = TRUE;
exaDoMigration(pixmaps, 1, TRUE); pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pDstPix;
pixmaps[0].pReg = &region;
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;
@ -374,23 +376,27 @@ exaTryDriverCompositeRects(CARD8 op,
{ {
return -1; return -1;
} }
pixmaps[0].as_dst = TRUE; if (pDstExaPix->pDamage) {
pixmaps[0].as_src = exaOpReadsDestination(op); ExaMigrationRec pixmaps[3];
pixmaps[0].pPix = pDstPix;
pixmaps[0].pReg = NULL; pixmaps[0].as_dst = TRUE;
pixmaps[1].as_dst = FALSE; pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[1].as_src = TRUE; pixmaps[0].pPix = pDstPix;
pixmaps[1].pPix = pSrcPix; pixmaps[0].pReg = NULL;
pixmaps[1].pReg = NULL; pixmaps[1].as_dst = FALSE;
if (pMask) { pixmaps[1].as_src = TRUE;
pixmaps[2].as_dst = FALSE; pixmaps[1].pPix = pSrcPix;
pixmaps[2].as_src = TRUE; pixmaps[1].pReg = NULL;
pixmaps[2].pPix = pMaskPix; if (pMask) {
pixmaps[2].pReg = NULL; pixmaps[2].as_dst = FALSE;
exaDoMigration(pixmaps, 3, TRUE); pixmaps[2].as_src = TRUE;
} else pixmaps[2].pPix = pMaskPix;
exaDoMigration(pixmaps, 2, TRUE); pixmaps[2].pReg = NULL;
exaDoMigration(pixmaps, 3, TRUE);
} else
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,22 +670,26 @@ exaTryDriverComposite(CARD8 op,
REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y); REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
pixmaps[0].as_dst = TRUE; if (pDstExaPix->pDamage) {
pixmaps[0].as_src = exaOpReadsDestination(op); ExaMigrationRec pixmaps[3];
pixmaps[0].pPix = pDstPix;
pixmaps[0].pReg = pixmaps[0].as_src ? NULL : &region; pixmaps[0].as_dst = TRUE;
pixmaps[1].as_dst = FALSE; pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[1].as_src = TRUE; pixmaps[0].pPix = pDstPix;
pixmaps[1].pPix = pSrcPix; pixmaps[0].pReg = pixmaps[0].as_src ? NULL : &region;
pixmaps[1].pReg = NULL; pixmaps[1].as_dst = FALSE;
if (pMask) { pixmaps[1].as_src = TRUE;
pixmaps[2].as_dst = FALSE; pixmaps[1].pPix = pSrcPix;
pixmaps[2].as_src = TRUE; pixmaps[1].pReg = NULL;
pixmaps[2].pPix = pMaskPix; if (pMask) {
pixmaps[2].pReg = NULL; pixmaps[2].as_dst = FALSE;
exaDoMigration(pixmaps, 3, TRUE); pixmaps[2].as_src = TRUE;
} else { pixmaps[2].pPix = pMaskPix;
exaDoMigration(pixmaps, 2, TRUE); pixmaps[2].pReg = NULL;
exaDoMigration(pixmaps, 3, TRUE);
} else {
exaDoMigration(pixmaps, 2, TRUE);
}
} }
pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y); pSrcPix = exaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);