atomic: do not set current state if commit fails

This commit is contained in:
Victor Brekenfeld 2020-05-03 17:55:08 +02:00
parent f3dabe2cea
commit b4cbecd369
1 changed files with 7 additions and 4 deletions

View File

@ -528,7 +528,6 @@ impl<A: AsRawFd + 'static> RawSurface for AtomicDrmSurfaceInternal<A> {
warn!(self.logger, "Failed to destory old mode property blob: {}", err); warn!(self.logger, "Failed to destory old mode property blob: {}", err);
} }
} }
*current = pending.clone();
// new config // new config
req req
@ -536,7 +535,7 @@ impl<A: AsRawFd + 'static> RawSurface for AtomicDrmSurfaceInternal<A> {
}; };
debug!(self.logger, "Setting screen: {:?}", req); debug!(self.logger, "Setting screen: {:?}", req);
self.atomic_commit( let result = self.atomic_commit(
&[ &[
AtomicCommitFlags::PageFlipEvent, AtomicCommitFlags::PageFlipEvent,
AtomicCommitFlags::AllowModeset, AtomicCommitFlags::AllowModeset,
@ -549,9 +548,13 @@ impl<A: AsRawFd + 'static> RawSurface for AtomicDrmSurfaceInternal<A> {
errmsg: "Error setting crtc", errmsg: "Error setting crtc",
dev: self.dev_path(), dev: self.dev_path(),
source, source,
})?; });
Ok(()) if result.is_ok() {
*current = pending.clone();
}
result
} }
fn page_flip(&self, framebuffer: framebuffer::Handle) -> Result<(), Error> { fn page_flip(&self, framebuffer: framebuffer::Handle) -> Result<(), Error> {