EXA: exaFillRegion{Solid,Tiled} improvements.

Use region to exclude bits that will be overwritten from migration.

Also make exaFillRegionSolid use the same logic as exaFillRegionTiled.
This commit is contained in:
Michel Dänzer 2007-09-03 13:14:29 +02:00
parent 5f7da4da8d
commit e81af8ba64

View File

@ -1074,7 +1074,11 @@ exaFillRegionSolid (DrawablePtr pDrawable,
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 = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = NULL; pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
alu) ? NULL : pRegion;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (pPixmap->drawable.width > pExaScr->info->maxX || if (pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
@ -1090,8 +1094,6 @@ exaFillRegionSolid (DrawablePtr pDrawable,
int nbox; int nbox;
BoxPtr pBox; BoxPtr pBox;
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
nbox = REGION_NUM_RECTS (pRegion); nbox = REGION_NUM_RECTS (pRegion);
pBox = REGION_RECTS (pRegion); pBox = REGION_RECTS (pRegion);
@ -1124,19 +1126,21 @@ exaFillRegionSolid (DrawablePtr pDrawable,
} }
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff); REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
return TRUE;
} }
else
{
fallback: fallback:
if (alu != GXcopy || planemask != FB_ALLONES) if (alu != GXcopy || !EXA_PM_IS_SOLID(pDrawable, planemask)) {
return FALSE; REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
EXA_FALLBACK(("to %p (%c)\n", pDrawable, return FALSE;
exaDrawableLocation(pDrawable)));
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
fbFillRegionSolid (pDrawable, pRegion, 0,
fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
} }
EXA_FALLBACK(("to %p (%c)\n", pDrawable,
exaDrawableLocation(pDrawable)));
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
fbFillRegionSolid (pDrawable, pRegion, 0,
fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
return TRUE; return TRUE;
} }
@ -1174,12 +1178,16 @@ exaFillRegionTiled (DrawablePtr pDrawable,
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 = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pReg = NULL; pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
alu) ? NULL : pRegion;
pixmaps[1].as_dst = FALSE; pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE; pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pTile; pixmaps[1].pPix = pTile;
pixmaps[1].pReg = NULL; pixmaps[1].pReg = NULL;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
REGION_TRANSLATE(pScreen, pRegion, xoff, yoff);
if (pPixmap->drawable.width > pExaScr->info->maxX || if (pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY || pPixmap->drawable.height > pExaScr->info->maxY ||
tileWidth > pExaScr->info->maxX || tileWidth > pExaScr->info->maxX ||
@ -1208,7 +1216,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
int dstY = pBox->y1; int dstY = pBox->y1;
int tileY; int tileY;
tileY = (dstY - pDrawable->y - pPatOrg->y) % tileHeight; tileY = (dstY - yoff - pDrawable->y - pPatOrg->y) % tileHeight;
while (height > 0) { while (height > 0) {
int width = pBox->x2 - pBox->x1; int width = pBox->x2 - pBox->x1;
int dstX = pBox->x1; int dstX = pBox->x1;
@ -1219,7 +1227,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
h = height; h = height;
height -= h; height -= h;
tileX = (dstX - pDrawable->x - pPatOrg->x) % tileWidth; tileX = (dstX - xoff - pDrawable->x - pPatOrg->x) % tileWidth;
while (width > 0) { while (width > 0) {
int w = tileWidth - tileX; int w = tileWidth - tileX;
if (w > width) if (w > width)
@ -1228,8 +1236,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
(*pExaScr->info->Copy) (pPixmap, (*pExaScr->info->Copy) (pPixmap,
tileX + tileXoff, tileY + tileYoff, tileX + tileXoff, tileY + tileYoff,
dstX + xoff, dstY + yoff, dstX, dstY, w, h);
w, h);
dstX += w; dstX += w;
tileX = 0; tileX = 0;
} }
@ -1240,16 +1247,20 @@ exaFillRegionTiled (DrawablePtr pDrawable,
} }
(*pExaScr->info->DoneCopy) (pPixmap); (*pExaScr->info->DoneCopy) (pPixmap);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
return TRUE; return TRUE;
} }
fallback: fallback:
if (alu != GXcopy || planemask != FB_ALLONES) if (alu != GXcopy || !EXA_PM_IS_SOLID(pDrawable, planemask)) {
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
return FALSE; return FALSE;
}
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable, EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable,
exaDrawableLocation(&pTile->drawable), exaDrawableLocation(&pTile->drawable),
exaDrawableLocation(pDrawable))); exaDrawableLocation(pDrawable)));
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg); exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
REGION_TRANSLATE(pScreen, pRegion, -xoff, -yoff);
exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC); exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
fbFillRegionTiled (pDrawable, pRegion, pTile); fbFillRegionTiled (pDrawable, pRegion, pTile);
exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC); exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);