diff --git a/Cargo.toml b/Cargo.toml index 4b3a592..886c4dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,9 +25,9 @@ cgmath = "0.18.0" dbus = { version = "0.9.0", optional = true } downcast-rs = "1.2.0" drm-fourcc = "^2.1.1" -drm = { version = "0.5.0", optional = true } -drm-ffi = { version = "0.2.0", optional = true } -gbm = { version = "0.7.0", optional = true, default-features = false, features = ["drm-support"] } +drm = { version = "0.6.1", optional = true } +drm-ffi = { version = "0.2.1", optional = true } +gbm = { version = "0.8.0", optional = true, default-features = false, features = ["drm-support"] } input = { version = "0.7", default-features = false, features=["libinput_1_14"], optional = true } indexmap = { version = "1.7", optional = true } lazy_static = "1" diff --git a/src/backend/drm/device/atomic.rs b/src/backend/drm/device/atomic.rs index 24ab6bb..9763d27 100644 --- a/src/backend/drm/device/atomic.rs +++ b/src/backend/drm/device/atomic.rs @@ -242,7 +242,7 @@ impl AtomicDrmDevice { req.add_property(*crtc, *mode_prop, property::Value::Unknown(0)); } self.fd - .atomic_commit(&[AtomicCommitFlags::AllowModeset], req) + .atomic_commit(AtomicCommitFlags::ALLOW_MODESET, req) .map_err(|source| Error::Access { errmsg: "Failed to disable connectors", dev: self.fd.dev_path(), @@ -282,7 +282,7 @@ impl Drop for AtomicDrmDevice { add_multiple_props(&mut req, &self.old_state.2); add_multiple_props(&mut req, &self.old_state.3); - if let Err(err) = self.fd.atomic_commit(&[AtomicCommitFlags::AllowModeset], req) { + if let Err(err) = self.fd.atomic_commit(AtomicCommitFlags::ALLOW_MODESET, req) { error!(self.logger, "Failed to restore previous state. Error: {}", err); } } diff --git a/src/backend/drm/surface/atomic.rs b/src/backend/drm/surface/atomic.rs index f381b20..6c17408 100644 --- a/src/backend/drm/surface/atomic.rs +++ b/src/backend/drm/surface/atomic.rs @@ -249,7 +249,7 @@ impl AtomicDrmSurface { )?; self.fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .map_err(|_| Error::TestFailed(self.crtc))?; @@ -287,7 +287,7 @@ impl AtomicDrmSurface { )?; self.fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .map_err(|_| Error::TestFailed(self.crtc))?; @@ -327,7 +327,7 @@ impl AtomicDrmSurface { self.fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .map_err(|_| Error::TestFailed(self.crtc))?; @@ -367,7 +367,7 @@ impl AtomicDrmSurface { if let Err(err) = self .fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .map_err(|_| Error::TestFailed(self.crtc)) @@ -428,7 +428,7 @@ impl AtomicDrmSurface { )?; self.fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .map_err(|_| Error::TestFailed(self.crtc))?; @@ -502,7 +502,7 @@ impl AtomicDrmSurface { if let Err(err) = self .fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req.clone(), ) .map_err(|_| Error::TestFailed(self.crtc)) @@ -530,21 +530,18 @@ impl AtomicDrmSurface { .fd .atomic_commit( if event { - &[ - // on the atomic api we can modeset and trigger a page_flip event on the same call! - AtomicCommitFlags::PageFlipEvent, - AtomicCommitFlags::AllowModeset, - // we also *should* not need to wait for completion, like with `set_crtc`, - // because we have tested this exact commit already, so we do not expect any errors later down the line. - // - // but there is always an exception and `amdgpu` can fail in interesting ways with this flag set... - // https://gitlab.freedesktop.org/drm/amd/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=drm_atomic_helper_wait_for_flip_done - // - // so we skip this flag: - // AtomicCommitFlags::Nonblock, - ] + // on the atomic api we can modeset and trigger a page_flip event on the same call! + AtomicCommitFlags::PAGE_FLIP_EVENT | AtomicCommitFlags::ALLOW_MODESET + // we also *should* not need to wait for completion, like with `set_crtc`, + // because we have tested this exact commit already, so we do not expect any errors later down the line. + // + // but there is always an exception and `amdgpu` can fail in interesting ways with this flag set... + // https://gitlab.freedesktop.org/drm/amd/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=drm_atomic_helper_wait_for_flip_done + // + // so we skip this flag: + // AtomicCommitFlags::Nonblock, } else { - &[AtomicCommitFlags::AllowModeset] + AtomicCommitFlags::ALLOW_MODESET }, req, ) @@ -588,9 +585,9 @@ impl AtomicDrmSurface { self.fd .atomic_commit( if event { - &[AtomicCommitFlags::PageFlipEvent, AtomicCommitFlags::Nonblock] + AtomicCommitFlags::PAGE_FLIP_EVENT | AtomicCommitFlags::NONBLOCK } else { - &[AtomicCommitFlags::Nonblock] + AtomicCommitFlags::NONBLOCK }, req, ) @@ -638,7 +635,7 @@ impl AtomicDrmSurface { let result = self .fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .is_ok(); @@ -676,7 +673,7 @@ impl AtomicDrmSurface { let result = self .fd .atomic_commit( - &[AtomicCommitFlags::AllowModeset, AtomicCommitFlags::TestOnly], + AtomicCommitFlags::ALLOW_MODESET | AtomicCommitFlags::TEST_ONLY, req, ) .is_ok(); @@ -937,7 +934,7 @@ impl AtomicDrmSurface { let result = self .fd - .atomic_commit(&[AtomicCommitFlags::Nonblock], req) + .atomic_commit(AtomicCommitFlags::NONBLOCK, req) .map_err(|source| Error::Access { errmsg: "Failed to commit on clear_plane", dev: self.fd.dev_path(), @@ -1029,7 +1026,7 @@ impl Drop for AtomicDrmSurface { req.add_property(self.crtc, *active_prop, property::Value::Boolean(false)); req.add_property(self.crtc, *mode_prop, property::Value::Unknown(0)); - if let Err(err) = self.fd.atomic_commit(&[AtomicCommitFlags::AllowModeset], req) { + if let Err(err) = self.fd.atomic_commit(AtomicCommitFlags::ALLOW_MODESET, req) { warn!(self.logger, "Unable to disable connectors: {}", err); } } diff --git a/src/backend/drm/surface/legacy.rs b/src/backend/drm/surface/legacy.rs index fcf37ce..abfd2bb 100644 --- a/src/backend/drm/surface/legacy.rs +++ b/src/backend/drm/surface/legacy.rs @@ -289,18 +289,13 @@ impl LegacyDrmSurface { // this will result in wasting a frame, because this flip will need to wait // for `set_crtc`, but is necessary to drive the event loop and thus provide // a more consistent api. - ControlDevice::page_flip( - &*self.fd, - self.crtc, - framebuffer, - &[PageFlipFlags::PageFlipEvent], - None, - ) - .map_err(|source| Error::Access { - errmsg: "Failed to queue page flip", - dev: self.fd.dev_path(), - source, - })?; + ControlDevice::page_flip(&*self.fd, self.crtc, framebuffer, PageFlipFlags::EVENT, None).map_err( + |source| Error::Access { + errmsg: "Failed to queue page flip", + dev: self.fd.dev_path(), + source, + }, + )?; } Ok(()) @@ -318,9 +313,9 @@ impl LegacyDrmSurface { self.crtc, framebuffer, if event { - &[PageFlipFlags::PageFlipEvent] + PageFlipFlags::EVENT } else { - &[] + PageFlipFlags::empty() }, None, )