diff --git a/Cargo.lock b/Cargo.lock index efb8899..33d25c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1889,14 +1889,6 @@ dependencies = [ name = "softbuffer" version = "0.4.1" -[[patch.unused]] -name = "cosmic-freedesktop-icons" -version = "0.4.0" - -[[patch.unused]] -name = "smithay-clipboard" -version = "0.8.0" - [[patch.unused]] name = "dpi" version = "0.1.2" @@ -1944,3 +1936,11 @@ version = "0.31.0-beta.2" [[patch.unused]] name = "winit-x11" version = "0.31.0-beta.2" + +[[patch.unused]] +name = "cosmic-freedesktop-icons" +version = "0.4.0" + +[[patch.unused]] +name = "smithay-clipboard" +version = "0.8.0" diff --git a/src/comp.rs b/src/comp.rs index 8457d08..47ec37c 100644 --- a/src/comp.rs +++ b/src/comp.rs @@ -122,12 +122,21 @@ pub fn run_compositor( Ok(tokio::spawn(async move { // Create a new process handler for cosmic-comp, with our compositor socket's // file descriptor as the `COSMIC_SESSION_SOCK` environment variable. + let mut comp_env = vec![( + "COSMIC_SESSION_SOCK".to_string(), + comp.as_raw_fd().to_string(), + )]; + // NVIDIA keeps a growing pool of pre-rendered compositor frames + // (smithay#1562 / cosmic-comp#1179). Cap it to a single buffer. + if std::path::Path::new("/proc/driver/nvidia").exists() { + comp_env.push(("__GL_MaxFramesAllowed".to_string(), "1".to_string())); + } process_manager .start_process( Process::new() .with_executable(exec) .with_args(args) - .with_env([("COSMIC_SESSION_SOCK", comp.as_raw_fd().to_string())]) + .with_env(comp_env) .with_on_exit(move |pman, _, err_code, _will_restart| { let session_dbus_tx = session_dbus_tx.clone(); async move {