diff --git a/lact-gui/i18n/en/lact_gui.ftl b/lact-gui/i18n/en/lact_gui.ftl index f0e2af9e..f0ce7e08 100644 --- a/lact-gui/i18n/en/lact_gui.ftl +++ b/lact-gui/i18n/en/lact_gui.ftl @@ -2,6 +2,10 @@ language = Language language-system-default = System Default language-restart-notice = Restart the LACT GUI to apply language changes. +experimental-features = Experimental Features +nvidia-pstate-offsets = NVIDIA per-P-state offsets +nvidia-pstate-offsets-description = Expose offsets for non-P0 states. Disabled by default because no known device/driver version supports it. + info-page = Hardware Info oc-page = Overclocking thermals-page = Thermals diff --git a/lact-gui/src/app.rs b/lact-gui/src/app.rs index f847e177..a1ff8db3 100644 --- a/lact-gui/src/app.rs +++ b/lact-gui/src/app.rs @@ -670,6 +670,9 @@ impl AppModel { AppMsg::ShowPreferencesDialog => { self.preferences_dialog.emit(PreferencesDialogMsg::Show); } + AppMsg::ExperimentalFeaturesChanged => { + sender.input(AppMsg::ReloadData { full: false }); + } AppMsg::ShowAboutDialog => { self.about_dialog.emit(AboutDialogMsg::Show); } @@ -1256,6 +1259,12 @@ impl AppModel { .model() .apply_clocks_config(&mut gpu_config.clocks_configuration); + if self.device_driver == "nvidia" && !CONFIG.read().experimental_nvidia_pstate_offsets { + let clocks = &mut gpu_config.clocks_configuration; + clocks.gpu_clock_offsets.retain(|pstate, _| *pstate == 0); + clocks.mem_clock_offsets.retain(|pstate, _| *pstate == 0); + } + let enabled_power_states = self.oc_page.model().get_enabled_power_states(); gpu_config.power_states = enabled_power_states; diff --git a/lact-gui/src/app/msg.rs b/lact-gui/src/app/msg.rs index b2482eb6..2515a7b9 100644 --- a/lact-gui/src/app/msg.rs +++ b/lact-gui/src/app/msg.rs @@ -27,6 +27,7 @@ pub enum AppMsg { DumpVBios, DebugSnapshot, ShowPreferencesDialog, + ExperimentalFeaturesChanged, ShowAboutDialog, ShowOverdriveDialog, ShowServiceSetupDialog, diff --git a/lact-gui/src/app/pages/oc_page/clocks_frame/mod.rs b/lact-gui/src/app/pages/oc_page/clocks_frame/mod.rs index d8781237..b3c9cbd9 100644 --- a/lact-gui/src/app/pages/oc_page/clocks_frame/mod.rs +++ b/lact-gui/src/app/pages/oc_page/clocks_frame/mod.rs @@ -1,5 +1,5 @@ use crate::{ - APP_BROKER, I18N, + APP_BROKER, CONFIG, I18N, app::{ components::{ adjustment_card::AdjustmentCard, @@ -167,7 +167,8 @@ impl relm4::Component for ClocksFrame { controls { append = >k::ToggleButton { #[watch] - set_visible: model.has_secondary_p_states(), + set_visible: model.has_secondary_p_states() + && model.secondary_p_states_enabled(), add_css_class: "adjustment-card-option-toggle", add_binding["active"]: &model.show_all_pstates, @@ -363,6 +364,9 @@ impl relm4::Component for ClocksFrame { self.update_vram_clock_ratio(); } ClocksFrameMsg::TogglePStatesVisibility => { + if !self.secondary_p_states_enabled() && self.show_all_pstates.value() { + self.show_all_pstates.set_value(false); + } for clock_type in self.adjustments.keys() { let visible = match clock_type { ClockspeedType::MaxCoreClock @@ -380,7 +384,8 @@ impl relm4::Component for ClocksFrame { } _ => { !self.secondary_p_state_clocks.contains(clock_type) - || self.show_all_pstates.value() + || (self.secondary_p_states_enabled() + && self.show_all_pstates.value()) } }; self.adjustments @@ -394,6 +399,10 @@ impl relm4::Component for ClocksFrame { } impl ClocksFrame { + fn secondary_p_states_enabled(&self) -> bool { + !self.show_nvidia_options || CONFIG.read().experimental_nvidia_pstate_offsets + } + fn set_clock(&mut self, clock_type: ClockspeedType, data: ClocksData) { if !self.domain.matches(clock_type) { return; @@ -712,6 +721,11 @@ impl ClocksFrame { self.adjustments .iter() .filter_map(|(clock_type, row)| { + if !self.secondary_p_states_enabled() + && self.secondary_p_state_clocks.contains(clock_type) + { + return None; + } let configured_value = row.get_changed_value().map(|value| value as i32); // If nvidia options are enabled, we always set locked clocks to None or Some let value = if self.show_nvidia_options { diff --git a/lact-gui/src/app/preferences_dialog.rs b/lact-gui/src/app/preferences_dialog.rs index 260ccd8a..fb5902d3 100644 --- a/lact-gui/src/app/preferences_dialog.rs +++ b/lact-gui/src/app/preferences_dialog.rs @@ -172,6 +172,22 @@ impl relm4::Component for PreferencesDialog { }, }, + add = &adw::PreferencesGroup { + set_title: &fl!(I18N, "experimental-features"), + + adw::SwitchRow { + set_title: &fl!(I18N, "nvidia-pstate-offsets"), + set_subtitle: &fl!(I18N, "nvidia-pstate-offsets-description"), + set_active: CONFIG.read().experimental_nvidia_pstate_offsets, + connect_active_notify => move |row| { + CONFIG.write().edit(|config| { + config.experimental_nvidia_pstate_offsets = row.is_active(); + }); + APP_BROKER.send(AppMsg::ExperimentalFeaturesChanged); + }, + }, + }, + add = &adw::PreferencesGroup { set_title: &fl!(I18N, "daemon"), diff --git a/lact-gui/src/config.rs b/lact-gui/src/config.rs index 419b8b02..04a36f6d 100644 --- a/lact-gui/src/config.rs +++ b/lact-gui/src/config.rs @@ -30,6 +30,8 @@ pub struct UiConfig { pub theme: AppTheme, #[serde(default)] pub color_scheme: AppColorScheme, + #[serde(default)] + pub experimental_nvidia_pstate_offsets: bool, pub language: Option, pub window_size: Option, } @@ -45,6 +47,7 @@ impl Default for UiConfig { gpus: HashMap::new(), theme: AppTheme::Automatic, color_scheme: AppColorScheme::default(), + experimental_nvidia_pstate_offsets: false, language: None, window_size: None, }