summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-02 09:47:10 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-02 09:53:27 +0000
commitf039ccf9587eb07528034c3247a6e700c87a5500 (patch)
tree203e814e878e3129fde37e15ddef44c72e07928a
parent392593e61dac3ac65ee8e32de492c4439413ee85 (diff)
sna: Be careful not to discard the clear operation for move-region-to-cpu
When moving only a region to the CPU and we detect a pending clear, we transform the operation into a move whole pixmap. In such situations, we only have a partial damage area and so need to or in MOVE_READ to prevent the pending clear of the whole pixmap from being discarded. References: https://bugs.freedesktop.org/show_bug.cgi?id=46792 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 52e75c76..c427808c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -922,6 +922,8 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
if ((flags & MOVE_READ) == 0) {
assert(flags & MOVE_WRITE);
+ DBG(("%s: no readbck, discarding gpu damage [%d], pending clear[%d]\n",
+ __FUNCTION__, priv->gpu_damage != NULL, priv->clear));
sna_damage_destroy(&priv->gpu_damage);
priv->clear = false;
@@ -1273,9 +1275,6 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
goto out;
}
- if (priv->clear)
- return _sna_pixmap_move_to_cpu(pixmap, flags);
-
if (priv->gpu_bo == NULL &&
(priv->create & KGEM_CAN_CREATE_GPU) == 0 &&
flags & MOVE_WRITE)
@@ -1293,6 +1292,13 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
return _sna_pixmap_move_to_cpu(pixmap, flags);
}
+ if (priv->clear) {
+ DBG(("%s: pending clear, moving whole pixmap\n", __FUNCTION__));
+ if (dx | dy)
+ RegionTranslate(region, -dx, -dy);
+ return _sna_pixmap_move_to_cpu(pixmap, flags | MOVE_READ);
+ }
+
if ((flags & MOVE_READ) == 0) {
DBG(("%s: no read, checking to see if we can stream the write into the GPU bo\n",
__FUNCTION__));