From 52f2d9ded5c81ca0062299c99519011921c1e747 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 9 Feb 2026 00:50:41 -0600 Subject: [PATCH] fix: force software rendering when hardware accel is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WEBKIT_DISABLE_DMABUF_RENDERER alone is not enough — WebKit still calls eglGetDisplay() for compositing and crashes with EGL_BAD_PARAMETER on systems without working EGL (VMs, some driver combinations). Setting LIBGL_ALWAYS_SOFTWARE=1 forces Mesa to use llvmpipe so the EGL initialization succeeds through software rasterization. --- src-tauri/src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index e98bc2913..a50eec734 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -88,14 +88,26 @@ fn main() { // Hardware acceleration control // Default: OFF for all GPUs (EGL crashes on too many configurations) // Opt-in: QBZ_HARDWARE_ACCEL=1 + // + // WEBKIT_DISABLE_DMABUF_RENDERER alone is NOT enough — WebKit still + // tries eglGetDisplay() for compositing and crashes with + // "Could not create default EGL display: EGL_BAD_PARAMETER" on systems + // without working EGL (VMs, some driver combos). + // LIBGL_ALWAYS_SOFTWARE forces Mesa to use llvmpipe so EGL init + // succeeds through software rasterization instead of crashing. if hardware_accel { eprintln!("[QBZ] Hardware acceleration enabled (QBZ_HARDWARE_ACCEL=1)"); if has_nvidia && is_wayland { eprintln!("[QBZ] Warning: NVIDIA + Wayland may cause crashes with hardware acceleration"); } - } else if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() { + } else { eprintln!("[QBZ] Hardware acceleration disabled (default). Set QBZ_HARDWARE_ACCEL=1 to enable"); - std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1"); + if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() { + std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1"); + } + if std::env::var_os("LIBGL_ALWAYS_SOFTWARE").is_none() { + std::env::set_var("LIBGL_ALWAYS_SOFTWARE", "1"); + } } }