intel: flush fake front buffer if server is about to destroy it.
authorPaul Berry <stereotype441@gmail.com>
Fri, 31 May 2013 16:45:49 +0000 (09:45 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 7 Jun 2013 20:42:34 +0000 (13:42 -0700)
Fixes piglit test "spec/!OpenGL 1.0/gl-1.0-front-invalidate-back"

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/intel/intel_context.c

index 7f8a2bbfa8cecdd575e80bbd28bd335f450b775f..09b33b142ed23aeb8238e524f21d93d01cd94770 100644 (file)
@@ -925,6 +925,15 @@ intel_query_dri2_buffers(struct intel_context *intel,
 
       attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
       attachments[i++] = intel_bits_per_pixel(front_rb);
+   } else if (front_rb && intel->front_buffer_dirty) {
+      /* We have pending front buffer rendering, but we aren't querying for a
+       * front buffer.  If the front buffer we have is a fake front buffer,
+       * the X server is going to throw it away when it processes the query.
+       * So before doing the query, make sure all the pending drawing has
+       * landed in the real front buffer.
+       */
+      intel_flush(&intel->ctx);
+      intel_flush_front(&intel->ctx);
    }
 
    if (back_rb) {