summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-13 11:30:32 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-14 18:13:47 +0000
commit252f3818250ecf4776f20afa8111d7f1f6f29c18 (patch)
tree54e4f6a2ef5b555882c29abc1c49385e6c35330a
parent9c73dd91e90810116c215060bac434c5e8174f5f (diff)
sna: Relinquish the GTT mmap on inactive buffers if moved out of the aperture
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index be01f67b..117cc5de 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -851,8 +851,15 @@ inline static void kgem_bo_move_to_inactive(struct kgem *kgem,
list_move(&bo->list, &kgem->inactive[bo->bucket]);
if (bo->map) {
int type = IS_CPU_MAP(bo->map);
- list_move_tail(&bo->vma, &kgem->vma[type].inactive[bo->bucket]);
- kgem->vma[type].count++;
+ if (!type && !kgem_bo_is_mappable(kgem, bo)) {
+ list_del(&bo->vma);
+ munmap(CPU_MAP(bo->map), bo->size);
+ bo->map = NULL;
+ }
+ if (bo->map) {
+ list_move_tail(&bo->vma, &kgem->vma[type].inactive[bo->bucket]);
+ kgem->vma[type].count++;
+ }
}
kgem->need_expire = true;