From 1f9a6156e9240a1efa8785ab5bca0a3b1757d08e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 31 Jan 2014 20:02:44 +0000 Subject: sna: remove short-circuit for move-to-CPU when damage covers region The short-circuit path missed translating the damage from drawable space into the pixmap (for Composite setups) which may have resulted in corruption. The path was also failing to consider the impact of reusing an active CPU bo when it could be discarding the unwanted damage and reallocating. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index c9033858..613b9c73 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -2424,17 +2424,11 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, if (flags & MOVE_WRITE) sna_pixmap_free_gpu(sna, priv); - goto contains_damage; - } - - if (priv->cpu && - priv->cpu_damage && - sna_damage_contains_box__no_reduce(priv->cpu_damage, - ®ion->extents)) { - DBG(("%s: pixmap=%ld CPU damage contains region\n", - __FUNCTION__, pixmap->drawable.serialNumber)); + if ((flags & MOVE_READ) == 0 && + priv->cpu_bo && !priv->cpu_bo->flush && + __kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) + sna_pixmap_free_cpu(sna, priv, false); -contains_damage: sna_pixmap_unmap(pixmap, priv); assert(priv->mapped == MAPPED_NONE); if (pixmap->devPrivate.ptr == NULL && -- cgit v1.2.3