summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-13 08:51:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-13 08:51:20 +0100
commitd47a01fce4d3d9c043a45fc034dc436c0af41981 (patch)
treef1f310a34fe24c06a191daf69785f4260e78ad3a /src/sna/sna_accel.c
parentc4d4bd5d92c7e53a7be6fa7fe119e4507af213ec (diff)
sna: Reorder ignore_cpu_damage() to avoid asserts
Tricksy asserts making sure that the correct arguments are passed around! Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl 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.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 23e27af6..72c16d3f 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4761,15 +4761,24 @@ try_upload__blt(PixmapPtr pixmap, RegionRec *region,
return true;
}
-static bool ignore_cpu_damage(struct sna_pixmap *priv, const BoxRec *box)
+static bool ignore_cpu_damage(struct sna *sna, struct sna_pixmap *priv, const RegionRec *region)
{
- if (priv->cpu_damage == NULL)
+ if (region_subsumes_pixmap(region, priv->pixmap))
return true;
- if (!sna_damage_contains_box__no_reduce(priv->cpu_damage, box))
- return true;
+ if (priv->cpu_damage != NULL) {
+ if (DAMAGE_IS_ALL(priv->cpu_damage == NULL))
+ return false;
+
+ if (!box_inplace(priv->pixmap, &region->extents))
+ return false;
+
+ if (sna_damage_contains_box__no_reduce(priv->cpu_damage, &region->extents))
+ return false;
+ }
+
+ return priv->gpu_bo == NULL || !__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo);
- return box_inplace(priv->pixmap, box);
}
static bool
@@ -4786,9 +4795,7 @@ try_upload__fast(PixmapPtr pixmap, RegionRec *region,
if (priv == NULL)
return false;
- if (region_subsumes_pixmap(region, pixmap) ||
- (ignore_cpu_damage(priv, &region->extents) &&
- (priv->gpu_bo == NULL || !__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo)))) {
+ if (ignore_cpu_damage(sna, priv, region)) {
if (try_upload__inplace(pixmap, region, x, y, w, h, bits, stride))
return true;
}