summaryrefslogtreecommitdiff
path: root/src/sna/kgem.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-05-26 06:54:03 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-05-26 07:46:51 +0100
commitb508d8f3318c42a2a87b7731789b1d03610e9b46 (patch)
treec9ae4b939f8c2e3c225d7eb68629ae42cb2373d1 /src/sna/kgem.c
parent605fcd9050efc816ac8163e8d626f466d98261c2 (diff)
sna: Assert that we do not replace active IO buffers
References: https://bugs.freedesktop.org/show_bug.cgi?id=79238 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.c')
-rw-r--r--src/sna/kgem.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index f635150a..12e41ca1 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -6223,7 +6223,7 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
__FUNCTION__, size, bo->used, bytes(&bo->base)));
gem_write__cachealigned(kgem->fd, bo->base.handle,
0, bo->used, bo->mem);
- kgem_buffer_release(kgem, bo);
+ assert(list_is_empty(&bo->base.vma));
bo->need_io = 0;
bo->write = 0;
offset = 0;
@@ -6280,13 +6280,14 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
goto done;
}
- if (size <= bytes(&bo->base) &&
+ if (bo->base.refcnt == 1 &&
+ size <= bytes(&bo->base) &&
(bo->base.rq == NULL ||
!__kgem_busy(kgem, bo->base.handle))) {
DBG(("%s: reusing whole buffer? size=%d, total=%d\n",
__FUNCTION__, size, bytes(&bo->base)));
__kgem_bo_clear_busy(&bo->base);
- kgem_buffer_release(kgem, bo);
+ assert(list_is_empty(&bo->base.vma));
switch (bo->mmapped) {
case MMAPPED_CPU: