fix: start on wayland with nvidia

This commit is contained in:
Felitendo committed 2026-09-15 21:21:46 +02:00
1 parent 030aa8fb57
commit 997483b3d4
3 files changed
+50

No files matched your search

+7
View File
@@ -29,6 +29,7 @@ works.
| `0014-Browse-skins-from-...` | A Browse tab on the skin page: Ely.by's catalogue in the app, and NameMC, laby.net and crafty.gg in a window. |
| `0015-Use-the-desktop-s-file-picker-...` | File pickers on Linux are the desktop's own, such as KDE's, through the XDG desktop portal. |
| `0016-Show-the-account-in-the-title-bar-...` | With the right sidebar folded away, the Minecraft account is shown in the title bar and managed from there. |
| `0017-Start-on-Wayland-with-an-NVIDIA-GPU` | The app no longer crashes at start under Wayland with the NVIDIA driver. |
### Offline accounts
@@ -104,6 +105,12 @@ File pickers on Linux go through the XDG desktop portal, so KDE shows its own di
own, instead of a GTK dialog the AppImage themes as light Adwaita. Without a portal, GTK's dialog is
used as before. Windows and macOS already use their native pickers.
With the NVIDIA driver under Wayland, WebKitGTK used to close the window at start with "Error 71".
The webview now hands its frames over through shared memory there
(`WEBKIT_DMABUF_RENDERER_FORCE_SHM=1`), still rendering on the GPU. Setting that or
`WEBKIT_DISABLE_DMABUF_RENDERER` yourself keeps your choice. The AppImage forces X11 and was not
affected.
### Skins
With an Ely.by account selected, the skin page shows the account's skins on Ely.by: apply one, add
@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Modrinth Enhanced <patches@modrinth-enhanced.invalid>
Date: Tue, 15 Sep 2026 21:11:40 +0200
Subject: [PATCH] Start on Wayland with an NVIDIA GPU
With the NVIDIA driver under Wayland, WebKitGTK's DMA-BUF renderer takes
the window down at start with "Error 71 (Protocol error) dispatching to
Wayland display", so the .deb and .rpm did not open at all there. The
AppImage forces X11 and never hit this. WEBKIT_DMABUF_RENDERER_FORCE_SHM
is now set at startup when the NVIDIA DRM module is loaded, which hands
frames over through shared memory and still renders on the GPU. A player
who set it, or WEBKIT_DISABLE_DMABUF_RENDERER, keeps their value.
---
apps/app/src/main.rs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/apps/app/src/main.rs b/apps/app/src/main.rs
index 4c269a3..5cdab91 100644
--- a/apps/app/src/main.rs
+++ b/apps/app/src/main.rs
@@ -125,6 +125,20 @@ fn main() {
unsafe { std::env::set_var("GTK_USE_PORTAL", "1") };
}
+ // With the NVIDIA driver under Wayland, WebKitGTK's DMA-BUF renderer
+ // takes the window down at start with "Error 71 (Protocol error)
+ // dispatching to Wayland display". Handing frames over through shared
+ // memory avoids it and still renders on the GPU. The AppImage forces X11
+ // and never hit this.
+ #[cfg(target_os = "linux")]
+ if std::path::Path::new("/sys/module/nvidia_drm").exists()
+ && std::env::var_os("WEBKIT_DMABUF_RENDERER_FORCE_SHM").is_none()
+ && std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none()
+ {
+ // SAFETY: nothing else is running yet.
+ unsafe { std::env::set_var("WEBKIT_DMABUF_RENDERER_FORCE_SHM", "1") };
+ }
+
#[cfg(feature = "export-app-events")]
theseus::export_app_event_bindings(
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+2
View File
@@ -164,6 +164,8 @@ check "the middle button autoscrolls" \
contains "$WORKTREE/apps/app-frontend/src/App.vue" 'installAutoscroll()'
check "file pickers use the desktop portal on Linux" \
contains "$WORKTREE/apps/app/src/main.rs" 'set_var("GTK_USE_PORTAL", "1")'
check "NVIDIA under Wayland does not crash the webview" \
contains "$WORKTREE/apps/app/src/main.rs" 'set_var("WEBKIT_DMABUF_RENDERER_FORCE_SHM", "1")'
log "No advertising or upsells"
check "no Modrinth+ upsell in the app" \