Skip to content

Commit

Permalink
Backed out changeset 460bb9bef9c3 (bug 1561883) for build bustage at …
Browse files Browse the repository at this point in the history
…nsWaylandDisplay.h on a CLOSED TREE.
  • Loading branch information
raulgurzau committed Jun 29, 2019
1 parent f992535 commit 99e0928
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
6 changes: 4 additions & 2 deletions gfx/gl/GLLibraryEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
# ifdef MOZ_WAYLAND
# include <gdk/gdkwayland.h>
# include <dlfcn.h>
# include "mozilla/widget/nsWaylandDisplay.h"
# endif // MOZ_WIDGET_GTK
#endif // MOZ_WAYLAND

Expand Down Expand Up @@ -788,7 +787,10 @@ EGLDisplay GLLibraryEGL::CreateDisplay(bool forceAccel,
// Some drivers doesn't support EGL_DEFAULT_DISPLAY
GdkDisplay* gdkDisplay = gdk_display_get_default();
if (!GDK_IS_X11_DISPLAY(gdkDisplay)) {
nativeDisplay = WaylandDisplayGetWLDisplay(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;
Expand Down
2 changes: 1 addition & 1 deletion widget/gtk/WindowSurfaceWayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void WindowBackBuffer::Attach(wl_surface* aSurface) {

wl_surface_attach(aSurface, GetWlBuffer(), 0, 0);
wl_surface_commit(aSurface);
wl_display_flush(WaylandDisplayGetWLDisplay());
wl_display_flush(GetWaylandDisplay()->GetDisplay());
SetAttached();
}

Expand Down
7 changes: 5 additions & 2 deletions widget/gtk/nsGtkKeyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#ifdef MOZ_WAYLAND
# include <sys/mman.h>
# include "nsWaylandDisplay.h"
#endif

namespace mozilla {
Expand Down Expand Up @@ -759,7 +758,11 @@ static const struct wl_registry_listener keyboard_registry_listener = {
gdk_registry_handle_global, gdk_registry_handle_global_remove};

void KeymapWrapper::InitBySystemSettingsWayland() {
wl_display* display = WaylandDisplayGetWLDisplay();
// Available as of GTK 3.8+
static auto sGdkWaylandDisplayGetWlDisplay = (wl_display * (*)(GdkDisplay*))
dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
wl_display* display =
sGdkWaylandDisplayGetWlDisplay(gdk_display_get_default());
wl_registry_add_listener(wl_display_get_registry(display),
&keyboard_registry_listener, this);
}
Expand Down
16 changes: 4 additions & 12 deletions widget/gtk/nsWaylandDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ namespace widget {
bool nsWaylandDisplay::mIsDMABufEnabled;
bool nsWaylandDisplay::mIsDMABufPrefLoaded;

wl_display* WaylandDisplayGetWLDisplay(GdkDisplay* aGdkDisplay) {
if (!aGdkDisplay) {
aGdkDisplay = gdk_display_get_default();
}

// Available as of GTK 3.8+
static auto sGdkWaylandDisplayGetWlDisplay = (wl_display * (*)(GdkDisplay*))
dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
return sGdkWaylandDisplayGetWlDisplay(aGdkDisplay);
}

// nsWaylandDisplay needs to be created for each calling thread(main thread,
// compositor thread and render thread)
#define MAX_DISPLAY_CONNECTIONS 3
Expand Down Expand Up @@ -74,7 +63,10 @@ void WaylandDispatchDisplays() {
// Get WaylandDisplay for given wl_display and actual calling thread.
static nsWaylandDisplay* WaylandDisplayGetLocked(GdkDisplay* aGdkDisplay,
const StaticMutexAutoLock&) {
wl_display* waylandDisplay = WaylandDisplayGetWLDisplay(aGdkDisplay);
// Available as of GTK 3.8+
static auto sGdkWaylandDisplayGetWlDisplay = (wl_display * (*)(GdkDisplay*))
dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
wl_display* waylandDisplay = sGdkWaylandDisplayGetWlDisplay(aGdkDisplay);

// Search existing display connections for wl_display:thread combination.
for (auto& display : gWaylandDisplays) {
Expand Down
1 change: 0 additions & 1 deletion widget/gtk/nsWaylandDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class nsWaylandDisplay {
void WaylandDispatchDisplays();
void WaylandDisplayShutdown();
nsWaylandDisplay* WaylandDisplayGet(GdkDisplay* aGdkDisplay = nullptr);
wl_display* WaylandDisplayGetWLDisplay(GdkDisplay* aGdkDisplay = nullptr);

typedef struct gbm_device* (*CreateDeviceFunc)(int);
typedef struct gbm_bo* (*CreateFunc)(struct gbm_device*, uint32_t, uint32_t,
Expand Down

0 comments on commit 99e0928

Please sign in to comment.