kms: Add kms backend module

This commit is contained in:
Victoria Brekenfeld 2022-01-20 19:51:46 +01:00
parent 2f53d25edd
commit ca32139131
5 changed files with 102 additions and 7 deletions

11
src/backend/kms/mod.rs Normal file
View file

@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::state::State;
use anyhow::Result;
use smithay::reexports::calloop::EventLoop;
pub struct KmsState {}
pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Result<()> {
unimplemented!()
}

View file

@ -4,16 +4,17 @@ use crate::state::State;
use anyhow::Result;
use smithay::reexports::calloop::EventLoop;
pub mod kms;
pub mod winit;
pub mod x11;
// TODO
// pub mod wayland; // tbd in smithay
// pub mod udev;
pub fn init_backend_auto(event_loop: &mut EventLoop<State>, state: &mut State) -> Result<()> {
match std::env::var("COSMIC_BACKEND") {
Ok(x) if x == "x11" => x11::init_backend(event_loop, state),
Ok(x) if x == "winit" => winit::init_backend(event_loop, state),
Ok(x) if x == "kms" => kms::init_backend(event_loop, state),
Ok(_) => unimplemented!("There is no backend with this identifier"),
Err(_) => {
if std::env::var_os("DISPLAY").is_some()
@ -28,7 +29,7 @@ pub fn init_backend_auto(event_loop: &mut EventLoop<State>, state: &mut State) -
}
}
} else {
unimplemented!("Currently this runs only nested")
kms::init_backend(event_loop, state)
}
}
}