diff -up firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp.mozilla-1460603 firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp --- firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp.mozilla-1460603 2018-05-16 07:38:30.000000000 +0200 +++ firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp 2018-05-25 10:58:45.170047851 +0200 @@ -31,6 +31,13 @@ #include "GLContextProvider.h" #include "gfxPrefs.h" #include "ScopedGLHelpers.h" +#ifdef MOZ_WIDGET_GTK +#include +#ifdef MOZ_WAYLAND +#include +#include +#endif // MOZ_WIDGET_GTK +#endif // MOZ_WAYLAND namespace mozilla { namespace gl { @@ -566,7 +573,22 @@ GLLibraryEGL::EnsureInitialized(bool for mIsWARP = true; } } else { - chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY); + void *nativeDisplay = EGL_DEFAULT_DISPLAY; +#ifdef MOZ_WAYLAND + // Some drivers doesn't support EGL_DEFAULT_DISPLAY + GdkDisplay *gdkDisplay = gdk_display_get_default(); + if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) { + static auto sGdkWaylandDisplayGetWlDisplay = + (wl_display *(*)(GdkDisplay *)) + dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display"); + nativeDisplay = sGdkWaylandDisplayGetWlDisplay(gdkDisplay); + if (!nativeDisplay) { + NS_WARNING("Failed to get wl_display."); + return false; + } + } +#endif + chosenDisplay = GetAndInitDisplay(*this, nativeDisplay); } if (!chosenDisplay) { @@ -872,4 +894,3 @@ AfterEGLCall(const char* glFunction) } /* namespace gl */ } /* namespace mozilla */ -