|
|
|
@ -249,20 +249,14 @@ void init_adl(int nDevs)
@@ -249,20 +249,14 @@ void init_adl(int nDevs)
|
|
|
|
|
adl_active = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float gpu_temp(int gpu) |
|
|
|
|
static inline float __gpu_temp(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
|
if (!gpus[gpu].has_adl || !adl_active) |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (ADL_Overdrive5_Temperature_Get(ga->iAdapterIndex, 0, &ga->lpTemperature) != ADL_OK) |
|
|
|
|
return 0; |
|
|
|
|
return (float)ga->lpTemperature.iTemperature / 1000; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int gpu_engineclock(int gpu) |
|
|
|
|
float gpu_temp(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
@ -270,12 +264,15 @@ int gpu_engineclock(int gpu)
@@ -270,12 +264,15 @@ int gpu_engineclock(int gpu)
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity) != ADL_OK) |
|
|
|
|
return 0; |
|
|
|
|
return __gpu_temp(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline int __gpu_engineclock(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
return ga->lpActivity.iEngineClock / 100; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int gpu_memclock(int gpu) |
|
|
|
|
int gpu_engineclock(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
@ -285,10 +282,15 @@ int gpu_memclock(int gpu)
@@ -285,10 +282,15 @@ int gpu_memclock(int gpu)
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity) != ADL_OK) |
|
|
|
|
return 0; |
|
|
|
|
return __gpu_engineclock(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline int __gpu_memclock(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
return ga->lpActivity.iMemoryClock / 100; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float gpu_vddc(int gpu) |
|
|
|
|
int gpu_memclock(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
@ -298,10 +300,15 @@ float gpu_vddc(int gpu)
@@ -298,10 +300,15 @@ float gpu_vddc(int gpu)
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity) != ADL_OK) |
|
|
|
|
return 0; |
|
|
|
|
return __gpu_memclock(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline float __gpu_vddc(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
return (float)ga->lpActivity.iVddc / 1000; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int gpu_activity(int gpu) |
|
|
|
|
float gpu_vddc(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
@ -309,14 +316,19 @@ int gpu_activity(int gpu)
@@ -309,14 +316,19 @@ int gpu_activity(int gpu)
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (!ga->lpOdParameters.iActivityReportingSupported) |
|
|
|
|
return 0; |
|
|
|
|
if (ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity) != ADL_OK) |
|
|
|
|
return 0; |
|
|
|
|
return __gpu_vddc(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline int __gpu_activity(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
if (!ga->lpOdParameters.iActivityReportingSupported) |
|
|
|
|
return 0; |
|
|
|
|
return ga->lpActivity.iActivityPercent; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int gpu_fanspeed(int gpu) |
|
|
|
|
int gpu_activity(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
@ -324,6 +336,13 @@ int gpu_fanspeed(int gpu)
@@ -324,6 +336,13 @@ int gpu_fanspeed(int gpu)
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity) != ADL_OK) |
|
|
|
|
return 0; |
|
|
|
|
return __gpu_activity(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline int __gpu_fanspeed(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
if (!(ga->lpFanSpeedInfo.iFlags & ADL_DL_FANCTRL_SUPPORTS_RPM_READ)) |
|
|
|
|
return 0; |
|
|
|
|
ga->lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_RPM; |
|
|
|
@ -332,14 +351,19 @@ int gpu_fanspeed(int gpu)
@@ -332,14 +351,19 @@ int gpu_fanspeed(int gpu)
|
|
|
|
|
return ga->lpFanSpeedValue.iFanSpeed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int gpu_fanpercent(int gpu) |
|
|
|
|
int gpu_fanspeed(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
|
if (!gpus[gpu].has_adl || !adl_active) |
|
|
|
|
return -1; |
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
return __gpu_fanspeed(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline int __gpu_fanpercent(struct gpu_adl *ga) |
|
|
|
|
{ |
|
|
|
|
if (!(ga->lpFanSpeedInfo.iFlags & ADL_DL_FANCTRL_SUPPORTS_PERCENT_READ )) |
|
|
|
|
return -1; |
|
|
|
|
ga->lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT; |
|
|
|
@ -348,6 +372,44 @@ int gpu_fanpercent(int gpu)
@@ -348,6 +372,44 @@ int gpu_fanpercent(int gpu)
|
|
|
|
|
return ga->lpFanSpeedValue.iFanSpeed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int gpu_fanpercent(int gpu) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
|
if (!gpus[gpu].has_adl || !adl_active) |
|
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
return __gpu_fanpercent(ga); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vddc, |
|
|
|
|
int *activity, int *fanspeed, int *fanpercent) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
|
|
|
|
|
|
if (!gpus[gpu].has_adl || !adl_active) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
*temp = __gpu_temp(ga); |
|
|
|
|
if (ADL_Overdrive5_CurrentActivity_Get(ga->iAdapterIndex, &ga->lpActivity) != ADL_OK) { |
|
|
|
|
*engineclock = 0; |
|
|
|
|
*memclock = 0; |
|
|
|
|
*vddc = 0; |
|
|
|
|
*activity = 0; |
|
|
|
|
} else { |
|
|
|
|
*engineclock = __gpu_engineclock(ga); |
|
|
|
|
*memclock = __gpu_memclock(ga); |
|
|
|
|
*vddc = __gpu_vddc(ga); |
|
|
|
|
*activity = __gpu_activity(ga); |
|
|
|
|
} |
|
|
|
|
*fanspeed = __gpu_fanspeed(ga); |
|
|
|
|
*fanpercent = __gpu_fanpercent(ga); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void get_enginerange(int gpu, int *imin, int *imax) |
|
|
|
|
{ |
|
|
|
|
struct gpu_adl *ga; |
|
|
|
@ -578,11 +640,11 @@ void gpu_autotune(int gpu)
@@ -578,11 +640,11 @@ void gpu_autotune(int gpu)
|
|
|
|
|
if (!gpus[gpu].has_adl || !adl_active) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
temp = gpu_temp(gpu); |
|
|
|
|
newpercent = fanpercent = gpu_fanpercent(gpu); |
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
temp = __gpu_temp(ga); |
|
|
|
|
newpercent = fanpercent = __gpu_fanpercent(ga); |
|
|
|
|
newengine = engine = gpu_engineclock(gpu) * 100; |
|
|
|
|
|
|
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
|
if (temp && fanpercent >= 0 && ga->autofan) { |
|
|
|
|
if (temp > ga->overtemp && fanpercent < 100) { |
|
|
|
|
applog(LOG_WARNING, "Overheat detected, increasing fan to 100%"); |
|
|
|
@ -687,9 +749,12 @@ void change_gpusettings(int gpu)
@@ -687,9 +749,12 @@ void change_gpusettings(int gpu)
|
|
|
|
|
float fval, fmin = 0, fmax = 0; |
|
|
|
|
int val, imin = 0, imax = 0; |
|
|
|
|
char input; |
|
|
|
|
int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0; |
|
|
|
|
float temp = 0, vddc = 0; |
|
|
|
|
|
|
|
|
|
wlogprint("Temp: %.1f °C\nFan Speed: %d RPM\nEngine Clock: %d MHz\nMemory Clock: %d Mhz\nVddc: %.3f V\nActivity: %d%%\n", |
|
|
|
|
gpu_temp(gpu), gpu_fanspeed(gpu), gpu_engineclock(gpu), gpu_memclock(gpu), gpu_vddc(gpu), gpu_activity(gpu)); |
|
|
|
|
if (gpu_stats(gpu, &temp, &engineclock, &memclock, &vddc, &activity, &fanspeed, &fanpercent)) |
|
|
|
|
wlogprint("Temp: %.1f °C\nFan Speed: %d%% (%d RPM)\nEngine Clock: %d MHz\nMemory Clock: %d Mhz\nVddc: %.3f V\nActivity: %d%%\n", |
|
|
|
|
temp, fanpercent, fanspeed, engineclock, memclock, vddc, activity); |
|
|
|
|
wlogprint("Fan autotune is %s\n", ga->autofan ? "enabled" : "disabled"); |
|
|
|
|
wlogprint("GPU engine clock autotune is %s\n", ga->autoengine ? "enabled" : "disabled"); |
|
|
|
|
wlogprint("Change [A]utomatic [E]ngine [F]an [M]emory [V]oltage\n"); |
|
|
|
|