diff --git a/adl.c b/adl.c index ea811233..c3ee3c8f 100644 --- a/adl.c +++ b/adl.c @@ -190,6 +190,8 @@ void init_adl(int nDevs) ga->iAdapterIndex = iAdapterIndex; ga->lpAdapterID = lpAdapterID; ga->lpStatus = lpStatus; + ga->DefPerfLev = NULL; + if (ADL_Overdrive5_ODParameters_Get(iAdapterIndex, &ga->lpOdParameters) != ADL_OK) { applog(LOG_INFO, "Failed to ADL_Overdrive5_ODParameters_Get"); continue; @@ -653,8 +655,6 @@ void change_autosettings(int gpu) struct gpu_adl *ga = &gpus[gpu].adl; char input; - wlogprint("Fan autotune is %s\n", ga->autofan ? "enabled" : "disabled"); - wlogprint("GPU engine clock autotune is %s\n", ga->autoengine ? "enabled" : "disabled"); wlogprint("Target temperature: %d\n", ga->targettemp); wlogprint("Overheat temperature: %d\n", ga->overtemp); wlogprint("Toggle [F]an auto [G]PU auto, change [T]arget [O]verheat\n"); @@ -679,10 +679,15 @@ void change_autosettings(int gpu) void change_gpusettings(int gpu) { - int val, imin = 0, imax = 0; + struct gpu_adl *ga = &gpus[gpu].adl; float fval, fmin = 0, fmax = 0; + int val, imin = 0, imax = 0; char input; + 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)); + 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"); wlogprint("Or press any other key to continue\n"); input = getch(); @@ -750,11 +755,24 @@ void change_gpusettings(int gpu) input = getch(); } -void clear_adl(void) +void clear_adl(nDevs) { + struct gpu_adl *ga; + int i; + if (!adl_active) return; + /* Try to reset values to their defaults */ + for (i = 0; i < nDevs; i++) { + ga = &gpus[i].adl; + if (!gpus[i].has_adl) + continue; + ADL_Overdrive5_ODPerformanceLevels_Set(ga->iAdapterIndex, ga->DefPerfLev); + free(ga->DefPerfLev); + ADL_Overdrive5_FanSpeed_Set(ga->iAdapterIndex, 0, &ga->DefFanSpeedValue); + } + ADL_Main_Memory_Free ( (void **)&lpInfo ); ADL_Main_Control_Destroy (); diff --git a/adl.h b/adl.h index 1bd0e022..1e2540bb 100644 --- a/adl.h +++ b/adl.h @@ -11,11 +11,11 @@ int gpu_activity(int gpu); int gpu_fanspeed(int gpu); void change_gpusettings(int gpu); void gpu_autotune(int gpu); -void clear_adl(void); +void clear_adl(int nDevs); #else /* HAVE_ADL */ void init_adl(int nDevs) {} void change_gpusettings(int gpu) { } void gpu_autotune(int gpu) { } -void clear_adl(void) {} +void clear_adl(int nDevs) {} #endif #endif diff --git a/main.c b/main.c index 47748615..bf385e96 100644 --- a/main.c +++ b/main.c @@ -5163,7 +5163,7 @@ int main (int argc, char *argv[]) print_summary(); #ifdef HAVE_OPENCL - clear_adl(); + clear_adl(nDevs); #endif if (gpu_threads)