diff options
author | Christoph Bumiller <[email protected]> | 2011-01-05 01:41:49 +0100 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-01-08 02:12:20 +0100 |
commit | bd301dfc12be76b155d9b2b65c4e4f142ab94320 (patch) | |
tree | d3b3a0be61d892a60fd4e600ad975dc3702ef9b3 /src/gallium/drivers | |
parent | 96d8a54716d96bd28f0c54a25ca6904fb4321a55 (diff) |
nvc0: tie buffer memory release to the buffer fence
... instead of the next fence to be emitted. This way we have a
chance to reclaim the storage earlier.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nvc0/nvc0_buffer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/nvc0/nvc0_buffer.c b/src/gallium/drivers/nvc0/nvc0_buffer.c index 8021e4348b2..0c19c526e0a 100644 --- a/src/gallium/drivers/nvc0/nvc0_buffer.c +++ b/src/gallium/drivers/nvc0/nvc0_buffer.c @@ -51,8 +51,12 @@ nvc0_buffer_allocate(struct nvc0_screen *screen, struct nvc0_resource *buf, static INLINE void release_allocation(struct nvc0_mm_allocation **mm, struct nvc0_fence *fence) { - (*mm)->next = fence->buffers; - fence->buffers = (*mm); + if (fence && fence->state != NVC0_FENCE_STATE_SIGNALLED) { + (*mm)->next = fence->buffers; + fence->buffers = (*mm); + } else { + nvc0_mm_free(*mm); + } (*mm) = NULL; } @@ -60,13 +64,12 @@ static void nvc0_buffer_destroy(struct pipe_screen *pscreen, struct pipe_resource *presource) { - struct nvc0_screen *screen = nvc0_screen(pscreen); struct nvc0_resource *res = nvc0_resource(presource); nouveau_bo_ref(NULL, &res->bo); if (res->mm) - release_allocation(&res->mm, screen->fence.current); + release_allocation(&res->mm, res->fence); if (res->data && !(res->status & NVC0_BUFFER_STATUS_USER_MEMORY)) FREE(res->data); |