Mesa (master): DRI2: Always call X server from dri2WaitX.

Michel Dänzer daenzer at kemper.freedesktop.org
Sun Aug 30 10:54:30 UTC 2009


Module: Mesa
Branch: master
Commit: 74ce9703a5a65267a9c0b6fb0ceb3c57cce20b5b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=74ce9703a5a65267a9c0b6fb0ceb3c57cce20b5b

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Sun Aug 30 12:37:13 2009 +0200

DRI2: Always call X server from dri2WaitX.

When there is no fake front buffer, just copy the top left pixel of the back
buffer onto itself. This should make sure the X server command stream is
flushed.

---

 src/glx/x11/dri2_glx.c |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index 89efe3a..aed7327 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -228,7 +228,8 @@ dri2CopySubBuffer(__GLXDRIdrawable * pdraw,
    /* Refresh the fake front (if present) after we just damaged the real
     * front.
     */
-   dri2WaitX(pdraw);
+   if (priv->have_fake_front)
+      dri2WaitX(pdraw);
 }
 
 static void
@@ -247,22 +248,36 @@ dri2WaitX(__GLXDRIdrawable * pdraw)
    XserverRegion region;
 
    /* Check we have the right attachments */
-   if (!priv->have_fake_front)
-      return;
+   if (priv->have_fake_front) {
+      xrect.x = 0;
+      xrect.y = 0;
+      xrect.width = priv->width;
+      xrect.height = priv->height;
 
-   xrect.x = 0;
-   xrect.y = 0;
-   xrect.width = priv->width;
-   xrect.height = priv->height;
+#ifdef __DRI2_FLUSH
+      if (pdraw->psc->f)
+         (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
+      region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+      DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
+                     DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+   } else {
+      xrect.x = 0;
+      xrect.y = 0;
+      xrect.width = 1;
+      xrect.height = 1;
 
 #ifdef __DRI2_FLUSH
-   if (pdraw->psc->f)
-      (*pdraw->psc->f->flush) (pdraw->driDrawable);
+      if (pdraw->psc->f)
+         (*pdraw->psc->f->flush)(pdraw->driDrawable);
 #endif
 
-   region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
-   DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
-                  DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+      region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+      DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
+                     DRI2BufferBackLeft, DRI2BufferBackLeft);
+   }
+
    XFixesDestroyRegion(pdraw->psc->dpy, region);
 }
 




More information about the mesa-commit mailing list