|
|
@ -39,6 +39,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
bool adl_active; |
|
|
|
bool adl_active; |
|
|
|
bool opt_reorder = false; |
|
|
|
bool opt_reorder = false; |
|
|
|
|
|
|
|
bool adl6 = false; |
|
|
|
|
|
|
|
|
|
|
|
int opt_hysteresis = 3; |
|
|
|
int opt_hysteresis = 3; |
|
|
|
const int opt_targettemp = 75; |
|
|
|
const int opt_targettemp = 75; |
|
|
@ -63,7 +64,7 @@ static void * __stdcall ADL_Main_Memory_Alloc(int iSize) |
|
|
|
// Optional Memory de-allocation function
|
|
|
|
// Optional Memory de-allocation function
|
|
|
|
static void __stdcall ADL_Main_Memory_Free (void **lpBuffer) |
|
|
|
static void __stdcall ADL_Main_Memory_Free (void **lpBuffer) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (*lpBuffer) { |
|
|
|
if (NULL != *lpBuffer) { |
|
|
|
free (*lpBuffer); |
|
|
|
free (*lpBuffer); |
|
|
|
*lpBuffer = NULL; |
|
|
|
*lpBuffer = NULL; |
|
|
|
} |
|
|
|
} |
|
|
@ -77,13 +78,15 @@ static void *GetProcAddress(void *pLibrary, const char *name) |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
static ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; |
|
|
|
static ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; |
|
|
|
static ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; |
|
|
|
static ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; |
|
|
|
static ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get; |
|
|
|
static ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get; |
|
|
|
static ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get; |
|
|
|
static ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get; |
|
|
|
static ADL_ADAPTER_ID_GET ADL_Adapter_ID_Get; |
|
|
|
static ADL_ADAPTER_ID_GET ADL_Adapter_ID_Get; |
|
|
|
static ADL_MAIN_CONTROL_REFRESH ADL_Main_Control_Refresh; |
|
|
|
static ADL_MAIN_CONTROL_REFRESH ADL_Main_Control_Refresh; |
|
|
|
static ADL_ADAPTER_VIDEOBIOSINFO_GET ADL_Adapter_VideoBiosInfo_Get; |
|
|
|
static ADL_ADAPTER_VIDEOBIOSINFO_GET ADL_Adapter_VideoBiosInfo_Get; |
|
|
|
|
|
|
|
static ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get; |
|
|
|
|
|
|
|
static ADL_ADAPTER_ACCESSIBILITY_GET ADL_Adapter_Accessibility_Get; |
|
|
|
|
|
|
|
|
|
|
|
static ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps; |
|
|
|
static ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps; |
|
|
|
|
|
|
|
|
|
|
@ -119,6 +122,7 @@ static ADL_OVERDRIVE6_POWERCONTROL_SET ADL_Overdrive6_PowerControl_Set; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
static int iNumberAdapters; |
|
|
|
static int iNumberAdapters; |
|
|
|
static LPAdapterInfo lpInfo = NULL; |
|
|
|
static LPAdapterInfo lpInfo = NULL; |
|
|
|
|
|
|
|
static LPADLDisplayInfo lpAdlDisplayInfo = NULL; |
|
|
|
|
|
|
|
|
|
|
|
int set_fanspeed(int gpu, int iFanSpeed); |
|
|
|
int set_fanspeed(int gpu, int iFanSpeed); |
|
|
|
static float __gpu_temp(struct gpu_adl *ga); |
|
|
|
static float __gpu_temp(struct gpu_adl *ga); |
|
|
@ -169,6 +173,10 @@ static bool init_overdrive5() |
|
|
|
applog(LOG_WARNING, "ATI ADL Overdrive5's API is missing"); |
|
|
|
applog(LOG_WARNING, "ATI ADL Overdrive5's API is missing"); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
applog(LOG_INFO, "ATI ADL Overdrive5 API found."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -197,6 +205,11 @@ static bool init_overdrive6() |
|
|
|
applog(LOG_WARNING, "ATI ADL Overdrive6's API is missing"); |
|
|
|
applog(LOG_WARNING, "ATI ADL Overdrive6's API is missing"); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
adl6 = true; |
|
|
|
|
|
|
|
applog(LOG_INFO, "ATI ADL Overdrive6 API found."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -222,12 +235,17 @@ static bool prepare_adl(void) |
|
|
|
ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY) GetProcAddress(hDLL,"ADL_Main_Control_Destroy"); |
|
|
|
ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY) GetProcAddress(hDLL,"ADL_Main_Control_Destroy"); |
|
|
|
ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET) GetProcAddress(hDLL,"ADL_Adapter_NumberOfAdapters_Get"); |
|
|
|
ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET) GetProcAddress(hDLL,"ADL_Adapter_NumberOfAdapters_Get"); |
|
|
|
ADL_Adapter_AdapterInfo_Get = (ADL_ADAPTER_ADAPTERINFO_GET) GetProcAddress(hDLL,"ADL_Adapter_AdapterInfo_Get"); |
|
|
|
ADL_Adapter_AdapterInfo_Get = (ADL_ADAPTER_ADAPTERINFO_GET) GetProcAddress(hDLL,"ADL_Adapter_AdapterInfo_Get"); |
|
|
|
|
|
|
|
ADL_Display_DisplayInfo_Get = (ADL_DISPLAY_DISPLAYINFO_GET) GetProcAddress(hDLL,"ADL_Display_DisplayInfo_Get"); |
|
|
|
ADL_Adapter_ID_Get = (ADL_ADAPTER_ID_GET) GetProcAddress(hDLL,"ADL_Adapter_ID_Get"); |
|
|
|
ADL_Adapter_ID_Get = (ADL_ADAPTER_ID_GET) GetProcAddress(hDLL,"ADL_Adapter_ID_Get"); |
|
|
|
ADL_Main_Control_Refresh = (ADL_MAIN_CONTROL_REFRESH) GetProcAddress(hDLL, "ADL_Main_Control_Refresh"); |
|
|
|
ADL_Main_Control_Refresh = (ADL_MAIN_CONTROL_REFRESH) GetProcAddress(hDLL, "ADL_Main_Control_Refresh"); |
|
|
|
ADL_Adapter_VideoBiosInfo_Get = (ADL_ADAPTER_VIDEOBIOSINFO_GET)GetProcAddress(hDLL,"ADL_Adapter_VideoBiosInfo_Get"); |
|
|
|
ADL_Adapter_VideoBiosInfo_Get = (ADL_ADAPTER_VIDEOBIOSINFO_GET)GetProcAddress(hDLL,"ADL_Adapter_VideoBiosInfo_Get"); |
|
|
|
ADL_Overdrive_Caps = (ADL_OVERDRIVE_CAPS)GetProcAddress(hDLL, "ADL_Overdrive_Caps"); |
|
|
|
ADL_Overdrive_Caps = (ADL_OVERDRIVE_CAPS)GetProcAddress(hDLL, "ADL_Overdrive_Caps"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ADL_Adapter_Accessibility_Get = (ADL_ADAPTER_ACCESSIBILITY_GET)GetProcAddress(hDLL, "ADL_Adapter_Accessibility_Get"); |
|
|
|
|
|
|
|
|
|
|
|
if (!ADL_Main_Control_Create || !ADL_Main_Control_Destroy || |
|
|
|
if (!ADL_Main_Control_Create || !ADL_Main_Control_Destroy || |
|
|
|
!ADL_Adapter_NumberOfAdapters_Get || !ADL_Adapter_AdapterInfo_Get || |
|
|
|
!ADL_Adapter_NumberOfAdapters_Get || !ADL_Adapter_AdapterInfo_Get || |
|
|
|
|
|
|
|
!ADL_Display_DisplayInfo_Get || |
|
|
|
!ADL_Adapter_ID_Get || !ADL_Main_Control_Refresh || |
|
|
|
!ADL_Adapter_ID_Get || !ADL_Main_Control_Refresh || |
|
|
|
!ADL_Adapter_VideoBiosInfo_Get || !ADL_Overdrive_Caps) { |
|
|
|
!ADL_Adapter_VideoBiosInfo_Get || !ADL_Overdrive_Caps) { |
|
|
|
applog(LOG_WARNING, "ATI ADL's API is missing"); |
|
|
|
applog(LOG_WARNING, "ATI ADL's API is missing"); |
|
|
@ -249,6 +267,7 @@ static bool prepare_adl(void) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
init_overdrive5(); |
|
|
|
init_overdrive5(); |
|
|
|
|
|
|
|
init_overdrive6(); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -258,6 +277,10 @@ void init_adl(int nDevs) |
|
|
|
int result, i, j, devices = 0, last_adapter = -1, gpu = 0, dummy = 0; |
|
|
|
int result, i, j, devices = 0, last_adapter = -1, gpu = 0, dummy = 0; |
|
|
|
struct gpu_adapters adapters[MAX_GPUDEVICES], vadapters[MAX_GPUDEVICES]; |
|
|
|
struct gpu_adapters adapters[MAX_GPUDEVICES], vadapters[MAX_GPUDEVICES]; |
|
|
|
bool devs_match = true; |
|
|
|
bool devs_match = true; |
|
|
|
|
|
|
|
ADLBiosInfo BiosInfo; |
|
|
|
|
|
|
|
int iNumDisplays; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "Number of ADL devices %d", nDevs); |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(pthread_mutex_init(&adl_lock, NULL))) { |
|
|
|
if (unlikely(pthread_mutex_init(&adl_lock, NULL))) { |
|
|
|
applog(LOG_ERR, "Failed to init adl_lock in init_adl"); |
|
|
|
applog(LOG_ERR, "Failed to init adl_lock in init_adl"); |
|
|
@ -290,14 +313,24 @@ void init_adl(int nDevs) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "Found %d ADL adapters", iNumberAdapters); |
|
|
|
|
|
|
|
|
|
|
|
/* Iterate over iNumberAdapters and find the lpAdapterID of real devices */ |
|
|
|
/* Iterate over iNumberAdapters and find the lpAdapterID of real devices */ |
|
|
|
for (i = 0; i < iNumberAdapters; i++) { |
|
|
|
for (i = 0; i < iNumberAdapters; i++) { |
|
|
|
int iAdapterIndex; |
|
|
|
int iAdapterIndex; |
|
|
|
int lpAdapterID; |
|
|
|
int lpAdapterID; |
|
|
|
|
|
|
|
|
|
|
|
iAdapterIndex = lpInfo[i].iAdapterIndex; |
|
|
|
iAdapterIndex = lpInfo[i].iAdapterIndex; |
|
|
|
|
|
|
|
|
|
|
|
/* Get unique identifier of the adapter, 0 means not AMD */ |
|
|
|
/* Get unique identifier of the adapter, 0 means not AMD */ |
|
|
|
result = ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID); |
|
|
|
result = ADL_Adapter_ID_Get(iAdapterIndex, &lpAdapterID); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ADL_Adapter_VideoBiosInfo_Get(iAdapterIndex, &BiosInfo) == ADL_ERR) { |
|
|
|
|
|
|
|
applog(LOG_INFO, "ADL index %d, id %d - FAILED to get BIOS info", iAdapterIndex, lpAdapterID); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
applog(LOG_INFO, "ADL index %d, id %d - BIOS partno.: %s, version: %s, date: %s", iAdapterIndex, lpAdapterID, BiosInfo.strPartNumber, BiosInfo.strVersion, BiosInfo.strDate); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (result != ADL_OK) { |
|
|
|
if (result != ADL_OK) { |
|
|
|
applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get. Error %d", result); |
|
|
|
if (result == -10) |
|
|
|
if (result == -10) |
|
|
@ -306,22 +339,27 @@ void init_adl(int nDevs) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Each adapter may have multiple entries */ |
|
|
|
/* Each adapter may have multiple entries */ |
|
|
|
if (lpAdapterID == last_adapter) |
|
|
|
if (lpAdapterID == last_adapter) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_DEBUG, "GPU %d " |
|
|
|
applog(LOG_INFO, "GPU %d assigned: " |
|
|
|
"iAdapterIndex %d " |
|
|
|
"iAdapterIndex:%d " |
|
|
|
"strUDID %s " |
|
|
|
"iPresent:%d " |
|
|
|
"iBusNumber %d " |
|
|
|
"strUDID:%s " |
|
|
|
"iDeviceNumber %d " |
|
|
|
"iBusNumber:%d " |
|
|
|
"iFunctionNumber %d " |
|
|
|
"iDeviceNumber:%d " |
|
|
|
"iVendorID %d " |
|
|
|
"iDrvIndex:%d " |
|
|
|
"strAdapterName %s ", |
|
|
|
"iFunctionNumber:%d " |
|
|
|
|
|
|
|
"iVendorID:%d " |
|
|
|
|
|
|
|
"name:%s", |
|
|
|
devices, |
|
|
|
devices, |
|
|
|
iAdapterIndex, |
|
|
|
lpInfo[i].iAdapterIndex, |
|
|
|
|
|
|
|
lpInfo[i].iPresent, |
|
|
|
lpInfo[i].strUDID, |
|
|
|
lpInfo[i].strUDID, |
|
|
|
lpInfo[i].iBusNumber, |
|
|
|
lpInfo[i].iBusNumber, |
|
|
|
lpInfo[i].iDeviceNumber, |
|
|
|
lpInfo[i].iDeviceNumber, |
|
|
|
|
|
|
|
lpInfo[i].iDrvIndex, |
|
|
|
lpInfo[i].iFunctionNumber, |
|
|
|
lpInfo[i].iFunctionNumber, |
|
|
|
lpInfo[i].iVendorID, |
|
|
|
lpInfo[i].iVendorID, |
|
|
|
lpInfo[i].strAdapterName); |
|
|
|
lpInfo[i].strAdapterName); |
|
|
@ -365,8 +403,9 @@ void init_adl(int nDevs) |
|
|
|
if (gpus[i].mapped) { |
|
|
|
if (gpus[i].mapped) { |
|
|
|
vadapters[gpus[i].virtual_adl].virtual_gpu = i; |
|
|
|
vadapters[gpus[i].virtual_adl].virtual_gpu = i; |
|
|
|
applog(LOG_INFO, "Mapping OpenCL device %d to ADL device %d", i, gpus[i].virtual_adl); |
|
|
|
applog(LOG_INFO, "Mapping OpenCL device %d to ADL device %d", i, gpus[i].virtual_adl); |
|
|
|
} else |
|
|
|
} else { |
|
|
|
gpus[i].virtual_adl = i; |
|
|
|
gpus[i].virtual_adl = i; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!devs_match) { |
|
|
|
if (!devs_match) { |
|
|
@ -451,6 +490,8 @@ void init_adl(int nDevs) |
|
|
|
ga->twin = NULL; |
|
|
|
ga->twin = NULL; |
|
|
|
ga->def_fan_valid = false; |
|
|
|
ga->def_fan_valid = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "ADL GPU %d is Adapter index %d and maps to adapter id %d", ga->gpu, ga->iAdapterIndex, ga->lpAdapterID); |
|
|
|
|
|
|
|
|
|
|
|
if (ADL_Adapter_VideoBiosInfo_Get(iAdapterIndex, &BiosInfo) != ADL_ERR) |
|
|
|
if (ADL_Adapter_VideoBiosInfo_Get(iAdapterIndex, &BiosInfo) != ADL_ERR) |
|
|
|
applog(LOG_INFO, "GPU %d BIOS partno.: %s, version: %s, date: %s", gpu, BiosInfo.strPartNumber, BiosInfo.strVersion, BiosInfo.strDate); |
|
|
|
applog(LOG_INFO, "GPU %d BIOS partno.: %s, version: %s, date: %s", gpu, BiosInfo.strPartNumber, BiosInfo.strVersion, BiosInfo.strDate); |
|
|
|
|
|
|
|
|
|
|
@ -545,7 +586,7 @@ void init_adl(int nDevs) |
|
|
|
ga->has_fanspeed = true; |
|
|
|
ga->has_fanspeed = true; |
|
|
|
|
|
|
|
|
|
|
|
/* Save the fanspeed values as defaults in case we reset later */ |
|
|
|
/* Save the fanspeed values as defaults in case we reset later */ |
|
|
|
if (ADL_Overdrive5_FanSpeed_Get(ga->iAdapterIndex, 0, &ga->DefFanSpeedValue) != ADL_OK) |
|
|
|
if (ADL_Overdrive5_FanSpeed_Get(iAdapterIndex, 0, &ga->DefFanSpeedValue) != ADL_OK) |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_FanSpeed_Get for default value"); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_FanSpeed_Get for default value"); |
|
|
|
else |
|
|
|
else |
|
|
|
ga->def_fan_valid = true; |
|
|
|
ga->def_fan_valid = true; |
|
|
@ -556,12 +597,12 @@ void init_adl(int nDevs) |
|
|
|
gpus[gpu].gpu_fan = 85; /* Set a nominal upper limit of 85% */ |
|
|
|
gpus[gpu].gpu_fan = 85; /* Set a nominal upper limit of 85% */ |
|
|
|
|
|
|
|
|
|
|
|
/* Not fatal if powercontrol get fails */ |
|
|
|
/* Not fatal if powercontrol get fails */ |
|
|
|
if (ADL_Overdrive5_PowerControl_Get(ga->iAdapterIndex, &ga->iPercentage, &dummy) != ADL_OK) |
|
|
|
if (ADL_Overdrive5_PowerControl_Get(iAdapterIndex, &ga->iPercentage, &dummy) != ADL_OK) |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_PowerControl_get"); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_PowerControl_get"); |
|
|
|
|
|
|
|
|
|
|
|
if (gpus[gpu].gpu_powertune) { |
|
|
|
if (gpus[gpu].gpu_powertune) { |
|
|
|
ADL_Overdrive5_PowerControl_Set(ga->iAdapterIndex, gpus[gpu].gpu_powertune); |
|
|
|
ADL_Overdrive5_PowerControl_Set(iAdapterIndex, gpus[gpu].gpu_powertune); |
|
|
|
ADL_Overdrive5_PowerControl_Get(ga->iAdapterIndex, &ga->iPercentage, &dummy); |
|
|
|
ADL_Overdrive5_PowerControl_Get(iAdapterIndex, &ga->iPercentage, &dummy); |
|
|
|
ga->managed = true; |
|
|
|
ga->managed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|