feat: hide nvidia all pstates offset behind flag (#1214)

* feat: hide nvidia all-pstate offset toggle under experimental flag

* check if it's used already

* ignore the non p0 states unless the flag is set

* chore: drop dedicated oc msg

* fix: missing dot in msg

---------

Co-authored-by: Ilya Zlobintsev <ilya.zl@protonmail.com>
This commit is contained in:
Roman MakarovandIlya Zlobintsev authored and GitHub committed 2026-10-03 23:09:35 +03:00
1 parent 0f7da6d88c
commit 8e3ac99cc1
6 files changed
+50 -3

No files matched your search

+4
View File
@@ -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
+9
View File
@@ -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;
+1
View File
@@ -27,6 +27,7 @@ pub enum AppMsg {
DumpVBios,
DebugSnapshot,
ShowPreferencesDialog,
ExperimentalFeaturesChanged,
ShowAboutDialog,
ShowOverdriveDialog,
ShowServiceSetupDialog,
@@ -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 = &gtk::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 {
+16
View File
@@ -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"),
+3
View File
@@ -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<String>,
pub window_size: Option<WindowSize>,
}
@@ -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,
}