Revert "Adjust engine speed up according to performance level engine setting, not the current engine speed." This reverts commit 68217ef6eed95f37da9024f96d098a3114e75c75. This did not have the desired effect and only added complexity.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/adl.c b/adl.c
index b651dba..6c4eb5b 100644
--- a/adl.c
+++ b/adl.c
@@ -1009,8 +1009,7 @@ static void fan_autotune(int gpu, int temp, int fanpercent, bool __maybe_unused
void gpu_autotune(int gpu, bool *enable)
{
- int lev, temp, fanpercent, engine, levengine, newengine, twintemp = 0;
- ADLODPerformanceLevels *lpOdPerformanceLevels;
+ int temp, fanpercent, engine, newengine, twintemp = 0;
bool fan_optimal = true;
struct cgpu_info *cgpu;
struct gpu_adl *ga;
@@ -1018,12 +1017,7 @@ void gpu_autotune(int gpu, bool *enable)
cgpu = &gpus[gpu];
ga = &cgpu->adl;
- lev = ga->lpOdParameters.iNumberOfPerformanceLevels - 1;
- lpOdPerformanceLevels = alloca(sizeof(ADLODPerformanceLevels) + (lev * sizeof(ADLODPerformanceLevel)));
- lpOdPerformanceLevels->iSize = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * lev;
-
lock_adl();
- ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity);
temp = __gpu_temp(ga);
if (ga->twin)
@@ -1032,7 +1026,6 @@ void gpu_autotune(int gpu, bool *enable)
unlock_adl();
newengine = engine = gpu_engineclock(gpu) * 100;
- levengine = lpOdPerformanceLevels->aLevels[lev].iEngineClock * 100;
if (temp && fanpercent >= 0 && ga->autofan) {
if (!ga->twin)
@@ -1065,12 +1058,10 @@ void gpu_autotune(int gpu, bool *enable)
} else if (temp > ga->targettemp + opt_hysteresis && engine > ga->minspeed && fan_optimal) {
applog(LOG_DEBUG, "Temperature %d degrees over target, decreasing clock speed", opt_hysteresis);
newengine = engine - ga->lpOdParameters.sEngineClock.iStep;
- /* Only try to tune engine speed up if this GPU is not
- * disabled, and work off the performance level engine
- * speed, not the current engine speed. */
- } else if (temp < ga->targettemp && levengine < ga->maxspeed && *enable) {
+ /* Only try to tune engine speed up if this GPU is not disabled */
+ } else if (temp < ga->targettemp && engine < ga->maxspeed && *enable) {
applog(LOG_DEBUG, "Temperature below target, increasing clock speed");
- newengine = levengine + ga->lpOdParameters.sEngineClock.iStep;
+ newengine = engine + ga->lpOdParameters.sEngineClock.iStep;
}
if (newengine > ga->maxspeed)