summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-11-17 10:28:48 +1000
committerDave Airlie <airlied@redhat.com>2008-11-17 19:15:20 +1000
commit08cd361234ed0410f67342f46ae01120c4fe3331 (patch)
tree37af35f5c6c053b20eb1ddaac18aecfed805e723
parent8f8a9c19ad58768b07461a3f4bccea98f7c4f958 (diff)
exa: avoid doing prepare/done without intervening copies in exaFillRegionTiled
This does a precursor check to make sure the copies are required before entering the prepare/done code.
-rw-r--r--exa/exa_accel.c61
1 files changed, 39 insertions, 22 deletions
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index ccef74422..f72a08ac3 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -1233,36 +1233,53 @@ exaFillRegionTiled (DrawablePtr pDrawable,
*/
if (alu != GXcopy)
ret = TRUE;
- else if ((*pExaScr->info->PrepareCopy) (pPixmap, pPixmap, 1, 1, alu,
- planemask)) {
- for (i = 0; i < nbox; i++)
- {
+ else {
+ Bool more_copy = FALSE;
+
+ for (i = 0; i < nbox; i++) {
int dstX = pBox[i].x1 + tileWidth;
int dstY = pBox[i].y1 + tileHeight;
- int width = min(pBox[i].x2 - dstX, tileWidth);
- int height = min(pBox[i].y2 - pBox[i].y1, tileHeight);
-
- while (dstX < pBox[i].x2) {
- (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
- dstX, pBox[i].y1, width, height);
- dstX += width;
- width = min(pBox[i].x2 - dstX, width * 2);
+
+ if ((dstX < pBox[i].x2) || (dstY < pBox[i].y2)) {
+ more_copy = TRUE;
+ break;
}
+ }
+
+ if (more_copy == FALSE)
+ ret = TRUE;
+
+ if (more_copy && (*pExaScr->info->PrepareCopy) (pPixmap, pPixmap,
+ 1, 1, alu, planemask)) {
+ for (i = 0; i < nbox; i++)
+ {
+ int dstX = pBox[i].x1 + tileWidth;
+ int dstY = pBox[i].y1 + tileHeight;
+ int width = min(pBox[i].x2 - dstX, tileWidth);
+ int height = min(pBox[i].y2 - pBox[i].y1, tileHeight);
+
+ while (dstX < pBox[i].x2) {
+ (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
+ dstX, pBox[i].y1, width, height);
+ dstX += width;
+ width = min(pBox[i].x2 - dstX, width * 2);
+ }
- width = pBox[i].x2 - pBox[i].x1;
- height = min(pBox[i].y2 - dstY, tileHeight);
+ width = pBox[i].x2 - pBox[i].x1;
+ height = min(pBox[i].y2 - dstY, tileHeight);
- while (dstY < pBox[i].y2) {
- (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
- pBox[i].x1, dstY, width, height);
- dstY += height;
- height = min(pBox[i].y2 - dstY, height * 2);
+ while (dstY < pBox[i].y2) {
+ (*pExaScr->info->Copy) (pPixmap, pBox[i].x1, pBox[i].y1,
+ pBox[i].x1, dstY, width, height);
+ dstY += height;
+ height = min(pBox[i].y2 - dstY, height * 2);
+ }
}
- }
- (*pExaScr->info->DoneCopy) (pPixmap);
+ (*pExaScr->info->DoneCopy) (pPixmap);
- ret = TRUE;
+ ret = TRUE;
+ }
}
exaMarkSync(pDrawable->pScreen);