Skip to content

Commit 99fd062

Browse files
Nicolettaclaude
authored andcommitted
fix: WebKit HardwareAccelerationPolicy::Never – EGL-Crash auf KDE Plasma
Env-Vars (LIBGL_ALWAYS_SOFTWARE etc.) verhindern den EGL_BAD_PARAMETER-Crash nicht – Mesa 26 AMD crasht bevor es sie liest. Fix auf API-Ebene: webkit2gtk::HardwareAccelerationPolicy::Never deaktiviert EGL-Init in WebKit bevor der GPU-Subprocess es versucht. - Cargo.toml: webkit2gtk = { version = "2", features = ["v2_40"] } (Linux) - lib.rs: with_webview → settings().set_hardware_acceleration_policy(Never) - lib.rs: Env-Var-Workarounds entfernt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0891c9c commit 99fd062

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src-tauri/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ tauri-plugin-shell = "2"
2727
tauri-plugin-updater = "2"
2828
tauri-plugin-process = "2"
2929
portpicker = "0.1"
30+
31+
[target.'cfg(target_os = "linux")'.dependencies]
32+
webkit2gtk = { version = "2", features = ["v2_40"] }

src-tauri/src/lib.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@ fn kill_backend(state: tauri::State<BackendChild>) {
5353

5454
#[cfg_attr(mobile, tauri::mobile_entry_point)]
5555
pub fn run() {
56-
// Linux-Rendering-Fix: WebKits GPU-Subprocess crasht auf bestimmten Systemen
57-
// (AMD + Mesa 26, KDE Plasma/Wayland) mit EGL_BAD_PARAMETER.
58-
// GDK_BACKEND allein reicht nicht – WebKit initialisiert EGL unabhängig vom
59-
// GTK-Backend in einem eigenen Subprocess.
60-
// LIBGL_ALWAYS_SOFTWARE=1 zwingt Mesa auf Software-Rendering (llvmpipe) bevor
61-
// irgendjemand GPU-EGL anfasst. Für eine Business-App kein wahrnehmbarer Unterschied.
62-
#[cfg(target_os = "linux")]
63-
{
64-
std::env::set_var("LIBGL_ALWAYS_SOFTWARE", "1");
65-
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
66-
}
67-
6856
tauri::Builder::default()
6957
.plugin(tauri_plugin_updater::Builder::new().build())
7058
.plugin(tauri_plugin_process::init())
@@ -98,6 +86,23 @@ pub fn run() {
9886
app.manage(BackendChild(Mutex::new(Some(child))));
9987
log::info!("Backend-Sidecar gestartet auf Port {}", port);
10088

89+
// Linux: Hardware-Beschleunigung in WebKit deaktivieren.
90+
// Env-Vars (LIBGL_ALWAYS_SOFTWARE etc.) reichen nicht – WebKits GPU-Subprocess
91+
// crasht auf AMD + Mesa 26 mit EGL_BAD_PARAMETER bevor er sie liest.
92+
// HardwareAccelerationPolicy::Never verhindert EGL-Init auf API-Ebene.
93+
#[cfg(target_os = "linux")]
94+
{
95+
use webkit2gtk::{SettingsExt, WebViewExt};
96+
if let Some(w) = app.get_webview_window("main") {
97+
let _ = w.with_webview(|wv| {
98+
let settings = wv.inner().settings().unwrap();
99+
settings.set_hardware_acceleration_policy(
100+
webkit2gtk::HardwareAccelerationPolicy::Never,
101+
);
102+
});
103+
}
104+
}
105+
101106
// Backend beim Schließen des Hauptfensters synchron beenden.
102107
// CloseRequested feuert zuverlässiger als RunEvent::Exit und
103108
// vermeidet Race-Conditions mit shell.open() (PDF-Links).

0 commit comments

Comments
 (0)