summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-07 23:45:37 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-08 09:16:47 +0000
commit5b16972d7850b2347efc084311d664e14263cba1 (patch)
treeba0046d0a3a8ff9f175bb74fefbe001b38000b44
parent207b4d4482a6af4a39472ec20ff04fa0c9322d73 (diff)
sna: Check that we successfully retired an active linear buffer
If we go to the trouble of running retire before searching, we may as well check that we retired something before proceeding to check all the inactive lists. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 0c2f5475..94b6c184 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1945,11 +1945,16 @@ search_linear_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags)
if (num_pages >= MAX_CACHE_SIZE / PAGE_SIZE)
return NULL;
- if (!use_active &&
- list_is_empty(inactive(kgem, num_pages)) &&
- !list_is_empty(active(kgem, num_pages, I915_TILING_NONE)) &&
- !kgem_retire(kgem))
- return NULL;
+ if (!use_active && list_is_empty(inactive(kgem, num_pages))) {
+ if (list_is_empty(active(kgem, num_pages, I915_TILING_NONE)))
+ return NULL;
+
+ if (!kgem_retire(kgem))
+ return NULL;
+
+ if (list_is_empty(inactive(kgem, num_pages)))
+ return NULL;
+ }
if (!use_active && flags & (CREATE_CPU_MAP | CREATE_GTT_MAP)) {
int for_cpu = !!(flags & CREATE_CPU_MAP);