summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-25 21:35:09 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-26 10:02:41 +0100
commit273716029e5318f1670e7111be2085c950995d42 (patch)
tree2085669b32b6e05626d46ad57cd73bb3099ba138
parente033a28bcb37867f3c947475714e1ef45c868825 (diff)
sna: Rearrange tiled x upload so that damage accumulation is last
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 47b25095..428535ef 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3976,11 +3976,24 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
if (dst == NULL)
return false;
+ kgem_bo_sync__cpu(&sna->kgem, priv->gpu_bo);
+
box = RegionRects(region);
n = RegionNumRects(region);
DBG(("%s: upload(%d, %d, %d, %d) x %d\n", __FUNCTION__, x, y, w, h, n));
+ do {
+ memcpy_to_tiled_x(&sna->kgem, bits, dst,
+ pixmap->drawable.bitsPerPixel,
+ stride, priv->gpu_bo->pitch,
+ box->x1 - x, box->y1 - y,
+ box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+ box++;
+ } while (--n);
+ __kgem_bo_unmap__cpu(&sna->kgem, priv->gpu_bo, dst);
+
if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
sna_damage_add(&priv->gpu_damage, region);
sna_damage_reduce_all(&priv->gpu_damage,
@@ -3995,18 +4008,6 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
if (priv->cpu_damage)
sna_damage_subtract(&priv->cpu_damage, region);
- kgem_bo_sync__cpu(&sna->kgem, priv->gpu_bo);
- do {
- memcpy_to_tiled_x(&sna->kgem, bits, dst,
- pixmap->drawable.bitsPerPixel,
- stride, priv->gpu_bo->pitch,
- box->x1 - x, box->y1 - y,
- box->x1, box->y1,
- box->x2 - box->x1, box->y2 - box->y1);
- box++;
- } while (--n);
- __kgem_bo_unmap__cpu(&sna->kgem, priv->gpu_bo, dst);
-
priv->clear = false;
priv->cpu = false;
return true;