summaryrefslogtreecommitdiff
path: root/mozilla-1460603.patch
blob: 3e705b57140a1ca7ed8912256d9d7ac430775b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 <gdk/gdk.h>
+#ifdef MOZ_WAYLAND
+#include <gdk/gdkwayland.h>
+#include <dlfcn.h>
+#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 */
-
bgstack15