diff options
author | Brian Paul <brianp@vmware.com> | 2012-08-30 09:27:16 -0600 |
---|---|---|
committer | Andreas Boll <andreas.boll.dev@gmail.com> | 2013-02-13 18:46:40 +0100 |
commit | dca04373c2efb177dbb7dca3ad2b57cb36b2ebe6 (patch) | |
tree | 07856ac375d4136d38cf8c2c5a023349f4cbaf07 | |
parent | a8f8287154bfebc8bade25703ef252d251386186 (diff) |
mesa: fix-up and use _mesa_delete_renderbuffer()
_mesa_delete_renderbuffer() should free the mutex (though that may be a
no-op) and then free the renderbuffer object itself. Subclasses of
gl_renderbuffer can use this function too.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
(cherry picked from commit 8472bb4508515cf0f717344ef5cc863b6e97e56a)
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast.c | 2 | ||||
-rw-r--r-- | src/mesa/main/renderbuffer.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_renderbuffer.c | 2 |
7 files changed, 11 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 82d4bb8934..ba360c5bf6 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -95,7 +95,7 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb) intel_miptree_release(&irb->mt); - free(irb); + _mesa_delete_renderbuffer(rb); } /** diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c index 50eb182435..3be958bbca 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c @@ -107,7 +107,7 @@ nouveau_renderbuffer_del(struct gl_renderbuffer *rb) struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface; nouveau_surface_ref(NULL, s); - FREE(rb); + _mesa_delete_renderbuffer(rb); } static struct gl_renderbuffer * diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 9032a323a3..2267a10b64 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -67,7 +67,7 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb) if (rrb && rrb->bo) { radeon_bo_unref(rrb->bo); } - free(rrb); + _mesa_delete_renderbuffer(rb); } #if defined(RADEON_R100) diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 9aed2f6e6c..f0ff0b0aaf 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -268,7 +268,7 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb) TRACE; free(xrb->Base.Buffer); - free(xrb); + _mesa_delete_renderbuffer(rb); } /* see bytes_per_line in libGL */ diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 1bb09bfe6a..26f53d1009 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -75,11 +75,15 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name) /** * Delete a gl_framebuffer. * This is the default function for renderbuffer->Delete(). + * Drivers which subclass gl_renderbuffer should probably implement their + * own delete function. But the driver might also call this function to + * free the object in the end. */ void _mesa_delete_renderbuffer(struct gl_renderbuffer *rb) { - /* no-op */ + _glthread_DESTROY_MUTEX(rb->Mutex); + free(rb); } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 40e3677f6a..01aba8eaff 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -232,7 +232,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb) pipe_surface_reference(&strb->surface, NULL); pipe_resource_reference(&strb->texture, NULL); free(strb->data); - free(strb); + _mesa_delete_renderbuffer(rb); } diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c index d8a7467b08..e468bdb16b 100644 --- a/src/mesa/swrast/s_renderbuffer.c +++ b/src/mesa/swrast/s_renderbuffer.c @@ -174,7 +174,7 @@ soft_renderbuffer_delete(struct gl_renderbuffer *rb) free(srb->Buffer); srb->Buffer = NULL; } - free(srb); + _mesa_delete_renderbuffer(rb); } |