diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-11 10:42:08 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-03-11 10:42:51 +0000 |
commit | 25a63b32c7b549ffb3c7f14de4bf2731d044eb39 (patch) | |
tree | 3112512cbca9d7afae015ca2e22526e9f017c2d4 | |
parent | 210d474a96d3adf7338b49ee2c234893b54bbb2c (diff) |
sna: Tighten checking for coherent maps
Remember all the special cases where we can use a CPU mmap as a
temporary substitute for a GTT mapping.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_accel.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index e9f29d09..35c2a902 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1361,6 +1361,20 @@ void sna_pixmap_destroy(PixmapPtr pixmap) sna_destroy_pixmap(pixmap); } +static inline bool has_coherent_map(struct sna *sna, + struct kgem_bo *bo) +{ + assert(bo->map); + + if (!IS_CPU_MAP(bo->map)) + return true; + + if (bo->tiling != I915_TILING_NONE) + return false; + + return bo->domain == DOMAIN_CPU || sna->kgem.has_llc; +} + static inline bool pixmap_inplace(struct sna *sna, PixmapPtr pixmap, struct sna_pixmap *priv, @@ -1373,7 +1387,7 @@ static inline bool pixmap_inplace(struct sna *sna, return false; if (priv->mapped) - return !IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc; + return has_coherent_map(sna, priv->gpu_bo); if (!write_only && priv->cpu_damage) return false; @@ -1564,7 +1578,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags) if (!priv->mapped) goto skip_inplace_map; - assert(!IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc); + assert(has_coherent_map(sna, priv->gpu_bo)); pixmap->devKind = priv->gpu_bo->pitch; assert(priv->gpu_bo->proxy == NULL); @@ -1622,7 +1636,7 @@ skip_inplace_map: pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo); priv->mapped = pixmap->devPrivate.ptr != NULL; if (priv->mapped) { - assert(!IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc); + assert(has_coherent_map(sna, priv->gpu_bo)); pixmap->devKind = priv->gpu_bo->pitch; if (flags & MOVE_WRITE) { assert(priv->gpu_bo->proxy == NULL); @@ -1869,7 +1883,7 @@ static inline bool region_inplace(struct sna *sna, if (priv->mapped) { DBG(("%s: yes, already mapped, continuiung\n", __FUNCTION__)); - return !IS_CPU_MAP(priv->gpu_bo->map); + return has_coherent_map(sna, priv->gpu_bo); } if (priv->flush) { @@ -1984,7 +1998,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable, pixmap->devPrivate.ptr = kgem_bo_map(&sna->kgem, priv->gpu_bo); priv->mapped = pixmap->devPrivate.ptr != NULL; if (priv->mapped) { - assert(!IS_CPU_MAP(priv->gpu_bo->map) || sna->kgem.has_llc); + assert(has_coherent_map(sna, priv->gpu_bo)); pixmap->devKind = priv->gpu_bo->pitch; if (flags & MOVE_WRITE) { if (!DAMAGE_IS_ALL(priv->gpu_damage)) { |