summaryrefslogtreecommitdiff
path: root/src/sna/kgem.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-11-08 08:53:55 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-11-08 09:56:18 +0000
commit84d667b94a97ad5fde68d730d57a19e1f4241ed5 (patch)
treee24a5ce8bfe6d3b3fd937d7238fba14a5a4ef975 /src/sna/kgem.c
parentcb579a4444146a0736c7bad5edc1f382a32b6bf6 (diff)
sna: Always schedule upload buffers for retirement after use
Even if they are multiply referenced due to cached references. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.c')
-rw-r--r--src/sna/kgem.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 5a540e42..a87b2a52 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1590,10 +1590,15 @@ kgem_add_handle(struct kgem *kgem, struct kgem_bo *bo)
static void kgem_add_bo(struct kgem *kgem, struct kgem_bo *bo)
{
+ assert(bo->refcnt);
+ assert(bo->proxy == NULL);
+
bo->exec = kgem_add_handle(kgem, bo);
bo->rq = MAKE_REQUEST(kgem->next_request, kgem->ring);
list_move_tail(&bo->request, &kgem->next_request->buffers);
+ if (bo->io && !list_is_empty(&bo->list))
+ list_move(&bo->list, &kgem->batch_buffers);
/* XXX is it worth working around gcc here? */
kgem->flush |= bo->flush;
@@ -2073,17 +2078,18 @@ static void kgem_bo_unref(struct kgem *kgem, struct kgem_bo *bo)
static void kgem_buffer_release(struct kgem *kgem, struct kgem_buffer *bo)
{
+ assert(bo->base.io);
while (!list_is_empty(&bo->base.vma)) {
struct kgem_bo *cached;
cached = list_first_entry(&bo->base.vma, struct kgem_bo, vma);
assert(cached->proxy == &bo->base);
+ assert(cached != &bo->base);
list_del(&cached->vma);
assert(*(struct kgem_bo **)cached->map__gtt == cached);
*(struct kgem_bo **)cached->map__gtt = NULL;
cached->map__gtt = NULL;
- assert(cached->map__cpu == NULL);
kgem_bo_destroy(kgem, cached);
}
@@ -2285,7 +2291,7 @@ bool kgem_retire(struct kgem *kgem)
{
bool retired = false;
- DBG(("%s\n", __FUNCTION__));
+ DBG(("%s, need_retire?=%d\n", __FUNCTION__, kgem->need_retire));
kgem->need_retire = false;
@@ -2460,11 +2466,9 @@ static void kgem_finish_buffers(struct kgem *kgem)
DBG(("%s: retaining upload buffer (%d/%d): used=%d, refcnt=%d\n",
__FUNCTION__, bo->used, bytes(&bo->base), used, bo->base.refcnt));
bo->used = used;
- if (bo->base.refcnt == 1) {
- list_move(&bo->base.list,
- &kgem->active_buffers);
- kgem->need_retire = true;
- }
+ list_move(&bo->base.list,
+ &kgem->active_buffers);
+ kgem->need_retire = true;
continue;
}
DBG(("%s: discarding mmapped buffer, used=%d, map type=%d\n",