diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-26 20:21:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-27 07:40:48 +0100 |
commit | 2ae5d7d9415a77c76078bc340066df73dce72d27 (patch) | |
tree | 9247ad0775385d2f8ff76608cd5ec4193e6689d5 | |
parent | 8cad98eca64224534887efbcd1c60604cd491c35 (diff) |
sna: Tidy selection of a near-miss active buffer.
References: https://bugs.freedesktop.org/show_bug.cgi?id=80560
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index db7e46f6..6556d126 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -4840,7 +4840,7 @@ search_active: } if (kgem->gen >= 040) { - for (i = I915_TILING_NONE; i <= I915_TILING_Y; i++) { + for (i = I915_TILING_Y; i >= I915_TILING_NONE; i--) { cache = &kgem->active[bucket][i]; list_for_each_entry(bo, cache, list) { assert(!bo->purged); @@ -4853,10 +4853,13 @@ search_active: if (num_pages(bo) < size) continue; - if (!gem_set_tiling(kgem->fd, - bo->handle, - tiling, pitch)) - continue; + if (bo->tiling != tiling || + (tiling != I915_TILING_NONE && bo->pitch != pitch)) { + if (!gem_set_tiling(kgem->fd, + bo->handle, + tiling, pitch)) + continue; + } kgem_bo_remove_from_active(kgem, bo); @@ -4872,11 +4875,8 @@ search_active: return bo; } } - } - - if (!exact) { /* allow an active near-miss? */ - i = tiling; - while (--i >= 0) { + } else if (!exact) { /* allow an active near-miss? */ + for (i = tiling; i >= I915_TILING_NONE; i--) { tiled_height = kgem_surface_size(kgem, kgem->has_relaxed_fencing, flags, width, height, bpp, tiling, &pitch); cache = active(kgem, tiled_height / PAGE_SIZE, i); @@ -7091,6 +7091,8 @@ kgem_replace_bo(struct kgem *kgem, dst->pitch = pitch; dst->unique_id = kgem_get_unique_id(kgem); dst->refcnt = 1; + assert(dst->tiling == I915_TILING_NONE); + assert(kgem_bo_can_blt(kgem, dst)); kgem_set_mode(kgem, KGEM_BLT, dst); if (!kgem_check_batch(kgem, 10) || |