fixed nvidia issues fallback to software rendering, removed accidentally made readme file in src/, added gtk to cargo lock
This commit is contained in:
parent
07ed5063cd
commit
d6b604639d
4 changed files with 89 additions and 183 deletions
|
|
@ -119,7 +119,7 @@ struct DownloadEntry {
|
|||
updated_at: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum WebViewHostMode {
|
||||
Child,
|
||||
|
|
@ -737,8 +737,10 @@ pub fn launch_webkit(args: &Cli) -> Result<()> {
|
|||
.unwrap_or_else(|| "RustyWolf".to_string());
|
||||
|
||||
if args.dry_run {
|
||||
let effective_dmabuf =
|
||||
std::env::var("WEBKIT_DISABLE_DMABUF_RENDERER").unwrap_or_else(|_| "0".to_string());
|
||||
println!(
|
||||
"engine=webkit url={start_url} private={} linux_backend={:?} linux_disable_dmabuf={}",
|
||||
"engine=webkit url={start_url} private={} linux_backend={:?} linux_disable_dmabuf={} effective_webkit_disable_dmabuf={effective_dmabuf}",
|
||||
args.private, args.linux_backend, args.linux_disable_dmabuf
|
||||
);
|
||||
return Ok(());
|
||||
|
|
@ -847,15 +849,65 @@ fn apply_linux_runtime_overrides(_args: &Cli) {
|
|||
},
|
||||
}
|
||||
|
||||
if _args.linux_disable_dmabuf {
|
||||
if should_disable_webkit_dmabuf(_args) {
|
||||
// WebKitGTK + NVIDIA can fail with dmabuf/gbm allocation on some systems.
|
||||
unsafe {
|
||||
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() {
|
||||
unsafe {
|
||||
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
}
|
||||
|
||||
if !_args.linux_disable_dmabuf {
|
||||
eprintln!(
|
||||
"Detected NVIDIA X11 WebKitGTK; disabled broken dmabuf renderer. Media codecs remain enabled."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn should_disable_webkit_dmabuf(args: &Cli) -> bool {
|
||||
if args.linux_disable_dmabuf {
|
||||
return true;
|
||||
}
|
||||
|
||||
if std::env::var("WEBKIT_FORCE_DMABUF_RENDERER")
|
||||
.ok()
|
||||
.as_deref()
|
||||
== Some("1")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
is_linux_x11_session() && is_linux_nvidia_graphics()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn is_linux_x11_session() -> bool {
|
||||
std::env::var("XDG_SESSION_TYPE")
|
||||
.map(|value| value.eq_ignore_ascii_case("x11"))
|
||||
.unwrap_or(false)
|
||||
|| (std::env::var_os("DISPLAY").is_some() && std::env::var_os("WAYLAND_DISPLAY").is_none())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn is_linux_nvidia_graphics() -> bool {
|
||||
env_value_contains("__GLX_VENDOR_LIBRARY_NAME", "nvidia")
|
||||
|| env_value_contains("GBM_BACKEND", "nvidia")
|
||||
|| env_value_contains("__NV_PRIME_RENDER_OFFLOAD", "1")
|
||||
|| Path::new("/proc/driver/nvidia/version").exists()
|
||||
|| Path::new("/sys/module/nvidia/version").exists()
|
||||
|| Path::new("/dev/nvidiactl").exists()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn env_value_contains(name: &str, needle: &str) -> bool {
|
||||
std::env::var(name)
|
||||
.map(|value| value.to_ascii_lowercase().contains(needle))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn sanitize_gtk_modules_env() {
|
||||
fn is_appmenu_module(token: &str) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue