From 0098e0c8825debbf37272e0f2d34f63d2746229e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 17 Jun 2010 18:29:55 +0100 Subject: uxa: Use accelerated get_image for copying to !offscreen Signed-off-by: Chris Wilson (cherry picked from commit d748f8e6fcebdf5b5b00c90b6c3d519560ee2928) Signed-off-by: Owain G. Ainsworth --- uxa/uxa-accel.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c index f19c9a07..2b43343c 100644 --- a/uxa/uxa-accel.c +++ b/uxa/uxa-accel.c @@ -613,8 +613,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, -- cgit v1.2.3