From ab387a89cf64ace9f7d7fa52b7743e78b625f47d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 18 Jan 2012 18:32:51 +0000 Subject: [PATCH] sna: Update bo->tiling during search_linear_cache search_linear_cache() was updated to track the first good match whilst it continued to search for a better match. This resulted in the first good bo being modified and a record of those modifications lost, in particular the change in tiling. Signed-off-by: Chris Wilson --- src/sna/kgem.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f8242306..0fb244f2 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1874,6 +1874,8 @@ search_linear_cache(struct kgem *kgem, unsigned int size, unsigned flags) if (gem_set_tiling(kgem->fd, bo->handle, I915_TILING_NONE, 0) != I915_TILING_NONE) continue; + + bo->tiling = I915_TILING_NONE; } if (bo->map) { @@ -1908,7 +1910,7 @@ search_linear_cache(struct kgem *kgem, unsigned int size, unsigned flags) else kgem_bo_remove_from_inactive(kgem, bo); - bo->tiling = I915_TILING_NONE; + assert(bo->tiling == I915_TILING_NONE); bo->pitch = 0; bo->delta = 0; DBG((" %s: found handle=%d (size=%d) in linear %s cache\n", @@ -1921,22 +1923,13 @@ search_linear_cache(struct kgem *kgem, unsigned int size, unsigned flags) } if (first) { - if (I915_TILING_NONE != first->tiling) { - assert(!use_active); - if (gem_set_tiling(kgem->fd, first->handle, - I915_TILING_NONE, 0) != I915_TILING_NONE) - return NULL; - - if (first->map) - kgem_bo_release_map(kgem, first); - } + assert(first->tiling == I915_TILING_NONE); if (use_active) kgem_bo_remove_from_active(kgem, first); else kgem_bo_remove_from_inactive(kgem, first); - first->tiling = I915_TILING_NONE; first->pitch = 0; first->delta = 0; DBG((" %s: found handle=%d (size=%d) in linear %s cache\n",