Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metal: discard presentation feedback when presentation fails #168

Merged
merged 3 commits into from
Apr 17, 2024
Merged
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
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
Loading