intel: Flush when mapping buffer objects so writes don't get reordered.
authorEric Anholt <eric@anholt.net>
Fri, 3 Jul 2009 01:02:44 +0000 (18:02 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 3 Jul 2009 01:53:56 +0000 (18:53 -0700)
While GEM covers this for execution it knows about, it doesn't know about
the batchbuffer we're preparing.  Fixes piglit vbo-map-remap.c testcase.

src/mesa/drivers/dri/intel/intel_buffer_objects.c
src/mesa/drivers/dri/intel/intel_regions.c

index 9408b0c351fc46ceaaaf51b422eef044fda0a443..9600557f2cc5e63c44ad2248947ed257c8b92186 100644 (file)
@@ -243,6 +243,9 @@ intel_bufferobj_map(GLcontext * ctx,
       return obj->Pointer;
    }
 
+   if (!read_only)
+      intelFlush(ctx);
+
    if (intel_obj->region)
       intel_bufferobj_cow(intel, intel_obj);
 
index 97a0aa592f7dc4c48e4249c1ba3ad99bbe472a47..7525cd9c4d7223ebbb20c97559e2fd3681b905d2 100644 (file)
@@ -111,6 +111,8 @@ debug_backtrace(void)
 GLubyte *
 intel_region_map(struct intel_context *intel, struct intel_region *region)
 {
+   intelFlush(&intel->ctx);
+
    _DBG("%s %p\n", __FUNCTION__, region);
    if (!region->map_refcount++) {
       if (region->pbo)