[PATCH] glx/present: Only send GLX_BufferSwapComplete for PresentCompleteKindPixmap

Keith Packard keithp at keithp.com
Thu Sep 4 08:36:07 PDT 2014


Present didn't provide the 'kind' argument to the
present_complete_notify hook that GLX uses to construct
GLX_BufferSwapComplete events, so GLX was reporting events for
PresentCompleteKindMSC notifications, which resulted in duplicate
GLX_BufferSwapComplete events and crashes in clutter.

See the gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=733282

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 glx/glxcmds.c           | 7 +++++--
 present/present.h       | 1 +
 present/present_event.c | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 2fc3f4c..d11c667 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2508,13 +2508,16 @@ __glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
 
 #if PRESENT
 static void
-__glXpresentCompleteNotify(WindowPtr window, CARD8 present_mode, CARD32 serial,
-                           uint64_t ust, uint64_t msc)
+__glXpresentCompleteNotify(WindowPtr window, CARD8 present_kind, CARD8 present_mode,
+                           CARD32 serial, uint64_t ust, uint64_t msc)
 {
     __GLXdrawable *drawable;
     int glx_type;
     int rc;
 
+    if (present_kind != PresentCompleteKindPixmap)
+        return;
+
     rc = dixLookupResourceByType((void **) &drawable, window->drawable.id,
                                  __glXDrawableRes, serverClient, DixGetAttrAccess);
 
diff --git a/present/present.h b/present/present.h
index 0e3bdc0..aab2e16 100644
--- a/present/present.h
+++ b/present/present.h
@@ -116,6 +116,7 @@ extern _X_EXPORT Bool
 present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
 
 typedef void (*present_complete_notify_proc)(WindowPtr window,
+                                             CARD8 kind,
                                              CARD8 mode,
                                              CARD32 serial,
                                              uint64_t ust,
diff --git a/present/present_event.c b/present/present_event.c
index ff57eba..d3a59ea 100644
--- a/present/present_event.c
+++ b/present/present_event.c
@@ -174,7 +174,7 @@ present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 se
         }
     }
     if (complete_notify)
-        (*complete_notify)(window, mode, serial, ust, msc);
+        (*complete_notify)(window, kind, mode, serial, ust, msc);
 }
 
 void
-- 
2.0.1



More information about the xorg-devel mailing list