perf+fix: DMABUF default on Linux, popout ACL fixes, plugin version sync, JFK bench fixture

Bundled work from a low-end laptop (Ryzen 5 4650U / Vega 6 / Linux Mint
22.2 / X11) profiling pass.

perf: WEBKIT_DISABLE_DMABUF_RENDERER=1 default on all Linux
  Previously only set on Wayland sessions. Empirically it's a
  significant idle-cost win on integrated GPUs in either session type:
  env-var matrix (release binary, 75s settle, 10s jiffies CPU sample)
  showed magnotia idle CPU 12.30% → 2.80% of one core and idle GPU
  17% → 10% on this hardware. Users can opt back in by exporting
  WEBKIT_DISABLE_DMABUF_RENDERER=0. The Wayland-only XWayland
  fallback (GDK_BACKEND=x11, WINIT_UNIX_BACKEND=x11) is unchanged.

fix: secondary-windows ACL — allow set-always-on-top
  The float window's pin toggle calls setAlwaysOnTop() but the
  secondary-windows capability didn't permit it, so the popout was
  stuck always-on-top regardless of the pin state. Adds the
  core:window:allow-set-always-on-top permission. Narrow scope.

fix: guard registerGlobalHotkey against non-main webviews
  Cross-window settings sync via localStorage can re-fire the
  $effect(() => settings.globalHotkey) callback inside popout webviews
  where the main layout's registerGlobalHotkey is reachable. Adds an
  early-return when the current window label is not "main", so the
  popout doesn't trigger an ACL-denied register/unregister and the
  user no longer sees a spurious "Hotkey not registered" toast when
  popouts are open. Keeps the global-shortcut perm scoped to main.

build: pin @tauri-apps/api 2.10.1 + @tauri-apps/plugin-dialog 2.7.1
  Match the Rust crate versions tauri-cli's version-mismatch check
  enforces during release builds. Without this, `npm run tauri build`
  exits 0 silently while emitting an Error and never producing
  binaries.

test: add crates/transcription/tests/jfk_bench.rs
  Reproducible RTF regression fixture. Env-gated on
  MAGNOTIA_WHISPER_TEST_MODEL + MAGNOTIA_WHISPER_TEST_AUDIO so it
  never runs in CI without setup. Loads the JFK WAV inline (no hound
  dep), times model load + cold + warm transcribe, prints SUMMARY.
  Baselines on this hardware:
    --release --features whisper:               cold RTF 0.054, warm 0.050, RSS 125 MB
    --release --features whisper,whisper-vulkan: cold RTF 0.029, warm 0.028, RSS 125 MB
  Vulkan on RADV/Vega 6 nearly halves transcription latency for
  Whisper Tiny — useful baseline for Phase 10 hardware-recommendation
  scoring.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jars
2026-05-09 09:09:03 +01:00
parent 2dfd7167fd
commit fdf27db0a1
7 changed files with 191 additions and 27 deletions

View File

@@ -97,17 +97,7 @@ async fn save_preferences(
/// --ozone-platform=x11). Day 6 of the upgrade plan.
#[cfg(target_os = "linux")]
fn ensure_x11_on_wayland() {
// If the user explicitly opted in to Wayland (XDG_SESSION_TYPE set by
// their session, KDE / GNOME compositor flags), force WebKitGTK + GDK
// onto X11 via XWayland. Idempotent: if a value is already set, keep
// it (the user knows best).
let session_type = std::env::var("XDG_SESSION_TYPE").unwrap_or_default();
let is_wayland = session_type.eq_ignore_ascii_case("wayland");
if !is_wayland {
return;
}
let set_if_unset = |key: &str, value: &str| {
let set_if_unset = |key: &str, value: &str, why: &str| {
if std::env::var_os(key).is_none() {
// SAFETY: setting env vars before any threads spawn (we are
// pre-Tauri-Builder here). This block is the only place these
@@ -115,15 +105,30 @@ fn ensure_x11_on_wayland() {
unsafe {
std::env::set_var(key, value);
}
eprintln!("[startup] Wayland workaround: {key}={value}");
eprintln!("[startup] Linux workaround: {key}={value} ({why})");
}
};
set_if_unset("GDK_BACKEND", "x11");
set_if_unset("WINIT_UNIX_BACKEND", "x11");
set_if_unset("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
// PipeWire screen-capture portal still works fine through XWayland;
// we only redirect the GUI rendering path.
// Always-on Linux: disable WebKit's DMA-BUF renderer. On RADV / Renoir
// class iGPUs and a number of NVIDIA driver stacks, the DMA-BUF path
// burns ~10pp idle GPU and ~10pp idle CPU compared to the legacy
// renderer for no visible quality difference. Empirically (env-var
// matrix on Ryzen 5 4650U / Vega 6, May 2026) toggling this dropped
// magnotia idle CPU 12.30% → 2.80% of one core and idle GPU 17% → 10%.
// Apples to both X11 and Wayland sessions; users can opt back in by
// setting WEBKIT_DISABLE_DMABUF_RENDERER=0 explicitly.
set_if_unset("WEBKIT_DISABLE_DMABUF_RENDERER", "1", "iGPU idle-cost workaround");
// If the user is on a Wayland session, also force WebKitGTK + GDK
// onto X11 via XWayland. Idempotent: if a value is already set, keep
// it (the user knows best). PipeWire screen-capture portal still
// works fine through XWayland; we only redirect the GUI rendering
// path.
let session_type = std::env::var("XDG_SESSION_TYPE").unwrap_or_default();
if session_type.eq_ignore_ascii_case("wayland") {
set_if_unset("GDK_BACKEND", "x11", "Wayland XWayland fallback");
set_if_unset("WINIT_UNIX_BACKEND", "x11", "Wayland XWayland fallback");
}
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]