Linux Wayland: ship libdecor + only prefer native Wayland when decorations are guaranteed #197
Labels
No labels
amd
avatars
bug
builder
cannot-reproduce
crash
epic
feature
from-viewer
gl-removal
known-limitation
monitoring
parity
perf
platform
priority
critical
priority
high
priority
low
priority
medium
provenance
rendering
rt
status
in-progress
status
testing
status
up-next
triage
ui
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sky_line/Slipstream#197
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implementation ticket for #196 (no window border on Ubuntu 24.04 GNOME, RX 9070 XT). The same reporter also sees poor FPS versus Alchemy, and this is probably one of the causes.
Background / root cause
6639761b61("High-DPI window and native Wayland", first in v0.11.0-beta.1) addedSDL_SetHint(SDL_HINT_VIDEO_DRIVER, "wayland,x11")atindra/llwindow/llsdl.cpp:114(Linux only). That forces native Wayland whenever a Wayland session exists. SDL 3.2's own default would put a GNOME 46 session on X11/XWayland, which is why Alchemy has a border on the same machine.SDL 3.2.22,SDL video driver: wayland,VK_KHR_wayland_surface, Ubuntu 24.04 (kernel 7.0.0-31-generic), GNOME, RX 9070 XT (RADV GFX1201).zxdg_decoration_manager_v1(server-side decorations). A native Wayland client on GNOME has to draw its own frame. SDL3 does this by dlopen'inglibdecor-0.so.0at runtime, and libdecor in turn loads a plugin (libdecor-cairo.soorlibdecor-gtk.so) from its plugin dir.libSDL3.so.0.2.22is built with libdecor support and dlopenslibdecor-0.so.0(confirmed viastrings). The dev machine (Arch) haslibdecor 0.2.5installed, so the bug never showed locally. On Ubuntu,libdecor-0-0/libdecor-0-plugin-1-gtkare not guaranteed to be installed. Without them SDL creates a plainxdg_toplevelwith no decorations: no title bar, no border, and no move/resize handles.fifo-v1/commit-timing-v1protocols. WithRenderVSyncEnable=1(the default) we present FIFO, and Mesa's Wayland WSI then paces on frame callbacks, which Mutter stops sending for occluded surfaces. This is one reason SDL 3.2 doesn't prefer Wayland by default on such compositors.Workaround for users today:
SDL_VIDEO_DRIVER=x11 ./slipstream. The env var overrides our hint, because we set it at normal priority.Plan
1. Ship libdecor + cairo plugin
libdecor-0.so.0andplugins/libdecor-cairo.soto the Linux package. Use a 3p package or copy from the build host inviewer_manifest.py(LinuxManifest). The cairo plugin is preferred over gtk because it only needs cairo/pango/dbus, which any desktop has, instead of GTK3.indra/newview/linux_tools/wrapper.sh→packaged/slipstream), exportLIBDECOR_PLUGIN_DIR="$RUN_PATH/lib/libdecor/plugins"unless the user already set it.LD_LIBRARY_PATH=./libis already set by the launcher.make glibc-checkstill passes (see the glibc_compat.h / fix_isa_note.py tooling).2. Safety net: only prefer Wayland when a frame is guaranteed
In
llsdl.cpp, beforeSDL_Init, replace the unconditional"wayland,x11"hint:SDL_VIDEO_DRIVERis set in the environment, respect it (already works).WAYLAND_DISPLAYis set and either (a) the compositor advertiseszxdg_decoration_manager_v1(KDE, wlroots, Hyprland, etc.), or (b)dlopen("libdecor-0.so.0")succeeds and a plugin is present, then preferwayland,x11.x11,wayland.wl_display_connect+ registry roundtrip is enough, or just treatXDG_CURRENT_DESKTOPcontaining GNOME as needing libdecor.Video driver: wayland (decorations: libdecor/cairo)orx11 (GNOME without libdecor), so reports make it obvious.3. User override
Add a setting (e.g.
LinuxVideoDriver: auto / wayland / x11), read before SDL init and restart-required. Also add a--x11launcher flag.4. (Related) Wayland vsync pacing
On compositors without
fifo-v1, consider MAILBOX (if available) or FIFO_RELAXED under Wayland, or at least document the occlusion stall.vk_swapchain.cppcurrently uses FIFO whenever vsync is on.Test matrix
make glibc-check.Refs #196
Shipped in 1.0.0 (bundled libdecor, native Wayland only when decorations are available) and in every release since, with no further Wayland decoration reports. Closing.