mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
NV Clocks tweaks
This commit is contained in:
16
app/Fans.cs
16
app/Fans.cs
@@ -146,15 +146,23 @@ namespace GHelper
|
||||
|
||||
if (gpu_boost < 0) gpu_boost = ASUSWmi.MaxGPUBoost;
|
||||
if (gpu_temp < 0) gpu_temp = ASUSWmi.MaxGPUTemp;
|
||||
|
||||
if (core == -1) core = 0;
|
||||
if (memory == 1) memory = 0;
|
||||
if (memory == -1) memory = 0;
|
||||
|
||||
if (readClocks)
|
||||
//if (readClocks)
|
||||
//{
|
||||
int status = nvControl.GetClocks(out int current_core, out int current_memory);
|
||||
if (status != -1)
|
||||
{
|
||||
nvControl.GetClocks(out core, out memory, out string gpuTitle);
|
||||
labelGPU.Text = gpuTitle;
|
||||
core = current_core;
|
||||
memory = current_memory;
|
||||
}
|
||||
|
||||
labelGPU.Text = nvControl.FullName;
|
||||
|
||||
//}
|
||||
|
||||
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
|
||||
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ public class NvidiaGpuControl : IGpuControl
|
||||
|
||||
public bool IsNvidia => IsValid;
|
||||
|
||||
public string FullName => _internalGpu!.FullName;
|
||||
|
||||
public int? GetCurrentTemperature()
|
||||
{
|
||||
if (!IsValid)
|
||||
@@ -49,12 +51,10 @@ public class NvidiaGpuControl : IGpuControl
|
||||
}
|
||||
|
||||
|
||||
public int GetClocks(out int core, out int memory, out string gpu)
|
||||
public int GetClocks(out int core, out int memory)
|
||||
{
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
|
||||
gpu = internalGpu.FullName;
|
||||
|
||||
//Logger.WriteLine(internalGpu.FullName);
|
||||
//Logger.WriteLine(internalGpu.ArchitectInformation.ToString());
|
||||
|
||||
@@ -63,12 +63,12 @@ public class NvidiaGpuControl : IGpuControl
|
||||
IPerformanceStates20Info states = GPUApi.GetPerformanceStates20(internalGpu.Handle);
|
||||
core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000;
|
||||
Logger.WriteLine($"GET GPU Clock offsets : {core}, {memory}");
|
||||
Logger.WriteLine($"GET GPU CLOCKS: {core}, {memory}");
|
||||
return 0;
|
||||
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
Logger.WriteLine("GET GPU CLOCKS:" + ex.Message);
|
||||
core = memory = 0;
|
||||
return -1;
|
||||
}
|
||||
@@ -141,12 +141,12 @@ public class NvidiaGpuControl : IGpuControl
|
||||
|
||||
try
|
||||
{
|
||||
Logger.WriteLine($"SET GPU Clock : {core}, {memory}");
|
||||
Logger.WriteLine($"SET GPU CLOCKS: {core}, {memory}");
|
||||
GPUApi.SetPerformanceStates20(internalGpu.Handle, overclock);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.WriteLine(ex.Message);
|
||||
Logger.WriteLine("SET GPU CLOCKS: "+ex.Message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
9
app/Properties/Strings.Designer.cs
generated
9
app/Properties/Strings.Designer.cs
generated
@@ -825,6 +825,15 @@ namespace GHelper.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Something is using dGPU and blocking Eco mode. Restart dGPU in device manager and try to set Eco again?.
|
||||
/// </summary>
|
||||
internal static string RestartGPU {
|
||||
get {
|
||||
return ResourceManager.GetString("RestartGPU", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to RPM.
|
||||
/// </summary>
|
||||
|
||||
@@ -372,6 +372,9 @@
|
||||
<data name="Quit" xml:space="preserve">
|
||||
<value>Quit</value>
|
||||
</data>
|
||||
<data name="RestartGPU" xml:space="preserve">
|
||||
<value>Something is using dGPU and blocking Eco mode. Restart dGPU in device manager and try to set Eco again?</value>
|
||||
</data>
|
||||
<data name="RPM" xml:space="preserve">
|
||||
<value>RPM</value>
|
||||
</data>
|
||||
|
||||
@@ -1056,17 +1056,18 @@ namespace GHelper
|
||||
|
||||
//if ((gpu_core > -5 && gpu_core < 5) && (gpu_memory > -5 && gpu_memory < 5)) launchAsAdmin = false;
|
||||
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
|
||||
if (HardwareControl.GpuControl is null) return;
|
||||
if (!HardwareControl.GpuControl!.IsNvidia) return;
|
||||
if (Program.wmi.DeviceGet(ASUSWmi.GPUEco) == 1) return;
|
||||
|
||||
using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||
try
|
||||
{
|
||||
int getStatus = nvControl.GetClocks(out int current_core, out int current_memory, out string gpuName);
|
||||
if (getStatus == -1) return;
|
||||
|
||||
if (Math.Abs(gpu_core - current_core) < 5 && Math.Abs(gpu_memory - current_memory) < 5) return;
|
||||
int getStatus = nvControl.GetClocks(out int current_core, out int current_memory);
|
||||
if (getStatus != -1)
|
||||
{
|
||||
if (Math.Abs(gpu_core - current_core) < 5 && Math.Abs(gpu_memory - current_memory) < 5) return;
|
||||
}
|
||||
|
||||
int setStatus = nvControl.SetClocks(gpu_core, gpu_memory);
|
||||
if (launchAsAdmin && setStatus == -1) Program.RunAsAdmin("gpu");
|
||||
@@ -1458,7 +1459,7 @@ namespace GHelper
|
||||
if (HardwareControl.GpuControl is null) return false;
|
||||
if (!HardwareControl.GpuControl!.IsNvidia) return false;
|
||||
|
||||
DialogResult dialogResult = MessageBox.Show("Something is using dGPU and blocking Eco mode. Restart dGPU in a device manager and try to set Eco again?", Properties.Strings.EcoMode, MessageBoxButtons.YesNo);
|
||||
DialogResult dialogResult = MessageBox.Show(Properties.Strings.RestartGPU, Properties.Strings.EcoMode, MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.No) return false;
|
||||
|
||||
Program.RunAsAdmin();
|
||||
|
||||
Reference in New Issue
Block a user