Skip to content

Commit f6f56d4

Browse files
committed
WSLg: cairo+software is the default; persistent flatpak overrides
Operator-confirmed across multiple test sessions 2026-05-10: every hardware rendering path on current WSLg + Mesa 25 + GTK 4.16+ ends in one of: (a) GLib G_IS_OBJECT assertion crashes shortly after window spawn (b) "Could not initialize EGL display" + WebKit web-process respawn loops every 200ms (c) Windows registering with weston RDP rail but never displaying content on the Windows host (msrdc-hosted but blank) Cairo + LIBGL_ALWAYS_SOFTWARE=1 + llvmpipe is the only combo that reliably produces stable, non-crashing GTK4 apps on WSLg today. Slow but correct. Operators with a known-stable hardware path opt back in via MIOS_GPU_HARDWARE=1. Two coupled changes: 1. /etc/profile.d/mios-wslg-gpu.sh: invert the toggle. Previous logic was MIOS_GPU_SOFTWARE=1 to OPT INTO software (with hw default). Operator feedback: "the windows never render though" even with hw path verified, multiple sessions. Flip the polarity so software is the safe default; MIOS_GPU_HARDWARE=1 is the opt-in for when upstream stabilizes. 2. /var/lib/flatpak/overrides/<app> (NEW): six system-level flatpak overrides pinning GSK_RENDERER=cairo + LIBGL_ALWAYS_SOFTWARE=1 inside each flatpak sandbox (sandboxes don't inherit profile.d). Apps covered: org.gnome.Epiphany, org.gnome.Nautilus, org.gnome.Software, com.github.tchx84.Flatseal, com.mattjakeman.ExtensionManager, com.vscodium.codium. Verified live: with override applied, Epiphany flatpak survives spawn (5 processes alive 15s in, no EGL/MESA/Vulkan errors, weston window registered). Without override, same flatpak hits "Failed to realize renderer 'GskGLRenderer'" + tight web-process crash loop. System-level overrides (here at /var/lib/flatpak/overrides/) apply to all users. User-level (~/.local/share/flatpak/overrides/) would only affect mios. The system-level placement plus repo tracking means the override survives flatpak --reset, reinstall, user deletion, and re-bootstrap. .gitignore: allowlist entries for /var/lib/flatpak/overrides/*. Known gap NOT solved by this commit: WSLg's host-side bridge issue where windows register with WSLg's RDP rail but msrdc doesn't actually display the surface content. This appears distinct from the Mesa/Vulkan render path (xeyes -- pure XLib, zero GPU -- has the same symptom in some sessions). Operator visibility hits both upstream WSLg and Microsoft RDP-RAIL host behavior, neither of which MiOS controls. Further mitigation may require switching to Sunshine + Moonlight streaming, X410, or waiting for WSLg fixes.
1 parent 437e309 commit f6f56d4

8 files changed

Lines changed: 71 additions & 37 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,13 @@ var/*
482482
var/lib/*
483483
!/var/lib/mios/
484484
!/var/lib/mios/**
485+
486+
# /var/lib/flatpak/overrides/ -- per-app environment overrides that
487+
# get applied INSIDE the flatpak sandbox. Tracked here so software-
488+
# rendering defaults survive operator deletions + re-install.
489+
!/var/lib/flatpak/
490+
!/var/lib/flatpak/overrides/
491+
!/var/lib/flatpak/overrides/*
485492
# Cookbooks (was /usr/local/share/mios/cookbooks/), prompt templates
486493
# (was /opt/mios/prompts/), and API examples (was /srv/mios/api/) all
487494
# moved to /usr/share/mios/{cookbooks,prompts,api}/ as of v0.2.3 path-

etc/profile.d/mios-wslg-gpu.sh

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,46 +23,37 @@
2323

2424
[ -d /mnt/wslg ] || return 0
2525

26-
# ── Cairo / software-rendering fallback toggle ───────────────────
27-
# Set MIOS_GPU_SOFTWARE=1 to force CPU-only rendering (cairo +
28-
# llvmpipe). Slow but always produces visible content -- useful
29-
# when dzn / d3d12 / NVIDIA paths are all failing for a specific
30-
# app. Operator can flip per-shell or persist via
31-
# ~/.config/environment.d/. Default (unset) = hardware-accelerated
32-
# d3d12 path below.
33-
if [ "${MIOS_GPU_SOFTWARE:-0}" = "1" ]; then
34-
export GALLIUM_DRIVER="${GALLIUM_DRIVER:-llvmpipe}"
35-
export LIBGL_ALWAYS_SOFTWARE=1
26+
# ── Mesa / GTK4: cairo + llvmpipe is the WSLg default ────────────
27+
# Operator-tested across multiple sessions 2026-05-10: every
28+
# hardware path (dzn Vulkan, d3d12 Gallium, NGL, GL renderer)
29+
# resulted in either:
30+
# (a) Apps spawning windows then crashing on GLib G_IS_OBJECT
31+
# assertions or "Could not initialize EGL display"
32+
# (b) WebKit "Web process crashed" in tight respawn loops
33+
# (c) Windows registering with weston RDP rail but never
34+
# displaying content on the Windows host
35+
# Cairo + LIBGL_ALWAYS_SOFTWARE=1 + llvmpipe is the only combo
36+
# that reliably produces stable, non-crashing GTK4 apps on WSLg
37+
# with current Mesa 25 / dzn / GTK 4.16+ versions. Slow but
38+
# correct. Per-flatpak overrides at /var/lib/flatpak/overrides/
39+
# pin the same env inside flatpak sandboxes (which don't inherit
40+
# this profile.d).
41+
#
42+
# When upstream WSLg + Mesa stabilize, flip MIOS_GPU_HARDWARE=1
43+
# to opt back into the hardware path. Empty / unset = software.
44+
if [ "${MIOS_GPU_HARDWARE:-0}" = "1" ]; then
45+
# Hardware-accelerated path: skip the software defaults and
46+
# let GTK4 / Mesa pick their own. Operator ack of expected
47+
# instability on current WSLg versions.
48+
export LIBGL_KOPPER_DISABLE="${LIBGL_KOPPER_DISABLE:-1}"
49+
else
50+
# Software path -- the default.
3651
export GSK_RENDERER="${GSK_RENDERER:-cairo}"
37-
return 0 2>/dev/null || exit 0
52+
export LIBGL_ALWAYS_SOFTWARE="${LIBGL_ALWAYS_SOFTWARE:-1}"
53+
export GALLIUM_DRIVER="${GALLIUM_DRIVER:-llvmpipe}"
54+
export LIBGL_KOPPER_DISABLE="${LIBGL_KOPPER_DISABLE:-1}"
3855
fi
3956

40-
# ── Mesa / GL ────────────────────────────────────────────────────
41-
# Mesa-25+ replaced the old DRI2 path with Kopper for X-on-Vulkan;
42-
# Kopper on WSLg goes through Zink which goes through dzn (broken
43-
# for many GTK4 features) -- disable Kopper unconditionally to
44-
# keep apps off the Zink path. This alone is non-destructive.
45-
export LIBGL_KOPPER_DISABLE="${LIBGL_KOPPER_DISABLE:-1}"
46-
47-
# d3d12 Gallium driver targets WSLg's WDDM via /dev/dxg.
48-
# Operator-tested 2026-05-10: forcing GALLIUM_DRIVER=d3d12 +
49-
# GSK_RENDERER=gl made GTK4 apps spawn windows but they crashed
50-
# shortly after on GLib G_IS_OBJECT assertions (Zink / dzn
51-
# inconsistency in the GTK4 GL renderer's surface handling).
52-
# Defaulting to MESA's auto-detection has proved more stable --
53-
# the loader picks llvmpipe (CPU) when no real GPU surfaces, and
54-
# GTK4's NGL renderer falls back to its own GL implementation.
55-
# Operators on hosts where d3d12 IS reliable can opt back in:
56-
# export GALLIUM_DRIVER=d3d12
57-
# export MESA_LOADER_DRIVER_OVERRIDE=d3d12
58-
# export GSK_RENDERER=gl
59-
60-
# ── GTK4 / GSK ───────────────────────────────────────────────────
61-
# Don't force GSK_RENDERER -- let GTK4 auto-detect. On WSLg with
62-
# Mesa 25 the auto path picks NGL which works for most apps.
63-
# When NGL fails (operator sees app-crash-shortly-after-spawn),
64-
# flip to MIOS_GPU_SOFTWARE=1 (block above) for cairo + llvmpipe.
65-
6657
# ── WebKit (Epiphany / GNOME-Web) ───────────────────────────────
6758
# WebKit-on-WSLg works best with hardware compositing disabled --
6859
# the dzn path can't reliably back WebKit's compositing layers.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Environment]
2+
GSK_RENDERER=cairo
3+
LIBGL_ALWAYS_SOFTWARE=1
4+
GALLIUM_DRIVER=llvmpipe
5+
LIBGL_KOPPER_DISABLE=1
6+
WEBKIT_DISABLE_COMPOSITING_MODE=1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Environment]
2+
GSK_RENDERER=cairo
3+
LIBGL_ALWAYS_SOFTWARE=1
4+
GALLIUM_DRIVER=llvmpipe
5+
LIBGL_KOPPER_DISABLE=1
6+
WEBKIT_DISABLE_COMPOSITING_MODE=1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Environment]
2+
GSK_RENDERER=cairo
3+
LIBGL_ALWAYS_SOFTWARE=1
4+
GALLIUM_DRIVER=llvmpipe
5+
LIBGL_KOPPER_DISABLE=1
6+
WEBKIT_DISABLE_COMPOSITING_MODE=1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Environment]
2+
GSK_RENDERER=cairo
3+
LIBGL_ALWAYS_SOFTWARE=1
4+
GALLIUM_DRIVER=llvmpipe
5+
LIBGL_KOPPER_DISABLE=1
6+
WEBKIT_DISABLE_COMPOSITING_MODE=1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Environment]
2+
GSK_RENDERER=cairo
3+
LIBGL_ALWAYS_SOFTWARE=1
4+
GALLIUM_DRIVER=llvmpipe
5+
LIBGL_KOPPER_DISABLE=1
6+
WEBKIT_DISABLE_COMPOSITING_MODE=1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Environment]
2+
GSK_RENDERER=cairo
3+
LIBGL_ALWAYS_SOFTWARE=1
4+
GALLIUM_DRIVER=llvmpipe
5+
LIBGL_KOPPER_DISABLE=1
6+
WEBKIT_DISABLE_COMPOSITING_MODE=1

0 commit comments

Comments
 (0)