summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/sna_accel.c26
-rw-r--r--src/sna/sna_display.c5
2 files changed, 18 insertions, 13 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ef7f842d..61210b12 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1974,6 +1974,8 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
kgem_bo_undo(&sna->kgem, priv->gpu_bo);
if (priv->cpu_bo)
kgem_bo_undo(&sna->kgem, priv->cpu_bo);
+ if (priv->move_to_gpu)
+ sna_pixmap_discard_shadow_damage(priv, NULL);
}
if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) {
@@ -2526,6 +2528,15 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
return _sna_pixmap_move_to_cpu(pixmap, flags);
}
+ if (priv->move_to_gpu) {
+ if ((flags & MOVE_READ) == 0)
+ sna_pixmap_discard_shadow_damage(priv, region);
+ if (!priv->move_to_gpu(sna, priv, MOVE_READ)) {
+ DBG(("%s: move-to-gpu override failed\n", __FUNCTION__));
+ return NULL;
+ }
+ }
+
if (flags & MOVE_WHOLE_HINT) {
DBG(("%s: region (%d, %d), (%d, %d) marked with WHOLE hint, pixmap %dx%d\n",
__FUNCTION__,
@@ -2538,16 +2549,6 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
return _sna_pixmap_move_to_cpu(pixmap, flags | MOVE_READ);
}
-
- if (priv->move_to_gpu) {
- if ((flags & MOVE_READ) == 0)
- sna_pixmap_discard_shadow_damage(priv, region);
- if (!priv->move_to_gpu(sna, priv, MOVE_READ)) {
- DBG(("%s: move-to-gpu override failed\n", __FUNCTION__));
- return NULL;
- }
- }
-
if (get_drawable_deltas(drawable, pixmap, &dx, &dy)) {
DBG(("%s: delta=(%d, %d)\n", __FUNCTION__, dx, dy));
RegionTranslate(region, dx, dy);
@@ -4353,7 +4354,7 @@ create_upload_tiled_x(struct kgem *kgem,
static bool
try_upload_blt(PixmapPtr pixmap, RegionRec *region,
- int x, int y, int w, int h, char *bits, int stride)
+ int x, int y, int w, int h, char *bits, int stride)
{
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_pixmap *priv;
@@ -4488,7 +4489,8 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region,
}
assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL);
- if (priv->cow || priv->move_to_gpu) {
+ if ((priv->cow || priv->move_to_gpu) &&
+ (!replaces || !sna_pixmap_move_to_gpu(pixmap, MOVE_WRITE))) {
DBG(("%s: no, has COW or pending move-to-gpu\n", __FUNCTION__));
return false;
}
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 6a1d0226..f0c130f4 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -909,7 +909,10 @@ void sna_pixmap_discard_shadow_damage(struct sna_pixmap *priv,
wait->region.extents.x2, wait->region.extents.y2));
assert(wait);
- RegionSubtract(&wait->region, &wait->region, region);
+ if (region)
+ RegionSubtract(&wait->region, &wait->region, region);
+ else
+ RegionEmpty(&wait->region);
}
static bool sna_mode_enable_shadow(struct sna *sna)