Skip to content

Commit

Permalink
Merge pull request #168 from mahkoh/jorth/various-fixes
Browse files Browse the repository at this point in the history
metal: discard presentation feedback when presentation fails
  • Loading branch information
mahkoh authored Apr 17, 2024
2 parents db81300 + 57bd050 commit 9a7e6c2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Add support for virtual-keyboard-unstable-v1.
- Add support for zwp_input_method_manager_v2.
- Add support for zwp_text_input_manager_v3.
- Add support for push-to-talk.
- Various bugfixes.

# 1.0.3 (2024-04-11)

Expand Down
11 changes: 7 additions & 4 deletions src/backends/metal/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,9 @@ impl MetalConnector {
if let Err(e) = changes.commit(DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT, 0) {
if let DrmError::Atomic(OsError(c::EACCES)) = e {
log::debug!("Could not perform atomic commit, likely because we're no longer the DRM master");
self.render_result
.borrow_mut()
.discard_presentation_feedback();
return Ok(());
}
if let Some(fb) = &new_fb {
Expand All @@ -784,6 +787,9 @@ impl MetalConnector {
}
}
}
self.render_result
.borrow_mut()
.discard_presentation_feedback();
Err(MetalError::Commit(e))
} else {
if let Some(fb) = new_fb {
Expand Down Expand Up @@ -1792,10 +1798,7 @@ impl MetalBackend {
let _ = fb.client.remove_obj(&*fb);
}
} else {
for fb in rr.presentation_feedbacks.drain(..) {
fb.send_discarded();
let _ = fb.client.remove_obj(&*fb);
}
rr.discard_presentation_feedback();
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/ifs/wl_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,9 @@ impl WlSurface {
let children = self.children.borrow_mut();
if let Some(children) = children.deref() {
for child in children.subsurfaces.values() {
child.surface.set_visible(visible);
if child.surface.buffer.is_some() {
child.surface.set_visible(visible);
}
}
}
if !visible {
Expand Down
7 changes: 7 additions & 0 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ impl RenderResult {
let _ = fr.client.remove_obj(&*fr);
}
}

pub fn discard_presentation_feedback(&mut self) {
for fb in self.presentation_feedbacks.drain(..) {
fb.send_discarded();
let _ = fb.client.remove_obj(&*fb);
}
}
}

impl Debug for RenderResult {
Expand Down

0 comments on commit 9a7e6c2

Please sign in to comment.