Browse Source

Allow adapterid 0 cards to enumerate as a device as they will be non-AMD cards, and enable ADL on any AMD card.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
2fafdab985
  1. 19
      adl.c

19
adl.c

@ -192,8 +192,6 @@ 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)
@ -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;

Loading…
Cancel
Save