Compare commits
No commits in common. "af8e8f52584d26a9dc20c62feb8ff822841b8a2e" and "fb038665c9bd89e9878ef515e99ee35757488d70" have entirely different histories.
af8e8f5258
...
fb038665c9
8 changed files with 22 additions and 89 deletions
|
@ -51,9 +51,7 @@ pub struct GeneralLimits {}
|
|||
#[derive(Serialize, Deserialize)]
|
||||
pub struct GpuLimits {
|
||||
pub fast_ppt_limits: Option<RangeLimit<u64>>,
|
||||
pub fast_ppt_default: u64,
|
||||
pub slow_ppt_limits: Option<RangeLimit<u64>>,
|
||||
pub slow_ppt_default: u64,
|
||||
pub ppt_step: u64,
|
||||
pub tdp_limits: Option<RangeLimit<u64>>,
|
||||
pub tdp_boost_limits: Option<RangeLimit<u64>>,
|
||||
|
|
|
@ -99,27 +99,15 @@ impl TGpu for Gpu {
|
|||
log::debug!("dev_mode_Gpu::limits(self) -> {{...}}");
|
||||
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 limit_struct = crate::api::GpuLimits {
|
||||
crate::api::GpuLimits {
|
||||
fast_ppt_limits: self.limits.fast_ppt.map(|lim| crate::api::RangeLimit {
|
||||
min: lim.min.unwrap_or(11_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 {
|
||||
min: lim.min.unwrap_or(7_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),
|
||||
tdp_limits: self.limits.tdp.map(|lim| crate::api::RangeLimit {
|
||||
min: lim.min.unwrap_or(11_000_000) / tdp_divisor,
|
||||
|
@ -144,12 +132,7 @@ impl TGpu for Gpu {
|
|||
max: lim.max.unwrap_or(1100),
|
||||
}),
|
||||
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 {
|
||||
|
|
|
@ -167,18 +167,6 @@ impl TGpu for Gpu {
|
|||
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
|
||||
.limits
|
||||
.slow_ppt
|
||||
|
@ -193,18 +181,6 @@ impl TGpu for Gpu {
|
|||
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),
|
||||
tdp_limits: self
|
||||
.limits
|
||||
|
|
|
@ -327,9 +327,7 @@ impl crate::settings::OnUnload for Gpu {
|
|||
fn bad_gpu_limits() -> crate::api::GpuLimits {
|
||||
crate::api::GpuLimits {
|
||||
fast_ppt_limits: None,
|
||||
fast_ppt_default: 1,
|
||||
slow_ppt_limits: None,
|
||||
slow_ppt_default: 1,
|
||||
ppt_step: 1,
|
||||
tdp_limits: None,
|
||||
tdp_boost_limits: None,
|
||||
|
|
|
@ -340,7 +340,6 @@ impl Gpu {
|
|||
}
|
||||
|
||||
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 payload = self.build_memory_clock_payload(clock);
|
||||
log::debug!(
|
||||
|
@ -354,9 +353,6 @@ impl Gpu {
|
|||
msg: format!("Failed to write to `{}`: {}", path.display(), e),
|
||||
setting: crate::settings::SettingVariant::Gpu,
|
||||
})
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn set_force_performance_related(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
|
@ -366,7 +362,7 @@ impl Gpu {
|
|||
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT
|
||||
.enforce_level(&self.sysfs_card)
|
||||
.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.memory_clock
|
||||
.or_else(|| {
|
||||
|
@ -635,7 +631,6 @@ impl crate::settings::OnLoad for Gpu {
|
|||
|
||||
impl crate::settings::OnUnload for Gpu {
|
||||
fn on_unload(&mut self) -> Result<(), Vec<SettingError>> {
|
||||
POWER_DPM_FORCE_PERFORMANCE_LEVEL_MGMT.set_gpu(false);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -643,32 +638,19 @@ impl crate::settings::OnUnload for Gpu {
|
|||
impl TGpu for Gpu {
|
||||
fn limits(&self) -> crate::api::GpuLimits {
|
||||
let max_gpu_clock = self.read_max_gpu_clock();
|
||||
let ppt_divisor = self.limits.ppt_divisor.unwrap_or(PPT_DIVISOR);
|
||||
crate::api::GpuLimits {
|
||||
fast_ppt_limits: Some(RangeLimit {
|
||||
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)
|
||||
/ 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 {
|
||||
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)
|
||||
/ 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),
|
||||
tdp_limits: None,
|
||||
tdp_boost_limits: None,
|
||||
|
|
|
@ -71,9 +71,7 @@ impl TGpu for Gpu {
|
|||
fn limits(&self) -> crate::api::GpuLimits {
|
||||
crate::api::GpuLimits {
|
||||
fast_ppt_limits: None,
|
||||
fast_ppt_default: 1_000_000,
|
||||
slow_ppt_limits: None,
|
||||
slow_ppt_default: 1_000_000,
|
||||
ppt_step: 1_000_000,
|
||||
tdp_limits: None,
|
||||
tdp_boost_limits: None,
|
||||
|
|
|
@ -85,9 +85,7 @@ export type GeneralLimits = {};
|
|||
|
||||
export type GpuLimits = {
|
||||
fast_ppt_limits: RangeLimit | null;
|
||||
fast_ppt_default: number;
|
||||
slow_ppt_limits: RangeLimit | null;
|
||||
slow_ppt_default: number;
|
||||
ppt_step: number;
|
||||
clock_min_limits: RangeLimit | null;
|
||||
clock_max_limits: RangeLimit | null;
|
||||
|
|
|
@ -41,11 +41,11 @@ export class Gpu extends Component<backend.IdcProps> {
|
|||
onChange={(value: boolean) => {
|
||||
if (value) {
|
||||
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) {
|
||||
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");
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue