Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DRM node abstraction #202

Merged
merged 16 commits into from
Sep 24, 2024
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub(crate) mod util;

pub mod buffer;
pub mod control;
pub mod node;

use std::ffi::{OsStr, OsString};
use std::time::Duration;
Expand Down
45 changes: 45 additions & 0 deletions src/node/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//! OS-Specific DRM constants.

/// DRM major value.
#[cfg(target_os = "dragonfly")]
pub const DRM_MAJOR: u32 = 145;

/// DRM major value.
#[cfg(target_os = "netbsd")]
pub const DRM_MAJOR: u32 = 34;

/// DRM major value.
#[cfg(all(target_os = "openbsd", target_arch = "x86"))]
pub const DRM_MAJOR: u32 = 88;

/// DRM major value.
#[cfg(all(target_os = "openbsd", not(target_arch = "x86")))]
pub const DRM_MAJOR: u32 = 87;

/// DRM major value.
#[cfg(not(any(target_os = "dragonfly", target_os = "netbsd", target_os = "openbsd")))]
pub const DRM_MAJOR: u32 = 226;

/// Primary DRM node prefix.
#[cfg(not(target_os = "openbsd"))]
pub const PRIMARY_NAME: &str = "card";

/// Primary DRM node prefix.
#[cfg(target_os = "openbsd")]
pub const PRIMARY_NAME: &str = "drm";

/// Control DRM node prefix.
#[cfg(not(target_os = "openbsd"))]
pub const CONTROL_NAME: &str = "controlD";

/// Control DRM node prefix.
#[cfg(target_os = "openbsd")]
pub const CONTROL_NAME: &str = "drmC";

/// Render DRM node prefix.
#[cfg(not(target_os = "openbsd"))]
pub const RENDER_NAME: &str = "renderD";

/// Render DRM node prefix.
#[cfg(target_os = "openbsd")]
pub const RENDER_NAME: &str = "drmR";
Loading