Browse Source

Adjust engine speed up according to performance level engine setting, not the current engine speed.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
68217ef6ee
  1. 17
      adl.c

17
adl.c

@ -1009,7 +1009,8 @@ static void fan_autotune(int gpu, int temp, int fanpercent, bool __maybe_unused
void gpu_autotune(int gpu, bool *enable) void gpu_autotune(int gpu, bool *enable)
{ {
int temp, fanpercent, engine, newengine, twintemp = 0; int lev, temp, fanpercent, engine, levengine, newengine, twintemp = 0;
ADLODPerformanceLevels *lpOdPerformanceLevels;
bool fan_optimal = true; bool fan_optimal = true;
struct cgpu_info *cgpu; struct cgpu_info *cgpu;
struct gpu_adl *ga; struct gpu_adl *ga;
@ -1017,7 +1018,12 @@ void gpu_autotune(int gpu, bool *enable)
cgpu = &gpus[gpu]; cgpu = &gpus[gpu];
ga = &cgpu->adl; ga = &cgpu->adl;
lev = ga->lpOdParameters.iNumberOfPerformanceLevels - 1;
lpOdPerformanceLevels = alloca(sizeof(ADLODPerformanceLevels) + (lev * sizeof(ADLODPerformanceLevel)));
lpOdPerformanceLevels->iSize = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * lev;
lock_adl(); lock_adl();
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity); ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity);
temp = __gpu_temp(ga); temp = __gpu_temp(ga);
if (ga->twin) if (ga->twin)
@ -1026,6 +1032,7 @@ void gpu_autotune(int gpu, bool *enable)
unlock_adl(); unlock_adl();
newengine = engine = gpu_engineclock(gpu) * 100; newengine = engine = gpu_engineclock(gpu) * 100;
levengine = lpOdPerformanceLevels->aLevels[lev].iEngineClock * 100;
if (temp && fanpercent >= 0 && ga->autofan) { if (temp && fanpercent >= 0 && ga->autofan) {
if (!ga->twin) if (!ga->twin)
@ -1058,10 +1065,12 @@ void gpu_autotune(int gpu, bool *enable)
} else if (temp > ga->targettemp + opt_hysteresis && engine > ga->minspeed && fan_optimal) { } 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); applog(LOG_DEBUG, "Temperature %d degrees over target, decreasing clock speed", opt_hysteresis);
newengine = engine - ga->lpOdParameters.sEngineClock.iStep; newengine = engine - ga->lpOdParameters.sEngineClock.iStep;
/* Only try to tune engine speed up if this GPU is not disabled */ /* Only try to tune engine speed up if this GPU is not
} else if (temp < ga->targettemp && engine < ga->maxspeed && *enable) { * disabled, and work off the performance level engine
* speed, not the current engine speed. */
} else if (temp < ga->targettemp && levengine < ga->maxspeed && *enable) {
applog(LOG_DEBUG, "Temperature below target, increasing clock speed"); applog(LOG_DEBUG, "Temperature below target, increasing clock speed");
newengine = engine + ga->lpOdParameters.sEngineClock.iStep; newengine = levengine + ga->lpOdParameters.sEngineClock.iStep;
} }
if (newengine > ga->maxspeed) if (newengine > ga->maxspeed)

Loading…
Cancel
Save