[PATCH] dri2: Don't throw an error on glXSwapBuffers() when single-buffered.

Eric Anholt eric at anholt.net
Wed Jun 1 14:49:03 PDT 2011


This fixes piglit glx-swap-singlebuffer (but not glx-swap-pixmap,
which hits a BadMatch elsewhere that I haven't tracked down), and the
original bug report of glean clipFlat, which was trying to do exactly
this.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32589
---
 hw/xfree86/dri2/dri2.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 9ca378f..571f7cf 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -802,9 +802,23 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
 	if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
 	    pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
     }
-    if (pSrcBuffer == NULL || pDestBuffer == NULL) {
+
+    /* From the GLX 1.4 specification page 34 (page 40 of the PDF):
+     *
+     *     This operation is a no-op if draw was created with a
+     *     non-double-buffered GLXFBConfig, or if draw is a GLXPixmap.
+     *
+     * We interpret this as "anything with no backbuffer does nothing
+     * for glXSwapBuffers().  See piglit glx-swap-pixmap and
+     * glx-swap-singlebuffer.
+     */
+    if (pSrcBuffer == NULL) {
+	return Success;
+    }
+
+    if (pDestBuffer == NULL) {
         xf86DrvMsg(pScreen->myNum, X_ERROR,
-		   "[DRI2] %s: drawable has no back or front?\n", __func__);
+		   "[DRI2] %s: drawable has no front?\n", __func__);
 	return BadDrawable;
     }
 
-- 
1.7.5.1




More information about the xorg mailing list