|
23 | 23 |
|
24 | 24 | [ -d /mnt/wslg ] || return 0 |
25 | 25 |
|
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. |
36 | 51 | 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}" |
38 | 55 | fi |
39 | 56 |
|
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 | | - |
66 | 57 | # ── WebKit (Epiphany / GNOME-Web) ─────────────────────────────── |
67 | 58 | # WebKit-on-WSLg works best with hardware compositing disabled -- |
68 | 59 | # the dzn path can't reliably back WebKit's compositing layers. |
|
0 commit comments