It can be quite an expensive operation, so we're better off not doing
it unless it's totally required.

Signed-off-by: Francisco Jerez <curroje...@riseup.net>
---
 hw/xfree86/dri2/dri2.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 3db826e..3f4ed92 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -212,6 +212,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
     int have_fake_front = 0;
     int front_format = 0;
     int dimensions_match;
+    int buffers_changed;
     int i;
 
     if (!pPriv) {
@@ -224,6 +225,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
     dimensions_match = (pDraw->width == pPriv->width)
        && (pDraw->height == pPriv->height);
 
+    buffers_changed = (pPriv->buffers == NULL);
+
     buffers = xalloc((count + 1) * sizeof(buffers[0]));
 
     for (i = 0; i < count; i++) {
@@ -280,6 +283,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
        for (i = 0; i < pPriv->bufferCount; i++) {
            if (pPriv->buffers[i] != NULL) {
                (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+               buffers_changed = 1;
            }
        }
 
@@ -298,7 +302,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
      * contents of the real front-buffer.  This ensures correct operation of
      * applications that call glXWaitX before calling glDrawBuffer.
      */
-    if (have_fake_front) {
+    if (have_fake_front && buffers_changed) {
        BoxRec box;
        RegionRec region;
 
-- 
1.6.4.4


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to