mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Do not bother resetting values to old ones if changes to GPU parameters report failure, instead returning a failure code only if the return value from get() differs.
This commit is contained in:
parent
dff1a81da7
commit
ebae03f22b
56
adl.c
56
adl.c
@ -605,19 +605,10 @@ static int set_engineclock(int gpu, int iEngineClock)
|
|||||||
lpOdPerformanceLevels->aLevels[i].iEngineClock = iEngineClock;
|
lpOdPerformanceLevels->aLevels[i].iEngineClock = iEngineClock;
|
||||||
}
|
}
|
||||||
lpOdPerformanceLevels->aLevels[lev].iEngineClock = iEngineClock;
|
lpOdPerformanceLevels->aLevels[lev].iEngineClock = iEngineClock;
|
||||||
if (ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels) != ADL_OK)
|
|
||||||
goto out;
|
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
|
||||||
/* Reset to old value if it fails! */
|
|
||||||
if (lpOdPerformanceLevels->aLevels[lev].iEngineClock != iEngineClock) {
|
|
||||||
/* Set all the parameters in case they're linked somehow */
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iEngineClock = ga->iEngineClock;
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iMemoryClock = ga->iMemoryClock;
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iVddc = ga->iVddc;
|
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels);
|
ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels);
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
||||||
goto out;
|
if (lpOdPerformanceLevels->aLevels[lev].iEngineClock == iEngineClock)
|
||||||
}
|
ret = 0;
|
||||||
ga->iEngineClock = lpOdPerformanceLevels->aLevels[lev].iEngineClock;
|
ga->iEngineClock = lpOdPerformanceLevels->aLevels[lev].iEngineClock;
|
||||||
if (ga->iEngineClock > ga->maxspeed)
|
if (ga->iEngineClock > ga->maxspeed)
|
||||||
ga->maxspeed = ga->iEngineClock;
|
ga->maxspeed = ga->iEngineClock;
|
||||||
@ -626,7 +617,6 @@ static int set_engineclock(int gpu, int iEngineClock)
|
|||||||
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
|
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
|
||||||
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
|
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
|
||||||
ga->managed = true;
|
ga->managed = true;
|
||||||
ret = 0;
|
|
||||||
out:
|
out:
|
||||||
unlock_adl();
|
unlock_adl();
|
||||||
return ret;
|
return ret;
|
||||||
@ -671,24 +661,14 @@ static int set_memoryclock(int gpu, int iMemoryClock)
|
|||||||
if (lpOdPerformanceLevels->aLevels[i].iMemoryClock > iMemoryClock)
|
if (lpOdPerformanceLevels->aLevels[i].iMemoryClock > iMemoryClock)
|
||||||
lpOdPerformanceLevels->aLevels[i].iMemoryClock = iMemoryClock;
|
lpOdPerformanceLevels->aLevels[i].iMemoryClock = iMemoryClock;
|
||||||
}
|
}
|
||||||
if (ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels) != ADL_OK)
|
|
||||||
goto out;
|
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
|
||||||
/* Reset to old value if it fails! */
|
|
||||||
if (lpOdPerformanceLevels->aLevels[lev].iMemoryClock != iMemoryClock) {
|
|
||||||
/* Set all the parameters in case they're linked somehow */
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iMemoryClock = ga->iEngineClock;
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iMemoryClock = ga->iMemoryClock;
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iVddc = ga->iVddc;
|
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels);
|
ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels);
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
||||||
goto out;
|
if (lpOdPerformanceLevels->aLevels[lev].iMemoryClock == iMemoryClock)
|
||||||
}
|
ret = 0;
|
||||||
ga->iEngineClock = lpOdPerformanceLevels->aLevels[lev].iEngineClock;
|
ga->iEngineClock = lpOdPerformanceLevels->aLevels[lev].iEngineClock;
|
||||||
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
|
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
|
||||||
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
|
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
|
||||||
ga->managed = true;
|
ga->managed = true;
|
||||||
ret = 0;
|
|
||||||
out:
|
out:
|
||||||
unlock_adl();
|
unlock_adl();
|
||||||
return ret;
|
return ret;
|
||||||
@ -744,24 +724,14 @@ static int set_vddc(int gpu, float fVddc)
|
|||||||
lpOdPerformanceLevels->aLevels[i].iVddc = iVddc;
|
lpOdPerformanceLevels->aLevels[i].iVddc = iVddc;
|
||||||
}
|
}
|
||||||
lpOdPerformanceLevels->aLevels[lev].iVddc = iVddc;
|
lpOdPerformanceLevels->aLevels[lev].iVddc = iVddc;
|
||||||
if (ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels) != ADL_OK)
|
|
||||||
goto out;
|
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
|
||||||
/* Reset to old value if it fails! */
|
|
||||||
if (lpOdPerformanceLevels->aLevels[lev].iVddc != iVddc) {
|
|
||||||
/* Set all the parameters in case they're linked somehow */
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iEngineClock = ga->iEngineClock;
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iMemoryClock = ga->iMemoryClock;
|
|
||||||
lpOdPerformanceLevels->aLevels[lev].iVddc = ga->iVddc;
|
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels);
|
ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, lpOdPerformanceLevels);
|
||||||
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
ADL_Overdrive5_ODPerformanceLevels_Get(ga->iAdapterIndex, 0, lpOdPerformanceLevels);
|
||||||
goto out;
|
if (lpOdPerformanceLevels->aLevels[lev].iVddc == iVddc)
|
||||||
}
|
ret = 0;
|
||||||
ga->iEngineClock = lpOdPerformanceLevels->aLevels[lev].iEngineClock;
|
ga->iEngineClock = lpOdPerformanceLevels->aLevels[lev].iEngineClock;
|
||||||
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
|
ga->iMemoryClock = lpOdPerformanceLevels->aLevels[lev].iMemoryClock;
|
||||||
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
|
ga->iVddc = lpOdPerformanceLevels->aLevels[lev].iVddc;
|
||||||
ga->managed = true;
|
ga->managed = true;
|
||||||
ret = 0;
|
|
||||||
out:
|
out:
|
||||||
unlock_adl();
|
unlock_adl();
|
||||||
return ret;
|
return ret;
|
||||||
@ -809,10 +779,9 @@ static int set_fanspeed(int gpu, int iFanSpeed)
|
|||||||
} else
|
} else
|
||||||
ga->lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
ga->lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||||
ga->lpFanSpeedValue.iFanSpeed = iFanSpeed;
|
ga->lpFanSpeedValue.iFanSpeed = iFanSpeed;
|
||||||
if (ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue) != ADL_OK)
|
if (ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->lpFanSpeedValue) == ADL_OK)
|
||||||
goto out;
|
|
||||||
ga->managed = true;
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
ga->managed = true;
|
||||||
out:
|
out:
|
||||||
unlock_adl();
|
unlock_adl();
|
||||||
return ret;
|
return ret;
|
||||||
@ -833,14 +802,11 @@ static int set_powertune(int gpu, int iPercentage)
|
|||||||
oldPercentage = ga->iPercentage;
|
oldPercentage = ga->iPercentage;
|
||||||
|
|
||||||
lock_adl();
|
lock_adl();
|
||||||
if (ADL_Overdrive5_PowerControl_Set(ga->iAdapterIndex, iPercentage) != ADL_OK) {
|
ADL_Overdrive5_PowerControl_Set(ga->iAdapterIndex, iPercentage);
|
||||||
ADL_Overdrive5_PowerControl_Set(ga->iAdapterIndex, ga->iPercentage);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
ADL_Overdrive5_PowerControl_Get(ga->iAdapterIndex, &ga->iPercentage, &dummy);
|
ADL_Overdrive5_PowerControl_Get(ga->iAdapterIndex, &ga->iPercentage, &dummy);
|
||||||
ga->managed = true;
|
if (ga->iPercentage == iPercentage)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
out:
|
ga->managed = true;
|
||||||
unlock_adl();
|
unlock_adl();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user