fix(linux): skip the NVIDIA explicit-sync workaround on driver 620+ with WebKitGTK 2.54+ (#48) #49

Merged
jared merged 1 commits from fix/nvidia-explicit-sync-gate into main 2026-11-09 17:00:35 -05:00
Owner

Fixes #48 (pending one comparison run, below).

Problem

On native Wayland with NVIDIA we always set __NV_DISABLE_EXPLICIT_SYNC=1. It was added in September (df760ab and bb5364b) to stop a launch crash ("Error 71", explicit-sync protocol error) on driver 615.71 with WebKitGTK 2.52.6.

On the same RTX 3070, now on Arch with driver 620.70.06 and webkit2gtk 2.54.2:

Run Result
Default (flag set) reported "extremely laggy" (#48)
LOTUS_NO_GPU_WORKAROUNDS=1 (flag off) launches, smooth, no Error 71
LOTUS_GPU_SAFE_MODE=1 (CPU rendering) laggy
WEBKIT_DISABLE_COMPOSITING_MODE=1 black window

So the crash the flag worked around is gone on these versions, and the flag is the likely cause of the lag. Implicit sync on NVIDIA can stall frames.

Change (src-tauri/src/gpu_workarounds.rs)

  • The flag is skipped only when both versions are new enough: the NVIDIA driver is 620 or later (read from /sys/module/nvidia/version, falling back to /proc/driver/nvidia/version) and the loaded WebKitGTK is 2.54 or later (webkit_get_major_version/minor, so the AppImage's bundled WebKitGTK counts, not the system one).
  • An older driver, an older WebKitGTK, or a version we can't read keeps today's behaviour. A wrong guess means the app doesn't open at all, so the gate is conservative.
  • User settings still win. Setting __NV_DISABLE_EXPLICIT_SYNC=1 by hand forces the old behaviour. LOTUS_GPU_SAFE_MODE and the X11/XWayland path are unchanged.
  • When the flag is skipped, the app prints gpu-workarounds: NVIDIA driver 620 with WebKitGTK 2.54: no workaround needed (…) on stderr, so a terminal launch shows which path it took.

Tests

  • cargo test --lib gpu_workarounds: 13/13 (9 existing unchanged, 4 new). The new ones cover the version gate, including only one side being new; driver-version parsing from both file formats, where a GCC version isn't mistaken for the driver; and safe mode and X11 still applying on fixed versions.
  • rustfmt --check and clippy --lib are clean for this file.

Before merging

  • Comparison run: start the installed app with no env vars (flag on) under the same conditions as the smooth run (same wallpaper setup). It should be noticeably laggier than LOTUS_NO_GPU_WORKAROUNDS=1. If both feel the same, the flag isn't the cause and this PR shouldn't ship as the #48 fix.
  • After release: a terminal launch should print the "no workaround needed" line and feel like the smooth run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA

Fixes #48 (pending one comparison run, below). ## Problem On native Wayland with NVIDIA we always set `__NV_DISABLE_EXPLICIT_SYNC=1`. It was added in September (df760ab and bb5364b) to stop a launch crash ("Error 71", explicit-sync protocol error) on driver 615.71 with WebKitGTK 2.52.6. On the same RTX 3070, now on Arch with driver **620.70.06** and **webkit2gtk 2.54.2**: | Run | Result | |---|---| | Default (flag set) | reported "extremely laggy" (#48) | | `LOTUS_NO_GPU_WORKAROUNDS=1` (flag off) | launches, **smooth**, no Error 71 | | `LOTUS_GPU_SAFE_MODE=1` (CPU rendering) | laggy | | `WEBKIT_DISABLE_COMPOSITING_MODE=1` | black window | So the crash the flag worked around is gone on these versions, and the flag is the likely cause of the lag. Implicit sync on NVIDIA can stall frames. ## Change (`src-tauri/src/gpu_workarounds.rs`) - The flag is skipped only when **both** versions are new enough: the NVIDIA driver is 620 or later (read from `/sys/module/nvidia/version`, falling back to `/proc/driver/nvidia/version`) **and** the loaded WebKitGTK is 2.54 or later (`webkit_get_major_version`/`minor`, so the AppImage's bundled WebKitGTK counts, not the system one). - An older driver, an older WebKitGTK, or a version we can't read keeps today's behaviour. A wrong guess means the app doesn't open at all, so the gate is conservative. - User settings still win. Setting `__NV_DISABLE_EXPLICIT_SYNC=1` by hand forces the old behaviour. `LOTUS_GPU_SAFE_MODE` and the X11/XWayland path are unchanged. - When the flag is skipped, the app prints `gpu-workarounds: NVIDIA driver 620 with WebKitGTK 2.54: no workaround needed (…)` on stderr, so a terminal launch shows which path it took. ## Tests - `cargo test --lib gpu_workarounds`: **13/13** (9 existing unchanged, 4 new). The new ones cover the version gate, including only one side being new; driver-version parsing from both file formats, where a GCC version isn't mistaken for the driver; and safe mode and X11 still applying on fixed versions. - `rustfmt --check` and `clippy --lib` are clean for this file. ## Before merging - **Comparison run:** start the installed app with no env vars (flag on) under the same conditions as the smooth run (same wallpaper setup). It should be noticeably laggier than `LOTUS_NO_GPU_WORKAROUNDS=1`. If both feel the same, the flag isn't the cause and this PR shouldn't ship as the #48 fix. - **After release:** a terminal launch should print the "no workaround needed" line and feel like the smooth run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
jared added 1 commit 2026-11-09 16:55:50 -05:00
On native Wayland we set __NV_DISABLE_EXPLICIT_SYNC=1 for every NVIDIA
user, to stop the "Error 71" protocol crash seen on driver 615 with
WebKitGTK 2.52. On driver 620.70.06 with WebKitGTK 2.54.2 (same RTX 3070)
the app launches and runs smoothly without it, while the default was
reported as extremely laggy.

Skip the flag only when both versions are known and new enough. An
older driver, an older WebKitGTK (e.g. the AppImage's bundled one) or a
version we can't read keeps the old behaviour, since a wrong guess means
the app doesn't open. Setting the variable by hand still forces it. The
app logs which path it took on stderr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
jared scheduled this pull request to auto merge when all checks succeed 2026-11-09 17:00:33 -05:00
jared merged commit f59b12276e into main 2026-11-09 17:00:35 -05:00
jared deleted branch fix/nvidia-explicit-sync-gate 2026-11-09 17:00:38 -05:00
Sign in to join this conversation.