intel: GetBuffer fix
authorBen Widawsky <ben@bwidawsk.net>
Mon, 8 Aug 2011 00:04:04 +0000 (17:04 -0700)
committerBen Widawsky <ben@bwidawsk.net>
Wed, 10 Aug 2011 23:07:40 +0000 (16:07 -0700)
After copy buffer on preGEN6, it is necessary to wait for the blit to
complete before returning data to the user.

This should fix the piglit test: copy_buffer_coherency (pre-GEN6).

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_buffer_objects.c

index 439d6fc8247607382b287edd131a7b8a9f56ebed..703300b31af7638093aeb92bc4f2ccf8bed1424b 100644 (file)
@@ -282,12 +282,17 @@ intel_bufferobj_get_subdata(struct gl_context * ctx,
                             GLvoid * data, struct gl_buffer_object *obj)
 {
    struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
+   struct intel_context *intel = intel_context(ctx);
 
    assert(intel_obj);
    if (intel_obj->sys_buffer)
       memcpy(data, (char *)intel_obj->sys_buffer + offset, size);
-   else
+   else {
+      if (drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) {
+        intel_batchbuffer_flush(intel);
+      }
       drm_intel_bo_get_subdata(intel_obj->buffer, offset, size, data);
+   }
 }