summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-08-29 16:27:35 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-08-29 16:49:09 +0100
commit28c8c5ca14c5b4eab7e2dc58c87050c1019037bb (patch)
tree6559447f92f097824801a003f42411dba78bfd34
parent4f2fc00944272243af343a8b99f6eb8e0dfda006 (diff)
sna: Free the buffers immediately upon release
They do not appear to have been leaked per-se, but we end up accumulating the unused buffers. A more complicated solution would be to reallocate the handle for retained buffers so that the GTT region can be reused. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39184 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index dcc35693..ef829fe8 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -692,7 +692,10 @@ static void kgem_finish_partials(struct kgem *kgem)
if (bo->base.refcnt == 1) {
DBG(("%s: discarding unused partial array: %d/%d\n",
__FUNCTION__, bo->used, bo->alloc));
- goto unref;
+
+ list_del(&bo->base.list);
+ gem_close(kgem->fd, bo->base.handle);
+ free(bo);
}
continue;
@@ -706,7 +709,6 @@ static void kgem_finish_partials(struct kgem *kgem)
bo->need_io = 0;
}
-unref:
list_del(&bo->base.list);
kgem_bo_unref(kgem, &bo->base);
}
@@ -1840,7 +1842,6 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
}
}
-
alloc = (flags & KGEM_BUFFER_LAST) ? 4096 : 32 * 1024;
alloc = ALIGN(size, alloc);
@@ -1879,10 +1880,10 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
bo->need_io = true;
} else {
__kgem_bo_init(&bo->base, handle, alloc);
- bo->base.reusable = false;
bo->base.sync = true;
bo->need_io = 0;
}
+ bo->base.reusable = false;
bo->alloc = alloc;
bo->used = size;