summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-28 23:14:24 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-29 10:33:31 +0100
commit32a9e0352a1e28509580d84bfc5377d8fae913c4 (patch)
treea118d9db3e8e360c35ce4bc8cab72c5a5c327b63
parent15266e1b9500f6b348661c60d1982bde911f2d0e (diff)
sna: Retire and search inactive again before creating new buffer
Attempt to retire an active buffer into the inactive cache before giving up and creating a new buffer. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index e8df7d9a..4827fb8e 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1270,6 +1270,13 @@ struct kgem_bo *kgem_create_linear(struct kgem *kgem, int size)
if (bo)
return kgem_bo_reference(bo);
+ if (!list_is_empty(&kgem->requests)) {
+ kgem_retire(kgem);
+ bo = search_linear_cache(kgem, size, false);
+ if (bo)
+ return kgem_bo_reference(bo);
+ }
+
handle = gem_create(kgem->fd, size);
if (handle == 0)
return NULL;
@@ -1541,6 +1548,12 @@ next_bo:
continue;
}
+ if (flags & CREATE_INACTIVE && !list_is_empty(&kgem->requests)) {
+ kgem_retire(kgem);
+ flags &= ~CREATE_INACTIVE;
+ goto skip_active_search;
+ }
+
handle = gem_create(kgem->fd, size);
if (handle == 0)
return NULL;