diff options
author | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2011-01-04 01:14:00 +0100 |
---|---|---|
committer | Christoph Bumiller <e0425955@student.tuwien.ac.at> | 2011-01-04 16:14:46 +0100 |
commit | 6de94e1012498b6859d9796f2836a162bb0ca4bc (patch) | |
tree | ad57341116996f0f4d83364c4f1e268a6c346014 /src/gallium/drivers/nvc0/nvc0_mm.c | |
parent | 471025929c893d223668814ad0f8e2bee76aac63 (diff) |
nvc0: delete memory caches and fence on screen destruction
Diffstat (limited to 'src/gallium/drivers/nvc0/nvc0_mm.c')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_mm.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_mm.c b/src/gallium/drivers/nvc0/nvc0_mm.c index e031fb393a..0629dad19c 100644 --- a/src/gallium/drivers/nvc0/nvc0_mm.c +++ b/src/gallium/drivers/nvc0/nvc0_mm.c @@ -243,3 +243,32 @@ nvc0_mm_create(struct nouveau_device *dev, uint32_t domain, return cache; } +static INLINE void +nvc0_mm_free_slabs(struct list_head *head) +{ + struct mm_slab *slab, *next; + + LIST_FOR_EACH_ENTRY_SAFE(slab, next, head, head) { + LIST_DEL(&slab->head); + nouveau_bo_ref(NULL, &slab->bo); + FREE(slab); + } +} + +void +nvc0_mm_destroy(struct nvc0_mman *cache) +{ + int i; + + for (i = 0; i < MM_NUM_BUCKETS; ++i) { + if (!LIST_IS_EMPTY(&cache->bucket[i].used) || + !LIST_IS_EMPTY(&cache->bucket[i].full)) + debug_printf("WARNING: destroying GPU memory cache " + "with some buffers still in use\n"); + + nvc0_mm_free_slabs(&cache->bucket[i].free); + nvc0_mm_free_slabs(&cache->bucket[i].used); + nvc0_mm_free_slabs(&cache->bucket[i].full); + } +} + |