diff options
author | Søren Sandmann <ssp@redhat.com> | 2010-10-15 11:49:28 -0400 |
---|---|---|
committer | Søren Sandmann <ssp@redhat.com> | 2010-10-15 11:49:28 -0400 |
commit | f664654e41fcf6ddef30af0855f757a454b5aac3 (patch) | |
tree | dbfcd239848de158ef6dd22601d63f97d7303327 | |
parent | 47e128ea5791a70e5155fc40be81bddd2b1138d8 (diff) |
Add put_image() acceleration
-rw-r--r-- | src/qxl.h | 4 | ||||
-rw-r--r-- | src/qxl_driver.c | 14 | ||||
-rw-r--r-- | src/qxl_surface.c | 40 |
3 files changed, 57 insertions, 1 deletions
@@ -814,6 +814,10 @@ void qxl_surface_copy (qxl_surface_t *dest, int src_x1, int src_y1, int dest_x1, int dest_y1, int width, int height); +Bool qxl_surface_put_image (qxl_surface_t *dest, + int x, int y, int width, int height, + const char *src, int src_pitch); + extern DevPrivateKeyRec uxa_pixmap_index; diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 8b9a86d..3e3beaa 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -1024,6 +1024,18 @@ qxl_done_copy (PixmapPtr dest) { } +static Bool +qxl_put_image (PixmapPtr *pDst, int x, int y, int w, int h, + char *src, int src_pitch) +{ + qxl_surface_t *surface = get_surface (pDst); + + if (surface) + return qxl_surface_put_image (surface, x, y, w, h, src, src_pitch); + + return FALSE; +} + static void qxl_set_screen_pixmap (PixmapPtr pixmap) { @@ -1125,7 +1137,7 @@ setup_uxa (qxl_screen_t *qxl, ScreenPtr screen) qxl->uxa->done_composite = unaccel; /* PutImage */ - qxl->uxa->put_image = unaccel; + qxl->uxa->put_image = qxl_put_image; /* Prepare access */ qxl->uxa->prepare_access = qxl_prepare_access; diff --git a/src/qxl_surface.c b/src/qxl_surface.c index c84fb03..65d259a 100644 --- a/src/qxl_surface.c +++ b/src/qxl_surface.c @@ -971,3 +971,43 @@ qxl_surface_copy (qxl_surface_t *dest, push_drawable (qxl, drawable); } + +Bool +qxl_surface_put_image (qxl_surface_t *dest, + int x, int y, int width, int height, + const char *src, int src_pitch) +{ + struct qxl_drawable *drawable; + qxl_screen_t *qxl = dest->qxl; + struct qxl_rect rect; + struct qxl_image *image; + + rect.left = x; + rect.right = x + width; + rect.top = y; + rect.bottom = y + height; + + drawable = make_drawable (qxl, dest->id, QXL_DRAW_COPY, &rect); + + drawable->u.copy.src_area.top = 0; + drawable->u.copy.src_area.bottom = height; + drawable->u.copy.src_area.left = 0; + drawable->u.copy.src_area.right = width; + + drawable->u.copy.rop_descriptor = ROPD_OP_PUT; + drawable->u.copy.scale_mode = 0; + drawable->u.copy.mask.flags = 0; + drawable->u.copy.mask.pos.x = 0; + drawable->u.copy.mask.pos.y = 0; + drawable->u.copy.mask.bitmap = 0; + + image = qxl_image_create ( + qxl, (const uint8_t *)src, 0, 0, width, height, src_pitch, + dest->Bpp); + drawable->u.copy.src_bitmap = + physical_address (qxl, image, qxl->main_mem_slot); + + push_drawable (qxl, drawable); + + return TRUE; +} |