gbm: only clear recreation state on successful commits

This commit is contained in:
Victor Brekenfeld 2020-05-03 18:00:24 +02:00
parent a6863af496
commit 44ebed3446
1 changed files with 8 additions and 3 deletions

View File

@ -74,11 +74,15 @@ impl<D: RawDevice + 'static> GbmSurfaceInternal<D> {
}; };
self.next_buffer.set(Some(next_bo)); self.next_buffer.set(Some(next_bo));
if cfg!(debug_assertions) {
if let Err(err) = self.crtc.get_framebuffer(fb) {
error!(self.logger, "Cached framebuffer invalid: {:?}: {}", fb, err);
}
}
let result = if self.recreated.get() { let result = if self.recreated.get() {
debug!(self.logger, "Commiting new state"); debug!(self.logger, "Commiting new state");
let res = self.crtc.commit(fb).map_err(Error::Underlying); self.crtc.commit(fb).map_err(Error::Underlying)
self.recreated.set(false);
res
} else { } else {
trace!(self.logger, "Queueing Page flip"); trace!(self.logger, "Queueing Page flip");
RawSurface::page_flip(&self.crtc, fb).map_err(Error::Underlying) RawSurface::page_flip(&self.crtc, fb).map_err(Error::Underlying)
@ -86,6 +90,7 @@ impl<D: RawDevice + 'static> GbmSurfaceInternal<D> {
match result { match result {
Ok(_) => { Ok(_) => {
self.recreated.set(false);
self.current_frame_buffer.set(Some(fb)); self.current_frame_buffer.set(Some(fb));
Ok(()) Ok(())
}, },