i965: Fix buffer object segfault since removal of system memory BOs.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 2 Jul 2013 05:08:22 +0000 (22:08 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 3 Jul 2013 17:48:12 +0000 (10:48 -0700)
Commit cf31a19300cbcecddb6bd0f878abb9316ebad2a1 removed support for BOs
backed by system memory, as it was only useful for i915.  However, it
removed a little too much code: intel_bufferobj_buffer() used to call
intel_bufferobj_alloc_buffer(), and after that commit, it didn't.

This led to NULL pointer dereferences in several test cases, such as
es3conform's transform_feedback_state_variables test.

This commit restores the allocation, preserving the original behavior.
It may not be the cleanest approach, but tidying should come later.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66432
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/intel_buffer_objects.c

index a8cd713aa9f39ee33a3c0c84ce87da175cdc0c7a..3f55122823e660d3e61dff946860af1cbd9d8e19 100644 (file)
@@ -417,6 +417,9 @@ intel_bufferobj_buffer(struct intel_context *intel,
    if (intel_obj->source)
       release_buffer(intel_obj);
 
+   if (intel_obj->buffer == NULL)
+      intel_bufferobj_alloc_buffer(intel, intel_obj);
+
    return intel_obj->buffer;
 }