Skip to content

Commit 0cf8f81

Browse files
authored
fix(vacs-client): fix random UI freezes under Wayland (#747)
main application, remote control, etc. continue to work, but UI rendering just seems to freeze randomly setting recommended WebkitGTK renderer env vars to try and mitigate the issue additional variables are not enabled for now as they negatively impact performace - can be further extended if needed
1 parent 99d4821 commit 0cf8f81

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

vacs-client/src/main.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,39 @@ fn main() {
99
let platform = platform::Platform::get();
1010
if matches!(platform, platform::Platform::LinuxWayland) {
1111
unsafe {
12-
// Workaround required until Wayland issues have been fixed.
12+
// Workarounds for WebKitGTK + Wayland rendering issues.
13+
//
14+
// WebKitGTK's DMA-BUF accelerated renderer has known bugs that cause
15+
// UI freezes (app keeps running but the window stops painting) and
16+
// crashes ("Error 71 Protocol error") on Wayland, especially with
17+
// NVIDIA drivers but also affecting AMD/Intel.
18+
//
1319
// See: https://github.com/tauri-apps/tauri/issues/10702
20+
// See: https://github.com/tauri-apps/tauri/issues/13498
21+
// See: https://bugs.webkit.org/show_bug.cgi?id=291332
22+
23+
// Disable NVIDIA's threaded GL optimization, which can race with
24+
// WebKitGTK's own threading. No-op on non-NVIDIA systems.
1425
std::env::set_var("__GL_THREADED_OPTIMIZATIONS", "0");
26+
27+
// Disable NVIDIA explicit sync to prevent Wayland protocol errors.
28+
// No-op on non-NVIDIA systems.
1529
std::env::set_var("__NV_DISABLE_EXPLICIT_SYNC", "1");
30+
31+
// Disable the DMA-BUF renderer, falling back to shared-memory
32+
// buffer transfers. This is the primary fix for UI freezes.
33+
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
34+
35+
// Disable GPU-accelerated compositing for CSS layers, transforms,
36+
// and animations. Falls back to CPU rendering. Removes GPU-
37+
// dependent rendering bugs but degrades animation performance
38+
// and disables effects like backdrop-filter: blur().
39+
// std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
40+
41+
// Suppress Mesa's device selection Vulkan layer, which auto-
42+
// selects the "best" GPU on multi-GPU systems (e.g. iGPU + dGPU
43+
// laptops). Prevents hangs from selecting the wrong GPU.
44+
// std::env::set_var("NODEVICE_SELECT", "1");
1645
}
1746
}
1847
}

0 commit comments

Comments
 (0)