feat: Add a DRM/KMS backend

This adds a DRM/KMS based backend to the system, as per #42. This system finds a CRTC and a connector, then uses that to create a frame buffer and a DUMB buffer that it can render to.

There's much more to do, and is left as an exercise for anyone with a significant DRM-based use case to pick up and fix.

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2023-08-12 13:39:13 -07:00 committed by GitHub
parent 2689cec2ca
commit ac0b7f5e14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 665 additions and 3 deletions

View file

@ -17,7 +17,8 @@ name = "buffer_mut"
harness = false
[features]
default = ["x11", "x11-dlopen", "wayland", "wayland-dlopen"]
default = ["kms", "x11", "x11-dlopen", "wayland", "wayland-dlopen"]
kms = ["bytemuck", "drm", "drm-sys", "nix"]
wayland = ["wayland-backend", "wayland-client", "memmap2", "nix", "fastrand"]
wayland-dlopen = ["wayland-sys/dlopen"]
x11 = ["as-raw-xcb-connection", "bytemuck", "nix", "tiny-xlib", "x11rb"]
@ -30,6 +31,8 @@ raw-window-handle = "0.5.0"
[target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dependencies]
as-raw-xcb-connection = { version = "1.0.0", optional = true }
bytemuck = { version = "1.12.3", optional = true }
drm = { version = "0.9.0", default-features = false, optional = true }
drm-sys = { version = "0.4.0", default-features = false, optional = true }
memmap2 = { version = "0.7.1", optional = true }
nix = { version = "0.26.1", optional = true }
tiny-xlib = { version = "0.2.1", optional = true }
@ -76,6 +79,7 @@ redox_syscall = "0.3"
cfg_aliases = "0.1.1"
[dev-dependencies]
colorous = "1.0.12"
criterion = { version = "0.4.0", default-features = false, features = ["cargo_bench_support"] }
instant = "0.1.12"
winit = "0.28.1"
@ -95,6 +99,9 @@ rayon = "1.5.1"
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3"
[target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox"))))'.dev-dependencies]
rustix = { version = "0.38.8", features = ["event"] }
[workspace]
members = [
"run-wasm",