mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
fixes
This commit is contained in:
parent
e63e168afb
commit
086ddae1bc
@ -55,6 +55,7 @@ pub struct AmdGpuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AmdGpuController {
|
impl AmdGpuController {
|
||||||
|
#[allow(unused_variables)]
|
||||||
pub fn new_from_path(
|
pub fn new_from_path(
|
||||||
common: CommonControllerInfo,
|
common: CommonControllerInfo,
|
||||||
libdrm_amdgpu: Option<&LibDrmAmdgpu>,
|
libdrm_amdgpu: Option<&LibDrmAmdgpu>,
|
||||||
|
@ -110,17 +110,17 @@ pub(crate) fn init_controller(
|
|||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let vendor_entry = pci_db.vendors.get_key_value(vendor_id);
|
let vendor = pci_db.vendors.get(&vendor_id.to_ascii_lowercase());
|
||||||
|
|
||||||
let pci_info = GpuPciInfo {
|
let pci_info = GpuPciInfo {
|
||||||
device_pci_info: PciInfo {
|
device_pci_info: PciInfo {
|
||||||
vendor_id: vendor_id.to_owned(),
|
vendor_id: vendor_id.to_owned(),
|
||||||
vendor: vendor_entry.map(|(vendor_name, _)| vendor_name.clone()),
|
vendor: vendor.map(|vendor| vendor.name.clone()),
|
||||||
model_id: device_id.to_owned(),
|
model_id: device_id.to_owned(),
|
||||||
model: vendor_entry.and_then(|(_, vendor)| {
|
model: vendor.and_then(|vendor| {
|
||||||
vendor
|
vendor
|
||||||
.devices
|
.devices
|
||||||
.get(device_id)
|
.get(&device_id.to_ascii_lowercase())
|
||||||
.map(|device| device.name.clone())
|
.map(|device| device.name.clone())
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -921,6 +921,7 @@ fn load_controllers(base_path: &Path) -> anyhow::Result<BTreeMap<String, Box<dyn
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
let nvml: LazyCell<Option<Rc<Nvml>>> = LazyCell::new(|| match Nvml::init() {
|
let nvml: LazyCell<Option<Rc<Nvml>>> = LazyCell::new(|| match Nvml::init() {
|
||||||
Ok(nvml) => {
|
Ok(nvml) => {
|
||||||
info!("Nvidia management library loaded");
|
info!("Nvidia management library loaded");
|
||||||
@ -931,7 +932,10 @@ fn load_controllers(base_path: &Path) -> anyhow::Result<BTreeMap<String, Box<dyn
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#[cfg(test)]
|
||||||
|
let nvml: LazyCell<Option<Rc<Nvml>>> = LazyCell::new(|| None);
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
let amd_drm: LazyCell<Option<LibDrmAmdgpu>> = LazyCell::new(|| match LibDrmAmdgpu::new() {
|
let amd_drm: LazyCell<Option<LibDrmAmdgpu>> = LazyCell::new(|| match LibDrmAmdgpu::new() {
|
||||||
Ok(drm) => {
|
Ok(drm) => {
|
||||||
info!("AMDGPU DRM initialized");
|
info!("AMDGPU DRM initialized");
|
||||||
@ -942,6 +946,8 @@ fn load_controllers(base_path: &Path) -> anyhow::Result<BTreeMap<String, Box<dyn
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#[cfg(test)]
|
||||||
|
let amd_drm: LazyCell<Option<LibDrmAmdgpu>> = LazyCell::new(|| None);
|
||||||
|
|
||||||
for entry in base_path
|
for entry in base_path
|
||||||
.read_dir()
|
.read_dir()
|
||||||
|
Loading…
Reference in New Issue
Block a user