Call cogl_xlib_renderer_set_threaded_swap_wait_enabled()

Set up things so that if the INTEL_swap_event extension is not present,
but the driver is known to have good thread support, we use an extra
thread and call glXWaitVideoSync() in the thread. This allows idles
to work properly, even when Mutter is constantly redrawing new frames;
otherwise, without INTEL_swap_event, we'll just block in glXSwapBuffers().

https://bugzilla.gnome.org/show_bug.cgi?id=779039
This commit is contained in:
Owen W. Taylor 2017-02-21 13:51:16 -05:00
parent d200868459
commit 383ba566bd
2 changed files with 14 additions and 0 deletions

View File

@ -605,6 +605,12 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
static void
meta_backend_x11_init (MetaBackendX11 *x11)
{
/* XInitThreads() is needed to use the "threaded swap wait" functionality
* in Cogl - see meta_renderer_x11_create_cogl_renderer(). We call it here
* to hopefully call it before any other use of XLib.
*/
XInitThreads();
clutter_x11_request_reset_on_video_memory_purge ();
/* We do X11 event retrieval ourselves */

View File

@ -66,6 +66,14 @@ meta_renderer_x11_create_cogl_renderer (MetaRenderer *renderer)
cogl_renderer_set_custom_winsys (cogl_renderer, get_x11_cogl_winsys_vtable);
cogl_xlib_renderer_set_foreign_display (cogl_renderer, xdisplay);
/* Set up things so that if the INTEL_swap_event extension is not present,
* but the driver is known to have good thread support, we use an extra
* thread and call glXWaitVideoSync() in the thread. This allows idles
* to work properly, even when Mutter is constantly redrawing new frames;
* otherwise, without INTEL_swap_event, we'll just block in glXSwapBuffers().
*/
cogl_xlib_renderer_set_threaded_swap_wait_enabled (cogl_renderer, TRUE);
return cogl_renderer;
}