xf86-video-ati: Branch 'master'

Alex Deucher agd5f at kemper.freedesktop.org
Fri Nov 30 12:37:53 PST 2007


 man/radeon.man      |   14 ++++-
 src/radeon.h        |   17 +++++--
 src/radeon_output.c |  124 ++++++++++++++++++++++++++++++++++++++++++----------
 3 files changed, 124 insertions(+), 31 deletions(-)

New commits:
commit 0175b79987ef4d7b0ce8238c3bdde989e504516a
Author: Alex Deucher <alex at botch2.(none)>
Date:   Fri Nov 30 15:37:42 2007 -0500

    RADEON: rework MacModel option
    
    this brings in some previous research from Michel Dänzer,
    Sjoerd Simons, and myself.  Hopefully, the driver will pick
    the correct MacModel in more cases.  This also changes the
    default connector table for desktop Macs to dual DVI rather
    than DVI+VGA as that seems to be the case more often than not.
    External TMDS chips are handled separately now as well.
    Eventually we should add an option to allow the user to specify
    what external TMDS chip they need, but we don't have enough info
    yet, so we'll rely on OF to init the external chip in most cases
    for now.

diff --git a/man/radeon.man b/man/radeon.man
index 8f7b551..41c7242 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -421,14 +421,22 @@ a powerbook or mini with DVI that does not work properly, try the alternate
 .br
 ibook                \-\- ibooks
 .br
-powerbook-duallink   \-\- Powerbooks with external DVI
+powerbook-external   \-\- Powerbooks with external DVI
 .br
-powerbook            \-\- Powerbooks with integrated DVI
+powerbook-internal   \-\- Powerbooks with integrated DVI
 .br
-mini                 \-\- Mac Mini with external DVI
+powerbook-vga        \-\- Powerbooks with VGA rather than DVI
+.br
+powerbook-duallink   \-\- powerbook-external alias
+.br
+powerbook            \-\- powerbook-internal alias
+.br
+mini-external        \-\- Mac Mini with external DVI
 .br
 mini-internal        \-\- Mac Mini with integrated DVI
 .br
+mini                 \-\- mini-external alias
+.br
 The default value is
 .B undefined.
 .TP
diff --git a/src/radeon.h b/src/radeon.h
index 4180752..f9bf343 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -428,13 +428,19 @@ typedef enum {
        CHIP_ERRATA_PLL_DELAY           = 0x00000004
 } RADEONErrata;
 
+typedef enum {
+    RADEON_SIL_164  = 0x00000001,
+    RADEON_SIL_1178 = 0x00000002
+} RADEONExtTMDSChip;
+
 #if defined(__powerpc__)
 typedef enum {
-       RADEON_MAC_IBOOK             = 0x00000001,
-       RADEON_MAC_POWERBOOK_DL      = 0x00000002,
-       RADEON_MAC_POWERBOOK         = 0x00000004,
-       RADEON_MAC_MINI              = 0x00000008,
-       RADEON_MAC_MINI_INTERNAL     = 0x00000016
+       RADEON_MAC_IBOOK              = 0x00000001,
+       RADEON_MAC_POWERBOOK_EXTERNAL = 0x00000002,
+       RADEON_MAC_POWERBOOK_INTERNAL = 0x00000004,
+       RADEON_MAC_POWERBOOK_VGA      = 0x00000008,
+       RADEON_MAC_MINI_EXTERNAL      = 0x00000016,
+       RADEON_MAC_MINI_INTERNAL      = 0x00000032
 } RADEONMacModel;
 #endif
 
@@ -827,6 +833,7 @@ typedef struct {
 #if defined(__powerpc__)
     RADEONMacModel    MacModel;
 #endif
+    RADEONExtTMDSChip ext_tmds_chip;
 
     Rotation rotation;
     void (*PointerMoved)(int, int, int);
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 1645b5a..efe093f 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -218,22 +218,33 @@ RADEONRestoreDVOChip(ScrnInfoPtr pScrn, xf86OutputPtr output)
 	   (CARD32)~(RADEON_GPIO_A_0 | RADEON_GPIO_A_1));
 
     if (!RADEONInitExtTMDSInfoFromBIOS(output)) {
-	/* do mac stuff here */
-#if defined(__powerpc__)
 	if (radeon_output->DVOChip) {
-	    switch(info->MacModel) {
-	    case RADEON_MAC_POWERBOOK_DL:
+	    switch(info->ext_tmds_chip) {
+	    case RADEON_SIL_164:
 		RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x30);
 		RADEONDVOWriteByte(radeon_output->DVOChip, 0x09, 0x00);
 		RADEONDVOWriteByte(radeon_output->DVOChip, 0x0a, 0x90);
 		RADEONDVOWriteByte(radeon_output->DVOChip, 0x0c, 0x89);
 		RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x3b);
 		break;
+#if 0
+		/* needs work see bug 10418 */
+	    case RADEON_SIL_1178:
+		RADEONDVOWriteByte(radeon_output->DVOChip, 0x0f, 0x44);
+		RADEONDVOWriteByte(radeon_output->DVOChip, 0x0f, 0x4c);
+		RADEONDVOWriteByte(radeon_output->DVOChip, 0x0e, 0x01);
+		RADEONDVOWriteByte(radeon_output->DVOChip, 0x0a, 0x80);
+                RADEONDVOWriteByte(radeon_output->DVOChip, 0x09, 0x30);
+                RADEONDVOWriteByte(radeon_output->DVOChip, 0x0c, 0xc9);
+                RADEONDVOWriteByte(radeon_output->DVOChip, 0x0d, 0x70);
+                RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x32);
+                RADEONDVOWriteByte(radeon_output->DVOChip, 0x08, 0x33);
+		break;
+#endif
 	    default:
 		break;
 	    }
 	}
-#endif
     }
 }
 
@@ -2667,7 +2678,7 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn)
 	info->BiosConnector[2].DDCType = DDC_NONE_DETECTED;
 	info->BiosConnector[2].valid = TRUE;
 	return TRUE;
-    case RADEON_MAC_POWERBOOK_DL:
+    case RADEON_MAC_POWERBOOK_EXTERNAL:
 	info->BiosConnector[0].DDCType = DDC_DVI;
 	info->BiosConnector[0].DACType = DAC_NONE;
 	info->BiosConnector[0].TMDSType = TMDS_NONE;
@@ -2686,7 +2697,7 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn)
 	info->BiosConnector[2].DDCType = DDC_NONE_DETECTED;
 	info->BiosConnector[2].valid = TRUE;
 	return TRUE;
-    case RADEON_MAC_POWERBOOK:
+    case RADEON_MAC_POWERBOOK_INTERNAL:
 	info->BiosConnector[0].DDCType = DDC_DVI;
 	info->BiosConnector[0].DACType = DAC_NONE;
 	info->BiosConnector[0].TMDSType = TMDS_NONE;
@@ -2705,7 +2716,26 @@ static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn)
 	info->BiosConnector[2].DDCType = DDC_NONE_DETECTED;
 	info->BiosConnector[2].valid = TRUE;
 	return TRUE;
-    case RADEON_MAC_MINI:
+    case RADEON_MAC_POWERBOOK_VGA:
+	info->BiosConnector[0].DDCType = DDC_DVI;
+	info->BiosConnector[0].DACType = DAC_NONE;
+	info->BiosConnector[0].TMDSType = TMDS_NONE;
+	info->BiosConnector[0].ConnectorType = CONNECTOR_CRT;
+	info->BiosConnector[0].valid = TRUE;
+
+	info->BiosConnector[1].DDCType = DDC_VGA;
+	info->BiosConnector[1].DACType = DAC_PRIMARY;
+	info->BiosConnector[1].TMDSType = TMDS_INT;
+	info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I;
+	info->BiosConnector[1].valid = TRUE;
+
+	info->BiosConnector[2].ConnectorType = CONNECTOR_STV;
+	info->BiosConnector[2].DACType = DAC_TVDAC;
+	info->BiosConnector[2].TMDSType = TMDS_NONE;
+	info->BiosConnector[2].DDCType = DDC_NONE_DETECTED;
+	info->BiosConnector[2].valid = TRUE;
+	return TRUE;
+    case RADEON_MAC_MINI_EXTERNAL:
 	info->BiosConnector[0].DDCType = DDC_CRT2;
 	info->BiosConnector[0].DACType = DAC_TVDAC;
 	info->BiosConnector[0].TMDSType = TMDS_EXT;
@@ -2815,11 +2845,19 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn)
 	    info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_I;
 	    info->BiosConnector[0].valid = TRUE;
 
+#if defined(__powerpc__)
 	    info->BiosConnector[1].DDCType = DDC_VGA;
 	    info->BiosConnector[1].DACType = DAC_PRIMARY;
 	    info->BiosConnector[1].TMDSType = TMDS_EXT;
+	    info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I;
+	    info->BiosConnector[1].valid = TRUE;
+#else
+	    info->BiosConnector[1].DDCType = DDC_VGA;
+	    info->BiosConnector[1].DACType = DAC_PRIMARY;
+	    info->BiosConnector[1].TMDSType = TMDS_NONE;
 	    info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
 	    info->BiosConnector[1].valid = TRUE;
+#endif
 	}
     }
 
@@ -2848,6 +2886,7 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn)
  * in /proc/cpuinfo (on Linux) */
 static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
 {
+    RADEONInfoPtr info = RADEONPTR(pScrn);
     RADEONMacModel ret = 0;
 #ifdef __linux__
     char cpuline[50];  /* 50 should be sufficient for our purposes */
@@ -2858,23 +2897,52 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
      * Unforunately, there doesn't seem to be any good way to figure it out.
      */
 
+    /* 
+     * PowerBook5,[1-5]: external tmds, single-link
+     * PowerBook5,[789]: external tmds, dual-link
+     * PowerBook5,6:     external tmds, single-link or dual-link
+     * need to add another option to specify the external tmds chip
+     * or find out what's used and add it.
+     */
+
+
     if (f != NULL) {
 	while (fgets(cpuline, sizeof cpuline, f)) {
 	    if (!strncmp(cpuline, "machine", strlen ("machine"))) {
-		if (strstr(cpuline, "PowerBook5,6") ||
-		    strstr(cpuline, "PowerBook5,7") ||
+		if (strstr(cpuline, "PowerBook5,1") ||
+		    strstr(cpuline, "PowerBook5,2") ||
+		    strstr(cpuline, "PowerBook5,3") ||
+		    strstr(cpuline, "PowerBook5,4") ||
+		    strstr(cpuline, "PowerBook5,5")) {
+		    ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* single link */
+		    info->ext_tmds_chip = RADEON_SIL_164; /* works on 5,2 */
+		    break;
+		}
+
+		if (strstr(cpuline, "PowerBook5,6")) {
+		    ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual or single link */
+		    break;
+		}
+
+		if (strstr(cpuline, "PowerBook5,7") ||
 		    strstr(cpuline, "PowerBook5,8") ||
 		    strstr(cpuline, "PowerBook5,9")) {
-		    ret = RADEON_MAC_POWERBOOK_DL;
+		    ret = RADEON_MAC_POWERBOOK_EXTERNAL; /* dual link */
+		    info->ext_tmds_chip = RADEON_SIL_1178; /* guess */
+		    break;
+		}
+
+		if (strstr(cpuline, "PowerBook3,3")) {
+		    ret = RADEON_MAC_POWERBOOK_VGA; /* vga rather than dvi */
 		    break;
 		}
 
 		if (strstr(cpuline, "PowerMac10,1")) {
-		    ret = RADEON_MAC_MINI_INTERNAL;
+		    ret = RADEON_MAC_MINI_INTERNAL; /* internal tmds */
 		    break;
 		}
 		if (strstr(cpuline, "PowerMac10,2")) {
-		    ret = RADEON_MAC_MINI;
+		    ret = RADEON_MAC_MINI_EXTERNAL; /* external tmds */
 		    break;
 		}
 	    } else if (!strncmp(cpuline, "detected as", strlen("detected as"))) {
@@ -2882,7 +2950,7 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
                     ret = RADEON_MAC_IBOOK;
 		    break;
 		} else if (strstr(cpuline, "PowerBook")) {
-		    ret = RADEON_MAC_POWERBOOK_DL;
+		    ret = RADEON_MAC_POWERBOOK_INTERNAL; /* internal tmds */
 		    break;
                 }
 
@@ -2901,10 +2969,12 @@ static RADEONMacModel RADEONDetectMacModel(ScrnInfoPtr pScrn)
 
     if (ret) {
 	xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Detected %s.\n",
-		   ret == RADEON_MAC_POWERBOOK_DL ? "PowerBook with external DVI" :
-		   ret == RADEON_MAC_POWERBOOK ? "PowerBook with integrated DVI" :
+		   ret == RADEON_MAC_POWERBOOK_EXTERNAL ? "PowerBook with external DVI" :
+		   ret == RADEON_MAC_POWERBOOK_INTERNAL ? "PowerBook with integrated DVI" :
+		   ret == RADEON_MAC_POWERBOOK_VGA ? "PowerBook with VGA" :
 		   ret == RADEON_MAC_IBOOK ? "iBook" :
-		   "Mac Mini");
+		   ret == RADEON_MAC_MINI_EXTERNAL ? "Mac Mini with external DVI" :
+		   "Mac Mini with integrated DVI");
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "If this is not correct, try Option \"MacModel\" and "
 		   "consider reporting to the\n");
@@ -2951,14 +3021,22 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
     if (optstr) {
 	if (!strncmp("ibook", optstr, strlen("ibook")))
 	    info->MacModel = RADEON_MAC_IBOOK;
-	else if (!strncmp("powerbook-duallink", optstr, strlen("powerbook-duallink")))
-	    info->MacModel = RADEON_MAC_POWERBOOK_DL;
-	else if (!strncmp("powerbook", optstr, strlen("powerbook")))
-	    info->MacModel = RADEON_MAC_POWERBOOK;
+	else if (!strncmp("powerbook-duallink", optstr, strlen("powerbook-duallink"))) /* alias */
+	    info->MacModel = RADEON_MAC_POWERBOOK_EXTERNAL;
+	else if (!strncmp("powerbook-external", optstr, strlen("powerbook-external")))
+	    info->MacModel = RADEON_MAC_POWERBOOK_EXTERNAL;
+	else if (!strncmp("powerbook-internal", optstr, strlen("powerbook-internal")))
+	    info->MacModel = RADEON_MAC_POWERBOOK_INTERNAL;
+	else if (!strncmp("powerbook-vga", optstr, strlen("powerbook-vga")))
+	    info->MacModel = RADEON_MAC_POWERBOOK_VGA;
+	else if (!strncmp("powerbook", optstr, strlen("powerbook"))) /* alias */
+	    info->MacModel = RADEON_MAC_POWERBOOK_INTERNAL;
 	else if (!strncmp("mini-internal", optstr, strlen("mini-internal")))
 	    info->MacModel = RADEON_MAC_MINI_INTERNAL;
-	else if (!strncmp("mini", optstr, strlen("mini")))
-	    info->MacModel = RADEON_MAC_MINI;
+	else if (!strncmp("mini-external", optstr, strlen("mini-external")))
+	    info->MacModel = RADEON_MAC_MINI_EXTERNAL;
+	else if (!strncmp("mini", optstr, strlen("mini"))) /* alias */
+	    info->MacModel = RADEON_MAC_MINI_EXTERNAL;
 	else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid Mac Model: %s\n", optstr);
 	}


More information about the xorg-commit mailing list