non-XOrg Wayland
2022-05 note: It's getting really rare for something to not work unless it's stuck to X11 or it's badly linking to OpenGL, consider that most things "Just Works", unless I described a problem and it's still there.
Warning: This is Wayland without any of libX11
or related (ie. libGL.so
instead of libOpenGL.so
) in the system, this also removes the XWayland
compatibility layer as it's an xorg-server component.
You can find this kind of similar setup in embedded systems (ie. SailfishOS), as X11 makes no sense outside of keyboard+mouse setups, but I don't expect it until a bunch of years for regular desktops (say when X.Org will have died), I'm doing this right now to avoid having to rush to get rid of X11 with having to push the End-of-Life date way back it's upstream date (that happened with python-2 because it wasn't much prepared until the last year or two).
It's also the kind of setup that I expect soon in security-oriented systems because Wayland addresses a number of design flaws.
Testing is done on Gentoo Linux with USE="-X -XWayland"
and (fixed via patching libglvnd). And launched into the Sway compositor.-DEGL_NO_X11
into the C(XX)FLAGS
Reminder:
- static linking
- (
LDFLAGS="-static"
) some of the library is copied in the executable - shared linking
- (
LDFLAGS="-shared"
) system library likeld-linux-x86-64.so.2
loading the libraries before execution - dynamic
linkingloading - (
dlopen()
) loading a library during the execution
NoVidya reminder §
Do not ask Libre software developers for support of the NVidia proprietary driver, specially when they already refused, the driver being proprietary means that any bug found has to be worked around, which often isn't possible without compromising performance and stability.
Also, in terms of history:
- After almost 10 years NVidia has yet to provide a complete enough driver for Wayland
Instead of providing the GBM API like everyone else, including other proprietary drivers (there is a lot of them on the embedded side of things), they created EGLStreams, which means a very large chunk of code (and so bugs) specific to NVidia- Contributes to a huge waste of chips by stopping the support of GPUs after about 5 years
Has basically been trashing any hope for nouveau to be a complete driver (check FOSDEM videos of the nouveau developers)- NVidia performance vs. AMDGPU performance on linux doesn't have a very large gap on real-life loads
- Doesn't provides async reprojection on linux, so no VR for you (Or a lot of those nice Vulkan speedups)
- Remember how awful Nvidia Optimus is?
- Video decoder driver can have frequent glitches depending on the encoding
Buildsystems §
I've yet to see one work correctly out of the box for this. The snippets in this section Abandons all copyrights if it could even begin to be copyrightable, as I can't assign to the Public Domain in France, they are distributed under any OSI/FSF-approuved license including CC-0, WTFPL, Unlicense and BSD-0.
CMake
- Replace
find_package(OpenGL REQUIRED)
to something likefind_package(OpenGL COMPONENTS OpenGL REQUIRED)
. This allows to not error out when libGL.so isn't found but libOpenGL.so is. - Replace
OPENGL_gl_LIBRARY
toOPENGL_opengl_LIBRARY
. This will allow to use libOpenGL.so over libGL.so when possible.
Auto*hell
Either use AX_CHECK_GL
from autoconf-archive with patch #10369: ax_check_gl.m4: Fallback to libOpenGL, or use something like the following:
AC_CHECK_HEADER(
[GL/gl.h],
AC_SEARCH_LIBS(glVertex3f, [opengl32 GL GL2 OpenGL], [test $ac_cv_search_glVertex3f = "none required" || GL_LIBS="$ac_cv_search_glVertex3f $GL_LIBS"], [AC_MSG_ERROR(*** OpenGL library not found on system!)]),
[AC_MSG_ERROR(*** OpenGL headers not found on system!)]
)
meson
Nice fail of an otherwise nice mainly declarative buildsystem there… (meson#3679)
gl_dep = dependency('gl', required: false)
if not gl_dep.found()
# libglvnd fallback for libX11-less wayland systems
gl_dep = dependency('opengl')
endif
GL API coverage §
All of this is tested on a "AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx" aka "AMD Radeon(TM) Vega 8 Graphics (RAVEN)" aka:
06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Picasso (rev d2) 06:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Raven/Raven2/Fenghuang HDMI/DP Audio Controller 06:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor 06:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1 06:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Raven USB 3.1 06:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor 06:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller
- glbinding
glinfo
output: pure_wayland_T495_glinfo.log - GLEW
glewinfo
output: pure_wayland_T495_glewinfo.log
Librairies §
Entirely works out of the box
- GLFW: Yes, Just Works
- glbinding: Yes, Just Works
- SDL2 (2.0.16): Yes, works out of the box. Some workarounds for previous versions being:
- For 2.0.14 and earlier: Needing to set
SDL_VIDEO_GL_DRIVER=libOpenGL.so
or patch libSDL2 (SDL#4158). - For 2.0.14 and earlier, you'll need libsdl-org/SDL#4358 for desktop OpenGL
- When bundled in binairies: Needing to set
SDL_DYNAMIC_API
to where your distro'slibSDL2.so
library is.
- For 2.0.14 and earlier: Needing to set
- SDL-1.2 (compat): Might still have few papercuts but overall it just works
- löve(2d) (0.10.2+, tested with 11.3 + lua5.2): Yes, it's SDL2-based after all.
- waffle Yes, use 1.7.0+ for support in modern compositors
- MyGUI (3.4.2+): Yes, earlier versions needed a patch to not pull libGL and GLX (mygui#224)
Needs more testing
- allegro-4: Maybe, compiles with OpenGL enabled
Needs workarounds / Incomplete support
- libepoxy: Needs libepoxy#259 for
libOpenGL.so
and then it just works - godot: Wayland support since Add Wayland support - PR86180
- wxWidgets GTK port, 3.1.x (3.1.5): Needs a patch to remove an harcoded
-lX11
- GTK 3: Almost. Suggestions are broken on multi-monitors as well as the usual glitches.
- Qt 5: Almost, menus are misplaced, specially on multi-monitors and requires
-lGL
→-lOpenGL
workaround - GLEW: OpenGL Extension Wrangler Library: Not really, consider libepoxy or glbinding (drop-in). I managed to get it to compile and work for some software with:
- Applying Extend GLEW API to support glewContextInit - GL without implied GLX, … #216
- Running
sed -i 's/-lGL/-lOpenGL/' config/Makefile.linux-egl
- Passing
POPT="${CFLAGS} -D__native_client__"
andSYSTEM=linux-egl
to make options, for both build and install
- GTK 4: No, unless maybe you use GNOME, which means it's not even FreeDesktop portable
- FreeGLUT: free OpenGL utility toolkit: No, depends on
wl_shell
which is absent in wlroots and probably others (See FreeGLUT#72), it's activity is very low so consider using other librairies instead - allegro-5: I managed to get most of it to compile with some patches, couldn't get liballegro_dialog (gtk on non-apple unixes) yet though as it depends on GTK with X11.
Doesn't Works
- irrlicht: Nope, there is some community work on it
- TCL/TK: Nope, but there is undroidwish apparently supporting it, GSoC idea page
- FLTK: Nope, could be there in the future(1.4.x) see STR #3371
- SFML: Simple and Fast Multimedia Library: Nope
- General Graphics Interface(GGI): Doesn't seems to have wayland support
- wxWidgets GTK port, 3.0.x: No, GUI depends on X11, also needs
-lGL
→-lOpenGL
patch - plib: Dead library (last commit in 2012, last release in 2006), has security issues
- cogl: Dead library (Archived), hardcodes for
-lGL
- clutter: Dying library (replaced by GTK 4.0), depends on cogl, doesn't supports xdg-shell
Web Browsers §
- Badwolf: Yes, Fully tested and supported as first-class citizen
- epiphany - Gnome Web: Yes, seems to work fine, should be well supported
- netsurf: GTK3 frontend just works
- chromium: Not really, requires to enable ozone, which means compiling it, something I'd rather not do
- Mozilla Firefox: No, segfaults when compiled without X11 libs. Wayland support is a horrible mess (ie. microphone/camera grab is a top-level window); screen-grabbing uses GNOME's xdg-desktop-portal, which is dbus-based instead of wayland-based
wlr_screencopy
.
Games §
Entirely works out of the box
- oshu: Yes, just Works (SDL2)
- Blob Wars : Attrition: Yes, Just Works (SDL2)
- VVVVVV: Yes, Just Works (SDL2)
- Superflu Riteurnz: Yes, just Works (SDL2)
- abuse (Crack.Com): Yes, Just Works
- open-supaplex: Just Works
- nxengine-evo (Cave Story modern engine): Just Works
- StabYourself games compatible with love-11.3 ( not-tetris-3, text-based-golf, text-based-sokoban, mari0, notdonkeykong, orderoftwilight, …): Just Works
- seven-kingdoms: Seems to work fine
Light temporary workaround caused by dependency
- taisei: Need to set
SDL_VIDEO_GL_DRIVER=libOpenGL.so
or patch libSDL2 (SDL#4158). - Emilia Pinball: Either SDL2 with GLES1 support (gentoo/gentoo#20690) and passing
--enable-gles
or applying libsdl-org/SDL#4358 to get desktop OpenGL working - Chromium B.S.U (0.9.16.1+): With SDL2 fixed for desktop OpenGL it works
- astromenace (1.4.1): With SDL2 fixed for desktop OpenGL it works
- OpenRA: With SDL2 fixed for desktop OpenGL it works
- xmoto: With SDL2 fixed for desktop OpenGL it works
Just needs SDL-1.2 compatibility library §
- formido: With sdl12-compat it just works
- heroes: Works with sdl12-compat, I just get a very small default window but fullscreen works
- luola: With sdl12-compat it just works
- orbital-eunuchs-sniper / sniper2d: With sdl12-compat it just works
- powermanga: With sdl12-compat it just works
- snipes: With sdl12-compat it seems to work???
- towbowl-tactics: With sdl12-compat it seems to work???
- abe: With sdl12-compat it seems to just work
- apricots: With sdl12-compat it seems to just work
- balloonchase: With sdl12-compat it seems to just work
- batrachians: With sdl12-compat it seems to just work
- clanbomber: With sdl12-compat 1cc3061c06877a7ee4277187aa59dcca755e5a7f and later it seems to just work
- savagewheels: With sdl12-compat it seems to just work
- betna: With sdl12-compat it seems to just work
- bumprace: With sdl12-compat it seems to just work
- ceferino: With sdl12-compat it seems to just work
- circuslinux: With sdl12-compat it seems to just work
- syobon: With sdl12-compat it seems to just work
Needs workarounds / Incomplete support
- SuperTux:
No, because of GLEWYes, changed it's build configuration to use glbinding - endless-sky: Almost, had to change linking from
GL
toOpenGL
inSConstruct
, no proper detection done - freeciv: Yes(SDL2 and Qt5 clients) and No(GTK+2 client, the default/goto one)
- SuperTuxKart: Quite, works in wayland with gles2(because irrlicht tries to dynamically load
libGL.so.1
otherwise) in current git (9f1ae2b7619f21546cc5cdd4bbeea53492d4b7ac
) - Xash3D FWGS + HLSDK Xash3D (Half-Life1 engine): Yes, has some glitches but seems unrelated to Wayland. Note: You need to set
SDL_VIDEO_GL_DRIVER=libOpenGL.so
orBOX86_LIBGL=libOpenGL.so
- neverball (1.6.0): Works with OpenGL ES(
make ENABLE_OPENGLES=1
) and desktop OpenGL withmake OGL_LIBS=-lOpenGL
- pingus: Displays with a small patch(pingus!191), story mode segfaults but seems unrelated.
- Excavation Site Mercury: Need to set
SDL_DYNAMIC_API
to where your distro'slibSDL2.so
library is - Baba Is You (Humble Bundle): Needs to run
patchelf --replace-needed libGL.so.1 libOpenGL.so.0 bin64/Chowdren
and setSDL_DYNAMIC_API
to where your distro'slibSDL2.so
library is - bzflag (2.4.22): Yes, done
sed -i -e 's;X_PRE_LIBS -lX11;X_PRE_LIBS;' -e's;\[opengl32 GL GL2\];[opengl32 GL GL2 OpenGL];' configure.ac
; Requires SDL2 fixed for desktop OpenGL - armagetronad (trunk at
0ba8c6ff0aeda14d86760a1744c6296cbf8632be
+ light fixes): With SDL2 fixed for desktop OpenGL it works - teeworlds (0.7.5 + master): Needed a small patch to use GLVND and remove an unused X11 check (teeworlds#2875)
- QuakeSpasm (master; Quake1 engine): With
USE_SDL2=1 COMMON_LIBS="-lm -lOpenGL"
passed tomake
it just works. - Maelstrom (3.0.6-r3):
double free or corruption (out)
- rrootage: sdl12-compat and replacing a
-lGL
to-lOpenGL
- violetland: With sdl12-compat and tweaking the CMakeList.txt for GLVND it just works
Almost
- blockrage: With sdl12-compat it seems to just work but it aborts on exit
- Cruising on Broadway: With sdl12-compat it seems to just work but it aborts on exit
- conveysdl: With sdl12-compat it seems to just work but it aborts on exit
Doesn't works
- wesnoth: No, some basic actions are broken (questionable hooks to xdg-open(1)/open(1) put behind a if-X11)
- xonotic: No, depends on X11
- dwarf fortress: No, hard-depends on GTK2+ and libSDL-1
- Secret Maryo Chronicles: No, hard depends on X11
- TSC: The Secret Chronicles of Dr. M.: No, because of SFML
- Extreme Tux Racer: No, because of SFML
- Mindustry: Nope,
libsdl-arc64.so
is shared linked againstlibGL.so.1
- oolite: Nope, still on SDL-1.2
- OpenRiichi: Vala looks like a mess to make it work with
libOpenGL.so
instead. - OpenSurge: No because it depends on
liballegro_dialog
- FTE Quake World(Quake Game Engine): Binary works in weston (with the legacy
"wl_shell"
) but doesn't in sway, it fails to hook to"xdg_wm_base"
properly. Their wayland code is a gigantic pile of hacks. - barrage:
creating 640x480 bitmap ... Unknown pixel format
- deathchase3d: Game seems to be broken, quitting triggers an abort
- shootingstar: Fails to detect SDL_image
- asteroid: No, hard-depends on GTK2+ (and libSDL-1.2)
- berusky: No, hard-depends on GTK2+ (and libSDL-1.2)
- gltron: Antique auto*hell harcoded for
-lGL
, breaks onautoreconf-{2.13,2.64,2.69}
- games-arcade/briquolo: Black screen :(
- crack-attack: Hardcodes
-lGL -lXi -lX11
Multimedia §
- mpv: Yes, Just Works
- MyPaint: Yes, Just Works
- dustr (light interactive cropping tool): Yes, Just Works
- zathura: Yes, Just Works (including the MuPDF plugin)
- evince: Yes, Just Works
- Inkscape: Yes, Just Works
- darktable: Yes, Just Works
- The GIMP (2.99.6): Yes, Just Works
- gstreamer: Mostly, only lacks wlr-based screen grabbing and requires patching meson for GLVND (included in 1.19.2+)
- imv (IMage Viewer): Sort-of, needs a patch for
-lGL
to-lOpenGL
(my PR for it) - blender: Needed to patch their cmake files a bit for GLVND
- Krita: Works, including tablet support. Had to switch Qt to full OpenGL instead of GLES and remove qtx11extra stuff in two
CMakeList.txt
files. - MuPDF: With GLUT enabled it uses it's own version of freeglut, seems to require changing the ebuild recipe a lot.
- Mumble: No, requires libXext (own PR for making it optionnal)
- OBS Studio: No, requires X11 libs including in feaneron's
egl-wayland
branch - azpainter: No, depends on X11
Emulator / Compat-layer §
- SCUMMVM: Yes, seems to just work
- hatari: Yes, seems to just work (SDL2)
- QEMU: Yes, screen resize is a bit bugged (needs unfocus-refocus in sway)
- Wine: Quite, works with alf's wayland branch(
ce0da9c9f646536df40c2fa2869482edee0b1b1e
) + own lazy patch for libOpenGL.so - DOSBox Staging (0.76.0): Yes, without OpenGL
- MelonDS: trivial patch to disable X11 dependency
- GNU EMACS: Soon, works in
feature/pgtk
branch and passing--with-pgtk
to./configure
- plan9port: No, doesn't seems to have a wayland port yet
Misc §
- kristall (Qt Gemini Browser): Yes, Just Works
- stellarium (0.21.0): Yes, just works
- gnumeric: Yes, seems to work fine
- Xournal++ (1.0.20): Almost, needed a patch(xournalpp#2934) to make X11 optional, included in 1.1.0+
- Mesa Demos: Nope
- abiword (3.0.5): Nope, hard-dependency on X11
- celestia (
22291cd795606a73226f3c7b0acff65bdbbf3f24
): Nope, blank rendering
See Also
- Awesome Wayland: curated list of Wayland code and resources
- Are We Wayland yet?
- Using wf-recorder as camera
- on abandoning the X server