Compare commits

..

No commits in common. "af8e8f52584d26a9dc20c62feb8ff822841b8a2e" and "fb038665c9bd89e9878ef515e99ee35757488d70" have entirely different histories.

8 changed files with 22 additions and 89 deletions

View file

@ -51,9 +51,7 @@ pub struct GeneralLimits {}
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
pub struct GpuLimits { pub struct GpuLimits {
pub fast_ppt_limits: Option<RangeLimit<u64>>, pub fast_ppt_limits: Option<RangeLimit<u64>>,
pub fast_ppt_default: u64,
pub slow_ppt_limits: Option<RangeLimit<u64>>, pub slow_ppt_limits: Option<RangeLimit<u64>>,
pub slow_ppt_default: u64,
pub ppt_step: u64, pub ppt_step: u64,
pub tdp_limits: Option<RangeLimit<u64>>, pub tdp_limits: Option<RangeLimit<u64>>,
pub tdp_boost_limits: Option<RangeLimit<u64>>, pub tdp_boost_limits: Option<RangeLimit<u64>>,

View file

@ -99,27 +99,15 @@ impl TGpu for Gpu {
log::debug!("dev_mode_Gpu::limits(self) -> {{...}}"); log::debug!("dev_mode_Gpu::limits(self) -> {{...}}");
let ppt_divisor = self.limits.ppt_divisor.unwrap_or(1_000_000); let ppt_divisor = self.limits.ppt_divisor.unwrap_or(1_000_000);
let tdp_divisor = self.limits.tdp_divisor.unwrap_or(1_000_000); let tdp_divisor = self.limits.tdp_divisor.unwrap_or(1_000_000);
let limit_struct = crate::api::GpuLimits { crate::api::GpuLimits {
fast_ppt_limits: self.limits.fast_ppt.map(|lim| crate::api::RangeLimit { fast_ppt_limits: self.limits.fast_ppt.map(|lim| crate::api::RangeLimit {
min: lim.min.unwrap_or(11_000_000) / ppt_divisor, min: lim.min.unwrap_or(11_000_000) / ppt_divisor,
max: lim.max.unwrap_or(42_000_000) / ppt_divisor, max: lim.max.unwrap_or(42_000_000) / ppt_divisor,
}), }),
fast_ppt_default: self
.limits
.fast_ppt_default
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
.unwrap_or(2_000_000)
/ ppt_divisor,
slow_ppt_limits: self.limits.slow_ppt.map(|lim| crate::api::RangeLimit { slow_ppt_limits: self.limits.slow_ppt.map(|lim| crate::api::RangeLimit {
min: lim.min.unwrap_or(7_000_000) / ppt_divisor, min: lim.min.unwrap_or(7_000_000) / ppt_divisor,
max: lim.max.unwrap_or(69_000_000) / ppt_divisor, max: lim.max.unwrap_or(69_000_000) / ppt_divisor,
}), }),
slow_ppt_default: self
.limits
.slow_ppt_default
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
.unwrap_or(3_000_000)
/ ppt_divisor,
ppt_step: self.limits.ppt_step.unwrap_or(1), ppt_step: self.limits.ppt_step.unwrap_or(1),
tdp_limits: self.limits.tdp.map(|lim| crate::api::RangeLimit { tdp_limits: self.limits.tdp.map(|lim| crate::api::RangeLimit {
min: lim.min.unwrap_or(11_000_000) / tdp_divisor, min: lim.min.unwrap_or(11_000_000) / tdp_divisor,
@ -144,12 +132,7 @@ impl TGpu for Gpu {
max: lim.max.unwrap_or(1100), max: lim.max.unwrap_or(1100),
}), }),
memory_step: self.limits.memory_clock_step.unwrap_or(400), memory_step: self.limits.memory_clock_step.unwrap_or(400),
}; }
log::debug!(
"dev_mode_Gpu::limits(self) -> {}",
serde_json::to_string_pretty(&limit_struct).unwrap()
);
limit_struct
} }
fn json(&self) -> crate::persist::GpuJson { fn json(&self) -> crate::persist::GpuJson {

View file

@ -167,18 +167,6 @@ impl TGpu for Gpu {
x x
} }
}), }),
fast_ppt_default: {
let def = self
.limits
.fast_ppt_default
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
.unwrap_or(15);
if let Some(ppt_divisor) = self.limits.ppt_divisor {
def / ppt_divisor
} else {
def
}
},
slow_ppt_limits: self slow_ppt_limits: self
.limits .limits
.slow_ppt .slow_ppt
@ -193,18 +181,6 @@ impl TGpu for Gpu {
x x
} }
}), }),
slow_ppt_default: {
let def = self
.limits
.slow_ppt_default
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
.unwrap_or(15);
if let Some(ppt_divisor) = self.limits.ppt_divisor {
def / ppt_divisor
} else {
def
}
},
ppt_step: self.limits.ppt_step.unwrap_or(1), ppt_step: self.limits.ppt_step.unwrap_or(1),
tdp_limits: self tdp_limits: self
.limits .limits

View file

@ -327,9 +327,7 @@ impl crate::settings::OnUnload for Gpu {
fn bad_gpu_limits() -> crate::api::GpuLimits { fn bad_gpu_limits() -> crate::api::GpuLimits {
crate::api::GpuLimits { crate::api::GpuLimits {
fast_ppt_limits: None, fast_ppt_limits: None,
fast_ppt_default: 1,
slow_ppt_limits: None, slow_ppt_limits: None,
slow_ppt_default: 1,
ppt_step: 1, ppt_step: 1,
tdp_limits: None, tdp_limits: None,
tdp_boost_limits: None, tdp_boost_limits: None,

View file

@ -340,23 +340,19 @@ impl Gpu {
} }
fn set_memory_speed(&self, clock: u64) -> Result<(), SettingError> { fn set_memory_speed(&self, clock: u64) -> Result<(), SettingError> {
if POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.needs_manual() { let path = GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.path(&self.sysfs_card);
let path = GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.path(&self.sysfs_card); let payload = self.build_memory_clock_payload(clock);
let payload = self.build_memory_clock_payload(clock); log::debug!(
log::debug!( "Generated payload for gpu fclk (memory): `{}` (is maxed? {})",
"Generated payload for gpu fclk (memory): `{}` (is maxed? {})", payload,
payload, self.is_memory_clock_maxed()
self.is_memory_clock_maxed() );
); self.sysfs_card
self.sysfs_card .set(GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.to_owned(), payload)
.set(GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.to_owned(), payload) .map_err(|e| SettingError {
.map_err(|e| SettingError { msg: format!("Failed to write to `{}`: {}", path.display(), e),
msg: format!("Failed to write to `{}`: {}", path.display(), e), setting: crate::settings::SettingVariant::Gpu,
setting: crate::settings::SettingVariant::Gpu, })
})
} else {
Ok(())
}
} }
fn set_force_performance_related(&mut self) -> Result<(), Vec<SettingError>> { fn set_force_performance_related(&mut self) -> Result<(), Vec<SettingError>> {
@ -366,7 +362,7 @@ impl Gpu {
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT
.enforce_level(&self.sysfs_card) .enforce_level(&self.sysfs_card)
.unwrap_or_else(|mut e| errors.append(&mut e)); .unwrap_or_else(|mut e| errors.append(&mut e));
// enable/disable downclock of GPU memory // enable/disable downclock of GPU memory (to 400Mhz?)
self.set_memory_speed( self.set_memory_speed(
self.memory_clock self.memory_clock
.or_else(|| { .or_else(|| {
@ -635,7 +631,6 @@ impl crate::settings::OnLoad for Gpu {
impl crate::settings::OnUnload for Gpu { impl crate::settings::OnUnload for Gpu {
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> { fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_gpu(false);
Ok(()) Ok(())
} }
} }
@ -643,32 +638,19 @@ impl crate::settings::OnUnload for Gpu {
impl TGpu for Gpu { impl TGpu for Gpu {
fn limits(&self) -> crate::api::GpuLimits { fn limits(&self) -> crate::api::GpuLimits {
let max_gpu_clock = self.read_max_gpu_clock(); let max_gpu_clock = self.read_max_gpu_clock();
let ppt_divisor = self.limits.ppt_divisor.unwrap_or(PPT_DIVISOR);
crate::api::GpuLimits { crate::api::GpuLimits {
fast_ppt_limits: Some(RangeLimit { fast_ppt_limits: Some(RangeLimit {
min: super::util::range_min_or_fallback(&self.limits.fast_ppt, MIN_FAST_PPT) min: super::util::range_min_or_fallback(&self.limits.fast_ppt, MIN_FAST_PPT)
/ ppt_divisor, / self.limits.ppt_divisor.unwrap_or(PPT_DIVISOR),
max: super::util::range_max_or_fallback(&self.limits.fast_ppt, MAX_FAST_PPT) max: super::util::range_max_or_fallback(&self.limits.fast_ppt, MAX_FAST_PPT)
/ ppt_divisor, / self.limits.ppt_divisor.unwrap_or(PPT_DIVISOR),
}), }),
fast_ppt_default: self
.limits
.fast_ppt_default
.or_else(|| self.limits.fast_ppt.and_then(|x| x.max))
.unwrap_or(MAX_FAST_PPT)
/ ppt_divisor,
slow_ppt_limits: Some(RangeLimit { slow_ppt_limits: Some(RangeLimit {
min: super::util::range_min_or_fallback(&self.limits.slow_ppt, MIN_SLOW_PPT) min: super::util::range_min_or_fallback(&self.limits.slow_ppt, MIN_SLOW_PPT)
/ ppt_divisor, / self.limits.ppt_divisor.unwrap_or(PPT_DIVISOR),
max: super::util::range_max_or_fallback(&self.limits.slow_ppt, MIN_SLOW_PPT) max: super::util::range_max_or_fallback(&self.limits.slow_ppt, MIN_SLOW_PPT)
/ ppt_divisor, / self.limits.ppt_divisor.unwrap_or(PPT_DIVISOR),
}), }),
slow_ppt_default: self
.limits
.slow_ppt_default
.or_else(|| self.limits.slow_ppt.and_then(|x| x.max))
.unwrap_or(MAX_SLOW_PPT)
/ ppt_divisor,
ppt_step: self.limits.ppt_step.unwrap_or(1), ppt_step: self.limits.ppt_step.unwrap_or(1),
tdp_limits: None, tdp_limits: None,
tdp_boost_limits: None, tdp_boost_limits: None,

View file

@ -71,9 +71,7 @@ impl TGpu for Gpu {
fn limits(&self) -> crate::api::GpuLimits { fn limits(&self) -> crate::api::GpuLimits {
crate::api::GpuLimits { crate::api::GpuLimits {
fast_ppt_limits: None, fast_ppt_limits: None,
fast_ppt_default: 1_000_000,
slow_ppt_limits: None, slow_ppt_limits: None,
slow_ppt_default: 1_000_000,
ppt_step: 1_000_000, ppt_step: 1_000_000,
tdp_limits: None, tdp_limits: None,
tdp_boost_limits: None, tdp_boost_limits: None,

View file

@ -85,9 +85,7 @@ export type GeneralLimits = {};
export type GpuLimits = { export type GpuLimits = {
fast_ppt_limits: RangeLimit | null; fast_ppt_limits: RangeLimit | null;
fast_ppt_default: number;
slow_ppt_limits: RangeLimit | null; slow_ppt_limits: RangeLimit | null;
slow_ppt_default: number;
ppt_step: number; ppt_step: number;
clock_min_limits: RangeLimit | null; clock_min_limits: RangeLimit | null;
clock_max_limits: RangeLimit | null; clock_max_limits: RangeLimit | null;

View file

@ -41,11 +41,11 @@ export class Gpu extends Component<backend.IdcProps> {
onChange={(value: boolean) => { onChange={(value: boolean) => {
if (value) { if (value) {
if ((get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.slow_ppt_limits != null) { if ((get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.slow_ppt_limits != null) {
set_value(SLOW_PPT_GPU, (get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.slow_ppt_default); set_value(SLOW_PPT_GPU, (get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.slow_ppt_limits!.max);
} }
if ((get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.fast_ppt_limits != null) { if ((get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.fast_ppt_limits != null) {
set_value(FAST_PPT_GPU, (get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.fast_ppt_default); set_value(FAST_PPT_GPU, (get_value(LIMITS_INFO) as backend.SettingsLimits).gpu.fast_ppt_limits!.max);
} }
reloadGUI("GPUPPTToggle"); reloadGUI("GPUPPTToggle");
} else { } else {