Mesa (dri2-swapbuffers): Make swapbuffers a one way request

Jesse Barnes jbarnes at kemper.freedesktop.org
Wed Jun 3 15:49:19 UTC 2009


Module: Mesa
Branch: dri2-swapbuffers
Commit: 65773bd7e69e424e7788c528524d7f29c4937ccd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=65773bd7e69e424e7788c528524d7f29c4937ccd

Author: Jesse Barnes <jbarnes at jbarnes-x200.(none)>
Date:   Wed Jun  3 12:02:39 2009 +0100

Make swapbuffers a one way request

In preparation for using invalidate buffers to force a new getbuffers request.

---

 include/GL/internal/dri_interface.h    |    3 --
 src/glx/x11/dri2.c                     |   36 +------------------------------
 src/glx/x11/dri2.h                     |    4 +-
 src/glx/x11/dri2_glx.c                 |   12 +--------
 src/mesa/drivers/dri/common/dri_util.c |   11 ---------
 src/mesa/drivers/dri/common/dri_util.h |    7 ------
 6 files changed, 6 insertions(+), 67 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index c7cef6b..910c916 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -732,9 +732,6 @@ struct __DRIdri2ExtensionRec {
 				      __DRIcontext *shared,
 				      void *loaderPrivate);
 
-    void (*setBuffers)(__DRIdrawable *drawable,
-		       __DRIbuffer *buffers,
-		       int count);
 };
 
 #endif
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
index 184fdeb..a7863ee 100644
--- a/src/glx/x11/dri2.c
+++ b/src/glx/x11/dri2.c
@@ -370,50 +370,18 @@ void DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
     SyncHandle();
 }
 
-DRI2Buffer *DRI2SwapBuffers(Display *dpy, XID drawable, int *recv_count)
+void DRI2SwapBuffers(Display *dpy, XID drawable)
 {
     XExtDisplayInfo *info = DRI2FindDisplay(dpy);
     xDRI2SwapBuffersReq *req;
-    xDRI2SwapBuffersReply rep;
-    xDRI2Buffer repBuffer;
-    DRI2Buffer *new_buffers;
-    int i;
 
-    XextCheckExtension (dpy, info, dri2ExtensionName, False);
+    XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
 
     LockDisplay(dpy);
     GetReq(DRI2SwapBuffers, req);
     req->reqType = info->codes->major_opcode;
     req->dri2ReqType = X_DRI2SwapBuffers;
     req->drawable = drawable;
-
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return NULL;
-    }
-
-    new_buffers = Xmalloc(rep.count * sizeof *new_buffers);
-    if (new_buffers == NULL) {
-	_XEatData(dpy, rep.count * sizeof repBuffer);
-	UnlockDisplay(dpy);
-	SyncHandle();
-	return NULL;
-    }
-
-    for (i = 0; i < rep.count; i++) {
-	_XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
-	new_buffers[i].attachment = repBuffer.attachment;
-	new_buffers[i].name = repBuffer.name;
-	new_buffers[i].pitch = repBuffer.pitch;
-	new_buffers[i].cpp = repBuffer.cpp;
-	new_buffers[i].flags = repBuffer.flags;
-    }
-
-    *recv_count = rep.count;
-
     UnlockDisplay(dpy);
     SyncHandle();
-
-    return new_buffers;
 }
diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h
index 8f04131..fc80649 100644
--- a/src/glx/x11/dri2.h
+++ b/src/glx/x11/dri2.h
@@ -77,7 +77,7 @@ extern void
 DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
 	       CARD32 dest, CARD32 src);
 
-extern DRI2Buffer *
-DRI2SwapBuffers(Display *dpy, XID drawable, int *count);
+extern void
+DRI2SwapBuffers(Display *dpy, XID drawable);
 
 #endif
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index 4b1e08e..41bbf02 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -327,8 +327,6 @@ static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
     __GLXDRIdisplayPrivate *pdp =
 	(__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
     __GLXscreenConfigs *psc = pdraw->psc;
-    DRI2Buffer *buffers;
-    int count;
 
 #ifdef __DRI2_FLUSH
     if (pdraw->psc->f)
@@ -339,15 +337,9 @@ static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
     if (!pdp->swapAvailable)
 	return dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
 
-    buffers = DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable, &count);
-    if (buffers == NULL || !count)
-	return dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
-
-    process_buffers(priv, buffers, count);
+    DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable);
 
-    (*psc->dri2->setBuffers)(pdraw->driDrawable, priv->buffers, count);
-
-    Xfree(buffers);
+    /* need to invalidate here... */
 }
 
 static __DRIbuffer *
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index f9b67c8..92151c4 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -484,16 +484,6 @@ dri2CreateNewDrawable(__DRIscreen *screen,
 }
 
 static void
-dri2SetBuffers(__DRIdrawable *draw, __DRIbuffer *buffers, int count)
-{
-    __DRIscreen *psp = draw->driScreenPriv;
-
-    if (psp->DriverAPI.SetBuffers)
-	    (*psp->DriverAPI.SetBuffers)(draw, buffers, count);
-}
-
-
-static void
 driDestroyDrawable(__DRIdrawable *pdp)
 {
     __DRIscreenPrivate *psp;
@@ -836,7 +826,6 @@ const __DRIdri2Extension driDRI2Extension = {
     dri2CreateNewScreen,
     dri2CreateNewDrawable,
     dri2CreateNewContext,
-    dri2SetBuffers,
 };
 
 /* This is the table of extensions that the loader will dlsym() for. */
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 2a6e1cd..c95a5c8 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -225,13 +225,6 @@ struct __DriverAPIRec {
 
     /* DRI2 Entry point */
     const __DRIconfig **(*InitScreen2) (__DRIscreen * priv);
-
-    /**
-     * Update the render buffers with a new set
-     */
-    void (*SetBuffers) ( __DRIdrawable *drawable,
-			 __DRIbuffer *buffers,
-			 int count);
 };
 
 extern const struct __DriverAPIRec driDriverAPI;




More information about the mesa-commit mailing list