summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-05 14:20:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-05 14:20:55 +0000
commitce93c00a33a395986ffc0d33aae85d2c23aabc5d (patch)
tree543a425d54e4e3a683a9990abffdc9996b6a57d8
parentf5d02d90f3349f33341954fc55824d12a7829e6c (diff)
sna: Avoid operating inplace if we have pending CPU damage
If the operation does not replace existing CPU damage, we are likely to want to reuse the pixmap again on the CPU, so avoid mixing CPU/GPU operations. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9ecf3c69..396dd9c5 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -870,9 +870,29 @@ static inline bool region_inplace(struct sna *sna,
if (wedged(sna))
return false;
- if (priv->mapped)
+ if (priv->mapped) {
+ DBG(("%s: already mapped\n", __FUNCTION__));
return true;
+ }
+ if (priv->cpu_damage) {
+ const BoxRec *extents = &region->extents;
+ const BoxRec *damage = &priv->cpu_damage->extents;
+ if (extents->x2 < damage->x2 || extents->x1 > damage->x1 ||
+ extents->y2 < damage->y2 || extents->y1 > damage->y1) {
+ DBG(("%s: uncovered CPU damage pending\n", __FUNCTION__));
+ return false;
+ }
+ }
+
+ DBG(("%s: (%dx%d), inplace? %d\n",
+ __FUNCTION__,
+ region->extents.x2 - region->extents.x1,
+ region->extents.y2 - region->extents.y1,
+ ((region->extents.x2 - region->extents.x1) *
+ (region->extents.y2 - region->extents.y1) *
+ pixmap->drawable.bitsPerPixel >> 12)
+ >= sna->kgem.half_cpu_cache_pages));
return ((region->extents.x2 - region->extents.x1) *
(region->extents.y2 - region->extents.y1) *
pixmap->drawable.bitsPerPixel >> 12)