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>
This commit is contained in:
Chris Wilson 2012-03-02 09:47:10 +00:00
parent 392593e61d
commit f039ccf958
1 changed files with 9 additions and 3 deletions

View File

@ -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__));