diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-06-17 18:29:55 +0100 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-06-21 13:35:52 +0100 |
commit | 0098e0c8825debbf37272e0f2d34f63d2746229e (patch) | |
tree | 250db7437fa7173b57e007d43b96b2bc33517fc8 /uxa | |
parent | 3c678b179ba97e6cc95ee7f8c3961af77eb07c74 (diff) |
uxa: Use accelerated get_image for copying to !offscreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit d748f8e6fcebdf5b5b00c90b6c3d519560ee2928)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Diffstat (limited to 'uxa')
-rw-r--r-- | uxa/uxa-accel.c | 41 |
1 files 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, |