diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-29 16:31:34 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-29 16:50:54 +0100 |
commit | c7d246ba6f750ee080c38ccc5603d01fcf7fce92 (patch) | |
tree | d917132d889bb141a40f8b9bfe81d2571306dd2a /src/sna/sna_accel.c | |
parent | 6ab2a3acf71b5204c399c7649e5601c93a99f25f (diff) |
sna: Move the clone discard into free-gpu
Rather than peppering the discard manually before the call to free the
GPU bo, always discard the COW when we actually free the GPU bo.
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.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 26667984..2ed50071 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -423,6 +423,9 @@ sna_copy_init_blt(struct sna_copy_op *copy, static void sna_pixmap_free_gpu(struct sna *sna, struct sna_pixmap *priv) { assert(priv->gpu_damage == NULL || priv->gpu_bo); + + if (priv->cow) + sna_pixmap_undo_cow(sna, priv, 0); assert(priv->cow == NULL); sna_damage_destroy(&priv->gpu_damage); @@ -2069,8 +2072,6 @@ mark_damage: pixmap->drawable.width, pixmap->drawable.height); assert(priv->gpu_damage == NULL); - if (priv->cow) - sna_pixmap_undo_cow(sna, priv, 0); sna_pixmap_free_gpu(sna, priv); if (priv->flush) { @@ -2083,14 +2084,14 @@ done: if (flags & MOVE_WRITE) { assert(DAMAGE_IS_ALL(priv->cpu_damage)); assert(priv->gpu_damage == NULL); + assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL); if (priv->cow) sna_pixmap_undo_cow(sna, priv, 0); - priv->source_count = SOURCE_BIAS; - assert(priv->gpu_bo == NULL || priv->gpu_bo->proxy == NULL); - if (priv->gpu_bo && priv->gpu_bo->domain != DOMAIN_GPU) { - DBG(("%s: discarding inactive GPU bo\n", __FUNCTION__)); + if (priv->gpu_bo && priv->gpu_bo->rq == NULL) { + DBG(("%s: discarding idle GPU bo\n", __FUNCTION__)); sna_pixmap_free_gpu(sna, priv); } + priv->source_count = SOURCE_BIAS; } if (priv->cpu_bo) { @@ -2102,10 +2103,6 @@ done: assert(pixmap->devPrivate.ptr == (void *)((unsigned long)priv->cpu_bo->map & ~3)); assert((flags & MOVE_WRITE) == 0 || !kgem_bo_is_busy(priv->cpu_bo)); } - if (flags & MOVE_WRITE) { - DBG(("%s: discarding GPU bo in favour of CPU bo\n", __FUNCTION__)); - sna_pixmap_free_gpu(sna, priv); - } } priv->cpu = (flags & (MOVE_INPLACE_HINT | MOVE_ASYNC_HINT)) == 0 && @@ -2691,11 +2688,8 @@ done: pixmap->drawable.width, pixmap->drawable.height); if (DAMAGE_IS_ALL(priv->cpu_damage)) { - if (priv->gpu_bo) { - DBG(("%s: replaced entire pixmap\n", - __FUNCTION__)); - sna_pixmap_free_gpu(sna, priv); - } + DBG(("%s: replaced entire pixmap\n", __FUNCTION__)); + sna_pixmap_free_gpu(sna, priv); } if (priv->flush) { assert(!priv->shm); @@ -4032,8 +4026,6 @@ try_upload_tiled_x(PixmapPtr pixmap, RegionRec *region, if (priv->gpu_bo && (replaces || priv->gpu_bo->proxy)) { DBG(("%s: discarding cached upload proxy\n", __FUNCTION__)); - if (priv->cow) - sna_pixmap_undo_cow(sna, priv, 0); sna_pixmap_free_gpu(sna, priv); } |