Bug 1462622 - [Gtk/Linux] Don't use GLXVsyncSource() on non-X11 displays, r?lsalzman draft
authorMartin Stransky <stransky@redhat.com>
Fri, 18 May 2018 14:44:30 +0200
changeset 796892 097891460e0aaea9a42e23b6d4cfed8a3958781a
parent 796662 54063deb2f1caf8c4acf6461d3ba779805835c96
push id110378
push userstransky@redhat.com
push dateFri, 18 May 2018 12:45:14 +0000
reviewerslsalzman
bugs1462622
milestone62.0a1
Bug 1462622 - [Gtk/Linux] Don't use GLXVsyncSource() on non-X11 displays, r?lsalzman MozReview-Commit-ID: BBtnNLWqSiq
gfx/thebes/gfxPlatformGtk.cpp
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -736,18 +736,20 @@ private:
 };
 
 already_AddRefed<gfx::VsyncSource>
 gfxPlatformGtk::CreateHardwareVsyncSource()
 {
   // Only use GLX vsync when the OpenGL compositor is being used.
   // The extra cost of initializing a GLX context while blocking the main
   // thread is not worth it when using basic composition.
+  // Also don't use it on non-X11 displays.
   if (gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) {
-    if (gl::sGLXLibrary.SupportsVideoSync()) {
+    if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
+        gl::sGLXLibrary.SupportsVideoSync()) {
       RefPtr<VsyncSource> vsyncSource = new GLXVsyncSource();
       VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
       if (!static_cast<GLXVsyncSource::GLXDisplay&>(display).Setup()) {
         NS_WARNING("Failed to setup GLContext, falling back to software vsync.");
         return gfxPlatform::CreateHardwareVsyncSource();
       }
       return vsyncSource.forget();
     }