summaryrefslogtreecommitdiff
path: root/src/sna/sna_accel.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-19 10:17:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-21 15:44:38 +0100
commit923dc207df7b05c138c628983ccaf2493dd63b62 (patch)
tree310901b071e220bca3e5e63e28237be40b8331c8 /src/sna/sna_accel.c
parent2046a49be59866a16db776ba53a588dbf6c02b12 (diff)
sna: Discard write hint from a couple more move-to-gpu
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_accel.c')
-rw-r--r--src/sna/sna_accel.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 27bbc069..78f5fed1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -481,8 +481,10 @@ static void sna_pixmap_free_gpu(struct sna *sna, struct sna_pixmap *priv)
sna_pixmap_undo_cow(sna, priv, MOVE_WRITE);
assert(priv->cow == NULL);
- if (priv->move_to_gpu)
+ if (priv->move_to_gpu) {
+ sna_pixmap_discard_shadow_damage(priv, NULL);
priv->move_to_gpu(sna, priv, MOVE_WRITE);
+ }
sna_damage_destroy(&priv->gpu_damage);
priv->clear = false;
@@ -3170,13 +3172,18 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl
if (priv->move_to_gpu) {
unsigned int hint;
- hint = flags | MOVE_READ | (priv->cpu_damage ? MOVE_WRITE : 0);
+ hint = flags | MOVE_READ;
if ((flags & MOVE_READ) == 0) {
RegionRec region;
region.extents = *box;
region.data = NULL;
sna_pixmap_discard_shadow_damage(priv, &region);
+ if (region_subsumes_pixmap(&region, pixmap))
+ hint &= ~MOVE_READ;
+ } else {
+ if (priv->cpu_damage)
+ hint |= MOVE_WRITE;
}
if (!priv->move_to_gpu(sna, priv, hint)) {
DBG(("%s: move-to-gpu override failed\n", __FUNCTION__));
@@ -3947,7 +3954,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags)
assert_pixmap_damage(pixmap);
if (priv->move_to_gpu &&
- !priv->move_to_gpu(sna, priv, flags | (priv->cpu_damage ? MOVE_WRITE : 0))) {
+ !priv->move_to_gpu(sna, priv, flags | ((priv->cpu_damage && (flags & MOVE_READ)) ? MOVE_WRITE : 0))) {
DBG(("%s: move-to-gpu override failed\n", __FUNCTION__));
return NULL;
}