Track whether or not front-buffer rendering may have occured.  If
there might be any pending front-buffer rendering waiting to get to
the screen, flush it from glFlush and related paths in the driver.

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
---
 src/mesa/drivers/dri/intel/intel_buffers.c |    2 ++
 src/mesa/drivers/dri/intel/intel_context.c |   11 +++++++++++
 src/mesa/drivers/dri/intel/intel_context.h |   10 ++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c 
b/src/mesa/drivers/dri/intel/intel_buffers.c
index f1908cb..26dd818 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -204,6 +204,8 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer 
*fb)
               intel_batchbuffer_flush(intel->batch);
            intel->front_cliprects = GL_TRUE;
            colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
+
+           intel->front_buffer_dirty = GL_TRUE;
         }
         else {
            if (!intel->constant_cliprect && intel->front_cliprects)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index 0aa1c18..72169ca 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -531,6 +531,17 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
 
    if (intel->batch->map != intel->batch->ptr)
       intel_batchbuffer_flush(intel->batch);
+
+   if (intel->front_buffer_dirty) {
+      __DRIscreen *const screen = intel->intelScreen->driScrnPriv;
+
+      intel->front_buffer_dirty = GL_FALSE;
+
+      if ((screen->dri2.loader->base.version >= 2)
+         && (screen->dri2.loader->flushFrontBuffer != NULL)) {
+        
(*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable->loaderPrivate);
+      }
+   }
 }
 
 void
diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index 8a8e59f..0af7677 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -260,11 +260,21 @@ struct intel_context
     * flush time while the lock is held.
     */
    GLboolean constant_cliprect;
+
    /**
     * In !constant_cliprect mode, set to true if the front cliprects should be
     * used instead of back.
     */
    GLboolean front_cliprects;
+
+   /**
+    * Set if rendering has occured to the drawable's front buffer.
+    *
+    * This is used in the DRI2 case to detect that glFlush should also copy
+    * the contents of the fake front buffer to the real front buffer.
+    */
+   GLboolean front_buffer_dirty;
+
    drm_clip_rect_t fboRect;     /**< cliprect for FBO rendering */
 
    int perf_boxes;
-- 
1.6.0.6

Attachment: pgpcfoLjS0d9a.pgp
Description: PGP signature

------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to