diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-22 12:00:49 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-22 12:59:02 +0100 |
commit | ac6cb667546a82b865c959a1be32f52b2da7bf7d (patch) | |
tree | 51a40a03e5b476152cf480bd58dfa631cd31fbff /src | |
parent | 785c1046b94fd9ca6f22b2a6d73639408a411cea (diff) |
sna: Flush before adding any SHM pixmap into the batch
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna.h | 4 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 34 | ||||
-rw-r--r-- | src/sna/sna_render.c | 2 |
3 files changed, 22 insertions, 18 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 157830ba..d655da0b 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -458,7 +458,9 @@ sna_drawable_move_to_gpu(DrawablePtr drawable, unsigned flags) return sna_pixmap_move_to_gpu(get_drawable_pixmap(drawable), flags) != NULL; } -void sna_add_flush_pixmap(struct sna *sna, struct sna_pixmap *priv); +void sna_add_flush_pixmap(struct sna *sna, + struct sna_pixmap *priv, + struct kgem_bo *bo); struct kgem_bo *sna_pixmap_change_tiling(PixmapPtr pixmap, uint32_t tiling); diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index bba24e54..9bab91cf 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1016,16 +1016,18 @@ fallback: return create_pixmap(sna, screen, width, height, depth, usage); } -void sna_add_flush_pixmap(struct sna *sna, struct sna_pixmap *priv) +void sna_add_flush_pixmap(struct sna *sna, + struct sna_pixmap *priv, + struct kgem_bo *bo) { DBG(("%s: marking pixmap=%ld for flushing\n", __FUNCTION__, priv->pixmap->drawable.serialNumber)); list_move(&priv->list, &sna->flush_pixmaps); - if (sna->kgem.need_retire) + if (bo->exec == NULL && sna->kgem.need_retire) kgem_retire(&sna->kgem); - if (!sna->kgem.need_retire || !sna->kgem.flush) { - DBG(("%s: GPU idle, flushing\n", __FUNCTION__)); + if (bo->exec == NULL || !sna->kgem.need_retire) { + DBG(("%s: flush bo idle, flushing\n", __FUNCTION__)); kgem_submit(&sna->kgem); } @@ -1078,8 +1080,8 @@ static Bool sna_destroy_pixmap(PixmapPtr pixmap) kgem_bo_destroy(&sna->kgem, priv->gpu_bo); if (priv->shm && kgem_bo_is_busy(priv->cpu_bo)) { + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); kgem_bo_submit(&sna->kgem, priv->cpu_bo); /* XXX ShmDetach */ - sna_add_flush_pixmap(sna, priv); } else __sna_free_pixmap(sna, pixmap, priv); return TRUE; @@ -1419,7 +1421,7 @@ skip_inplace_map: if (priv->flush) { assert(!priv->shm); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->gpu_bo); } } @@ -2030,7 +2032,7 @@ done: } if (priv->flush) { assert(!priv->shm); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->gpu_bo); } } @@ -2244,7 +2246,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl box, n, 0); if (ok && priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } } if (!ok) { @@ -2288,7 +2290,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl box, 1, 0); if (ok && priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } } if (!ok) { @@ -2323,7 +2325,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl box, n, 0); if (ok && priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } } if (!ok) { @@ -2349,7 +2351,7 @@ sna_pixmap_move_area_to_gpu(PixmapPtr pixmap, const BoxRec *box, unsigned int fl if (priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } done: @@ -2623,7 +2625,7 @@ use_cpu_bo: if (priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); /* As we may have flushed and retired,, recheck for busy bo */ if ((flags & FORCE_GPU) == 0 && !kgem_bo_is_busy(priv->cpu_bo)) @@ -2851,7 +2853,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags) box, n, 0); if (ok && priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } } if (!ok) { @@ -2886,7 +2888,7 @@ sna_pixmap_move_to_gpu(PixmapPtr pixmap, unsigned flags) if (priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } /* For large bo, try to keep only a single copy around */ @@ -3441,7 +3443,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, } if (priv->flush) { assert(!priv->shm); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->gpu_bo); } } priv->cpu = true; @@ -4320,7 +4322,7 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc, if (src_priv->shm) { assert(!src_priv->flush); - sna_add_flush_pixmap(sna, src_priv); + sna_add_flush_pixmap(sna, src_priv, src_priv->cpu_bo); } if (damage) diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index 13822b8a..8373890c 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -378,7 +378,7 @@ use_cpu_bo(struct sna *sna, PixmapPtr pixmap, const BoxRec *box, bool blt) if (priv->shm) { assert(!priv->flush); - sna_add_flush_pixmap(sna, priv); + sna_add_flush_pixmap(sna, priv, priv->cpu_bo); } DBG(("%s for box=(%d, %d), (%d, %d)\n", |