author | Martin Stransky <stransky@redhat.com> |
Wed, 09 May 2018 15:26:15 +0200 | |
changeset 795677 | a513bfa3c1fc408743bd5b4aed6e416f4d8cc0d7 |
parent 795067 | a382f8feaba41f1cb1cee718f8815cd672c10f3c |
push id | 110048 |
push user | stransky@redhat.com |
push date | Wed, 16 May 2018 12:58:13 +0000 |
reviewers | lsalzman |
bugs | 1460603 |
milestone | 62.0a1 |
--- a/gfx/gl/GLLibraryEGL.cpp +++ b/gfx/gl/GLLibraryEGL.cpp @@ -26,16 +26,23 @@ #endif #include "OGLShaderProgram.h" #include "prenv.h" #include "prsystem.h" #include "GLContext.h" #include "GLContextProvider.h" #include "gfxPrefs.h" #include "ScopedGLHelpers.h" +#ifdef MOZ_WIDGET_GTK +#include <gdk/gdk.h> +#ifdef MOZ_WAYLAND +#include <gdk/gdkwayland.h> +#include <dlfcn.h> +#endif // MOZ_WIDGET_GTK +#endif // MOZ_WAYLAND namespace mozilla { namespace gl { StaticMutex GLLibraryEGL::sMutex; GLLibraryEGL sEGLLibrary; // should match the order of EGLExtensions, and be null-terminated. @@ -714,17 +721,32 @@ GLLibraryEGL::CreateDisplay(bool forceAc *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WARP_FALLBACK"); } NS_ERROR("Fallback WARP context failed to initialize."); return nullptr; } 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 nullptr; + } + } +#endif + chosenDisplay = GetAndInitDisplay(*this, nativeDisplay); } if (!chosenDisplay) { if (out_failureId->IsEmpty()) { *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_DISPLAY"); } NS_WARNING("Failed to initialize a display."); return nullptr; @@ -883,9 +905,8 @@ AfterEGLCall(const char* glFunction) { if (ShouldTrace()) { printf_stderr("[egl] < %s\n", glFunction); } } } /* namespace gl */ } /* namespace mozilla */ -