metal: discard presentation feedback when presentation fails
This commit is contained in:
parent
db81300d02
commit
9acbea1389
2 changed files with 14 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
@ -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 {
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue