diff options
author | Eric Anholt <[email protected]> | 2007-05-31 09:45:45 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2007-05-31 09:45:45 -0700 |
commit | 2ac17c68e2d64260168a54a275e839775828f534 (patch) | |
tree | ceb8b3e74c5259713d6a32829baf90983310acfc | |
parent | fb7e21514f96c36e4c5abcb6621d48cb16a8c1e1 (diff) |
Add buffer manager destroy function.
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr_ttm.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_screen.c | 2 |
5 files changed, 30 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 840fc7601ac..407409bf06d 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -144,3 +144,9 @@ dri_bo_get_subdata(dri_bo *bo, unsigned long offset, memcpy(data, (unsigned char *)bo->virtual + offset, size); dri_bo_unmap(bo); } + +void +dri_bufmgr_destroy(dri_bufmgr *bufmgr) +{ + bufmgr->destroy(bufmgr); +} diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 6aac54b7f42..0f8e27923be 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -155,8 +155,9 @@ struct _dri_bufmgr { void (*fence_wait)(dri_fence *fence); /** - * Checks and returns whether the given fence is signaled. + * Tears down the buffer manager instance. */ + void (*destroy)(dri_bufmgr *bufmgr); }; dri_bo *dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, @@ -190,6 +191,6 @@ dri_bufmgr *dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, int (*fence_wait)(void *private, unsigned int cookie), void *driver_priv); -void dri_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr); +void dri_bufmgr_destroy(dri_bufmgr *bufmgr); #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index 90a2ff85f98..c6202d969cc 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -829,6 +829,16 @@ dri_fake_fence_wait(dri_fence *fence) _glthread_UNLOCK_MUTEX(bufmgr_fake->mutex); } +static void +dri_fake_destroy(dri_bufmgr *bufmgr) +{ + dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr; + + _glthread_DESTROY_MUTEX(bufmgr_fake->mutex); + mmDestroy(bufmgr_fake->heap); + free(bufmgr); +} + dri_bufmgr * dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, unsigned long size, @@ -865,6 +875,7 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->bufmgr.fence_wait = dri_fake_fence_wait; bufmgr_fake->bufmgr.fence_reference = dri_fake_fence_reference; bufmgr_fake->bufmgr.fence_unreference = dri_fake_fence_unreference; + bufmgr_fake->bufmgr.destroy = dri_fake_destroy; bufmgr_fake->fence_emit = fence_emit; bufmgr_fake->fence_wait = fence_wait; diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c index a721a7ce5c3..64248a1d871 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c @@ -339,6 +339,15 @@ dri_ttm_fence_wait(dri_fence *fence) } } +static void +dri_fake_destroy(dri_bufmgr *bufmgr) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; + + _glthread_DESTROY_MUTEX(bufmgr_ttm->mutex); + free(bufmgr); +} + /** * Initializes the TTM buffer manager, which uses the kernel to allocate, map, * and manage map buffer objections. diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index 4d61407909d..e3a631b6961 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -557,7 +557,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv) intelUnmapScreenRegions(intelScreen); - /* XXX: bufmgr teardown */ + dri_bufmgr_destroy(intelScreen->bufmgr); FREE(intelScreen); sPriv->private = NULL; } |