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>
This commit is contained in:
parent
4f2fc00944
commit
28c8c5ca14
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue