diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-08 22:05:34 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-08 23:18:20 +0100 |
commit | 0f82c1a451a2d5763d9cf53b48f55200f7716966 (patch) | |
tree | 3fc72aaca89ef1ca450b0dff411a71b52cedd464 /src | |
parent | bd7e653e1ee009e225b0bbf60dcaebc9b0fa2788 (diff) |
sna: Always reuse scanout bo where possible
When looking for an inactive scanout and all are busy, select the oldest
for reuse.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/kgem.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index ed905889..f06c6f2a 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -3878,7 +3878,9 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem, size /= PAGE_SIZE; bucket = cache_bucket(size); - if ((flags & (CREATE_SCANOUT | CREATE_INACTIVE)) == CREATE_SCANOUT) { + if (flags & CREATE_SCANOUT) { + struct kgem_bo *last = NULL; + list_for_each_entry_reverse(bo, &kgem->scanout, list) { assert(bo->scanout); assert(bo->delta); @@ -3901,6 +3903,11 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem, bo->pitch = pitch; } + if (flags & CREATE_INACTIVE && bo->rq) { + last = bo; + continue; + } + list_del(&bo->list); bo->unique_id = kgem_get_unique_id(kgem); @@ -3912,6 +3919,18 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem, return bo; } + if (last) { + list_del(&last->list); + + last->unique_id = kgem_get_unique_id(kgem); + DBG((" 1:from scanout: pitch=%d, tiling=%d, handle=%d, id=%d\n", + last->pitch, last->tiling, last->handle, last->unique_id)); + assert(last->pitch*kgem_aligned_height(kgem, height, last->tiling) <= kgem_bo_size(last)); + assert_tiling(kgem, last); + last->refcnt = 1; + return last; + } + bo = __kgem_bo_create_from_stolen(kgem, size, tiling, pitch); if (bo) return bo; |