mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1695453 - Rename IsWaylandDisabled to IsWaylandEnabled, r=stransky
Inversed logic has been proven to be more difficult to read, so use the simple positive variant. Also add a simple sanity check for `WAYLAND_DISPLAY` so if people set `MOZ_ENABLE_WAYLAND` in a X11 session don't get undesired behavior. While on it, change a check for `XDG_SESSION_TYPE` to also use `WAYLAND_DISPLAY`, improving behavior when launching FF from a TTY or a TTY-launched session (e.g. via `weston-launch`). `WAYLAND_DISPLAY` and `DISPLAY` are not expected to be set if no Wayland or X11 server is available, so using them makes us behave more predictable. Differential Revision: https://phabricator.services.mozilla.com/D106726
This commit is contained in:
parent
a9eae8dc84
commit
f1206ef5d7
@ -2184,7 +2184,7 @@ RefPtr<VsyncChild> BrowserChild::GetVsyncChild() {
|
||||
// given platform. Note: this only makes sense if nsWindow returns a
|
||||
// window-specific VsyncSource.
|
||||
#if defined(MOZ_WAYLAND)
|
||||
if (!IsWaylandDisabled() && !mVsyncChild) {
|
||||
if (IsWaylandEnabled() && !mVsyncChild) {
|
||||
PVsyncChild* actor = SendPVsyncConstructor();
|
||||
mVsyncChild = static_cast<VsyncChild*>(actor);
|
||||
}
|
||||
|
@ -661,11 +661,11 @@ bool ContentChild::Init(MessageLoop* aIOLoop, base::ProcessId aParentPid,
|
||||
if (!gfxPlatform::IsHeadless()) {
|
||||
const char* display_name = PR_GetEnv("MOZ_GDK_DISPLAY");
|
||||
if (!display_name) {
|
||||
bool waylandDisabled = true;
|
||||
bool waylandEnabled = false;
|
||||
# ifdef MOZ_WAYLAND
|
||||
waylandDisabled = IsWaylandDisabled();
|
||||
waylandEnabled = IsWaylandEnabled();
|
||||
# endif
|
||||
if (waylandDisabled) {
|
||||
if (!waylandEnabled) {
|
||||
display_name = PR_GetEnv("DISPLAY");
|
||||
}
|
||||
}
|
||||
|
@ -275,11 +275,11 @@ mozilla::ipc::IPCResult GPUParent::RecvInit(
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
char* display_name = PR_GetEnv("MOZ_GDK_DISPLAY");
|
||||
if (!display_name) {
|
||||
bool waylandDisabled = true;
|
||||
bool waylandEnabled = false;
|
||||
# ifdef MOZ_WAYLAND
|
||||
waylandDisabled = IsWaylandDisabled();
|
||||
waylandEnabled = IsWaylandEnabled();
|
||||
# endif
|
||||
if (waylandDisabled) {
|
||||
if (!waylandEnabled) {
|
||||
display_name = PR_GetEnv("DISPLAY");
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsAppRunner.h" // for IsWaylandDisabled on IsX11EGLEnabled
|
||||
#include "nsAppRunner.h" // for IsWaylandEnabled on IsX11EGLEnabled
|
||||
#include "stdint.h"
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
@ -1200,7 +1200,7 @@ int childgltest() {
|
||||
int pci_count = get_pci_status();
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
if (!IsWaylandDisabled()) {
|
||||
if (IsWaylandEnabled()) {
|
||||
wayland_egltest();
|
||||
} else
|
||||
#endif
|
||||
|
@ -4157,7 +4157,12 @@ static void PR_CALLBACK ReadAheadDlls_ThreadStart(void* arg) {
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WAYLAND)
|
||||
bool IsWaylandDisabled() {
|
||||
bool IsWaylandEnabled() {
|
||||
const char* waylandDisplay = PR_GetEnv("WAYLAND_DISPLAY");
|
||||
if (!waylandDisplay) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// MOZ_ENABLE_WAYLAND is our primary Wayland on/off switch.
|
||||
const char* waylandPref = PR_GetEnv("MOZ_ENABLE_WAYLAND");
|
||||
bool enableWayland = (waylandPref && *waylandPref);
|
||||
@ -4173,7 +4178,7 @@ bool IsWaylandDisabled() {
|
||||
if (enableWayland && gtk_check_version(3, 22, 0) != nullptr) {
|
||||
NS_WARNING("Running Wayland backen on Gtk3 < 3.22. Expect issues/glitches");
|
||||
}
|
||||
return !enableWayland;
|
||||
return enableWayland;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4362,13 +4367,13 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
|
||||
saveDisplayArg = true;
|
||||
}
|
||||
|
||||
bool disableWayland = true;
|
||||
bool waylandEnabled = false;
|
||||
# if defined(MOZ_WAYLAND)
|
||||
disableWayland = IsWaylandDisabled();
|
||||
waylandEnabled = IsWaylandEnabled();
|
||||
# endif
|
||||
// On Wayland disabled builds read X11 DISPLAY env exclusively
|
||||
// and don't care about different displays.
|
||||
if (disableWayland && !display_name) {
|
||||
if (!waylandEnabled && !display_name) {
|
||||
display_name = PR_GetEnv("DISPLAY");
|
||||
if (!display_name) {
|
||||
PR_fprintf(PR_STDERR,
|
||||
|
@ -167,7 +167,7 @@ void setASanReporterPath(nsIFile* aDir);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
bool IsWaylandDisabled();
|
||||
bool IsWaylandEnabled();
|
||||
#endif
|
||||
|
||||
#endif // nsAppRunner_h__
|
||||
|
@ -462,7 +462,7 @@ void GfxInfo::GetData() {
|
||||
mAdapterDescription.Assign(glRenderer);
|
||||
#ifdef MOZ_WAYLAND
|
||||
mIsWayland = gdk_display_get_default() &&
|
||||
!GDK_IS_X11_DISPLAY(gdk_display_get_default());
|
||||
GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default());
|
||||
if (mIsWayland) {
|
||||
mIsWaylandDRM = GetDMABufDevice()->IsDMABufVAAPIEnabled() ||
|
||||
GetDMABufDevice()->IsDMABufWebGLEnabled() ||
|
||||
@ -473,8 +473,8 @@ void GfxInfo::GetData() {
|
||||
// Make a best effort guess at whether or not we are using the XWayland compat
|
||||
// layer. For all intents and purposes, we should otherwise believe we are
|
||||
// using X11.
|
||||
const char* windowEnv = getenv("XDG_SESSION_TYPE");
|
||||
mIsXWayland = windowEnv && strcmp(windowEnv, "wayland") == 0;
|
||||
const char* waylandDisplay = getenv("WAYLAND_DISPLAY");
|
||||
mIsXWayland = !mIsWayland && waylandDisplay;
|
||||
|
||||
// Make a best effort guess at the desktop environment in use. Sadly there
|
||||
// does not appear to be a standard way to do this, so we check a few
|
||||
|
Loading…
x
Reference in New Issue
Block a user