diff options
author | Søren Sandmann <ssp@redhat.com> | 2010-06-09 12:05:40 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-09-14 06:38:49 -0400 |
commit | cbc9f2bc2f05bb4f4589873b86776eb4a4bce65c (patch) | |
tree | 58aae6a9e0a9bc4a25e1f9e0b0d47adf3a37d466 | |
parent | 3169cd116ee7210589b6bb8718f401d2f68ab773 (diff) |
Add support for copying
-rw-r--r-- | src/qxl.h | 5 | ||||
-rw-r--r-- | src/qxl_driver.c | 95 |
2 files changed, 96 insertions, 4 deletions
@@ -629,6 +629,11 @@ struct _qxl_screen_t uint8_t slot_id_bits; uint8_t slot_gen_bits; uint64_t va_slot_mask; + + union + { + PixmapPtr copy_source; + } u; }; static inline Bool diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 75a9279..1fb693e 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -944,6 +944,93 @@ qxl_pixmap_is_offscreen (PixmapPtr pixmap) return FALSE; } +/* + * Copy + */ +static Bool +qxl_check_copy (PixmapPtr source, PixmapPtr dest, + int alu, Pixel planemask) +{ + if (!UXA_PM_IS_SOLID (&source->drawable, planemask)) + { + ErrorF ("non solid planemask\n"); + return FALSE; + } + + if (source->drawable.bitsPerPixel != dest->drawable.bitsPerPixel) + { + ErrorF ("differing bitsperpixel\n"); + return FALSE; + } + + if (source->drawable.bitsPerPixel != 16 && + source->drawable.bitsPerPixel != 32) + { + ErrorF ("bad bpp\n"); + return FALSE; + } + + /* FIXME: support other rops */ + if (alu != GXcopy) + { + ErrorF ("not gxcopy\n"); + return FALSE; + } + + return TRUE; +} + +static Bool +qxl_prepare_copy (PixmapPtr source, PixmapPtr dest, + int xdir, int ydir, int alu, + Pixel planemask) +{ + ScreenPtr pScreen = source->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + qxl_screen_t *qxl = pScrn->driverPrivate; + + qxl->u.copy_source = source; + + return TRUE; +} + +static Bool +qxl_copy (PixmapPtr dest, + int src_x1, int src_y1, + int dest_x1, int dest_y1, + int width, int height) +{ + ScreenPtr pScreen = dest->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + qxl_screen_t *qxl = pScrn->driverPrivate; + struct qxl_drawable *drawable; + struct qxl_rect qrect; + + assert (qxl->u.copy_source == pScreen->GetScreenPixmap (pScreen)); + + qrect.top = dest_y1; + qrect.bottom = dest_y1 + height; + qrect.left = dest_x1; + qrect.right = dest_x1 + width; + +/* ErrorF (" Translate %d %d %d %d by %d %d (offsets %d %d)\n", */ +/* b->x1, b->y1, b->x2, b->y2, */ +/* dx, dy, dst_xoff, dst_yoff); */ + + drawable = make_drawable (qxl, QXL_COPY_BITS, &qrect); + drawable->u.copy_bits.src_pos.x = src_x1; + drawable->u.copy_bits.src_pos.y = src_y1; + + push_drawable (qxl, drawable); + + return TRUE; +} + +static void +qxl_done_copy (PixmapPtr dest) +{ +} + static Bool setup_uxa (qxl_screen_t *qxl, ScreenPtr screen) { @@ -968,10 +1055,10 @@ setup_uxa (qxl_screen_t *qxl, ScreenPtr screen) qxl->uxa->done_solid = unaccel; /* Copy */ - qxl->uxa->check_copy = unaccel; - qxl->uxa->prepare_copy = unaccel; - qxl->uxa->copy = unaccel; - qxl->uxa->done_copy = unaccel; + qxl->uxa->check_copy = qxl_check_copy; + qxl->uxa->prepare_copy = qxl_prepare_copy; + qxl->uxa->copy = qxl_copy; + qxl->uxa->done_copy = qxl_done_copy; /* Composite */ qxl->uxa->check_composite = unaccel; |