Commit 2fafdab985a2c1c89a6d0c52ab02457a732cf61e

Con Kolivas 2011-09-09T10:03:10

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

diff --git a/adl.c b/adl.c
index 7789319..4f21444 100644
--- a/adl.c
+++ b/adl.c
@@ -192,17 +192,15 @@ void init_adl(int nDevs)
 			applog(LOG_INFO, "Failed to ADL_Adapter_ID_Get");
 			continue;
 		}
-		if (!lpAdapterID)
-			continue;
 
 		/* Each adapter may have multiple entries */
 		if (lpAdapterID == last_adapter)
 			continue;
 
 		/* We found a truly new adapter instead of a logical
-			* one. Now since there's no way of correlating the
-			* opencl enumerated devices and the ADL enumerated
-			* ones, we have to assume they're in the same order.*/
+		* one. Now since there's no way of correlating the
+		* opencl enumerated devices and the ADL enumerated
+		* ones, we have to assume they're in the same order.*/
 		if (++devices > nDevs) {
 			applog(LOG_ERR, "ADL found more devices than opencl");
 			return;
@@ -210,6 +208,11 @@ void init_adl(int nDevs)
 		gpu = devices - 1;
 		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
 		 * should support ADL */
 		ga = &gpus[gpu].adl;
@@ -218,18 +221,14 @@ void init_adl(int nDevs)
 		ga->DefPerfLev = NULL;
 
 		/* 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");
-			continue;
-		}
 
 		/* Force the speed to high, whether it's ignored or not */
 		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");
-			continue;
-		}
 
 		lev = ga->lpOdParameters.iNumberOfPerformanceLevels - 1;
 		/* 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;
 
 		/* 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");
-			continue;
-		}
 		/* Set the limits we'd use based on default gpu speeds */
 		ga->maxspeed = ga->minspeed = lpOdPerformanceLevels->aLevels[lev].iEngineClock;