Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,5 @@ cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch
cosmic-client-toolkit = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }

[patch.crates-io]
smithay = { git = "https://github.com/smithay/smithay.git", rev = "8148d67" }
# smithay = { git = "https://github.com/smithay/smithay.git", rev = "8148d67" }
smithay = { git = "https://github.com/ids1024/smithay", branch = "dpms" }
46 changes: 28 additions & 18 deletions src/backend/kms/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,29 +655,39 @@ impl LockedDevice<'_> {
.surfaces
.iter()
.filter(|(_, s)| s.is_active())
.map(|(crtc, surface)| (*crtc, surface.output.clone()))
.map(|(crtc, surface)| (*crtc, (surface.output.clone(), surface.get_dpms())))
.collect::<HashMap<_, _>>();

for (crtc, compositor) in self.drm.compositors().iter() {
let elements = match output_map.get(crtc) {
Some(output) => output_elements(
Some(&self.inner.render_node),
renderer,
shell,
now,
output,
CursorMode::All,
None,
)
.with_context(|| "Failed to render outputs")?,
None => Vec::new(),
let (elements, dpms) = match output_map.get(crtc) {
Some((output, dpms)) => (
output_elements(
Some(&self.inner.render_node),
renderer,
shell,
now,
output,
CursorMode::All,
None,
)
.with_context(|| "Failed to render outputs")?,
*dpms,
),
None => (Vec::new(), true),
};

let mut compositor = compositor.lock().unwrap();
compositor.render_frame(renderer, &elements, CLEAR_COLOR, FrameFlags::empty())?;
if let Err(err) = compositor.commit_frame() {
if !matches!(err, FrameError::EmptyFrame) {
return Err(err.into());
if dpms {
let mut compositor = compositor.lock().unwrap();
compositor.render_frame(
renderer,
&elements,
CLEAR_COLOR,
FrameFlags::empty(),
)?;
if let Err(err) = compositor.commit_frame() {
if !matches!(err, FrameError::EmptyFrame) {
return Err(err.into());
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/kms/surface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ impl Surface {
.send(ThreadCommand::Resume { compositor });
}

pub fn get_dpms(&mut self) -> bool {
pub fn get_dpms(&self) -> bool {
self.dpms
}

Expand Down