Clean up by setting performance profiles and fan settings to startup levels on exit.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
diff --git a/adl.c b/adl.c
index ea81123..c3ee3c8 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 1bd0e02..1e2540b 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 4774861..bf385e9 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)