i915tex: Take into account various mapping states when dropping the
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Wed, 14 Feb 2007 10:11:23 +0000 (11:11 +0100)
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Wed, 14 Feb 2007 10:11:37 +0000 (11:11 +0100)
batch buffer after a resolution / rotation switch.

src/mesa/drivers/dri/i915tex/intel_context.c

index aa76875a4ab9c37ec72c4d881b468b1072a80223..a5ce08b17012ecba7b667341ec705a32e4eac2a0 100644 (file)
@@ -643,7 +643,9 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
    if (sarea->width != intel->width ||
        sarea->height != intel->height ||
        sarea->rotation != intel->current_rotation) {
-
+      
+      void *batchMap = intel->batch->map;
+      
       /*
        * FIXME: Really only need to do this when drawing to a
        * common back- or front buffer.
@@ -653,9 +655,18 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
        * This will drop the outstanding batchbuffer on the floor
        */
 
-      driBOUnmap(intel->batch->buffer);
+      if (batchMap != NULL) {
+        driBOUnmap(intel->batch->buffer);
+        intel->batch->map = NULL;
+      }
+
       intel_batchbuffer_reset(intel->batch);
 
+      if (batchMap == NULL) {
+        driBOUnmap(intel->batch->buffer);
+        intel->batch->map = NULL;
+      }
+
       /* lose all primitives */
       intel->prim.primitive = ~0;
       intel->prim.start_ptr = 0;