Mesa (10.3): glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC== 0 correctly. (v2)

Emil Velikov evelikov at kemper.freedesktop.org
Sun Dec 14 15:43:34 UTC 2014


Module: Mesa
Branch: 10.3
Commit: c085fcd2f271ee4f22cb8659722141f9c8efecab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c085fcd2f271ee4f22cb8659722141f9c8efecab

Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Fri Dec  5 08:42:29 2014 +0100

glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly. (v2)

targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

v2: Simplify as suggested by Axel Davy. Add comments proposed
by Eric Anholt.

Cc: "10.3 10.4" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
Reviewed-by: Eric Anholt <eric at anholt.net>
(cherry picked from commit 8cab54de16f4691672533967daa79c9cfa2e24cc)

---

 src/glx/dri3_glx.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index ed30094..a150ac2 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -501,6 +501,15 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
 {
    struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
 
+   /* From the GLX_OML_sync_control spec:
+    *
+    *     "If <target_sbc> = 0, the function will block until all previous
+    *      swaps requested with glXSwapBuffersMscOML for that window have
+    *      completed."
+    */
+   if (!target_sbc)
+      target_sbc = priv->send_sbc;
+
    while (priv->recv_sbc < target_sbc) {
       if (!dri3_wait_for_event(pdraw))
          return 0;




More information about the mesa-commit mailing list