Skip to content

Commit

Permalink
Fix gfxWatchdog
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed May 30, 2023
1 parent 0a32c48 commit 9fc273c
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions HandheldCompanion/Managers/PerformanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private void cpuWatchdog_Elapsed(object? sender, ElapsedEventArgs e)

double ReadTDP = CurrentTDP[idx];

if (ReadTDP > byte.MinValue && ReadTDP < byte.MaxValue)
if (ReadTDP != 0)
cpuWatchdog.Interval = INTERVAL_DEFAULT;
else
cpuWatchdog.Interval = INTERVAL_DEGRADED;
Expand All @@ -428,13 +428,6 @@ private void cpuWatchdog_Elapsed(object? sender, ElapsedEventArgs e)
// processor specific
if (processor.GetType() == typeof(IntelProcessor))
{
// not ready yet
if (CurrentTDP[(int)PowerType.MsrSlow] == 0 || CurrentTDP[(int)PowerType.MsrFast] == 0)
{
Monitor.Exit(cpuLock);
return;
}

int TDPslow = (int)StoredTDP[(int)PowerType.Slow];
int TDPfast = (int)StoredTDP[(int)PowerType.Fast];

Expand All @@ -461,26 +454,12 @@ private void gfxWatchdog_Elapsed(object? sender, ElapsedEventArgs e)

if (Monitor.TryEnter(gfxLock))
{
bool GPUdone = false;

if (processor.GetType() == typeof(AMDProcessor))
{
// not ready yet
if (CurrentGfxClock == 0)
{
Monitor.Exit(gfxLock);
return;
}
}
else if (processor.GetType() == typeof(IntelProcessor))
{
// not ready yet
if (CurrentGfxClock == 0)
{
Monitor.Exit(gfxLock);
return;
}
}
bool GPUdone = false;

if (CurrentGfxClock != 0)
gfxWatchdog.Interval = INTERVAL_DEFAULT;
else
gfxWatchdog.Interval = INTERVAL_DEGRADED;

// not ready yet
if (StoredGfxClock == 0)
Expand Down

0 comments on commit 9fc273c

Please sign in to comment.