-
Notifications
You must be signed in to change notification settings - Fork 16
/
amdapi_adl.h
108 lines (82 loc) · 4.32 KB
/
amdapi_adl.h
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
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef AMDAPI_ADL_H
#define AMDAPI_ADL_H
#include <QMutex>
#include <QLibrary>
#include <QObject>
#include "adl_sdk.h"
#include "adl_structures.h"
class amdapi_adl : public QLibrary
{
public:
amdapi_adl();
~amdapi_adl();
int getGPUCount();
int getGpuTemperature(int gpu);
int getGPUClock(int gpu);
int getMemClock(int gpu);
int getGpuClock(int gpu);
int getPowerDraw(int gpu);
int getFanSpeed(int gpu);
int setMemClockOffset(int gpu, int clock);
int setGPUOffset(int gpu, int offset);
int setPowerLimitPercent(int gpu, unsigned int percent);
int setTempLimitOffset(int gpu, unsigned int offset);
int setFanSpeed(int gpu, unsigned int percent);
bool isInitialized(){return _isInitialized;}
int getHigherTemp();
int getLowerTemp();
int getHigherFanSpeed();
int getLowerFanSpeed();
int getMemMaxClock();
int getMemLowerClock();
int getGPUMaxClock();
int getGPUMinClock();
int getMaxPowerDraw();
int getMinPowerDraw();
int getPowerDrawSum();
private:
// Definitions of the used function pointers. Add more if you use other ADL APIs
typedef int ( *ADL2_MAIN_CONTROL_CREATE )(ADL_MAIN_MALLOC_CALLBACK, int, ADL_CONTEXT_HANDLE*);
typedef int ( *ADL2_MAIN_CONTROL_DESTROY )(ADL_CONTEXT_HANDLE*);
typedef int ( *ADL_FLUSH_DRIVER_DATA)(int);
typedef int ( *ADL2_ADAPTER_ACTIVE_GET ) (ADL_CONTEXT_HANDLE, int, int* );
typedef int ( *ADL_ADAPTER_NUMBEROFADAPTERS_GET ) ( int* );
typedef int ( *ADL_ADAPTER_ADAPTERINFO_GET ) ( LPAdapterInfo, int );
typedef int ( *ADL_ADAPTERX2_CAPS) (int, int*);
typedef int ( *ADL2_OVERDRIVE_CAPS) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * iSupported, int * iEnabled, int * iVersion);
typedef int ( *ADL2_OVERDRIVEN_CAPABILITIES_GET) (ADL_CONTEXT_HANDLE, int, ADLODNCapabilities*);
typedef int ( *ADL2_OVERDRIVEN_SYSTEMCLOCKS_GET) (ADL_CONTEXT_HANDLE, int, ADLODNPerformanceLevels*);
typedef int ( *ADL2_OVERDRIVEN_SYSTEMCLOCKS_SET) (ADL_CONTEXT_HANDLE, int, ADLODNPerformanceLevels*);
typedef int ( *ADL2_OVERDRIVEN_MEMORYCLOCKS_GET) (ADL_CONTEXT_HANDLE, int, ADLODNPerformanceLevels*);
typedef int ( *ADL2_OVERDRIVEN_MEMORYCLOCKS_SET) (ADL_CONTEXT_HANDLE, int, ADLODNPerformanceLevels*);
typedef int ( *ADL2_OVERDRIVEN_PERFORMANCESTATUS_GET) (ADL_CONTEXT_HANDLE, int, ADLODNPerformanceStatus*);
typedef int ( *ADL2_OVERDRIVEN_FANCONTROL_GET) (ADL_CONTEXT_HANDLE, int, ADLODNFanControl*);
typedef int ( *ADL2_OVERDRIVEN_FANCONTROL_SET) (ADL_CONTEXT_HANDLE, int, ADLODNFanControl*);
typedef int ( *ADL2_OVERDRIVEN_POWERLIMIT_GET) (ADL_CONTEXT_HANDLE, int, ADLODNPowerLimitSetting*);
typedef int ( *ADL2_OVERDRIVEN_POWERLIMIT_SET) (ADL_CONTEXT_HANDLE, int, ADLODNPowerLimitSetting*);
typedef int ( *ADL2_OVERDRIVEN_TEMPERATURE_GET) (ADL_CONTEXT_HANDLE, int, int, int*);
ADL2_MAIN_CONTROL_CREATE ADL2_Main_Control_Create = NULL;
ADL2_MAIN_CONTROL_DESTROY ADL2_Main_Control_Destroy = NULL;
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get = NULL;
ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get = NULL;
ADL_ADAPTERX2_CAPS ADL_AdapterX2_Caps = NULL;
ADL2_ADAPTER_ACTIVE_GET ADL2_Adapter_Active_Get=NULL;
ADL2_OVERDRIVEN_CAPABILITIES_GET ADL2_OverdriveN_Capabilities_Get = NULL;
ADL2_OVERDRIVEN_SYSTEMCLOCKS_GET ADL2_OverdriveN_SystemClocks_Get = NULL;
ADL2_OVERDRIVEN_SYSTEMCLOCKS_SET ADL2_OverdriveN_SystemClocks_Set = NULL;
ADL2_OVERDRIVEN_PERFORMANCESTATUS_GET ADL2_OverdriveN_PerformanceStatus_Get = NULL;
ADL2_OVERDRIVEN_FANCONTROL_GET ADL2_OverdriveN_FanControl_Get =NULL;
ADL2_OVERDRIVEN_FANCONTROL_SET ADL2_OverdriveN_FanControl_Set=NULL;
ADL2_OVERDRIVEN_POWERLIMIT_GET ADL2_OverdriveN_PowerLimit_Get =NULL;
ADL2_OVERDRIVEN_POWERLIMIT_SET ADL2_OverdriveN_PowerLimit_Set=NULL;
ADL2_OVERDRIVEN_MEMORYCLOCKS_GET ADL2_OverdriveN_MemoryClocks_Get = NULL;
ADL2_OVERDRIVEN_MEMORYCLOCKS_GET ADL2_OverdriveN_MemoryClocks_Set = NULL;
ADL2_OVERDRIVE_CAPS ADL2_Overdrive_Caps = NULL;
ADL2_OVERDRIVEN_TEMPERATURE_GET ADL2_OverdriveN_Temperature_Get = NULL;
private:
bool _isInitialized;
int _gpuCount;
ADL_CONTEXT_HANDLE _context;
LPAdapterInfo _lpAdapterInfo;
};
#endif // AMDAPI_ADL_H