summaryrefslogtreecommitdiff
path: root/uxa/uxa-accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-17 18:29:55 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-19 13:39:48 +0100
commitd748f8e6fcebdf5b5b00c90b6c3d519560ee2928 (patch)
tree103c51467af169a2110fffb2c890416f35a90f69 /uxa/uxa-accel.c
parent78ee25f005fac9e9cc85425aa3fca8c396d015ea (diff)
uxa: Use accelerated get_image for copying to !offscreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'uxa/uxa-accel.c')
-rw-r--r--uxa/uxa-accel.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 78d95628..acbc69f2 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -618,8 +618,45 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
goto fallback;
}
- if (!uxa_pixmap_is_offscreen(pDstPixmap))
- goto fallback;
+ if (!uxa_pixmap_is_offscreen(pDstPixmap)) {
+ int stride, bpp;
+ char *dst;
+
+ if (!uxa_pixmap_is_offscreen(pSrcPixmap))
+ goto fallback;
+
+ if (!uxa_screen->info->get_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;
+
+ dst = pDstPixmap->devPrivate.ptr;
+ stride = pDstPixmap->devKind;
+ bpp /= 8;
+ while (nbox--) {
+ if (!uxa_screen->info->get_image(pSrcPixmap,
+ pbox->x1 + src_off_x,
+ pbox->y1 + src_off_y,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1,
+ (char *) dst +
+ (pbox->y1 + dy + dst_off_y) * stride +
+ (pbox->x1 + dx + dst_off_x) * bpp,
+ stride))
+ goto fallback;
+
+ pbox++;
+ }
+
+ return;
+ }
if (uxa_pixmap_is_offscreen(pSrcPixmap)) {
if (!(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap,