anvil: use fallback-device for atomic/legacy

This commit is contained in:
Victor Brekenfeld 2020-04-19 22:54:38 +02:00
parent df951b5de7
commit 24a51f721d
2 changed files with 12 additions and 11 deletions

View File

@ -29,5 +29,5 @@ gl_generator = "0.14"
default = [ "winit", "egl", "udev", "logind" ] default = [ "winit", "egl", "udev", "logind" ]
egl = [ "smithay/use_system_lib" ] egl = [ "smithay/use_system_lib" ]
winit = [ "smithay/backend_winit" ] winit = [ "smithay/backend_winit" ]
udev = [ "smithay/backend_libinput", "smithay/backend_udev", "smithay/backend_drm_atomic", "smithay/backend_drm_gbm", "smithay/backend_drm_egl", "smithay/backend_session", "input" ] udev = [ "smithay/backend_libinput", "smithay/backend_udev", "smithay/backend_drm_atomic", "smithay/backend_drm_legacy", "smithay/backend_drm_gbm", "smithay/backend_drm_egl", "smithay/backend_session", "input" ]
logind = [ "smithay/backend_session_logind" ] logind = [ "smithay/backend_session_logind" ]

View File

@ -19,15 +19,13 @@ use smithay::backend::egl::{display::EGLBufferReader, EGLGraphicsBackend};
use smithay::{ use smithay::{
backend::{ backend::{
drm::{ drm::{
atomic::AtomicDrmDevice,
common::fallback::FallbackDevice,
device_bind, device_bind,
egl::{EglDevice, EglSurface}, egl::{EglDevice, EglSurface},
gbm::{egl::Gbm as EglGbmBackend, GbmDevice}, gbm::{egl::Gbm as EglGbmBackend, GbmDevice},
atomic::AtomicDrmDevice, legacy::LegacyDrmDevice,
//legacy::LegacyDrmDevice, DevPath, Device, DeviceHandler, Surface,
DevPath,
Device,
DeviceHandler,
Surface,
}, },
graphics::CursorBackend, graphics::CursorBackend,
input::InputBackend, input::InputBackend,
@ -72,6 +70,7 @@ use crate::shell::{init_shell, MyWindowMap, Roles};
use crate::AnvilState; use crate::AnvilState;
use smithay::backend::drm::gbm::GbmSurface; use smithay::backend::drm::gbm::GbmSurface;
#[derive(Clone)]
pub struct SessionFd(RawFd); pub struct SessionFd(RawFd);
impl AsRawFd for SessionFd { impl AsRawFd for SessionFd {
fn as_raw_fd(&self) -> RawFd { fn as_raw_fd(&self) -> RawFd {
@ -79,10 +78,12 @@ impl AsRawFd for SessionFd {
} }
} }
type RenderDevice = type RenderDevice = EglDevice<
EglDevice<EglGbmBackend<AtomicDrmDevice<SessionFd>>, GbmDevice<AtomicDrmDevice<SessionFd>>>; EglGbmBackend<FallbackDevice<AtomicDrmDevice<SessionFd>, LegacyDrmDevice<SessionFd>>>,
GbmDevice<FallbackDevice<AtomicDrmDevice<SessionFd>, LegacyDrmDevice<SessionFd>>>,
>;
type RenderSurface = type RenderSurface =
EglSurface<GbmSurface<AtomicDrmDevice<SessionFd>>>; EglSurface<GbmSurface<FallbackDevice<AtomicDrmDevice<SessionFd>, LegacyDrmDevice<SessionFd>>>>;
pub fn run_udev(mut display: Display, mut event_loop: EventLoop<AnvilState>, log: Logger) -> Result<(), ()> { pub fn run_udev(mut display: Display, mut event_loop: EventLoop<AnvilState>, log: Logger) -> Result<(), ()> {
let name = display.add_socket_auto().unwrap().into_string().unwrap(); let name = display.add_socket_auto().unwrap().into_string().unwrap();
@ -417,7 +418,7 @@ impl<S: SessionNotifier, Data: 'static> UdevHandler for UdevHandlerImpl<S, Data>
) )
.ok() .ok()
.and_then( .and_then(
|fd| match AtomicDrmDevice::new(SessionFd(fd), self.logger.clone()) { |fd| match FallbackDevice::new(SessionFd(fd), self.logger.clone()) {
Ok(drm) => Some(drm), Ok(drm) => Some(drm),
Err(err) => { Err(err) => {
error!(self.logger, "Skipping drm device, because of error: {}", err); error!(self.logger, "Skipping drm device, because of error: {}", err);