From ec5ca6844bd52a3a17005314b615f1629f652686 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 28 Feb 2008 15:45:46 -0800 Subject: [intel] Bug #14575: Unmap buffers when deleting/dataing as required. Otherwise, we would assertion error when doing the final unreference of the buffer with an outstanding map (catching the memory leak). --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index bd1b2ca1b14..951b8cbfb76 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -35,6 +35,10 @@ #include "intel_regions.h" #include "dri_bufmgr.h" +static GLboolean intel_bufferobj_unmap(GLcontext * ctx, + GLenum target, + struct gl_buffer_object *obj); + /** Allocates a new dri_bo to store the data for the buffer object. */ static void intel_bufferobj_alloc_buffer(struct intel_context *intel, @@ -101,6 +105,12 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj) assert(intel_obj); + /* Buffer objects are automatically unmapped when deleting according + * to the spec. + */ + if (obj->Pointer) + intel_bufferobj_unmap(ctx, 0, obj); + if (intel_obj->region) { intel_bufferobj_release_region(intel, intel_obj); } @@ -132,6 +142,12 @@ intel_bufferobj_data(GLcontext * ctx, intel_obj->Base.Size = size; intel_obj->Base.Usage = usage; + /* Buffer objects are automatically unmapped when creating new data buffers + * according to the spec. + */ + if (obj->Pointer) + intel_bufferobj_unmap(ctx, 0, obj); + if (intel_obj->region) intel_bufferobj_release_region(intel, intel_obj); -- cgit v1.2.3