From f0fd4d500de03c30c7ce19915f85acadd1ca4e5d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 23 Sep 2015 10:52:42 +0100 Subject: [PATCH] sna: Explicitly retire any buffers underneath the static_request If we are forced to use the static_request (reserved for allocation failure), we dispatch the execbuffer synchronously and expect no buffers to be present afterwards. Rather than just assert that this is so, we should clean up the buffer list! Signed-off-by: Chris Wilson --- src/sna/kgem.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index ed1ec58b..b975bfc7 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -3091,7 +3091,6 @@ static bool __kgem_retire_rq(struct kgem *kgem, struct kgem_request *rq) } bo->domain = DOMAIN_NONE; - bo->gtt_dirty = false; bo->rq = NULL; if (bo->refcnt) continue; @@ -3335,6 +3334,7 @@ static void kgem_commit(struct kgem *kgem) bo->binding.offset = 0; bo->domain = DOMAIN_GPU; bo->gpu_dirty = false; + bo->gtt_dirty = false; if (bo->proxy) { /* proxies are not used for domain tracking */ @@ -3358,6 +3358,23 @@ static void kgem_commit(struct kgem *kgem) kgem_throttle(kgem); } + while (!list_is_empty(&rq->buffers)) { + bo = list_first_entry(&rq->buffers, + struct kgem_bo, + request); + + assert(RQ(bo->rq) == rq); + assert(bo->exec == NULL); + assert(bo->domain == DOMAIN_GPU); + + list_del(&bo->request); + bo->domain = DOMAIN_NONE; + bo->rq = NULL; + + if (bo->refcnt == 0) + _kgem_bo_destroy(kgem, bo); + } + kgem_retire(kgem); assert(list_is_empty(&rq->buffers));