summaryrefslogtreecommitdiff
path: root/src/sna/kgem.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-09-29 23:33:23 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-29 23:34:18 +0100
commit2c06e9576aa62290a133cea5158bb979284ac8a8 (patch)
tree70f2d23e66bf1f51b19523581e923a5a6c899c68 /src/sna/kgem.c
parent57c799deb01b8a5919f872926cf71f11cb3aee15 (diff)
sna: Use the bo allocation cache for converting buffers
Since we have a malloc cache for the bo, we may as well use it when converting from an upload buffer to a bo. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.c')
-rw-r--r--src/sna/kgem.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4e70f146..9685fb34 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1742,7 +1742,11 @@ static struct kgem_bo *kgem_bo_replace_io(struct kgem_bo *bo)
return bo;
assert(!bo->snoop);
- base = malloc(sizeof(*base));
+ if (__kgem_freed_bo) {
+ base = __kgem_freed_bo;
+ __kgem_freed_bo = *(struct kgem_bo **)base;
+ } else
+ base = malloc(sizeof(*base));
if (base) {
DBG(("%s: transferring io handle=%d to bo\n",
__FUNCTION__, bo->handle));