summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-08-20 14:56:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-08-20 16:06:13 +0100
commit410316d20299b9ed3447d1d897f904af786ed097 (patch)
tree410b7f3d364909d8b31908f3dfbd36337b240a92
parent91f1bf971f9cdc6498f513a5ddec1ad7a4e24b3d (diff)
sna: Refine decision making for maybe-inplace trapezoids
In particular, we want to avoid preferentially taking the CPU paths when it may force any migration (including clear). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 6cc03f9a..dd438de5 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -4660,6 +4660,8 @@ static bool
trapezoid_spans_maybe_inplace(CARD8 op, PicturePtr src, PicturePtr dst,
PictFormatPtr maskFormat)
{
+ struct sna_pixmap *priv;
+
if (NO_SCAN_CONVERTER)
return false;
@@ -4712,7 +4714,26 @@ trapezoid_spans_maybe_inplace(CARD8 op, PicturePtr src, PicturePtr dst,
}
out:
- return is_cpu(dst->pDrawable) ? true : dst->pDrawable->width <= TOR_INPLACE_SIZE;
+ priv = sna_pixmap_from_drawable(dst->pDrawable);
+ if (priv == NULL)
+ return true;
+
+ if (priv->cpu_bo && kgem_bo_is_busy(priv->cpu_bo))
+ return false;
+
+ if (DAMAGE_IS_ALL(priv->cpu_damage) || priv->gpu_damage == NULL)
+ return true;
+
+ if (priv->clear)
+ return dst->pDrawable->width <= TOR_INPLACE_SIZE;
+
+ if (kgem_bo_is_busy(priv->gpu_bo))
+ return false;
+
+ if (priv->cpu_damage)
+ return true;
+
+ return dst->pDrawable->width <= TOR_INPLACE_SIZE;
}
static bool