summaryrefslogtreecommitdiff
path: root/src/sna/sna_io.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-11-28 18:22:01 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-28 18:59:50 +0000
commit8657128fa7e758a2dde93340d6e58928d5f11255 (patch)
tree400f3a39f49ac1f51032abb34f7577c380f43c0d /src/sna/sna_io.c
parent4e38d22105da2bd97db005dc505e75dcd22291d3 (diff)
sna: Pass the pixmap to sna_replace()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_io.c')
-rw-r--r--src/sna/sna_io.c39
1 files changed, 23 insertions, 16 deletions
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;