Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: keep DMA-BUF off on NVIDIA Wayland when compositing is turned off by the environment (#14141)

Daniel Hanf4b9af09ddbd
diff --git a/studio/src-tauri/src/linux_webkit.rs b/studio/src-tauri/src/linux_webkit.rs
index 1bc9412ef2c..d2a3ccff1c5 100644
--- a/studio/src-tauri/src/linux_webkit.rs
+++ b/studio/src-tauri/src/linux_webkit.rs
@@ -34,6 +34,8 @@ const NVIDIA_DRIVER_VERSION_PATH: &str = "/proc/driver/nvidia/version";
const NVIDIA_REASON: &str = "NVIDIA driver loaded (no Wayland session)";
const NVIDIA_APPIMAGE_X11_REASON: &str = "NVIDIA driver loaded (AppImage on X11)";
const NVIDIA_WAYLAND_REASON: &str = "NVIDIA driver loaded (Wayland session)";
+const NVIDIA_WAYLAND_OPERATOR_COMPOSITING_REASON: &str =
+ "NVIDIA driver loaded (Wayland session, compositing turned off by the environment)";
const NVIDIA_APPIMAGE_GLES_REASON: &str =
"NVIDIA driver loaded; AppImage without a usable GLES library";
const WAYLAND_REASON: &str = "Wayland session";
@@ -157,9 +159,7 @@ fn rendering_plan(
if env(FORCE_SHARED_MEMORY).is_some() && !ours(FORCE_SHARED_MEMORY) {
return RenderingPlan::PreserveEnvironment;
}
- if env(DISABLE_COMPOSITING).is_some() && !ours(DISABLE_COMPOSITING) {
- return RenderingPlan::PreserveEnvironment;
- }
+ let operator_compositing_off = env(DISABLE_COMPOSITING).is_some() && !ours(DISABLE_COMPOSITING);
// Stands the NVIDIA branch down and nothing else: it answers that patch's question,
// not the missing-GLES one below, and that launch cannot render without its fallback.
@@ -184,6 +184,17 @@ fn rendering_plan(
&& gles_usable
&& supports_force_shared_memory(webkit_version);
+ // Compositing off alone still commits DMA-BUF on WebKitGTK 2.53+, Error 71 on NVIDIA Wayland (#12845).
+ if operator_compositing_off {
+ if nvidia_driver_loaded && !force_dmabuf && wayland_session {
+ return RenderingPlan::Apply(
+ RenderingWorkaround::DisableDmabuf,
+ NVIDIA_WAYLAND_OPERATOR_COMPOSITING_REASON,
+ );
+ }
+ return RenderingPlan::PreserveEnvironment;
+ }
+
// Opt-in only. Do not auto-apply it on Wayland NVIDIA mixed-GPU open-module hosts (#9734):
// #13875 has that shape and crashes with Error 71 under it, while DISABLE_DMABUF works.
let setting = env(DISABLE_COMPOSITING_SETTING);
@@ -1318,8 +1329,48 @@ mod tests {
fn an_operator_who_set_the_variable_keeps_their_environment() {
let theirs: &[(&str, &str)] = &[(WAYLAND_DISPLAY, "wayland-0"), (DISABLE_COMPOSITING, "1")];
assert_eq!(
- plan_on_graphics(theirs, true),
+ plan_on_graphics(theirs, false),
+ RenderingPlan::PreserveEnvironment
+ );
+ let theirs_x11: &[(&str, &str)] = &[(X11_DISPLAY, ":0"), (DISABLE_COMPOSITING, "1")];
+ assert_eq!(
+ plan_on_graphics(theirs_x11, true),
RenderingPlan::PreserveEnvironment
);
}
+
+ #[test]
+ fn operator_compositing_off_on_nvidia_wayland_still_gets_dmabuf_off() {
+ let theirs: &[(&str, &str)] = &[(WAYLAND_DISPLAY, "wayland-0"), (DISABLE_COMPOSITING, "1")];
+ let expected = RenderingPlan::Apply(
+ RenderingWorkaround::DisableDmabuf,
+ NVIDIA_WAYLAND_OPERATOR_COMPOSITING_REASON,
+ );
+ assert_eq!(plan_on_graphics(theirs, true), expected);
+
+ let relaunch: &[(&str, &str)] = &[
+ (WAYLAND_DISPLAY, "wayland-0"),
+ (DISABLE_COMPOSITING, "1"),
+ (DISABLE_DMABUF, "1"),
+ (APPLIED_WORKAROUND, DISABLE_DMABUF),
+ ];
+ assert_eq!(plan_on_graphics(relaunch, true), expected);
+
+ for (name, value) in [
+ (DISABLE_DMABUF, "0"),
+ (FORCE_SHARED_MEMORY, "1"),
+ (FORCE_DMABUF, "1"),
+ ] {
+ let vars: &[(&str, &str)] = &[
+ (WAYLAND_DISPLAY, "wayland-0"),
+ (DISABLE_COMPOSITING, "1"),
+ (name, value),
+ ];
+ assert_eq!(
+ plan_on_graphics(vars, true),
+ RenderingPlan::PreserveEnvironment,
+ "{name}={value}"
+ );
+ }
+ }
}