From d6a412812c19fe4698752d2589ead4965048b107 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 2 Jun 2014 10:32:11 +0100 Subject: [PATCH] sna: Use CPU mmappings for linear uploads The other half of the commit that accidentally got included with commit bb49222a514b1d6041f3d9530a22f5701377118b Author: Chris Wilson Date: Mon Jun 2 08:25:52 2014 +0100 sna: Add DBG hints for using inplace CPU mmappings Signed-off-by: Chris Wilson --- src/sna/sna_io.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index c71435a6..f464dce7 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -659,7 +659,7 @@ write_boxes_inplace__tiled(struct kgem *kgem, uint8_t *dst; assert(kgem_bo_can_map__cpu(kgem, bo, true)); - assert(bo->tiling == I915_TILING_X); + assert(bo->tiling != I915_TILING_Y); dst = kgem_bo_map__cpu(kgem, bo); if (dst == NULL) @@ -670,13 +670,23 @@ write_boxes_inplace__tiled(struct kgem *kgem, if (sigtrap_get()) return false; - do { - memcpy_to_tiled_x(kgem, src, dst, bpp, stride, bo->pitch, - box->x1 + src_dx, box->y1 + src_dy, - box->x1 + dst_dx, box->y1 + dst_dy, - box->x2 - box->x1, box->y2 - box->y1); - box++; - } while (--n); + if (bo->tiling) { + do { + memcpy_to_tiled_x(kgem, src, dst, bpp, stride, bo->pitch, + box->x1 + src_dx, box->y1 + src_dy, + box->x1 + dst_dx, box->y1 + dst_dy, + box->x2 - box->x1, box->y2 - box->y1); + box++; + } while (--n); + } else { + do { + memcpy_blt(src, dst, bpp, stride, bo->pitch, + box->x1 + src_dx, box->y1 + src_dy, + box->x1 + dst_dx, box->y1 + dst_dy, + box->x2 - box->x1, box->y2 - box->y1); + box++; + } while (--n); + } sigtrap_put(); return true;