Skip to content

The agent that grows with you

fix(desktop): skip the WSL GPU-blocklist override on Wayland ozone

emozillaf8489405600c
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index a803515a7e3..5bc169afb10 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -787,8 +787,14 @@ if (DEV_CDP.port) {
// WSLg: Chromium blocklists the Mesa vGPU → software compositing → typing lag.
// /dev/dxg means a real GPU is available; un-blocklist it. Skipped when a remote
-// display already forced software (SSH'd-into-WSL).
-if (IS_WSL && !REMOTE_DISPLAY_REASON && fs.existsSync('/dev/dxg')) {
+// display already forced software (SSH'd-into-WSL), and on Wayland ozone: WSL has
+// no DRM render node, so forced GPU compositing segfaults the GPU process there.
+if (
+ IS_WSL &&
+ !REMOTE_DISPLAY_REASON &&
+ fs.existsSync('/dev/dxg') &&
+ linuxOzoneBackend(process.env, process.argv) !== 'wayland'
+) {
app.commandLine.appendSwitch('ignore-gpu-blocklist')
app.commandLine.appendSwitch('enable-gpu-rasterization')
app.commandLine.appendSwitch('enable-zero-copy')
diff --git a/apps/desktop/electron/wslg-launch.test.ts b/apps/desktop/electron/wslg-launch.test.ts
index 96c414a34a8..6f6b9a5bf46 100644
--- a/apps/desktop/electron/wslg-launch.test.ts
+++ b/apps/desktop/electron/wslg-launch.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
+import { linuxOzoneBackend } from './hud-windowing'
import { wslgLaunchArgs } from './wslg-launch'
const env = { WSL_DISTRO_NAME: 'Ubuntu', WAYLAND_DISPLAY: 'wayland-0', DISPLAY: ':0' }
@@ -39,6 +40,15 @@ describe('WSLg launch arguments', () => {
expect(wslgLaunchArgs([], { ...env, SSH_CONNECTION: 'remote' }, 'linux')).toBeNull()
expect(wslgLaunchArgs([], { ...env, DISPLAY: 'localhost:10.0' }, 'linux')).toBeNull()
})
+
+ // main.ts keys the WSL GPU-blocklist override off linuxOzoneBackend: forcing GPU
+ // compositing on WSLg's Wayland ozone segfaults the GPU process (no DRM render node).
+ it('is the backend main.ts sees after the relaunch', () => {
+ expect(linuxOzoneBackend(env, wslgLaunchArgs([], env, 'linux')!)).toBe('wayland')
+
+ const x11 = { ...env, ELECTRON_OZONE_PLATFORM_HINT: 'x11' }
+ expect(linuxOzoneBackend(x11, wslgLaunchArgs([], x11, 'linux')!)).toBe('x11')
+ })
})
const nativeWayland = { XDG_SESSION_TYPE: 'wayland', WAYLAND_DISPLAY: 'wayland-0', DISPLAY: ':0' }