Merge pull request #442 from dragonnn/fix-use_mode

Fix use_mode when trying to apply higher resolution then the current one
This commit is contained in:
Victoria Brekenfeld 2021-12-23 22:04:35 +01:00 committed by GitHub
commit 35c9e02b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -354,7 +354,7 @@ impl<A: AsRawFd + 'static> AtomicDrmSurface<A> {
source, source,
})?; })?;
let test_fb = self.create_test_buffer(pending.mode.size())?; let test_fb = self.create_test_buffer(mode.size())?;
let req = self.build_request( let req = self.build_request(
&mut pending.connectors.iter(), &mut pending.connectors.iter(),
&mut [].iter(), &mut [].iter(),

View File

@ -309,8 +309,11 @@ where
/// Fails if the mode is not compatible with the underlying /// Fails if the mode is not compatible with the underlying
/// [`crtc`](drm::control::crtc) or any of the /// [`crtc`](drm::control::crtc) or any of the
/// pending [`connector`](drm::control::connector)s. /// pending [`connector`](drm::control::connector)s.
pub fn use_mode(&self, mode: Mode) -> Result<(), Error> { pub fn use_mode(&mut self, mode: Mode) -> Result<(), Error> {
self.drm.use_mode(mode).map_err(Error::DrmError) self.drm.use_mode(mode).map_err(Error::DrmError)?;
let (w, h) = mode.size();
self.swapchain.resize(w as _, h as _);
Ok(())
} }
} }