summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-28 14:19:22 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-29 06:57:04 +0100
commit80752fb2794faa581d891b24148eaf51c42afd25 (patch)
tree2d429ac78208cb443faa6c5b2071f7734b3abf45 /src
parent2a0176379f0ff290d276adc72d44dfddafd96da5 (diff)
sna: Tidy calling memcpy_from_tiled
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/kgem.c5
-rw-r--r--src/sna/kgem.h10
-rw-r--r--src/sna/sna_accel.c26
-rw-r--r--src/sna/sna_io.c1
4 files changed, 31 insertions, 11 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 898f9435..22aef258 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -5968,6 +5968,7 @@ void *kgem_bo_map__cpu(struct kgem *kgem, struct kgem_bo *bo)
assert(!bo->purged);
assert(list_is_empty(&bo->list));
assert(bo->proxy == NULL);
+ assert_tiling(kgem, bo);
if (bo->map__cpu)
return MAP(bo->map__cpu);
@@ -6086,6 +6087,8 @@ void kgem_bo_sync__cpu(struct kgem *kgem, struct kgem_bo *bo)
{
DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
assert(!bo->scanout);
+ assert_tiling(kgem, bo);
+
kgem_bo_submit(kgem, bo);
/* SHM pixmaps use proxies for subpage offsets */
@@ -6120,6 +6123,7 @@ void kgem_bo_sync__cpu_full(struct kgem *kgem, struct kgem_bo *bo, bool write)
{
DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
assert(!bo->scanout || !write);
+ assert_tiling(kgem, bo);
if (write || bo->needs_flush)
kgem_bo_submit(kgem, bo);
@@ -6165,6 +6169,7 @@ void kgem_bo_sync__gtt(struct kgem *kgem, struct kgem_bo *bo)
DBG(("%s: handle=%d\n", __FUNCTION__, bo->handle));
assert(bo->refcnt);
assert(bo->proxy == NULL);
+ assert_tiling(kgem, bo);
kgem_bo_submit(kgem, bo);
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index e66bffb1..be9b7e88 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -787,6 +787,11 @@ memcpy_to_tiled_x(struct kgem *kgem,
int16_t dst_x, int16_t dst_y,
uint16_t width, uint16_t height)
{
+ assert(kgem->memcpy_to_tiled_x);
+ assert(src_x >= 0 && src_y >= 0);
+ assert(dst_x >= 0 && dst_y >= 0);
+ assert(8*src_stride >= (src_x+width) * bpp);
+ assert(8*dst_stride >= (dst_x+width) * bpp);
return kgem->memcpy_to_tiled_x(src, dst, bpp,
src_stride, dst_stride,
src_x, src_y,
@@ -802,6 +807,11 @@ memcpy_from_tiled_x(struct kgem *kgem,
int16_t dst_x, int16_t dst_y,
uint16_t width, uint16_t height)
{
+ assert(kgem->memcpy_from_tiled_x);
+ assert(src_x >= 0 && src_y >= 0);
+ assert(dst_x >= 0 && dst_y >= 0);
+ assert(8*src_stride >= (src_x+width) * bpp);
+ assert(8*dst_stride >= (dst_x+width) * bpp);
return kgem->memcpy_from_tiled_x(src, dst, bpp,
src_stride, dst_stride,
src_x, src_y,
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index a5599077..9f5c0b47 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1693,30 +1693,32 @@ static inline bool gpu_bo_download(struct sna *sna,
return false;
if (priv->gpu_bo->tiling) {
+ int bpp = priv->pixmap->drawable.bitsPerPixel;
+ void *dst = priv->pixmap->devPrivate.ptr;
+ int dst_pitch = priv->pixmap->devKind;
+
DBG(("%s: download through a tiled CPU map\n", __FUNCTION__));
do {
DBG(("%s: box (%d, %d), (%d, %d)\n",
__FUNCTION__, box->x1, box->y1, box->x2, box->y2));
- memcpy_from_tiled_x(&sna->kgem, src,
- priv->pixmap->devPrivate.ptr,
- priv->pixmap->drawable.bitsPerPixel,
- priv->gpu_bo->pitch,
- priv->pixmap->devKind,
+ memcpy_from_tiled_x(&sna->kgem, src, dst, bpp,
+ priv->gpu_bo->pitch, dst_pitch,
box->x1, box->y1,
box->x1, box->y1,
box->x2 - box->x1, box->y2 - box->y1);
box++;
} while (--n);
} else {
+ int bpp = priv->pixmap->drawable.bitsPerPixel;
+ void *dst = priv->pixmap->devPrivate.ptr;
+ int dst_pitch = priv->pixmap->devKind;
+
DBG(("%s: download through a linear CPU map\n", __FUNCTION__));
do {
DBG(("%s: box (%d, %d), (%d, %d)\n",
__FUNCTION__, box->x1, box->y1, box->x2, box->y2));
- memcpy_blt(src,
- priv->pixmap->devPrivate.ptr,
- priv->pixmap->drawable.bitsPerPixel,
- priv->gpu_bo->pitch,
- priv->pixmap->devKind,
+ memcpy_blt(src, dst, bpp,
+ priv->gpu_bo->pitch, dst_pitch,
box->x1, box->y1,
box->x1, box->y1,
box->x2 - box->x1, box->y2 - box->y1);
@@ -4934,6 +4936,10 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
get_drawable_deltas(drawable, pixmap, &dx, &dy);
x += dx + drawable->x;
y += dy + drawable->y;
+ assert(region->extents.x1 >= x);
+ assert(region->extents.y1 >= y);
+ assert(region->extents.x2 <= x + w);
+ assert(region->extents.y2 <= y + h);
if (try_upload__fast(pixmap, region, x, y, w, h, bits, stride))
return true;
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index f464dce7..9e175a75 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -118,7 +118,6 @@ read_boxes_inplace__cpu(struct kgem *kgem,
return false;
if (bo->tiling == I915_TILING_X) {
- assert(kgem->memcpy_from_tiled_x);
do {
memcpy_from_tiled_x(kgem, src, dst, bpp, src_pitch, dst_pitch,
box->x1, box->y1,