feat: disable thermals controls on rdna3+ when overdrive is disabled, as it is not writeable

This commit is contained in:
Ilya Zlobintsev 2024-01-14 12:24:52 +02:00
parent 57d419c92f
commit 20028cc101
8 changed files with 45 additions and 6 deletions

4
Cargo.lock generated
View File

@ -1397,9 +1397,9 @@ checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
[[package]]
name = "libdrm_amdgpu_sys"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "803eb16e071244ced33c3ff1078b70fb5c1fe6c7134c1b565e211e0788f496f7"
checksum = "6badab42a333de99a838f765a5fe283a0eda3484d1e58dc753d53ef27881b252"
dependencies = [
"libc",
]

View File

@ -33,7 +33,7 @@ serde_with = { version = "3.4.0", default-features = false, features = [
"macros",
] }
zbus = { version = "3.14.1", default-features = false, features = ["tokio"] }
libdrm_amdgpu_sys = { optional = true, version = "0.4.0" }
libdrm_amdgpu_sys = { optional = true, version = "0.4.1" }
tar = "0.4.40"
chrono = "0.4.31"
os-release = "0.1.0"

View File

@ -20,6 +20,9 @@ use tokio::{
};
use tracing::{debug, debug_span, info, warn, Instrument, Level};
/// RDNA3, minimum family that supports the new pmfw interface
pub const AMDGPU_FAMILY_GC_11_0_0: u32 = 145;
pub use server::system::MODULE_CONF_PATH;
const MIN_SYSTEM_UPTIME_SECS: f32 = 10.0;

View File

@ -217,6 +217,7 @@ impl GpuController {
.and_then(|handle| handle.device_info().ok())
.map(|drm_info| DrmInfo {
family_name: drm_info.get_family_name().to_string(),
family_id: drm_info.family_id(),
asic_name: drm_info.get_asic_name().to_string(),
chip_class: drm_info.get_chip_class().to_string(),
compute_units: drm_info.cu_active_number,

View File

@ -242,6 +242,7 @@ impl App {
self.root_stack.info_page.set_info(&info);
self.set_initial(gpu_id);
self.root_stack.thermals_page.set_info(&info);
}
fn set_initial(&self, gpu_id: &str) {

View File

@ -37,7 +37,7 @@ impl RootStack {
container.add_titled(&oc_page.container, Some("oc_page"), "OC");
let thermals_page = ThermalsPage::new();
let thermals_page = ThermalsPage::new(&system_info);
container.add_titled(&thermals_page.container, Some("thermals_page"), "Thermals");

View File

@ -5,13 +5,19 @@ use glib::clone;
use gtk::prelude::*;
use gtk::*;
use lact_client::schema::{
default_fan_curve, DeviceStats, FanControlMode, FanCurveMap, PmfwOptions,
default_fan_curve, DeviceInfo, DeviceStats, FanControlMode, FanCurveMap, PmfwOptions,
SystemInfo,
};
use lact_daemon::AMDGPU_FAMILY_GC_11_0_0;
use tracing::debug;
use self::{fan_curve_frame::FanCurveFrame, pmfw_frame::PmfwFrame};
use super::{label_row, values_grid};
use crate::app::page_section::PageSection;
const PMFW_WARNING: &str =
"Warning: Overclocking support is disabled, fan control functionality is not available.";
#[derive(Debug)]
pub struct ThermalsSettings {
pub manual_fan_control: bool,
@ -24,6 +30,7 @@ pub struct ThermalsSettings {
#[derive(Clone)]
pub struct ThermalsPage {
pub container: Box,
pmfw_warning_label: Label,
temperatures_label: Label,
fan_speed_label: Label,
pmfw_frame: PmfwFrame,
@ -31,10 +38,12 @@ pub struct ThermalsPage {
fan_curve_frame: FanCurveFrame,
fan_control_mode_stack: Stack,
fan_control_mode_stack_switcher: StackSwitcher,
overdrive_enabled: Option<bool>,
}
impl ThermalsPage {
pub fn new() -> Self {
pub fn new(system_info: &SystemInfo) -> Self {
let container = Box::builder()
.orientation(Orientation::Vertical)
.spacing(15)
@ -42,6 +51,12 @@ impl ThermalsPage {
.margin_end(20)
.build();
let pmfw_warning_label = Label::builder()
.label(PMFW_WARNING)
.halign(Align::Start)
.build();
container.append(&pmfw_warning_label);
let stats_section = PageSection::new("Statistics");
let stats_grid = values_grid();
@ -88,6 +103,7 @@ impl ThermalsPage {
});
Self {
pmfw_warning_label,
container,
temperatures_label,
fan_speed_label,
@ -96,9 +112,25 @@ impl ThermalsPage {
fan_control_mode_stack,
fan_control_mode_stack_switcher,
pmfw_frame,
overdrive_enabled: system_info.amdgpu_overdrive_enabled,
}
}
pub fn set_info(&self, info: &DeviceInfo) {
let pmfw_disabled = info.drm_info.as_ref().is_some_and(|info| {
debug!(
"family id: {}, overdrive enabled {:?}",
info.family_id, self.overdrive_enabled
);
(info.family_id >= AMDGPU_FAMILY_GC_11_0_0) && (self.overdrive_enabled != Some(true))
});
self.pmfw_warning_label.set_visible(pmfw_disabled);
let sensitive = self.fan_control_mode_stack_switcher.is_sensitive() && !pmfw_disabled;
self.fan_control_mode_stack_switcher
.set_sensitive(sensitive);
}
pub fn set_stats(&self, stats: &DeviceStats, initial: bool) {
let mut temperatures: Vec<String> = stats
.temps

View File

@ -98,6 +98,8 @@ pub struct DeviceInfo<'a> {
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DrmInfo {
pub family_name: String,
#[serde(default)]
pub family_id: u32,
pub asic_name: String,
pub chip_class: String,
pub compute_units: u32,