summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-02-26 12:48:56 -0800
committerIan Romanick <[email protected]>2014-02-28 15:23:59 -0800
commit6e3ce7997ac9adec4cc9aba62c0aea611460bbbb (patch)
treea88707e26dbe7bc07bfc9bb57f81800bac751967 /src
parent1b6aad2234f277da1c4e0b2cd6634e8303526d9d (diff)
i915: Allocate the sys_buffer using _mesa_align_malloc
Though it won't matter on Linux, use _mesa_align_free to release it. Since i965 doesn't have sys_buffer, I overlooked this in the GL_ARB_map_buffer_alignment work a few months ago. Fixes i915 (and presumably i830) regressions in ARB_map_buffer_range tests and the failure in arb_map_buffer_alignment-sanity_test. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74960 Cc: "10.1" <[email protected]> Reviewed-by: Matt Turner <[email protected]> (cherry picked from commit ff2cbf9e0ca0ee46a15add1a42cd48705c84e0de)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/intel_buffer_objects.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
index 345db6dfe0f..21403150d72 100644
--- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
@@ -96,7 +96,7 @@ intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj)
if (obj->Pointer)
intel_bufferobj_unmap(ctx, obj);
- free(intel_obj->sys_buffer);
+ _mesa_align_free(intel_obj->sys_buffer);
drm_intel_bo_unreference(intel_obj->buffer);
free(intel_obj);
@@ -129,7 +129,7 @@ intel_bufferobj_data(struct gl_context * ctx,
if (intel_obj->buffer != NULL)
release_buffer(intel_obj);
- free(intel_obj->sys_buffer);
+ _mesa_align_free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
if (size != 0) {
@@ -137,7 +137,8 @@ intel_bufferobj_data(struct gl_context * ctx,
* contents anyway.
*/
if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) {
- intel_obj->sys_buffer = malloc(size);
+ intel_obj->sys_buffer =
+ _mesa_align_malloc(size, ctx->Const.MinMapBufferAlignment);
if (intel_obj->sys_buffer != NULL) {
if (data != NULL)
memcpy(intel_obj->sys_buffer, data, size);
@@ -188,7 +189,7 @@ intel_bufferobj_subdata(struct gl_context * ctx,
return;
}
- free(intel_obj->sys_buffer);
+ _mesa_align_free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
}
@@ -295,7 +296,7 @@ intel_bufferobj_map_range(struct gl_context * ctx,
return obj->Pointer;
}
- free(intel_obj->sys_buffer);
+ _mesa_align_free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
}
@@ -478,7 +479,7 @@ intel_bufferobj_buffer(struct intel_context *intel,
0, intel_obj->Base.Size,
intel_obj->sys_buffer);
- free(intel_obj->sys_buffer);
+ _mesa_align_free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
intel_obj->offset = 0;
}
@@ -663,7 +664,7 @@ intel_buffer_object_purgeable(struct gl_context * ctx,
return intel_buffer_purgeable(intel_obj->buffer);
if (option == GL_RELEASED_APPLE) {
- free(intel_obj->sys_buffer);
+ _mesa_align_free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
return GL_RELEASED_APPLE;