Skip to content

Commit 37a6923

Browse files
leaanthonywails-fleet-botclaudemultica-agent
authored
fix(linux): apply WEBKIT_DISABLE_DMABUF_RENDERER on X11 for NVIDIA GPUs (#5295)
fix(linux): apply WEBKIT_DISABLE_DMABUF_RENDERER on X11 too for NVIDIA GPUs The blank/white window bug (#4985) affects both X11 and Wayland sessions with NVIDIA proprietary drivers, but the previous workaround only set WEBKIT_DISABLE_DMABUF_RENDERER=1 on Wayland. Remove the session-type guard so the env var is applied whenever the nvidia kernel module is present. Also adds the same protection to the purego build variant (previously unhandled) and documents the issue + automatic mitigation in the Linux troubleshooting guide. Co-authored-by: wails-fleet-bot <noreply@wails-fleet.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
1 parent d75d5cf commit 37a6923

4 files changed

Lines changed: 36 additions & 8 deletions

File tree

docs/src/content/docs/guides/build/linux.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ sudo pacman -S base-devel
195195

196196
Alternatively, run `wails3 task setup:docker` and the build system will use Docker automatically.
197197

198+
### Blank or white window on NVIDIA GPU
199+
200+
On Linux with NVIDIA proprietary drivers, Wails apps may show a blank or white window on startup. This is caused by a WebKitGTK bug where the DMA-BUF renderer fails with `gbm_bo_map()` against the NVIDIA proprietary driver (affects X11 and Wayland, driver versions 377–580+, GPUs from the 10 series and older GT 710).
201+
202+
**Wails applies `WEBKIT_DISABLE_DMABUF_RENDERER=1` automatically** when it detects the NVIDIA kernel module (`/sys/module/nvidia`), so most users will not need to do anything.
203+
204+
If you still see a blank window (for example in a container where the module path is not visible), set the environment variable manually before launching your app:
205+
206+
```bash
207+
WEBKIT_DISABLE_DMABUF_RENDERER=1 ./myapp
208+
```
209+
210+
Related upstream bugs: [WebKit #262607](https://bugs.webkit.org/show_bug.cgi?id=262607), [WebKit #180739](https://bugs.webkit.org/show_bug.cgi?id=180739).
211+
198212
### AppImage strip compatibility
199213

200214
On modern Linux distributions (Arch Linux, Fedora 39+, Ubuntu 24.04+), system libraries are compiled with `.relr.dyn` ELF sections for more efficient relocations. The `linuxdeploy` tool used to create AppImages bundles an older `strip` binary that cannot process these modern sections.

v3/pkg/application/application_linux.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ func init() {
5959
_ = os.Setenv("GDK_BACKEND", "x11")
6060
}
6161

62-
// Disable DMA-BUF renderer on Wayland with NVIDIA to prevent "Error 71 (Protocol error)" crashes.
63-
// This is a known WebKitGTK issue with NVIDIA proprietary drivers on Wayland.
62+
// Disable DMA-BUF renderer on any session type with NVIDIA to prevent blank windows and
63+
// "Error 71 (Protocol error)" crashes. NVIDIA proprietary drivers fail gbm_bo_map() when
64+
// importing DMA-BUF, causing blank/white screens on both X11 and Wayland.
6465
// See: https://bugs.webkit.org/show_bug.cgi?id=262607
65-
if os.Getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == "" &&
66-
os.Getenv("XDG_SESSION_TYPE") == "wayland" &&
67-
isNVIDIAGPU() {
66+
// See: https://github.com/wailsapp/wails/issues/4985
67+
if os.Getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == "" && isNVIDIAGPU() {
6868
_ = os.Setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "1")
6969
}
7070
}

v3/pkg/application/application_linux_gtk4.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ func init() {
4949
fmt.Println("│ Please report issues: https://github.com/wailsapp/wails/issues/4957 │")
5050
fmt.Println("└────────────────────────────────────────────────────────────────────────┘")
5151

52-
if os.Getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == "" &&
53-
os.Getenv("XDG_SESSION_TYPE") == "wayland" &&
54-
isNVIDIAGPU() {
52+
// Disable DMA-BUF renderer on any session type with NVIDIA to prevent blank windows and
53+
// "Error 71 (Protocol error)" crashes. NVIDIA proprietary drivers fail gbm_bo_map() when
54+
// importing DMA-BUF, causing blank/white screens on both X11 and Wayland.
55+
// See: https://bugs.webkit.org/show_bug.cgi?id=262607
56+
// See: https://github.com/wailsapp/wails/issues/4985
57+
if os.Getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == "" && isNVIDIAGPU() {
5558
_ = os.Setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "1")
5659
}
5760
}

v3/pkg/application/linux_purego.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,17 @@ var (
233233
func init() {
234234
// needed for GTK4 to function
235235
_ = os.Setenv("GDK_BACKEND", "x11")
236+
237+
// Disable DMA-BUF renderer on any session type with NVIDIA to prevent blank windows and
238+
// "Error 71 (Protocol error)" crashes. NVIDIA proprietary drivers fail gbm_bo_map() when
239+
// importing DMA-BUF, causing blank/white screens on both X11 and Wayland.
240+
// See: https://bugs.webkit.org/show_bug.cgi?id=262607
241+
// See: https://github.com/wailsapp/wails/issues/4985
242+
if os.Getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == "" {
243+
if _, err := os.Stat("/sys/module/nvidia"); err == nil {
244+
_ = os.Setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "1")
245+
}
246+
}
236247
var err error
237248

238249
// gtk, err = purego.Dlopen(gtk4, purego.RTLD_NOW|purego.RTLD_GLOBAL)

0 commit comments

Comments
 (0)