From 29b766ae242765e8d84b39914467233972dd2aa2 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 16 May 2026 12:22:41 -0600 Subject: [PATCH 1/3] fix(graphics): recommend CPU for NVIDIA-only, allow DMA-BUF on hybrid NVIDIA-only systems no longer get a hardware-acceleration recommendation that visibly stutters under WebKitGTK. The three NVIDIA-only branches (Wayland+GNOME, Wayland, X11) collapse into one CPU-rendering profile, since XWayland does not rescue the stutter either. NVIDIA + iGPU hybrid now allows DMA-BUF: WebKit composites on the stable iGPU stack, so the instability that affects NVIDIA-only systems does not apply. The recommendation also tells the user to pick the iGPU explicitly in the rendering GPU selector instead of Auto. cc --- crates/qbz-app/src/graphics_autoconfig.rs | 87 +++++++++++------------ 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/crates/qbz-app/src/graphics_autoconfig.rs b/crates/qbz-app/src/graphics_autoconfig.rs index 65a92c8da..cfdd649f8 100644 --- a/crates/qbz-app/src/graphics_autoconfig.rs +++ b/crates/qbz-app/src/graphics_autoconfig.rs @@ -200,69 +200,52 @@ pub fn compute_recommendation(env: &Environment) -> Recommendation { } let is_wayland = env.display_server == "Wayland"; - let desktop_lower = env.desktop.to_lowercase(); - let is_gnome = desktop_lower.contains("gnome"); let has_hybrid_igpu = env.gpu_nvidia && (env.gpu_intel || env.gpu_amd); // Hybrid laptops (NVIDIA dGPU + Intel/AMD iGPU). WebKit composes via // the iGPU through EGL/GLX defaults - the NVIDIA card sits idle for - // PRIME render offload. Forcing GSK_RENDERER=gl here was hurting - // performance because the GL renderer biases toward the dGPU stack - // even when the iGPU is the actual paint target. Auto (None) lets - // GTK4 pick NGL/Vulkan as appropriate for the iGPU. DMA-BUF stays - // disabled - that one is fragile on any NVIDIA-touching setup. + // PRIME render offload. Auto (None) lets GTK4 pick NGL/Vulkan as + // appropriate for the iGPU. DMA-BUF is safe here: the compositing + // path runs on the stable iGPU stack, not the NVIDIA driver, so the + // instability that affects NVIDIA-only systems does not apply. The + // user must still pick the iGPU explicitly in the rendering GPU + // selector - leaving it on Auto can resolve to the NVIDIA card. if has_hybrid_igpu { let igpu_label = if env.gpu_intel { "Intel" } else { "AMD" }; rationale.push(format!( "NVIDIA + {} hybrid: iGPU handles WebKit compositing, leaving GSK at Auto", igpu_label )); + rationale.push(format!( + "Select the {} integrated GPU explicitly in the rendering GPU selector instead of Auto", + igpu_label + )); return Recommendation { hardware_acceleration: true, force_x11: false, gsk_renderer: None, - disable_dmabuf: true, + disable_dmabuf: false, disable_blur_background: false, rationale, }; } - // NVIDIA + Wayland + GNOME: known stutter combo - if env.gpu_nvidia && is_wayland && is_gnome { - rationale.push("NVIDIA + Wayland + GNOME: using GL renderer, DMA-BUF off".to_string()); - rationale.push("This combination has known compositing issues".to_string()); - return Recommendation { - hardware_acceleration: true, - force_x11: false, - gsk_renderer: Some("gl".to_string()), - disable_dmabuf: true, - disable_blur_background: false, - rationale, - }; - } - - // NVIDIA + Wayland (non-GNOME) - if env.gpu_nvidia && is_wayland { - rationale.push("NVIDIA + Wayland: using GL renderer, DMA-BUF off".to_string()); - return Recommendation { - hardware_acceleration: true, - force_x11: false, - gsk_renderer: Some("gl".to_string()), - disable_dmabuf: true, - disable_blur_background: false, - rationale, - }; - } - - // NVIDIA + X11 + // NVIDIA-only (no iGPU to offload WebKit compositing to). WebKitGTK + // on the proprietary NVIDIA driver has long-standing compositing + // stutter that XWayland does not solve. Rather than recommend + // hardware acceleration that visibly stutters, fall back to CPU + // rendering: trimmed but smooth. DMA-BUF stays off - there is no + // stable GPU compositing path on this configuration. if env.gpu_nvidia { - rationale.push("NVIDIA + X11: full hardware acceleration, DMA-BUF off".to_string()); + rationale.push("NVIDIA-only system: using CPU rendering for a smooth UI".to_string()); + rationale + .push("WebKit GPU compositing on the NVIDIA driver has unresolved stutter".to_string()); return Recommendation { - hardware_acceleration: true, + hardware_acceleration: false, force_x11: false, - gsk_renderer: Some("gl".to_string()), + gsk_renderer: Some("cairo".to_string()), disable_dmabuf: true, - disable_blur_background: false, + disable_blur_background: true, rationale, }; } @@ -361,7 +344,7 @@ mod tests { } #[test] - fn nvidia_hybrid_leaves_renderer_auto_and_disables_dmabuf() { + fn nvidia_hybrid_leaves_renderer_auto_and_allows_dmabuf() { let mut environment = env("Wayland"); environment.gpu_nvidia = true; environment.gpu_intel = true; @@ -370,30 +353,40 @@ mod tests { assert!(recommendation.hardware_acceleration); assert_eq!(recommendation.gsk_renderer, None); - assert!(recommendation.disable_dmabuf); + // DMA-BUF is safe on hybrid: the iGPU does the compositing. + assert!(!recommendation.disable_dmabuf); + // The user is told to pick the iGPU explicitly, not leave Auto. + assert!(recommendation + .rationale + .iter() + .any(|line| line.contains("integrated GPU"))); } #[test] - fn nvidia_wayland_gnome_uses_gl_and_disables_dmabuf() { + fn nvidia_only_wayland_uses_cpu_rendering() { let mut environment = env("Wayland"); environment.gpu_nvidia = true; - environment.desktop = "GNOME".to_string(); let recommendation = compute_recommendation(&environment); - assert_eq!(recommendation.gsk_renderer.as_deref(), Some("gl")); + assert!(!recommendation.hardware_acceleration); + assert_eq!(recommendation.gsk_renderer.as_deref(), Some("cairo")); assert!(recommendation.disable_dmabuf); + assert!(recommendation.disable_blur_background); } #[test] - fn nvidia_x11_uses_gl_and_disables_dmabuf() { + fn nvidia_only_x11_uses_cpu_rendering() { let mut environment = env("X11"); environment.gpu_nvidia = true; let recommendation = compute_recommendation(&environment); - assert_eq!(recommendation.gsk_renderer.as_deref(), Some("gl")); + // X11/XWayland does not rescue NVIDIA-only: CPU rendering either way. + assert!(!recommendation.hardware_acceleration); + assert_eq!(recommendation.gsk_renderer.as_deref(), Some("cairo")); assert!(recommendation.disable_dmabuf); + assert!(!recommendation.force_x11); } #[test] From 3d29cf1384096a8a3f61fe2c0ed45bd4d8d50643 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 16 May 2026 12:22:41 -0600 Subject: [PATCH 2/3] fix(graphics): make recommendation advisory-only, GPU-aware DMA-BUF help The graphics recommendation banner no longer writes settings: the Apply button and the v2_apply_graphics_recommendation command are removed, so the banner only detects and explains. The user applies the change with the real toggles, matching the HiFi Wizard's advisory model. write_recommendation stays for the qbz --autoconfig-graphics CLI. The Force DMA-BUF help text is now GPU-aware: the instability warning only shows on NVIDIA-only systems; non-NVIDIA and hybrid hosts are told it is safe to enable. On hybrid hosts the rendering GPU dropdown marks the integrated GPU as recommended. cc --- src-tauri/src/autoconfig_graphics.rs | 10 +-- .../commands_v2/graphics_recommendation.rs | 16 ---- src-tauri/src/lib.rs | 1 - src/lib/components/views/SettingsView.svelte | 80 +++++++------------ src/lib/i18n/locales/de.json | 6 +- src/lib/i18n/locales/en.json | 6 +- src/lib/i18n/locales/es.json | 6 +- src/lib/i18n/locales/fr.json | 6 +- src/lib/i18n/locales/pt.json | 6 +- 9 files changed, 56 insertions(+), 81 deletions(-) diff --git a/src-tauri/src/autoconfig_graphics.rs b/src-tauri/src/autoconfig_graphics.rs index bdd6582e9..8e374fc35 100644 --- a/src-tauri/src/autoconfig_graphics.rs +++ b/src-tauri/src/autoconfig_graphics.rs @@ -106,17 +106,17 @@ fn apply_recommendation(rec: &Recommendation) { } } -/// Apply the recommendation to the persistence layer. Shared between the CLI -/// prompt (`apply_recommendation`) and the V2 command surface. Returns the -/// list of write errors so the caller can surface them appropriately (stderr -/// for CLI, frontend toast for the Settings UI). +/// Apply the recommendation to the persistence layer. Used by the CLI prompt +/// (`apply_recommendation`); the Settings UI is advisory-only and no longer +/// writes the recommendation. Returns the list of write errors so the caller +/// can surface them on stderr. /// /// DMA-BUF semantics after the 1.2.13 opt-in flip: /// - `rec.disable_dmabuf = true` -> force_dmabuf = false (matches default; /// runtime keeps DMA-BUF off). /// - `rec.disable_dmabuf = false` -> force_dmabuf = true (user opts in via /// this recommendation; runtime turns DMA-BUF on). -pub fn write_recommendation(rec: &Recommendation) -> Result<(), Vec> { +fn write_recommendation(rec: &Recommendation) -> Result<(), Vec> { let mut errors = Vec::new(); match GraphicsSettingsStore::new() { diff --git a/src-tauri/src/commands_v2/graphics_recommendation.rs b/src-tauri/src/commands_v2/graphics_recommendation.rs index 6d134a3e0..eb46aeeb9 100644 --- a/src-tauri/src/commands_v2/graphics_recommendation.rs +++ b/src-tauri/src/commands_v2/graphics_recommendation.rs @@ -4,7 +4,6 @@ //! tool); this module is just the Tauri surface that the Graphics tab uses //! to render the "Detected / Recommended" banner. -use crate::autoconfig_graphics::write_recommendation; use qbz_app::graphics_autoconfig::{ compute_recommendation, detect_environment, Environment, Recommendation, }; @@ -34,21 +33,6 @@ pub fn v2_get_graphics_recommendation() -> GraphicsRecommendationPayload { } } -/// Write the current recommendation to the persistence layer. -/// `force_dmabuf` is derived from `disable_dmabuf` per the 1.2.13 -/// opt-in semantics (see `write_recommendation` in autoconfig_graphics). -/// Returns the list of per-field errors so the UI can surface them. -/// Empty `Ok(Vec)` means "everything written, restart required". -#[tauri::command] -pub fn v2_apply_graphics_recommendation() -> Result, Vec> { - let environment = detect_environment(); - let recommendation = compute_recommendation(&environment); - match write_recommendation(&recommendation) { - Ok(()) => Ok(Vec::new()), - Err(errors) => Err(errors), - } -} - /// Payload for the rendering-GPU dropdown in Settings > Graphics. /// `gpus` is the full list (physical PCI devices intersected with /// available EGL vendor stacks, plus the Software fallback). diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index fabe87762..9e9adab78 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1661,7 +1661,6 @@ pub fn run(qconnect_cli_override: Option) { commands_v2::v2_set_preferred_gpu, commands_v2::v2_set_nvidia_compat_mode, commands_v2::v2_get_graphics_recommendation, - commands_v2::v2_apply_graphics_recommendation, commands_v2::v2_enumerate_gpus, commands_v2::v2_mark_boot_succeeded, commands_v2::v2_get_crash_flags, diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index 0dbe2125b..f31f82cca 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -440,10 +440,10 @@ // Graphics recommendation surfaced in the Graphics tab. Populated on // mount via v2_get_graphics_recommendation (matrix lives in - // autoconfig_graphics.rs). The banner fires only when at least one - // recommended value differs from the currently persisted setting; the - // "Apply" button writes the entire recommendation via - // v2_apply_graphics_recommendation. + // autoconfig_graphics.rs). The banner is advisory-only: it fires when + // at least one recommended value differs from the currently persisted + // setting and tells the user what to change. There is no Apply button + // by design - the user toggles the real settings manually. type GraphicsRecommendation = { environment: { display_server: string; @@ -4248,6 +4248,11 @@ } const preferredGpuOptions = $derived.by(() => { + // On a hybrid NVIDIA + iGPU host, the iGPU is the recommended pick: + // WebKit composites there and the NVIDIA card stays idle. Mark it so + // the user does not leave the dropdown on the ambiguous Auto. + const env = graphicsRecommendation?.environment; + const igpuRecommended = !!env && env.gpu_nvidia && (env.gpu_intel || env.gpu_amd); const autoTarget = autoResolvedGpuId ? detectedGpus.find((g) => g.id === autoResolvedGpuId) : null; @@ -4262,7 +4267,13 @@ for (const g of detectedGpus) { if (!g.is_usable) continue; if (g.kind === 'integrated' && !hasIntegrated) { - opts.push({ value: 'integrated', label: $t('settings.graphics.gpu.integrated', { values: { name: g.name } }) }); + const integratedLabel = $t('settings.graphics.gpu.integrated', { values: { name: g.name } }); + opts.push({ + value: 'integrated', + label: igpuRecommended + ? `${integratedLabel} ${$t('settings.graphics.gpu.recommendedSuffix')}` + : integratedLabel, + }); hasIntegrated = true; } if (g.kind === 'discrete' && !hasDiscrete) { @@ -4310,32 +4321,21 @@ return recommendationSignature(graphicsRecommendation) !== dismissedRecommendationSignature; }); - async function handleApplyGraphicsRecommendation() { - try { - const errors = await invoke('v2_apply_graphics_recommendation'); - if (errors && errors.length > 0) { - console.error('Failed to apply some graphics settings:', errors); - showToast(errors.join('; '), 'error'); - return; - } - // Refresh local state from DB so the toggles snap to the new values - const gs = await invoke('v2_get_graphics_settings'); - forceX11 = gs.force_x11; - gskRenderer = gs.gsk_renderer || ''; - hardwareAcceleration = gs.hardware_acceleration; - const ds = await invoke('v2_get_developer_settings'); - forceDmabuf = ds.force_dmabuf; - // Banner will hide naturally because diff is now false. Clear the - // dismiss flag too so the next environment change re-evaluates - // cleanly without a stale signature blocking the new banner. - dismissedRecommendationSignature = null; - removeUserItem(RECOMMENDATION_DISMISS_KEY); - showToast($t('settings.graphics.recommendation.applied'), 'success'); - } catch (err) { - console.error('Failed to apply graphics recommendation:', err); - showToast(String(err), 'error'); + // DMA-BUF help text is GPU-aware. The instability warning only + // applies to NVIDIA-only systems; non-NVIDIA and hybrid setups (the + // iGPU composites) can enable it safely. Returns an i18n key so $t() + // stays in the template, not inside $derived (CSS-extraction rule). + const forceDmabufDescKey = $derived.by(() => { + const env = graphicsRecommendation?.environment; + if (!env) return 'settings.graphics.forceDmabufDesc'; + if (env.gpu_nvidia && (env.gpu_intel || env.gpu_amd)) { + return 'settings.graphics.forceDmabufDescHybrid'; } - } + if (env.gpu_nvidia) { + return 'settings.graphics.forceDmabufDescNvidiaOnly'; + } + return 'settings.graphics.forceDmabufDescSafe'; + }); function handleDismissRecommendation() { if (!graphicsRecommendation) return; @@ -5547,9 +5547,6 @@ {/if}
- @@ -5663,7 +5660,7 @@
{$t('settings.graphics.forceDmabuf')} - {$t('settings.graphics.forceDmabufDesc')} + {$t(forceDmabufDescKey)}
handleForceDmabufChange(v)} />
@@ -7581,21 +7578,6 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz filter: brightness(1.15); } - .primary-btn { - background: var(--accent-primary, #7c3aed); - color: var(--btn-primary-text, #fff); - border: 1px solid transparent; - border-radius: 6px; - padding: 6px 14px; - font-size: 13px; - font-weight: 600; - cursor: pointer; - } - - .primary-btn:hover { - filter: brightness(1.1); - } - .secondary-btn { background: transparent; color: var(--text-secondary); diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 10026bbe2..9726dc0d5 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -2792,6 +2792,9 @@ "hardwareAccelerationDesc": "GPU-Rendering aktivieren. Deaktivieren erzwingt Software-Rendering (nur CPU). Deaktivieren bei Abstuerzen oder visuellen Artefakten.", "forceDmabuf": "DMA-BUF-Renderer erzwingen", "forceDmabufDesc": "DMA-BUF-Pufferfreigabe mit dem Compositor erzwingen. Kann die Leistung verbessern, aber auf manchen Systemen abstuerzen (besonders NVIDIA + Wayland).", + "forceDmabufDescSafe": "Aktiviert die DMA-BUF-Pufferfreigabe mit dem Compositor für flüssigeres Rendering. Auf deiner Hardware unbedenklich. Neustart erforderlich.", + "forceDmabufDescHybrid": "Deine integrierte GPU übernimmt das Rendering, daher ist DMA-BUF hier unbedenklich. Verbessert die Render-Flüssigkeit. Neustart erforderlich.", + "forceDmabufDescNvidiaOnly": "Auf reinen NVIDIA-Systemen nicht empfohlen — DMA-BUF kann Rendering-Instabilität verursachen. Neustart erforderlich.", "forceX11": "X11-Backend erzwingen (Wayland)", "forceX11Desc": "XWayland statt nativem Wayland verwenden. Empfohlen fuer NVIDIA-GPUs mit Wayland-Abstuerzen.", "gdkScale": "Anzeigeskalierung (XWayland)", @@ -2826,8 +2829,6 @@ "recommendation": { "title": "Empfohlen für dein System", "detected": "Erkannt", - "apply": "Übernehmen", - "applied": "Konfiguration übernommen. QBZ neu starten, damit es wirksam wird.", "dismiss": "Verwerfen", "redetect": "Empfohlene Einstellungen erkennen", "noChanges": "Die Einstellungen entsprechen bereits der Empfehlung für dieses System." @@ -2839,6 +2840,7 @@ "auto": "Automatisch (System-Standard)", "autoWithTarget": "Automatisch ({name})", "integrated": "Integriert — {name}", + "recommendedSuffix": "(empfohlen)", "discrete": "Dediziert — {name}", "software": "Software (CPU, llvmpipe)" }, diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index 89e003f52..2947c7ed1 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -2798,6 +2798,9 @@ "hardwareAccelerationDesc": "Enable GPU rendering. Disabling forces software rendering (CPU only). Turn off if you experience crashes or visual artifacts.", "forceDmabuf": "Force DMA-BUF Renderer", "forceDmabufDesc": "Force DMA-BUF buffer sharing with compositor. May improve performance but can crash on some systems (especially NVIDIA + Wayland).", + "forceDmabufDescSafe": "Enables DMA-BUF buffer sharing with the compositor for smoother rendering. Safe on your hardware. Restart required.", + "forceDmabufDescHybrid": "Your integrated GPU handles rendering, so DMA-BUF is safe to enable here. Improves rendering smoothness. Restart required.", + "forceDmabufDescNvidiaOnly": "Not recommended on NVIDIA-only systems — DMA-BUF can cause rendering instability. Restart required.", "forceX11": "Force X11 backend (Wayland)", "forceX11Desc": "Use XWayland instead of native Wayland. Recommended for NVIDIA GPUs that crash on Wayland.", "gdkScale": "Display scale (XWayland)", @@ -2832,8 +2835,6 @@ "recommendation": { "title": "Recommended for your system", "detected": "Detected", - "apply": "Apply", - "applied": "Configuration applied. Restart QBZ to take effect.", "dismiss": "Dismiss", "redetect": "Detect recommended settings", "noChanges": "Settings already match the recommendation for this system." @@ -2845,6 +2846,7 @@ "auto": "Auto (system default)", "autoWithTarget": "Auto ({name})", "integrated": "Integrated — {name}", + "recommendedSuffix": "(recommended)", "discrete": "Discrete — {name}", "software": "Software (CPU, llvmpipe)" }, diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 7089f4f4b..cb12b115f 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -2798,6 +2798,9 @@ "hardwareAccelerationDesc": "Habilitar renderizado GPU. Desactivar fuerza renderizado por software (solo CPU). Desactivar si experimentas crashes o artefactos visuales.", "forceDmabuf": "Forzar Renderizador DMA-BUF", "forceDmabufDesc": "Forzar comparticion de buffers DMA-BUF con el compositor. Puede mejorar rendimiento pero puede crashear en algunos sistemas (especialmente NVIDIA + Wayland).", + "forceDmabufDescSafe": "Activa el uso compartido de buffers DMA-BUF con el compositor para un render más fluido. Es seguro en tu hardware. Requiere reiniciar.", + "forceDmabufDescHybrid": "Tu GPU integrada se encarga del render, así que aquí es seguro activar DMA-BUF. Mejora la fluidez del render. Requiere reiniciar.", + "forceDmabufDescNvidiaOnly": "No se recomienda en sistemas solo con NVIDIA: DMA-BUF puede causar inestabilidad de render. Requiere reiniciar.", "forceX11": "Forzar X11 (Wayland)", "forceX11Desc": "Usar XWayland en lugar de Wayland nativo. Recomendado para GPUs NVIDIA con crashes en Wayland.", "gdkScale": "Escala de pantalla (XWayland)", @@ -2832,8 +2835,6 @@ "recommendation": { "title": "Recomendado para tu sistema", "detected": "Detectado", - "apply": "Aplicar", - "applied": "Configuracion aplicada. Reinicia QBZ para que surta efecto.", "dismiss": "Descartar", "redetect": "Detectar configuracion recomendada", "noChanges": "La configuracion actual ya coincide con la recomendacion para este sistema." @@ -2845,6 +2846,7 @@ "auto": "Auto (predeterminado del sistema)", "autoWithTarget": "Auto ({name})", "integrated": "Integrada — {name}", + "recommendedSuffix": "(recomendada)", "discrete": "Dedicada — {name}", "software": "Software (CPU, llvmpipe)" }, diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index ab6367815..1e68c688b 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -2792,6 +2792,9 @@ "hardwareAccelerationDesc": "Activer le rendu GPU. Désactiver force le rendu logiciel (CPU uniquement). Désactiver en cas de crashes ou d'artéfacts visuels.", "forceDmabuf": "Forcer le rendu DMA-BUF", "forceDmabufDesc": "Forcer le partage de tampons DMA-BUF avec le compositeur. Peut améliorer les performances mais peut planter sur certains systèmes (en particulier NVIDIA + Wayland).", + "forceDmabufDescSafe": "Active le partage de tampons DMA-BUF avec le compositeur pour un rendu plus fluide. Sans risque sur votre matériel. Redémarrage requis.", + "forceDmabufDescHybrid": "Votre GPU intégré gère le rendu, donc DMA-BUF peut être activé ici sans risque. Améliore la fluidité du rendu. Redémarrage requis.", + "forceDmabufDescNvidiaOnly": "Déconseillé sur les systèmes NVIDIA uniquement — DMA-BUF peut provoquer une instabilité du rendu. Redémarrage requis.", "forceX11": "Forcer le backend X11 (Wayland)", "forceX11Desc": "Utiliser XWayland au lieu du Wayland natif. Recommandé pour les GPU NVIDIA avec des crashes sous Wayland.", "gdkScale": "Échelle d'affichage (XWayland)", @@ -2826,8 +2829,6 @@ "recommendation": { "title": "Recommandé pour votre système", "detected": "Détecté", - "apply": "Appliquer", - "applied": "Configuration appliquée. Redémarrez QBZ pour qu'elle prenne effet.", "dismiss": "Ignorer", "redetect": "Détecter les paramètres recommandés", "noChanges": "Les paramètres correspondent déjà à la recommandation pour ce système." @@ -2839,6 +2840,7 @@ "auto": "Auto (par défaut)", "autoWithTarget": "Auto ({name})", "integrated": "Intégré — {name}", + "recommendedSuffix": "(recommandé)", "discrete": "Dédié — {name}", "software": "Logiciel (CPU, llvmpipe)" }, diff --git a/src/lib/i18n/locales/pt.json b/src/lib/i18n/locales/pt.json index 9db6865f1..86347b6c4 100644 --- a/src/lib/i18n/locales/pt.json +++ b/src/lib/i18n/locales/pt.json @@ -2792,6 +2792,9 @@ "hardwareAccelerationDesc": "Ativar renderização por GPU. Desativar força renderização por software (apenas CPU). Desative se tiver travamentos ou artefatos visuais.", "forceDmabuf": "Forçar Renderizador DMA-BUF", "forceDmabufDesc": "Forçar compartilhamento de buffer DMA-BUF com o compositor. Pode melhorar o desempenho, mas pode travar em alguns sistemas (especialmente NVIDIA + Wayland).", + "forceDmabufDescSafe": "Ativa o compartilhamento de buffers DMA-BUF com o compositor para uma renderização mais fluida. Seguro no seu hardware. Reinício necessário.", + "forceDmabufDescHybrid": "Sua GPU integrada faz a renderização, então é seguro ativar o DMA-BUF aqui. Melhora a fluidez da renderização. Reinício necessário.", + "forceDmabufDescNvidiaOnly": "Não recomendado em sistemas apenas com NVIDIA — o DMA-BUF pode causar instabilidade de renderização. Reinício necessário.", "forceX11": "Forçar backend X11 (Wayland)", "forceX11Desc": "Usar XWayland em vez do Wayland nativo. Recomendado para GPUs NVIDIA que travam no Wayland.", "gdkScale": "Escala de exibição (XWayland)", @@ -2826,8 +2829,6 @@ "recommendation": { "title": "Recomendado para o seu sistema", "detected": "Detectado", - "apply": "Aplicar", - "applied": "Configuracao aplicada. Reinicie o QBZ para que tenha efeito.", "dismiss": "Descartar", "redetect": "Detectar configuracoes recomendadas", "noChanges": "As configuracoes ja correspondem a recomendacao para este sistema." @@ -2839,6 +2840,7 @@ "auto": "Auto (padrao do sistema)", "autoWithTarget": "Auto ({name})", "integrated": "Integrada — {name}", + "recommendedSuffix": "(recomendada)", "discrete": "Dedicada — {name}", "software": "Software (CPU, llvmpipe)" }, From 3abb7f66cb7a71e545e2b46c0a88702dca755295 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sat, 16 May 2026 13:53:17 -0600 Subject: [PATCH 3/3] fix(playback): gate within-track resume on cache, drop slow seek path Session resume of a Qobuz track no longer forces the streaming start-position path, which buffered the CMAF stream sequentially from byte 0 up to the saved offset (up to ~30s wait, with no buffering indication). v2_play_track is now always called without a start position. The track resumes at the saved offset only on a cache hit (format_id === null), where the audio is a full in-memory buffer and Seek lands like a local file. On a cache miss it starts from 0:00 instead of blocking on a sequential buffer fill. No backend or audio-engine change; the start_position_secs streaming path is now unused. cc --- src/lib/services/commandRouter.ts | 8 +++---- src/lib/stores/playerStore.ts | 40 +++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/lib/services/commandRouter.ts b/src/lib/services/commandRouter.ts index c6bf21602..23b377fcd 100644 --- a/src/lib/services/commandRouter.ts +++ b/src/lib/services/commandRouter.ts @@ -116,10 +116,10 @@ export async function cmdPlayTrack( // start_position_secs). duration_secs is required on the streaming // path — without it the backend stores duration=0 and // current_position() clamps to 0, freezing the seekbar (seen on - // session-restore first play). start_position_secs > 0 turns the - // call into a session-resume play (#315): backend buffers enough - // bytes to cover the offset and pre-skips decoder output before - // engaging audio, avoiding the play-then-seek race. + // session-restore first play). start_position_secs is still accepted + // by the backend but the frontend no longer uses it: session resume + // now seeks to the saved offset only on a cache hit, where the audio + // is fully in memory and Seek lands (see playerStore togglePlay). return invoke('v2_play_track', { trackId, quality: quality ?? null, diff --git a/src/lib/stores/playerStore.ts b/src/lib/stores/playerStore.ts index 05b1e805e..381fa5ecd 100644 --- a/src/lib/stores/playerStore.ts +++ b/src/lib/stores/playerStore.ts @@ -559,25 +559,39 @@ export async function togglePlay(): Promise { void flushPendingSeek(); } } else { - // Qobuz track — use v2_play_track. Pass duration so the + // Qobuz track session restore (#315 within-track resume). + // Play from the start: v2_play_track serves a cache hit + // instantly or streams from byte 0. Pass duration so the // streaming backend's current_position() doesn't clamp to 0 // (the value flows into thread_state.duration and seekbar - // progress is capped by .min(duration)). For session resume, - // hand the restore offset directly to v2_play_track via - // startPositionSecs (#315 extension): the streaming path - // waits for enough buffer to cover the offset and pre-skips - // decoder output before engaging audio, instead of the - // play-then-seek dance that silently dropped the seek - // because the audio thread's Seek handler bails when there - // is no `current_audio_data` (streaming uses - // `current_streaming_source` instead). - await cmdPlayTrack( + // progress is capped by .min(duration)). + // + // Resume the saved offset ONLY on a cache hit (format_id === + // null): the audio is then a full in-memory buffer + // (current_audio_data) so the Seek handler lands, exactly + // like a local file. On a cache miss the track streams via + // CMAF — seeking mid-track would block on the buffer filling + // sequentially from byte 0, far too slow to feel like a + // feature, so we deliberately start fresh from 0:00. + const result = (await cmdPlayTrack( currentTrack.id, getStreamingQuality(), currentTrack.duration ? Math.round(currentTrack.duration) : null, null, - restorePosition > 1 ? restorePosition : null, - ); + null, + )) as { format_id?: number | null } | null | undefined; + const servedFromCache = result != null && result.format_id === null; + if (restorePosition > 1 && servedFromCache) { + pendingSeekPosition = restorePosition; + void flushPendingSeek(); + } else if (restorePosition > 1) { + // Cache miss — undo the seekbar pre-anchor (setPendingSessionRestore + // pre-set currentTime to the saved offset) so the bar matches + // the actual start at 0:00 instead of flashing the saved time. + currentTime = 0; + anchorPosition(0); + notifyListeners(); + } } } else {