[Mesa-dev] [PATCH 2/2] glx: Make glXWaitGL actually flush the GL command stream.
Eric Anholt
eric at anholt.net
Mon May 6 17:39:12 PDT 2013
We were only flushing it in the fake-front case, which won't be enough if
you're doing something like drawing into a GLXPixmap and using X rendering
to composite from it.
---
src/glx/dri2_glx.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 3cdd249..d813788 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -664,10 +664,30 @@ dri2_wait_gl(struct glx_context *gc)
struct dri2_drawable *priv = (struct dri2_drawable *)
GetGLXDRIDrawable(gc->currentDpy, gc->currentDrawable);
- if (priv == NULL || !priv->have_fake_front)
- return;
-
- dri2_copy_drawable(priv, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+ if (priv != NULL) {
+ if (priv->have_fake_front) {
+ dri2_copy_drawable(priv, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+ } else {
+ struct dri2_screen *psc = (struct dri2_screen *) priv->base.psc;
+
+ /* From the GLX 1.4 spec, page 33:
+ *
+ * "OpenGL calls made prior to glXWaitGL are guaranteed to be
+ * executed before X rendering calls made after glXWaitGL. While
+ * the same result can be achieved using glFinish, glXWaitGL
+ * does not require a round trip to the server, and is therefore
+ * more efficient in cases where the client and server are on
+ * separate machines."
+ *
+ * In DRI2, we assume that the kernel serializes operations on BOs
+ * appropriately, so a glFlush here that gets the GL commands down to
+ * the kernel is enough to ensure that later X rendering comes after
+ * it.
+ */
+ if (psc->f)
+ (*psc->f->flush) (priv->driDrawable);
+ }
+ }
}
/**
--
1.8.3.rc0
More information about the mesa-dev
mailing list