perf(linux): cut OpenGL RSS via isolated auth/Vulkan helpers, malloc_trim, 1024 atlas (v0.1.3)

This commit is contained in:
marwy 2026-11-27 17:25:15 +03:00
parent 19ceef9f74
commit 0b2561503f
9 changed files with 175 additions and 23 deletions

View file

@ -451,13 +451,9 @@ mod imp {
mod imp {
use super::NativeEvent;
use crate::api::models::Track;
use crate::api::signing::extract_oauth_token;
use crate::api::YANDEX_OAUTH_URL;
use gtk::prelude::*;
use std::io::{BufRead, BufReader, Write};
use std::io::{BufRead, BufReader};
use std::process::{Command, Stdio};
use winit::window::Window;
use wry::{WebViewBuilder, WebViewBuilderExtUnix};
const OAUTH_TOKEN_PREFIX: &str = "YM_OAUTH_TOKEN:";
@ -480,8 +476,17 @@ mod imp {
winit::window::Icon::from_rgba(img.into_raw(), w, h).ok()
}
/// Entry point for the short-lived `--auth-webview` subprocess on Linux (GTK3 + WebKitGTK).
/// Entry point for the short-lived `yandex-music-auth` subprocess on Linux (GTK3 + WebKitGTK).
/// Compiled ONLY when `--features linux-webview` is enabled so the main player binary has
/// zero `libwebkit2gtk` / `libjavascriptcoregtk` / `libgtk-3` DT_NEEDED dependencies!
#[cfg(feature = "linux-webview")]
pub fn run_auth_webview_subprocess() {
use crate::api::signing::extract_oauth_token;
use crate::api::YANDEX_OAUTH_URL;
use gtk::prelude::*;
use std::io::Write;
use wry::{WebViewBuilder, WebViewBuilderExtUnix};
// Avoid blank WebKitGTK window on NVIDIA/Wayland/VM drivers during OAuth login.
if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() {
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
@ -554,14 +559,38 @@ mod imp {
gtk::main();
}
/// Spawn the isolated `--auth-webview` subprocess and return the captured OAuth token.
#[cfg(not(feature = "linux-webview"))]
pub fn run_auth_webview_subprocess() {
eprintln!("yandex-music-auth helper required");
std::process::exit(2);
}
/// Spawn the isolated `yandex-music-auth` helper binary (or `--auth-webview` if built with
/// `linux-webview`) and return the captured OAuth token.
pub fn spawn_auth_webview_subprocess() -> anyhow::Result<String> {
let exe = std::env::current_exe()?;
let mut child = Command::new(exe)
.arg("--auth-webview")
let sibling_helper = exe.with_file_name("yandex-music-auth");
let mut child = if sibling_helper.is_file() {
Command::new(&sibling_helper)
.stdout(Stdio::piped())
.stderr(Stdio::null())
.spawn()?
} else if let Ok(c) = Command::new("yandex-music-auth")
.stdout(Stdio::piped())
.stderr(Stdio::null())
.spawn()?;
.spawn()
{
c
} else if cfg!(feature = "linux-webview") {
Command::new(&exe)
.arg("--auth-webview")
.stdout(Stdio::piped())
.stderr(Stdio::null())
.spawn()?
} else {
anyhow::bail!("WebKitGTK auth helper (yandex-music-auth) unavailable");
};
let stdout = child
.stdout