summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-11 15:42:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-11 15:54:16 +0000
commitb82851e74d5010ee08938ee42fa44c29fed633b1 (patch)
tree913d8716d37a9902636144e5ff5c3ddec7670e75 /src
parent2a5ab05f1690484c230e8f876a3f7aefb371af71 (diff)
sna: Mark upload pixmaps as being wholly GPU damaged
So that subsequent code resists performing CPU operations with them (after they have been populated.) Marking both sides as wholly damaged breaks the rules, but should work out so long as we check whether we can perform the operation within the target damage first. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_accel.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2c61b096..ef0c5773 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -746,6 +746,9 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
priv->gpu_bo ? priv->gpu_bo->handle : 0,
priv->gpu_damage));
+ if (priv->cpu_damage && priv->cpu_damage->mode == DAMAGE_ALL)
+ goto done;
+
if ((flags & MOVE_READ) == 0) {
assert(flags == MOVE_WRITE);
@@ -995,6 +998,9 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
return _sna_pixmap_move_to_cpu(pixmap, flags);
}
+ if (priv->cpu_damage && priv->cpu_damage->mode == DAMAGE_ALL)
+ goto done;
+
if ((flags & MOVE_READ) == 0) {
assert(flags == MOVE_WRITE);
@@ -1196,6 +1202,9 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, BoxPtr box)
DBG(("%s()\n", __FUNCTION__));
+ if (priv->gpu_damage && priv->gpu_damage->mode == DAMAGE_ALL)
+ goto done;
+
if (priv->gpu_bo == NULL) {
struct sna *sna = to_sna_from_pixmap(pixmap);
unsigned flags;
@@ -1487,6 +1496,13 @@ sna_pixmap_create_upload(ScreenPtr screen,
return NullPixmap;
}
+ /* Marking both the shadow and the GPU bo is a little dubious,
+ * but will work so long as we always check before doing the
+ * transfer.
+ */
+ sna_damage_all(&priv->gpu_damage, width, height);
+ sna_damage_all(&priv->cpu_damage, width, height);
+
pixmap->drawable.width = width;
pixmap->drawable.height = height;
pixmap->drawable.depth = depth;
@@ -1569,6 +1585,9 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
if (priv == NULL)
return NULL;
+ if (priv->gpu_damage && priv->gpu_damage->mode == DAMAGE_ALL)
+ goto done;
+
sna_damage_reduce(&priv->cpu_damage);
DBG(("%s: CPU damage? %d\n", __FUNCTION__, priv->cpu_damage != NULL));