summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-08-30 13:54:18 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2007-09-07 18:41:32 +0200
commitea92ea415665e294a1ba233e9a1d39b6daa0cee1 (patch)
tree101eec0d43b0fe9a7361e3ae0fe245dbde19a7c5
parentaa2ed73e0ec881947c969b67269e3206da4de359 (diff)
EXA: exaGetImage improvements.
Use the new migration infrastructure to cache FB bits we need in the system copy, for the benefit of repeated calls.
-rw-r--r--exa/exa_accel.c51
-rw-r--r--exa/exa_priv.h6
-rw-r--r--exa/exa_unaccel.c13
3 files changed, 37 insertions, 33 deletions
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 36815e2cc..df6a62d68 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -1247,22 +1247,43 @@ exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
* Accelerates GetImage for solid ZPixmap downloads from framebuffer memory.
*
* This is probably the only case we actually care about. The rest fall through
- * to migration and ExaCheckGetImage, which hopefully will result in migration
- * pushing the pixmap out of framebuffer.
+ * to migration and fbGetImage, which hopefully will result in migration pushing
+ * the pixmap out of framebuffer.
*/
void
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;
int xoff, yoff;
Bool ok;
- if (pExaScr->swappedOut || (w == 1 && h == 1))
+ if (pExaScr->swappedOut)
goto fallback;
- if (pExaScr->info->DownloadFromScreen == NULL)
+ 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);
+
+ exaDoMigration(pixmaps, 1, FALSE);
+
+ pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
+
+ if (pPix == NULL || pExaScr->info->DownloadFromScreen == NULL)
goto fallback;
/* Only cover the ZPixmap, solid copy case. */
@@ -1275,20 +1296,22 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
if (pDrawable->bitsPerPixel < 8)
goto fallback;
- pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
- if (pPix == NULL)
- goto fallback;
-
- xoff += pDrawable->x;
- yoff += pDrawable->y;
-
- ok = pExaScr->info->DownloadFromScreen(pPix, x + xoff, y + yoff, w, h, d,
+ ok = pExaScr->info->DownloadFromScreen(pPix, pDrawable->x + x + xoff,
+ pDrawable->y + y + yoff, w, h, d,
PixmapBytePad(w, pDrawable->depth));
if (ok) {
exaWaitSync(pDrawable->pScreen);
- return;
+ goto out;
}
fallback:
- ExaCheckGetImage (pDrawable, x, y, w, h, format, planeMask, d);
+ EXA_FALLBACK(("from %p (%c)\n", pDrawable,
+ exaDrawableLocation(pDrawable)));
+
+ exaPrepareAccessReg (pDrawable, EXA_PREPARE_SRC, &Reg);
+ fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
+ exaFinishAccess (pDrawable, EXA_PREPARE_SRC);
+
+out:
+ REGION_UNINIT(pScreen, &Reg);
}
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index a8bdbd67e..8e51f5d72 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -265,12 +265,6 @@ ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
int w, int h, int x, int y);
void
-ExaCheckGetImage (DrawablePtr pDrawable,
- int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *d);
-
-void
ExaCheckGetSpans (DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt,
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 970c2cba2..8fb7b526e 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -265,19 +265,6 @@ ExaCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
}
void
-ExaCheckGetImage (DrawablePtr pDrawable,
- int x, int y, int w, int h,
- unsigned int format, unsigned long planeMask,
- char *d)
-{
- EXA_FALLBACK(("from %p (%c)\n", pDrawable,
- exaDrawableLocation(pDrawable)));
- exaPrepareAccess (pDrawable, EXA_PREPARE_SRC);
- fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
- exaFinishAccess (pDrawable, EXA_PREPARE_SRC);
-}
-
-void
ExaCheckGetSpans (DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt,