diff --git a/README.md b/README.md index 07a29bf..2bd5094 100644 --- a/README.md +++ b/README.md @@ -119,11 +119,6 @@ Steps: It's also possible to build LACT without some of the features by using cargo feature flags. This can be useful if some dependency is not available on your system, or is too old. -Build without DRM support (some GPU information will not be available): -``` -cargo build --no-default-features -p lact --features=lact-gui -``` - Minimal build (no GUI!): ``` cargo build --no-default-features -p lact diff --git a/lact-daemon/Cargo.toml b/lact-daemon/Cargo.toml index b0e29e3..2256745 100644 --- a/lact-daemon/Cargo.toml +++ b/lact-daemon/Cargo.toml @@ -4,8 +4,7 @@ version = "0.5.6" edition = "2021" [features] -default = ["drm"] -drm = ["libdrm_amdgpu_sys"] +default = [] [dependencies] lact-schema = { path = "../lact-schema" } @@ -33,7 +32,7 @@ tokio = { version = "1.35.1", features = [ vulkano = { version = "0.34.1", default-features = false } futures = { version = "0.3.30", default-features = false } zbus = { version = "4.1.2", default-features = false, features = ["tokio"] } -libdrm_amdgpu_sys = { optional = true, version = "0.7.3" } +libdrm_amdgpu_sys = "0.7.3" tar = "0.4.40" libflate = "2.0.0" os-release = "0.1.0" diff --git a/lact-daemon/src/server/gpu_controller/mod.rs b/lact-daemon/src/server/gpu_controller/mod.rs index 7ad3491..9c23ff0 100644 --- a/lact-daemon/src/server/gpu_controller/mod.rs +++ b/lact-daemon/src/server/gpu_controller/mod.rs @@ -36,7 +36,6 @@ use tokio::{ time::{sleep, timeout}, }; use tracing::{debug, error, info, trace, warn}; -#[cfg(feature = "libdrm_amdgpu_sys")] use { lact_schema::DrmMemoryInfo, libdrm_amdgpu_sys::AMDGPU::{DeviceHandle as DrmHandle, MetricsInfo, GPU_INFO}, @@ -49,7 +48,6 @@ const GPU_CLOCKDOWN_TIMEOUT_SECS: u64 = 3; pub struct GpuController { pub(super) handle: GpuHandle, - #[cfg(feature = "libdrm_amdgpu_sys")] pub drm_handle: Option, pub pci_info: Option, pub fan_control_handle: RefCell>, @@ -60,7 +58,6 @@ impl GpuController { let handle = GpuHandle::new_from_path(sysfs_path) .map_err(|error| anyhow!("failed to initialize gpu handle: {error}"))?; - #[cfg(feature = "libdrm_amdgpu_sys")] let drm_handle = match get_drm_handle(&handle) { Ok(handle) => Some(handle), Err(err) => { @@ -108,7 +105,6 @@ impl GpuController { Ok(Self { handle, - #[cfg(feature = "libdrm_amdgpu_sys")] drm_handle, pci_info, fan_control_handle: RefCell::new(None), @@ -171,7 +167,6 @@ impl GpuController { } } - #[cfg(feature = "libdrm_amdgpu_sys")] fn get_full_vbios_version(&self) -> Option { if let Some(drm_handle) = &self.drm_handle { if let Ok(vbios_info) = drm_handle.get_vbios_info() { @@ -182,12 +177,6 @@ impl GpuController { self.handle.get_vbios_version().ok() } - #[cfg(not(feature = "libdrm_amdgpu_sys"))] - fn get_full_vbios_version(&self) -> Option { - self.handle.get_vbios_version().ok() - } - - #[cfg(feature = "libdrm_amdgpu_sys")] fn get_drm_info(&self) -> Option { use libdrm_amdgpu_sys::AMDGPU::VRAM_TYPE; @@ -228,12 +217,6 @@ impl GpuController { } } - #[cfg(not(feature = "libdrm_amdgpu_sys"))] - fn get_drm_info(&self) -> Option { - None - } - - #[cfg(feature = "libdrm_amdgpu_sys")] fn get_current_gfxclk(&self) -> Option { self.drm_handle .as_ref() @@ -241,11 +224,6 @@ impl GpuController { .and_then(|metrics| metrics.get_current_gfxclk()) } - #[cfg(not(feature = "libdrm_amdgpu_sys"))] - fn get_current_gfxclk(&self) -> Option { - None - } - fn get_link_info(&self) -> LinkInfo { LinkInfo { current_width: self.handle.get_current_link_width().ok(), @@ -319,12 +297,6 @@ impl GpuController { } } - #[cfg(not(feature = "libdrm_amdgpu_sys"))] - fn get_throttle_info(&self) -> Option>> { - None - } - - #[cfg(feature = "libdrm_amdgpu_sys")] fn get_throttle_info(&self) -> Option>> { use libdrm_amdgpu_sys::AMDGPU::ThrottlerType; @@ -927,7 +899,6 @@ impl GpuController { } } -#[cfg(feature = "libdrm_amdgpu_sys")] fn get_drm_handle(handle: &GpuHandle) -> anyhow::Result { let slot_name = handle .get_pci_slot_name() diff --git a/lact/Cargo.toml b/lact/Cargo.toml index d1f15d5..ba3181a 100644 --- a/lact/Cargo.toml +++ b/lact/Cargo.toml @@ -4,8 +4,7 @@ version = "0.5.6" edition = "2021" [features] -default = ["lact-gui", "drm"] -drm = ["lact-daemon/drm"] +default = ["lact-gui"] adw = ["lact-gui/adw"] [dependencies]