mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
chore: drop support for building without libdrm
libdrm was initially added as a way to get more information, but is now used for some crucial functionality like GPU generation and VRAM type detection. it should always be used to avoid these things not working
This commit is contained in:
parent
74dda30925
commit
8e9c13cbf6
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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<DrmHandle>,
|
||||
pub pci_info: Option<GpuPciInfo>,
|
||||
pub fan_control_handle: RefCell<Option<FanControlHandle>>,
|
||||
@ -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<String> {
|
||||
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<String> {
|
||||
self.handle.get_vbios_version().ok()
|
||||
}
|
||||
|
||||
#[cfg(feature = "libdrm_amdgpu_sys")]
|
||||
fn get_drm_info(&self) -> Option<DrmInfo> {
|
||||
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<DrmInfo> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(feature = "libdrm_amdgpu_sys")]
|
||||
fn get_current_gfxclk(&self) -> Option<u16> {
|
||||
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<u16> {
|
||||
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<BTreeMap<String, Vec<String>>> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(feature = "libdrm_amdgpu_sys")]
|
||||
fn get_throttle_info(&self) -> Option<BTreeMap<String, Vec<String>>> {
|
||||
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<DrmHandle> {
|
||||
let slot_name = handle
|
||||
.get_pci_slot_name()
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user