drm_lease: Disable overlay planes when active

This commit is contained in:
Victoria Brekenfeld 2025-01-02 17:39:16 +01:00 committed by Victoria Brekenfeld
parent 8b87d6524e
commit 546966bf15
3 changed files with 120 additions and 4 deletions

View file

@ -423,6 +423,14 @@ impl Surface {
Ok(true)
}
pub fn allow_overlay_scanout(&mut self, flag: bool) {
let (tx, rx) = std::sync::mpsc::sync_channel(1);
let _ = self
.thread_command
.send(ThreadCommand::AllowOverlayScanout(flag, tx));
let _ = rx.recv();
}
pub fn suspend(&mut self) {
let (tx, rx) = std::sync::mpsc::sync_channel(1);
let _ = self.thread_command.send(ThreadCommand::Suspend(tx));
@ -607,6 +615,23 @@ fn surface_thread(
};
}
}
Event::Msg(ThreadCommand::AllowOverlayScanout(flag, tx)) => {
if !crate::utils::env::bool_var("COSMIC_DISABLE_DIRECT_SCANOUT").unwrap_or(false)
&& !crate::utils::env::bool_var("COSMIC_DISABLE_OVERLAY_SCANOUT")
.unwrap_or(false)
{
if flag {
state
.frame_flags
.insert(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);
} else {
state
.frame_flags
.remove(FrameFlags::ALLOW_OVERLAY_PLANE_SCANOUT);
}
}
let _ = tx.send(());
}
Event::Closed | Event::Msg(ThreadCommand::End) => {
signal.stop();
signal.wakeup();