summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2008-02-28 15:45:46 -0800
committerEric Anholt <[email protected]>2008-02-28 16:01:15 -0800
commitec5ca6844bd52a3a17005314b615f1629f652686 (patch)
treeb3a935a173690e74dd54cf2b89ca83bdce325100
parent981b7da8a7e263979ce68d39b122b4cc7adea8e3 (diff)
[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).
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c16
1 files changed, 16 insertions, 0 deletions
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);