diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-12 18:59:54 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-12 20:18:48 +0000 |
commit | 44c585a1d8c3b603a9c79bf7dfecf420575cfb61 (patch) | |
tree | 66b34513aba095be037e9ec84a6ccd1c910c0d93 | |
parent | 20e318c292a4e1336093dfbc77cb44d099c80050 (diff) |
sna: Discard cached upload proxy when writing to the pixmap via the CPU
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 983a5f3d..30262c15 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1907,6 +1907,15 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags) kgem_bo_undo(&sna->kgem, priv->cpu_bo); } + if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) { + DBG(("%s: discarding cached upload buffer\n", __FUNCTION__)); + assert(DAMAGE_IS_ALL(priv->cpu_damage)); + assert(!priv->pinned); + assert(!priv->mapped); + kgem_bo_destroy(&sna->kgem, priv->gpu_bo); + priv->gpu_bo = NULL; + } + if (DAMAGE_IS_ALL(priv->cpu_damage)) { DBG(("%s: CPU all-damaged\n", __FUNCTION__)); assert(priv->gpu_damage == NULL || DAMAGE_IS_ALL(priv->gpu_damage)); @@ -2333,6 +2342,15 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, assert(priv->gpu_damage == NULL || priv->gpu_bo); + if (flags & MOVE_WRITE && priv->gpu_bo && priv->gpu_bo->proxy) { + DBG(("%s: discarding cached upload buffer\n", __FUNCTION__)); + assert(DAMAGE_IS_ALL(priv->cpu_damage)); + assert(!priv->pinned); + assert(!priv->mapped); + kgem_bo_destroy(&sna->kgem, priv->gpu_bo); + priv->gpu_bo = NULL; + } + if (sna_damage_is_all(&priv->cpu_damage, pixmap->drawable.width, pixmap->drawable.height)) { |