fallback: Allow forcing legacy modeset via env-variable

This commit is contained in:
Victor Brekenfeld 2020-04-26 22:43:55 +02:00
parent 5fb73a497e
commit 8a040630a0
1 changed files with 14 additions and 1 deletions

View File

@ -23,6 +23,7 @@ use drm::{
use nix::libc::c_void; use nix::libc::c_void;
use nix::libc::dev_t; use nix::libc::dev_t;
use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::io::{AsRawFd, RawFd};
use std::env;
#[cfg(feature = "use_system_lib")] #[cfg(feature = "use_system_lib")]
use wayland_server::Display; use wayland_server::Display;
@ -173,11 +174,23 @@ impl<A: AsRawFd + Clone + 'static> FallbackDevice<AtomicDrmDevice<A>, LegacyDrmD
let log = crate::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_drm_fallback")); let log = crate::slog_or_stdlog(logger).new(o!("smithay_module" => "backend_drm_fallback"));
info!(log, "Trying to initialize AtomicDrmDevice"); info!(log, "Trying to initialize AtomicDrmDevice");
if env::var("SMITHAY_USE_LEGACY")
.map(|x|
x == "1"
|| x.to_lowercase() == "true"
|| x.to_lowercase() == "yes"
|| x.to_lowercase() == "y"
).unwrap_or(false)
{
info!(log, "SMITHAY_USE_LEGACY is set. Forcing LegacyDrmDevice.");
return Ok(FallbackDevice::Fallback(LegacyDrmDevice::new(fd, disable_connectors, log)?));
}
match AtomicDrmDevice::new(fd.clone(), disable_connectors, log.clone()) { match AtomicDrmDevice::new(fd.clone(), disable_connectors, log.clone()) {
Ok(dev) => Ok(FallbackDevice::Preference(dev)), Ok(dev) => Ok(FallbackDevice::Preference(dev)),
Err(err) => { Err(err) => {
error!(log, "Failed to initialize preferred AtomicDrmDevice: {}", err); error!(log, "Failed to initialize preferred AtomicDrmDevice: {}", err);
info!(log, "Falling back to fallback LegacyyDrmDevice"); info!(log, "Falling back to fallback LegacyDrmDevice");
Ok(FallbackDevice::Fallback(LegacyDrmDevice::new(fd, disable_connectors, log)?)) Ok(FallbackDevice::Fallback(LegacyDrmDevice::new(fd, disable_connectors, log)?))
} }
} }