|
|
@ -192,17 +192,15 @@ void init_adl(int nDevs) |
|
|
|
applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get"); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get"); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!lpAdapterID) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Each adapter may have multiple entries */ |
|
|
|
/* Each adapter may have multiple entries */ |
|
|
|
if (lpAdapterID == last_adapter) |
|
|
|
if (lpAdapterID == last_adapter) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
/* We found a truly new adapter instead of a logical
|
|
|
|
/* We found a truly new adapter instead of a logical
|
|
|
|
* one. Now since there's no way of correlating the |
|
|
|
* one. Now since there's no way of correlating the |
|
|
|
* opencl enumerated devices and the ADL enumerated |
|
|
|
* opencl enumerated devices and the ADL enumerated |
|
|
|
* ones, we have to assume they're in the same order.*/ |
|
|
|
* ones, we have to assume they're in the same order.*/ |
|
|
|
if (++devices > nDevs) { |
|
|
|
if (++devices > nDevs) { |
|
|
|
applog(LOG_ERR, "ADL found more devices than opencl"); |
|
|
|
applog(LOG_ERR, "ADL found more devices than opencl"); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -210,6 +208,11 @@ void init_adl(int nDevs) |
|
|
|
gpu = devices - 1; |
|
|
|
gpu = devices - 1; |
|
|
|
last_adapter = lpAdapterID; |
|
|
|
last_adapter = lpAdapterID; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!lpAdapterID) { |
|
|
|
|
|
|
|
applog(LOG_INFO, "Adapter returns ID 0 meaning not AMD. Card order might be confused"); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* From here on we know this device is a discrete device and
|
|
|
|
/* From here on we know this device is a discrete device and
|
|
|
|
* should support ADL */ |
|
|
|
* should support ADL */ |
|
|
|
ga = &gpus[gpu].adl; |
|
|
|
ga = &gpus[gpu].adl; |
|
|
@ -218,18 +221,14 @@ void init_adl(int nDevs) |
|
|
|
ga->DefPerfLev = NULL; |
|
|
|
ga->DefPerfLev = NULL; |
|
|
|
|
|
|
|
|
|
|
|
/* Save whatever the current speed setting is to restore on exit */ |
|
|
|
/* Save whatever the current speed setting is to restore on exit */ |
|
|
|
if (ADL_Adapter_Speed_Get(iAdapterIndex, &ga->lpCurrent, &dummy) != ADL_OK) { |
|
|
|
if (ADL_Adapter_Speed_Get(iAdapterIndex, &ga->lpCurrent, &dummy) != ADL_OK) |
|
|
|
applog(LOG_INFO, "Failed to ADL_Adapter_Speed_Get"); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Adapter_Speed_Get"); |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Force the speed to high, whether it's ignored or not */ |
|
|
|
/* Force the speed to high, whether it's ignored or not */ |
|
|
|
ADL_Adapter_Speed_Set(iAdapterIndex, ADL_CONTEXT_SPEED_FORCEHIGH); |
|
|
|
ADL_Adapter_Speed_Set(iAdapterIndex, ADL_CONTEXT_SPEED_FORCEHIGH); |
|
|
|
|
|
|
|
|
|
|
|
if (ADL_Overdrive5_ODParameters_Get(iAdapterIndex, &ga->lpOdParameters) != ADL_OK) { |
|
|
|
if (ADL_Overdrive5_ODParameters_Get(iAdapterIndex, &ga->lpOdParameters) != ADL_OK) |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_ODParameters_Get"); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_ODParameters_Get"); |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lev = ga->lpOdParameters.iNumberOfPerformanceLevels - 1; |
|
|
|
lev = ga->lpOdParameters.iNumberOfPerformanceLevels - 1; |
|
|
|
/* We're only interested in the top performance level */ |
|
|
|
/* We're only interested in the top performance level */ |
|
|
@ -237,10 +236,8 @@ void init_adl(int nDevs) |
|
|
|
lpOdPerformanceLevels->iSize = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * lev; |
|
|
|
lpOdPerformanceLevels->iSize = sizeof(ADLODPerformanceLevels) + sizeof(ADLODPerformanceLevel) * lev; |
|
|
|
|
|
|
|
|
|
|
|
/* Get default performance levels first */ |
|
|
|
/* Get default performance levels first */ |
|
|
|
if (ADL_Overdrive5_ODPerformanceLevels_Get(iAdapterIndex, 1, lpOdPerformanceLevels) != ADL_OK) { |
|
|
|
if (ADL_Overdrive5_ODPerformanceLevels_Get(iAdapterIndex, 1, lpOdPerformanceLevels) != ADL_OK) |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_ODPerformanceLevels_Get"); |
|
|
|
applog(LOG_INFO, "Failed to ADL_Overdrive5_ODPerformanceLevels_Get"); |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/* Set the limits we'd use based on default gpu speeds */ |
|
|
|
/* Set the limits we'd use based on default gpu speeds */ |
|
|
|
ga->maxspeed = ga->minspeed = lpOdPerformanceLevels->aLevels[lev].iEngineClock; |
|
|
|
ga->maxspeed = ga->minspeed = lpOdPerformanceLevels->aLevels[lev].iEngineClock; |
|
|
|
|
|
|
|
|
|
|
|