diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-28 18:22:01 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-28 18:59:50 +0000 |
commit | 8657128fa7e758a2dde93340d6e58928d5f11255 (patch) | |
tree | 400f3a39f49ac1f51032abb34f7577c380f43c0d | |
parent | 4e38d22105da2bd97db005dc505e75dcd22291d3 (diff) |
sna: Pass the pixmap to sna_replace()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 2 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 19 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 15 | ||||
-rw-r--r-- | src/sna/sna_io.c | 39 |
4 files changed, 32 insertions, 43 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 4377774c..c0ac8882 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -626,8 +626,8 @@ void sna_write_boxes(struct sna *sna, const BoxRec *box, int n); struct kgem_bo *sna_replace(struct sna *sna, + PixmapPtr pixmap, struct kgem_bo *bo, - int width, int height, int bpp, const void *src, int stride); Bool diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 90c30469..c467f744 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -796,10 +796,8 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box) box->y2 >= pixmap->drawable.height) { priv->gpu_bo = sna_replace(sna, + pixmap, priv->gpu_bo, - pixmap->drawable.width, - pixmap->drawable.height, - pixmap->drawable.bitsPerPixel, pixmap->devPrivate.ptr, pixmap->devKind); } else { @@ -1106,10 +1104,8 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap) box->y2 >= pixmap->drawable.height) { priv->gpu_bo = sna_replace(sna, + pixmap, priv->gpu_bo, - pixmap->drawable.width, - pixmap->drawable.height, - pixmap->drawable.bitsPerPixel, pixmap->devPrivate.ptr, pixmap->devKind); } else { @@ -1343,11 +1339,7 @@ sna_put_image_upload_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, box->x2 >= pixmap->drawable.width && box->y2 >= pixmap->drawable.height) { priv->gpu_bo = - sna_replace(sna, priv->gpu_bo, - pixmap->drawable.width, - pixmap->drawable.height, - pixmap->drawable.bitsPerPixel, - bits, stride); + sna_replace(sna, pixmap, priv->gpu_bo, bits, stride); return TRUE; } @@ -2149,10 +2141,9 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, dst_priv->gpu_bo = sna_replace(sna, + dst_pixmap, dst_priv->gpu_bo, - dst_pixmap->drawable.width, - dst_pixmap->drawable.height, - bpp, bits, stride); + bits, stride); sna_damage_destroy(&dst_priv->cpu_damage); sna_damage_all(&dst_priv->gpu_damage, diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index 4c7beabf..5e4dccf4 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -1011,8 +1011,7 @@ blt_put_composite(struct sna *sna, data += (src_y - dst_y) * pitch; dst_priv->gpu_bo = - sna_replace(sna, dst_priv->gpu_bo, - r->width, r->height, bpp, + sna_replace(sna, op->dst.pixmap, dst_priv->gpu_bo, data, pitch); } else { BoxRec box; @@ -1051,11 +1050,7 @@ fastcall static void blt_put_composite_box(struct sna *sna, data += (box->x1 + op->u.blt.sx) * bpp; dst_priv->gpu_bo = - sna_replace(sna, - op->dst.bo, - op->dst.width, - op->dst.height, - src->drawable.bitsPerPixel, + sna_replace(sna, op->dst.pixmap, op->dst.bo, data, pitch); } else { sna_write_boxes(sna, @@ -1091,11 +1086,7 @@ static void blt_put_composite_boxes(struct sna *sna, data += (box->x1 + op->u.blt.sx) * bpp; dst_priv->gpu_bo = - sna_replace(sna, - op->dst.bo, - op->dst.width, - op->dst.height, - src->drawable.bitsPerPixel, + sna_replace(sna, op->dst.pixmap, op->dst.bo, data, pitch); } else { sna_write_boxes(sna, diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 29307136..aba636cc 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -424,22 +424,28 @@ void sna_write_boxes(struct sna *sna, } struct kgem_bo *sna_replace(struct sna *sna, + PixmapPtr pixmap, struct kgem_bo *bo, - int width, int height, int bpp, const void *src, int stride) { struct kgem *kgem = &sna->kgem; void *dst; DBG(("%s(handle=%d, %dx%d, bpp=%d, tiling=%d)\n", - __FUNCTION__, bo->handle, width, height, bpp, bo->tiling)); + __FUNCTION__, bo->handle, + pixmap->drawable.width, + pixmap->drawable.height, + pixmap->drawable.bitsPerPixel, + bo->tiling)); if (kgem_bo_is_busy(bo)) { struct kgem_bo *new_bo; new_bo = kgem_create_2d(kgem, - width, height, bpp, bo->tiling, - CREATE_INACTIVE); + pixmap->drawable.width, + pixmap->drawable.height, + pixmap->drawable.bitsPerPixel, + bo->tiling, CREATE_INACTIVE); if (new_bo) { kgem_bo_destroy(kgem, bo); bo = new_bo; @@ -447,18 +453,19 @@ struct kgem_bo *sna_replace(struct sna *sna, } if (bo->tiling == I915_TILING_NONE && bo->pitch == stride) { - kgem_bo_write(kgem, bo, src, (height-1)*stride + width*bpp/8); - return bo; - } - - dst = kgem_bo_map(kgem, bo, PROT_READ | PROT_WRITE); - if (dst) { - memcpy_blt(src, dst, bpp, - stride, bo->pitch, - 0, 0, - 0, 0, - width, height); - munmap(dst, bo->size); + kgem_bo_write(kgem, bo, src, + (pixmap->drawable.height-1)*stride + pixmap->drawable.width*pixmap->drawable.bitsPerPixel/8); + } else { + dst = kgem_bo_map(kgem, bo, PROT_READ | PROT_WRITE); + if (dst) { + memcpy_blt(src, dst, pixmap->drawable.bitsPerPixel, + stride, bo->pitch, + 0, 0, + 0, 0, + pixmap->drawable.width, + pixmap->drawable.height); + munmap(dst, bo->size); + } } return bo; |