diff -up clutter-1.20.0/clutter/x11/clutter-backend-x11.c.enable-threaded-swap-wait clutter-1.20.0/clutter/x11/clutter-backend-x11.c
--- clutter-1.20.0/clutter/x11/clutter-backend-x11.c.enable-threaded-swap-wait 2016-06-29 15:46:54.250758214 -0400
+++ clutter-1.20.0/clutter/x11/clutter-backend-x11.c 2016-06-29 15:47:58.573790526 -0400
@@ -91,6 +91,7 @@ static const gchar *atom_names[] = {
/* various flags corresponding to pre init setup calls */
static gboolean _want_reset_on_video_memory_purge = FALSE;
+static gboolean _enable_threaded_swap_wait = FALSE;
static gboolean _no_xevent_retrieval = FALSE;
static gboolean clutter_enable_xinput = TRUE;
static gboolean clutter_enable_argb = FALSE;
@@ -688,6 +689,9 @@ clutter_backend_x11_get_renderer (Clutte
cogl_xlib_renderer_set_foreign_display (renderer, xdisplay);
cogl_xlib_renderer_request_reset_on_video_memory_purge (renderer,
_want_reset_on_video_memory_purge);
+ cogl_xlib_renderer_set_threaded_swap_wait_enabled (renderer,
+ _enable_threaded_swap_wait);
+
return renderer;
}
@@ -1054,6 +1058,30 @@ clutter_x11_request_reset_on_video_memor
}
/**
+ * clutter_x11_enable_threaded_swap_wait:
+ *
+ * If the driver doesn't have a better way to wait for frame completion,
+ * and is on a whitelist of drivers where using a separate thread for
+ * frame completion is known to work, do that. XInitThreads() must be
+ * called by the application before any other Xlib calls. See docs for
+ * cogl_xlib_renderer_set_threaded_swap_wait_enabled() for more details.
+ *
+ * This function can only be called before calling clutter_init().
+ */
+void
+clutter_x11_enable_threaded_swap_wait (void)
+{
+ if (_clutter_context_is_initialized ())
+ {
+ g_warning ("%s() can only be used before calling clutter_init()",
+ G_STRFUNC);
+ return;
+ }
+
+ _enable_threaded_swap_wait = TRUE;
+}
+
+/**
* clutter_x11_get_default_screen:
*
* Gets the number of the default X Screen object.
diff -up clutter-1.20.0/clutter/x11/clutter-x11.h.enable-threaded-swap-wait clutter-1.20.0/clutter/x11/clutter-x11.h
--- clutter-1.20.0/clutter/x11/clutter-x11.h.enable-threaded-swap-wait 2016-06-29 15:46:54.252758246 -0400
+++ clutter-1.20.0/clutter/x11/clutter-x11.h 2016-06-29 15:47:27.193287248 -0400
@@ -173,6 +173,9 @@ guint clutter_x11_event_sequence_get_tou
CLUTTER_AVAILABLE_IN_ALL
void clutter_x11_request_reset_on_video_memory_purge (void);
+CLUTTER_AVAILABLE_IN_ALL
+void clutter_x11_enable_threaded_swap_wait (void);
+
G_END_DECLS
#endif /* __CLUTTER_X11_H__ */