summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-14 14:54:34 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-04-14 17:10:09 +0100
commit2d17bd50af367bead84985c22fdd43d264a5f072 (patch)
tree7d9ea58141a095f2f642ab8bf9f5bd48714aedaa
parent1cc2c2c44ac72460cf1c4e6bdc13c612235809c9 (diff)
Revert "Revert "uxa: Try using put_image when copying from a memory buffer.""
This reverts commit 6d50553e8f70d8f2142efdfd6c90bc27a599d0bc. Now we have taught the fallback path not to infinitely recurse, re-enable the accelerated path for ShmPutImage and friends.
-rw-r--r--uxa/uxa-accel.c51
1 files changed, 43 insertions, 8 deletions
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index cd3e477b..4f7fd41c 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -450,18 +450,19 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
goto fallback;
}
- if (!uxa_pixmap_is_offscreen(pSrcPixmap) ||
- !uxa_pixmap_is_offscreen(pDstPixmap) ||
- !(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap,
+ if (!uxa_pixmap_is_offscreen(pDstPixmap))
+ goto fallback;
+
+ if (uxa_pixmap_is_offscreen(pSrcPixmap)) {
+ if (!(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap,
reverse ? -1 : 1,
upsidedown ? -1 : 1,
pGC ? pGC->alu : GXcopy,
pGC ? pGC->
- planemask : FB_ALLONES)) {
+ planemask : FB_ALLONES))
goto fallback;
- }
- while (nbox--) {
+ while (nbox--) {
(*uxa_screen->info->copy) (pDstPixmap,
pbox->x1 + dx + src_off_x,
pbox->y1 + dy + src_off_y,
@@ -470,9 +471,43 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
- }
+ }
+
+ (*uxa_screen->info->done_copy) (pDstPixmap);
+ } else {
+ int stride, bpp;
+ char *src;
- (*uxa_screen->info->done_copy) (pDstPixmap);
+ if (!uxa_screen->info->put_image)
+ goto fallback;
+
+ /* Don't bother with under 8bpp, XYPixmaps. */
+ bpp = pSrcPixmap->drawable.bitsPerPixel;
+ if (bpp != pDstDrawable->bitsPerPixel || bpp < 8)
+ goto fallback;
+
+ /* Only accelerate copies: no rop or planemask. */
+ if (pGC && (!UXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask) || pGC->alu != GXcopy))
+ goto fallback;
+
+ src = pSrcPixmap->devPrivate.ptr;
+ stride = pSrcPixmap->devKind;
+ bpp /= 8;
+ while (nbox--) {
+ if (!uxa_screen->info->put_image(pDstPixmap,
+ pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1,
+ (char *) src +
+ (pbox->y1 + dy + src_off_y) * stride +
+ (pbox->x1 + dx + src_off_x) * bpp,
+ stride))
+ goto fallback;
+
+ pbox++;
+ }
+ }
return;