diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-02-10 16:37:38 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-02-10 16:39:17 +0000 |
commit | 1267235fd474c5249d45a7015e3d741dc607e57f (patch) | |
tree | e2e1ae88a384e043c7ca5743bf690ad5a03ca48f /src/sna/sna_accel.c | |
parent | 2f99070708ce8f591c31e1e908809a0ce551c13f (diff) |
sna: Check for overwriting damage before applying clear
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r-- | src/sna/sna_accel.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 531dd40d..871b1f81 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1960,6 +1960,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags) if (DAMAGE_IS_ALL(priv->cpu_damage)) { DBG(("%s: CPU all-damaged\n", __FUNCTION__)); assert(priv->gpu_damage == NULL || DAMAGE_IS_ALL(priv->gpu_damage)); + assert(priv->gpu_damage == NULL || (flags & MOVE_WRITE) == 0); goto done; } @@ -2391,6 +2392,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) { DBG(("%s: discarding cached upload buffer\n", __FUNCTION__)); assert(DAMAGE_IS_ALL(priv->cpu_damage)); + assert(priv->gpu_damage == NULL); assert(!priv->pinned); assert(!priv->mapped); kgem_bo_destroy(&sna->kgem, priv->gpu_bo); @@ -2664,11 +2666,20 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, } assert(priv->gpu_bo->proxy == NULL); + + if ((flags & MOVE_READ) == 0) { + assert(flags & MOVE_WRITE); + sna_damage_subtract(&priv->gpu_damage, region); + priv->clear = false; + goto done; + } + if (priv->clear) { int n = RegionNumRects(region); BoxPtr box = RegionRects(region); assert(DAMAGE_IS_ALL(priv->gpu_damage)); + assert(priv->cpu_damage == NULL); DBG(("%s: pending clear, doing partial fill\n", __FUNCTION__)); if (priv->cpu_bo) { @@ -2697,12 +2708,6 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, goto done; } - if ((flags & MOVE_READ) == 0) { - assert(flags & MOVE_WRITE); - sna_damage_subtract(&priv->gpu_damage, region); - goto done; - } - if (MIGRATE_ALL && priv->gpu_damage) { BoxPtr box; int n = sna_damage_get_boxes(priv->gpu_damage, &box); |