gbm: do not block buffer forever if commit/page_flip fails

This commit is contained in:
Victor Brekenfeld 2020-05-03 16:53:44 +02:00
parent 0a716438e3
commit 64fc1aa0da
1 changed files with 15 additions and 7 deletions

View File

@ -74,18 +74,26 @@ impl<D: RawDevice + 'static> GbmSurfaceInternal<D> {
}; };
self.next_buffer.set(Some(next_bo)); self.next_buffer.set(Some(next_bo));
if self.recreated.get() { let result = if self.recreated.get() {
debug!(self.logger, "Commiting new state"); debug!(self.logger, "Commiting new state");
self.crtc.commit(fb).map_err(Error::Underlying)?; let res = self.crtc.commit(fb).map_err(Error::Underlying);
self.recreated.set(false); 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)
};
match result {
Ok(_) => {
self.current_frame_buffer.set(Some(fb));
Ok(())
},
Err(err) => {
self.unlock_buffer();
Err(err)
}
} }
self.current_frame_buffer.set(Some(fb));
Ok(())
} }
pub fn recreate(&self) -> Result<(), Error<<<D as Device>::Surface as Surface>::Error>> { pub fn recreate(&self) -> Result<(), Error<<<D as Device>::Surface as Surface>::Error>> {