summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-18 21:29:29 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-18 21:30:58 +0100
commitd2312c8f958002e54ddcb834f37916f4b46ac291 (patch)
tree8c896bdb5fe7b0815cb129649b83a0ba6886b626
parent75e9eeca7e998b1ee3f8b0df780adae1b9e5b408 (diff)
sna: Fixup tracking of vmap upload buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 84475fe8..aaddda4f 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1032,7 +1032,9 @@ static void kgem_bo_free(struct kgem *kgem, struct kgem_bo *bo)
if (IS_VMAP_MAP(bo->map)) {
assert(bo->rq == NULL);
- free(MAP(bo->map));
+ assert(MAP(bo->map) != bo || bo->io);
+ if (bo != MAP(bo->map))
+ free(MAP(bo->map));
bo->map = NULL;
}
if (bo->map)
@@ -1578,6 +1580,7 @@ static void kgem_finish_partials(struct kgem *kgem)
(kgem->has_llc || !IS_CPU_MAP(bo->base.map))) {
DBG(("%s: retaining partial upload buffer (%d/%d)\n",
__FUNCTION__, bo->used, bytes(&bo->base)));
+ assert(!bo->base.vmap);
list_move(&bo->base.list,
&kgem->active_partials);
continue;
@@ -3881,10 +3884,11 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
DBG(("%s: created vmap handle=%d for buffer\n",
__FUNCTION__, bo->base.handle));
- bo->need_io = false;
bo->base.io = true;
bo->base.vmap = true;
+ bo->base.map = MAKE_VMAP_MAP(bo);
bo->mmapped = true;
+ bo->need_io = false;
goto init;
}