diff options
author | Tilman Sauerbeck <[email protected]> | 2006-06-11 09:12:27 +0000 |
---|---|---|
committer | Tilman Sauerbeck <[email protected]> | 2006-06-11 09:12:27 +0000 |
commit | 51eb359ea96a048f942b5e72c5634d36d9859d97 (patch) | |
tree | d6d4ba1584aae710c3bf6aa84d929dfa134cb556 /src | |
parent | 5b90cf2f2f3dcda0d674c01859847149b4054608 (diff) |
destroy the memory manager along with the context
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_mm.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_mm.h | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index ab582525abc..d7f027dcb82 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -486,6 +486,13 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv) radeonCleanupContext(&r300->radeon); +#ifdef USER_BUFFERS + /* the memory manager might be accessed when Mesa frees the shared + * state, so don't destroy it earlier + */ + radeon_mm_destroy(r300); +#endif + /* free the option cache */ driDestroyOptionCache(&r300->radeon.optionCache); diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c index 55aa5df01a6..ce3c5e4b9ab 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.c +++ b/src/mesa/drivers/dri/r300/radeon_mm.c @@ -69,6 +69,15 @@ void radeon_mm_init(r300ContextPtr rmesa) resize_u_list(rmesa); } +void radeon_mm_destroy(r300ContextPtr rmesa) +{ + _mesa_free(rmesa->rmm->u_list); + rmesa->rmm->u_list = NULL; + + _mesa_free(rmesa->rmm); + rmesa->rmm = NULL; +} + void *radeon_mm_ptr(r300ContextPtr rmesa, int id) { assert(id <= rmesa->rmm->u_last); diff --git a/src/mesa/drivers/dri/r300/radeon_mm.h b/src/mesa/drivers/dri/r300/radeon_mm.h index 9df5224ddeb..81f89917e60 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.h +++ b/src/mesa/drivers/dri/r300/radeon_mm.h @@ -26,6 +26,7 @@ struct radeon_memory_manager { }; extern void radeon_mm_init(r300ContextPtr rmesa); +extern void radeon_mm_destroy(r300ContextPtr rmesa); extern void *radeon_mm_ptr(r300ContextPtr rmesa, int id); extern int radeon_mm_find(r300ContextPtr rmesa, void *ptr); extern int radeon_mm_alloc(r300ContextPtr rmesa, int alignment, int size); |