Signed-off-by: Ian Romanick <[email protected]>
---
 hw/xfree86/dri2/dri2.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 351d02b..0b52a0f 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -141,6 +141,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
     DRI2BufferPtr   buffers;
     unsigned int temp_buf[32];
     unsigned int *temp = temp_buf;
+    int have_fake_front = 0;
 
 
     /* If the drawable is a window and the front-buffer is requested, silently
@@ -163,6 +164,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
 
            if (attachments[i] == DRI2BufferFakeFrontLeft) {
                need_fake_front--;
+               have_fake_front = 1;
            }
 
            temp[i] = attachments[i];
@@ -171,6 +173,7 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
        if (need_fake_front > 0) {
            temp[i] = DRI2BufferFakeFrontLeft;
            count++;
+           have_fake_front = 1;
            attachments = temp;
        }
     }
@@ -195,6 +198,25 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
     *height = pPriv->height;
     *out_count = pPriv->bufferCount;
 
+
+    /* If the client is getting a fake front-buffer, pre-fill it with the
+     * contents of the real front-buffer.  This ensures correct operation of
+     * applications that call glXWaitX before calling glDrawBuffer.
+     */
+    if (have_fake_front) {
+       BoxRec box;
+       RegionRec region;
+
+       box.x1 = 0;
+       box.y1 = 0;
+       box.x2 = pPriv->width;
+       box.y2 = pPriv->height;
+       REGION_INIT(pDraw->pScreen, &region, &box, 0);
+
+       DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
+                      DRI2BufferFrontLeft);
+    }
+
     return pPriv->buffers;
 }
 
-- 
1.6.0.6


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to