xf86-video-ati: Branch 'master' - 14 commits

Dave Airlie airlied at kemper.freedesktop.org
Sat Sep 23 10:46:39 EEST 2006


 src/radeon.h         |    6 
 src/radeon_display.c |  729 ++++++++++++++++++++++++++++++++++-----------------
 src/radeon_driver.c  |   11 
 3 files changed, 505 insertions(+), 241 deletions(-)

New commits:
diff-tree 452f0f8079d65679905ed5178a256534ef0db0e4 (from a8b9aa69259a0706d0688d2656ece5a292799242)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sat Sep 23 07:41:57 2006 +1000

    radeon: bring over final set of changes for radeon_display.c from susperpatch
    
    This brings over Alex's final set of changes...
    
    i'm unsure about the disappearance of reverseddc - alex to review

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 5401a9a..7c78de2 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -941,7 +941,9 @@ static void RADEONQueryConnectedDisplays
     pRADEONEnt->Controller[0].IsActive = FALSE;
     pRADEONEnt->Controller[1].IsActive = FALSE;
 
-    if (!RADEONGetConnectorInfoFromBIOS(pScrn)) {
+    if (!RADEONGetConnectorInfoFromBIOS(pScrn) ||
+        ((pRADEONEnt->PortInfo[0].DDCType == 0) &&
+        (pRADEONEnt->PortInfo[1].DDCType == 0))) {
 	/* Below is the most common setting, but may not be true */
 	pRADEONEnt->PortInfo[0].MonType = MT_UNKNOWN;
 	pRADEONEnt->PortInfo[0].MonInfo = NULL;
@@ -958,6 +960,7 @@ static void RADEONQueryConnectedDisplays
 	pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_CRT;
 
 
+#if 0 // DA what replaced this?? 
        /* Some cards have the DDC lines swapped and we have no way to
         * detect it yet (Mac cards)
         */
@@ -965,6 +968,7 @@ static void RADEONQueryConnectedDisplays
            pRADEONEnt->PortInfo[0].DDCType = DDC_VGA;
            pRADEONEnt->PortInfo[1].DDCType = DDC_DVI;
         }
+#endif
     }
 
     /* always make TMDS_INT port first*/
@@ -1035,6 +1039,12 @@ static void RADEONQueryConnectedDisplays
      * Another usage of this option is you want to config the server
      * to start up with a certain monitor arrangement even one monitor
      * is not plugged in when server starts.
+     * For example, you can config your laptop with 
+     * Option "MonitorLayout" "LVDS, CRT"
+     * Option "CloneHSync" "40-150"
+     * Option "CloneVRefresh" "60-120"
+     * With these options, you can connect in your CRT monitor later
+     * after the X server has started.
      */
     if ((s = xf86GetOptValString(info->Options, OPTION_MONITOR_LAYOUT))) {
         char s1[5], s2[5];
@@ -1066,18 +1076,30 @@ static void RADEONQueryConnectedDisplays
         } while(*s++);
         s2[i] = '\0';
 
-	for (i = 0; i < max_mt; i++) {
-	    if (strcmp(s1, MonTypeName[i]) == 0) {
-		pRADEONEnt->PortInfo[0].MonType = MonTypeID[i];
-		break;
-	    }
-	}
-	for (i = 0; i < max_mt; i++) {
-	    if (strcmp(s2, MonTypeName[i]) == 0) {
-		pRADEONEnt->PortInfo[1].MonType = MonTypeID[i];
-		break;
-	    }
-	}
+        for (i = 0; i < max_mt; i++)
+        {
+            if (strcmp(s1, MonTypeName[i]) == 0) 
+            {
+                pRADEONEnt->PortInfo[0].MonType = MonTypeID[i];
+                break;
+            }
+        }
+        if (i ==  max_mt)
+            xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
+                       "Invalid Monitor type specified for 1st port \n"); 
+
+        for (i = 0; i < max_mt; i++)
+        {
+            if (strcmp(s2, MonTypeName[i]) == 0) 
+            {
+                pRADEONEnt->PortInfo[1].MonType = MonTypeID[i];
+                break;
+            }
+
+        }
+        if (i ==  max_mt)
+            xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
+                       "Invalid Monitor type specified for 2nd port \n"); 
 
 	if (i ==  max_mt)
 	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -1099,6 +1121,18 @@ static void RADEONQueryConnectedDisplays
         }
 #endif
 
+        /* some thinkpads and powerbooks use lvds and internal tmds 
+	 * at the same time.  --AGD
+	 */
+	if ((pRADEONEnt->PortInfo[0].MonType  == MT_LCD) &&
+	    (pRADEONEnt->PortInfo[1].MonType == MT_DFP)) {
+	    pRADEONEnt->PortInfo[1].DDCType = DDC_DVI;
+	    pRADEONEnt->PortInfo[0].DDCType = DDC_MONID;
+            pRADEONEnt->PortInfo[1].TMDSType = TMDS_INT;
+            pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_DVI_I;
+            pRADEONEnt->PortInfo[0].TMDSType = TMDS_UNKNOWN;
+	}
+
         if (!ignore_edid) {
             if ((pRADEONEnt->PortInfo[0].MonType > MT_NONE) &&
                 (pRADEONEnt->PortInfo[0].MonType < MT_STV))
diff-tree a8b9aa69259a0706d0688d2656ece5a292799242 (from 8d4ae98c528a2309dc3c545893dbba2e7f76916c)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sat Sep 23 07:38:25 2006 +1000

    radeon: align tabs and make display detection like superpatch

diff --git a/src/radeon_display.c b/src/radeon_display.c
index d07bf6f..5401a9a 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1112,79 +1112,67 @@ static void RADEONQueryConnectedDisplays
 
     }
 
-    if(((!info->HasCRTC2) || info->IsDellServer)) {
-	if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN) {
-	    if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_DVI, &pRADEONEnt->PortInfo[0])));
-	    else if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_VGA, &pRADEONEnt->PortInfo[0])));
-	    else if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_CRT2, &pRADEONEnt->PortInfo[0])));
-	    else
-		pRADEONEnt->PortInfo[0].MonType = MT_CRT;
-	}
-
-	if (!ignore_edid) {
-	    if (pRADEONEnt->PortInfo[0].MonInfo) {
-		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n");
-		xf86PrintEDID(pRADEONEnt->PortInfo[0].MonInfo );
-		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of Monitor1 EDID data --------------------\n");
-	    }
-	}
-
-	pRADEONEnt->PortInfo[1].MonType = MT_NONE;
-	pRADEONEnt->PortInfo[1].MonInfo = NULL;
-	pRADEONEnt->PortInfo[1].DDCType = DDC_NONE_DETECTED;
-	pRADEONEnt->PortInfo[1].DACType = DAC_UNKNOWN;
-	pRADEONEnt->PortInfo[1].TMDSType = TMDS_UNKNOWN;
-	pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_NONE;
-
-	pRADEONEnt->Controller[0].pPort = &pRADEONEnt->PortInfo[0];
-	pRADEONEnt->Controller[1].pPort = &pRADEONEnt->PortInfo[1];
-
-	info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType;
-
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		   "Primary:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n",
-		   MonTypeName[pRADEONEnt->PortInfo[0].MonType+1],
-		   info->IsAtomBios ?
-		   ConnectorTypeNameATOM[pRADEONEnt->PortInfo[0].ConnectorType]:
-		   ConnectorTypeName[pRADEONEnt->PortInfo[0].ConnectorType],
-		   DACTypeName[pRADEONEnt->PortInfo[0].DACType+1],
-		   TMDSTypeName[pRADEONEnt->PortInfo[0].TMDSType+1],
-		   DDCTypeName[pRADEONEnt->PortInfo[0].DDCType]);
-
-	return;
-    }
-
     if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN || pRADEONEnt->PortInfo[1].MonType == MT_UNKNOWN) {
+		
+        if ((!info->HasCRTC2) && (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN)) {
+			if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_DVI,
+																			&pRADEONEnt->PortInfo[0])));
+			else if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_VGA,
+																				 &pRADEONEnt->PortInfo[0])));
+			else if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_CRT2,
+																				 &pRADEONEnt->PortInfo[0])));
+			else
+				pRADEONEnt->PortInfo[0].MonType = MT_CRT;
+			
+			if (!ignore_edid) {
+				if (pRADEONEnt->PortInfo[0].MonInfo) {
+					xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n");
+					xf86PrintEDID(pRADEONEnt->PortInfo[0].MonInfo );
+					xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of Monitor1 EDID data --------------------\n");
+				}
+			}
+
+			pRADEONEnt->PortInfo[1].MonType = MT_NONE;
+			pRADEONEnt->PortInfo[1].MonInfo = NULL;
+			pRADEONEnt->PortInfo[1].DDCType = DDC_NONE_DETECTED;
+			pRADEONEnt->PortInfo[1].DACType = DAC_UNKNOWN;
+			pRADEONEnt->PortInfo[1].TMDSType = TMDS_UNKNOWN;
+			pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_NONE;
+			
+			pRADEONEnt->Controller[0].pPort = &pRADEONEnt->PortInfo[0];
+			pRADEONEnt->Controller[1].pPort = &pRADEONEnt->PortInfo[1];
+			return;
+		}
+		
+		/* Primary Head (DVI or Laptop Int. panel)*/
+		/* A ddc capable display connected on DVI port */
+		if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN) {
+			if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn,
+																			pRADEONEnt->PortInfo[0].DDCType,
+																			&pRADEONEnt->PortInfo[0])));
+			else if (info->IsMobility &&
+					 (INREG(RADEON_BIOS_4_SCRATCH) & 4)) {
+				/* non-DDC laptop panel connected on primary */
+				pRADEONEnt->PortInfo[0].MonType = MT_LCD;
+			} else {
+				/* CRT on DVI, TODO: not reliable, make it always return false for now*/
+				pRADEONEnt->PortInfo[0].MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[0].DACType));
+			}
+		}
 
-	/* Primary Head (DVI or Laptop Int. panel)*/
-	/* A ddc capable display connected on DVI port */
-	if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN) {
-	    if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn,
-									    pRADEONEnt->PortInfo[0].DDCType,
-									    &pRADEONEnt->PortInfo[0])));
-	    else if (info->IsMobility &&
-		     (INREG(RADEON_BIOS_4_SCRATCH) & 4)) {
-		/* non-DDC laptop panel connected on primary */
-		pRADEONEnt->PortInfo[0].MonType = MT_LCD;
-	    } else {
-		/* CRT on DVI, TODO: not reliable, make it always return false for now*/
-		pRADEONEnt->PortInfo[0].MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[0].DACType));
-	    }
+		/* Secondary Head (mostly VGA, can be DVI on some OEM boards)*/
+		if (pRADEONEnt->PortInfo[1].MonType == MT_UNKNOWN) {
+			if((pRADEONEnt->PortInfo[1].MonType =
+				RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[1].DDCType, &pRADEONEnt->PortInfo[1])));
+			else if (info->IsMobility &&
+					 (INREG(RADEON_FP2_GEN_CNTL) & RADEON_FP2_ON)) {
+				/* non-DDC TMDS panel connected through DVO */
+				pRADEONEnt->PortInfo[1].MonType = MT_DFP;
+			} else
+				pRADEONEnt->PortInfo[1].MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[1].DACType));
+		}
 	}
 
-	/* Secondary Head (mostly VGA, can be DVI on some OEM boards)*/
-	if (pRADEONEnt->PortInfo[1].MonType == MT_UNKNOWN) {
-	    if((pRADEONEnt->PortInfo[1].MonType =
-                RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[1].DDCType, &pRADEONEnt->PortInfo[1])));
-            else if (info->IsMobility &&
-                     (INREG(RADEON_FP2_GEN_CNTL) & RADEON_FP2_ON)) {
-                /* non-DDC TMDS panel connected through DVO */
-                pRADEONEnt->PortInfo[1].MonType = MT_DFP;
-            } else
-                pRADEONEnt->PortInfo[1].MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[1].DACType));
-        }
-    }
-
     if(ignore_edid) {
         pRADEONEnt->PortInfo[0].MonInfo = NULL;
         pRADEONEnt->PortInfo[1].MonInfo = NULL;
diff-tree 8d4ae98c528a2309dc3c545893dbba2e7f76916c (from 65b54847c5e79b2ec3cb1a08b265229443c9deb9)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sat Sep 23 07:26:44 2006 +1000

    radeon: align some output with superpatch

diff --git a/src/radeon_display.c b/src/radeon_display.c
index a7ebabb..d07bf6f 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1190,15 +1190,17 @@ static void RADEONQueryConnectedDisplays
         pRADEONEnt->PortInfo[1].MonInfo = NULL;
     } else {
         if (pRADEONEnt->PortInfo[0].MonInfo) {
-            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on port 1 ----------------------\n");
-            xf86PrintEDID(pRADEONEnt->PortInfo[0].MonInfo );
+            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on 1st port ----------------------\n");
+            xf86PrintEDID( pRADEONEnt->PortInfo[0].MonInfo );
         }
 
         if (pRADEONEnt->PortInfo[1].MonInfo) {
-            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on port 2-----------------------\n");
-            xf86PrintEDID(pRADEONEnt->PortInfo[1].MonInfo );
+            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on 2nd port -----------------------\n");
+            xf86PrintEDID( pRADEONEnt->PortInfo[1].MonInfo );
         }
     }
+    
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\n");
 
     return;
 }
diff-tree 65b54847c5e79b2ec3cb1a08b265229443c9deb9 (from 7e16d9fff96dcdff8c25dbbe2a51be0023b7985a)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sat Sep 23 07:22:31 2006 +1000

    radeon: change function name to Displays rather than Monitors

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 1acc925..a7ebabb 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -914,7 +914,7 @@ void RADEONGetTVDacAdjInfo(ScrnInfoPtr p
     }
 }
 
-static void RADEONQueryConnectedMonitors(ScrnInfoPtr pScrn)
+static void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info       = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt  = RADEONEntPriv(pScrn);
@@ -1205,15 +1205,15 @@ static void RADEONQueryConnectedMonitors
 
 Bool RADEONMapControllers(ScrnInfoPtr pScrn)
 {
-    Bool head_reversed = FALSE;
     RADEONInfoPtr info       = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
+    Bool head_reversed = FALSE;
 
     info->MergeType = MT_NONE;
 
     if (!info->IsSecondary) {
-      RADEONQueryConnectedMonitors(pScrn);
+      RADEONQueryConnectedDisplays(pScrn);
 
       pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[0]);
       pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[1]);
diff-tree 7e16d9fff96dcdff8c25dbbe2a51be0023b7985a (from 6f63b3dc8b3e2299f5f02abc1c565176d2d46cee)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sat Sep 23 07:21:15 2006 +1000

    radeon: make GetConnectedMonitors a static void

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 5207e12..1acc925 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -914,7 +914,7 @@ void RADEONGetTVDacAdjInfo(ScrnInfoPtr p
     }
 }
 
-BOOL RADEONQueryConnectedMonitors(ScrnInfoPtr pScrn)
+static void RADEONQueryConnectedMonitors(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info       = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt  = RADEONEntPriv(pScrn);
@@ -1151,7 +1151,7 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
 		   TMDSTypeName[pRADEONEnt->PortInfo[0].TMDSType+1],
 		   DDCTypeName[pRADEONEnt->PortInfo[0].DDCType]);
 
-	return TRUE;
+	return;
     }
 
     if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN || pRADEONEnt->PortInfo[1].MonType == MT_UNKNOWN) {
@@ -1200,7 +1200,7 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
         }
     }
 
-    return TRUE;
+    return;
 }
 
 Bool RADEONMapControllers(ScrnInfoPtr pScrn)
diff-tree 6f63b3dc8b3e2299f5f02abc1c565176d2d46cee (from c9f3ced3b1c194cacf1ab9436ee6c2d4efd3a8e9)
Author: Dave Airlie <airlied at linux.ie>
Date:   Sat Sep 23 07:19:43 2006 +1000

    radeon: some minor alignments and cleanups for info->

diff --git a/src/radeon_display.c b/src/radeon_display.c
index cf2d1ef..5207e12 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -921,12 +921,7 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
     unsigned char *RADEONMMIO = info->MMIO;
     const char *s;
     Bool ignore_edid = FALSE;
-    int i = 0, second = 0, max_mt;
-
-
-
-    max_mt = 5;
-
+    int i = 0, second = 0, max_mt = 5;
 
     /* We first get the information about all connectors from BIOS.
      * This is how the card is phyiscally wired up.
@@ -962,6 +957,7 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
 	pRADEONEnt->PortInfo[1].TMDSType = TMDS_EXT;
 	pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_CRT;
 
+
        /* Some cards have the DDC lines swapped and we have no way to
         * detect it yet (Mac cards)
         */
@@ -1143,7 +1139,6 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
 	pRADEONEnt->Controller[0].pPort = &pRADEONEnt->PortInfo[0];
 	pRADEONEnt->Controller[1].pPort = &pRADEONEnt->PortInfo[1];
 
-	info->MergeType = MT_NONE;
 	info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType;
 
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1215,6 +1210,8 @@ Bool RADEONMapControllers(ScrnInfoPtr pS
     RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
 
+    info->MergeType = MT_NONE;
+
     if (!info->IsSecondary) {
       RADEONQueryConnectedMonitors(pScrn);
 
@@ -1316,6 +1313,17 @@ Bool RADEONMapControllers(ScrnInfoPtr pS
             xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
     }
 
+    info->HBlank     = 0;
+    info->HOverPlus  = 0;
+    info->HSyncWidth = 0;
+    info->VBlank     = 0;
+    info->VOverPlus  = 0;
+    info->VSyncWidth = 0;
+    info->DotClock   = 0;
+    info->UseBiosDividers = FALSE;
+
+    info->OverlayOnCRTC2 = FALSE;
+
     return TRUE;
 }
 
diff-tree c9f3ced3b1c194cacf1ab9436ee6c2d4efd3a8e9 (from e752443c540d9a94522050c61ef7c33d912fece5)
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Sat Sep 23 07:16:10 2006 +1000

    radeon: add reverse display option to switch displays on non-mobility cards

diff --git a/src/radeon.h b/src/radeon.h
index e8cd54c..c1561e4 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -151,7 +151,8 @@ typedef enum {
     OPTION_REVERSE_DDC,
     OPTION_LVDS_PROBE_PLL,
     OPTION_ACCELMETHOD,
-    OPTION_CONSTANTDPI
+    OPTION_CONSTANTDPI,
+    OPTION_REVERSE_DISPLAY
 } RADEONOpts;
 
 /* ------- mergedfb support ------------- */
diff --git a/src/radeon_display.c b/src/radeon_display.c
index 8a40ba0..cf2d1ef 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1268,7 +1268,7 @@ Bool RADEONMapControllers(ScrnInfoPtr pS
 
 	if ((pRADEONEnt->Controller[0].pPort->MonType != MT_NONE) &&
 	    (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE)) {
-	  if (FALSE /*xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DISPLAY, FALSE)*/) {
+	  if (xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DISPLAY, FALSE)) {
 		if (info->IsMobility) {
 		    /* Don't reverse display for mobility chips, as only CRTC1 path has RMX which
 		       will be required by many LCD panels
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 72cb22a..8b1ff9f 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -201,7 +201,8 @@ static const OptionInfoRec RADEONOptions
     { OPTION_REVERSE_DDC,    "ReverseDDC",       OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_LVDS_PROBE_PLL, "LVDSProbePLL",     OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_ACCELMETHOD,    "AccelMethod",      OPTV_STRING,  {0}, FALSE },
-    { OPTION_CONSTANTDPI,    "ConstantDPI",	 OPTV_BOOLEAN,	{0}, FALSE },
+    { OPTION_CONSTANTDPI,    "ConstantDPI",	 OPTV_BOOLEAN, {0}, FALSE },
+    { OPTION_REVERSE_DISPLAY,"ReverseDisplay",   OPTV_BOOLEAN, {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
diff-tree e752443c540d9a94522050c61ef7c33d912fece5 (from 7a0e4eb47655c4701fc3a4b33b6c8e9f378ccc9e)
Author: Dave Airlie <airlied at linux.ie>
Date:   Fri Sep 22 07:10:10 2006 +1000

    radeon: flesh out mapcontrollers

diff --git a/src/radeon_display.c b/src/radeon_display.c
index f029301..8a40ba0 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -927,13 +927,6 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
 
     max_mt = 5;
 
-    if(info->IsSecondary) {
-        pScrn->monitor->DDC = pRADEONEnt->Controller[1].pPort->MonInfo;
-	info->DisplayType = (RADEONMonitorType)pRADEONEnt->Controller[1].pPort->MonType;
-	if(info->DisplayType == MT_NONE) return FALSE;
-	return TRUE;
-    }
-
 
     /* We first get the information about all connectors from BIOS.
      * This is how the card is phyiscally wired up.
@@ -1212,58 +1205,6 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
         }
     }
 
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\n");
-
-    pRADEONEnt->Controller[0].pPort = &pRADEONEnt->PortInfo[0];
-    pRADEONEnt->Controller[1].pPort = &pRADEONEnt->PortInfo[1];
-    if (pRADEONEnt->PortInfo[0].MonType == MT_NONE) {
-	if (pRADEONEnt->PortInfo[1].MonType == MT_NONE) {
-  	    pRADEONEnt->Controller[0].pPort->MonType = MT_CRT;
-	} else {
-	    pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
-  	    pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
-	}
-    }
-
-    pScrn->monitor->DDC = pRADEONEnt->Controller[0].pPort->MonInfo;
-    info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType;
-
-    pRADEONEnt->ReversedDAC = FALSE;
-    info->OverlayOnCRTC2 = FALSE;
-    info->MergeType = MT_NONE;
-    if (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE) {
-	if(!pRADEONEnt->HasSecondary) {
- 	    info->MergeType = pRADEONEnt->Controller[1].pPort->MonType;
-	}
-
-	if (pRADEONEnt->PortInfo[1].DACType == DAC_TVDAC) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Reversed DAC decteced\n");
-	    pRADEONEnt->ReversedDAC = TRUE;
-	}
-    } else {
-	pRADEONEnt->HasSecondary = FALSE;
-    }
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Primary:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n",
-	       MonTypeName[pRADEONEnt->PortInfo[0].MonType+1],
-	       info->IsAtomBios ?
-	       ConnectorTypeNameATOM[pRADEONEnt->PortInfo[0].ConnectorType]:
-	       ConnectorTypeName[pRADEONEnt->PortInfo[0].ConnectorType],
-	       DACTypeName[pRADEONEnt->PortInfo[0].DACType+1],
-	       TMDSTypeName[pRADEONEnt->PortInfo[0].TMDSType+1],
-	       DDCTypeName[pRADEONEnt->PortInfo[0].DDCType]);
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-	       "Secondary:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n",
-	       MonTypeName[pRADEONEnt->PortInfo[1].MonType+1],
-	       info->IsAtomBios ?
-	       ConnectorTypeNameATOM[pRADEONEnt->PortInfo[1].ConnectorType]:
-	       ConnectorTypeName[pRADEONEnt->PortInfo[1].ConnectorType],
-	       DACTypeName[pRADEONEnt->PortInfo[1].DACType+1],
-	       TMDSTypeName[pRADEONEnt->PortInfo[1].TMDSType+1],
-	       DDCTypeName[pRADEONEnt->PortInfo[1].DDCType]);
-
     return TRUE;
 }
 
@@ -1273,7 +1214,99 @@ Bool RADEONMapControllers(ScrnInfoPtr pS
     RADEONInfoPtr info       = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
-    RADEONQueryConnectedMonitors(pScrn);
+
+    if (!info->IsSecondary) {
+      RADEONQueryConnectedMonitors(pScrn);
+
+      pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[0]);
+      pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[1]);
+
+      xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+		 "Port1:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n", 
+		 MonTypeName[pRADEONEnt->Controller[0].pPort->MonType+1], 
+		 info->IsAtomBios ? 
+		 ConnectorTypeNameATOM[pRADEONEnt->Controller[0].pPort->ConnectorType]:
+		 ConnectorTypeName[pRADEONEnt->Controller[0].pPort->ConnectorType],
+		 DACTypeName[pRADEONEnt->Controller[0].pPort->DACType+1],
+		 TMDSTypeName[pRADEONEnt->Controller[0].pPort->TMDSType+1],
+		 DDCTypeName[pRADEONEnt->Controller[0].pPort->DDCType]);
+
+      xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+		 "Port2:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n", 
+		 MonTypeName[pRADEONEnt->Controller[1].pPort->MonType+1], 
+		 info->IsAtomBios ? 
+		 ConnectorTypeNameATOM[pRADEONEnt->Controller[1].pPort->ConnectorType]:
+		 ConnectorTypeName[pRADEONEnt->Controller[1].pPort->ConnectorType],
+		 DACTypeName[pRADEONEnt->Controller[1].pPort->DACType+1],
+		 TMDSTypeName[pRADEONEnt->Controller[1].pPort->TMDSType+1],
+		 		 DDCTypeName[pRADEONEnt->Controller[1].pPort->DDCType]);
+
+	/* no display detected on primary port*/
+	if (pRADEONEnt->Controller[0].pPort->MonType == MT_NONE) {
+	    if (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE) {
+		/* Only one detected on secondary, let it to be primary */
+		pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
+		pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
+		head_reversed = TRUE;
+	    } else {
+		/* None detected, Default to a CRT connected */
+		pRADEONEnt->Controller[0].pPort->MonType = MT_CRT;
+	    }
+	}
+
+	if ((pRADEONEnt->Controller[0].pPort->MonType == MT_LCD) &&
+	    (pRADEONEnt->Controller[1].pPort->MonType == MT_CRT)) {
+	    if (!(INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON)) {
+		/* LCD is switched off, don't turn it on, otherwise it may casue lockup due to SS issue. */
+		pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
+		pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
+		pRADEONEnt->Controller[1].pPort->MonType = MT_NONE;
+		head_reversed = TRUE;
+		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD is switched off, only CRT will be used\n");
+	    }
+	}
+
+	if ((pRADEONEnt->Controller[0].pPort->MonType != MT_NONE) &&
+	    (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE)) {
+	  if (FALSE /*xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DISPLAY, FALSE)*/) {
+		if (info->IsMobility) {
+		    /* Don't reverse display for mobility chips, as only CRTC1 path has RMX which
+		       will be required by many LCD panels
+		    */
+		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Reverse Display cannot be used for mobility chip\n");
+		} else {
+		    pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
+		    pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
+		    head_reversed = TRUE;
+		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Primary and Secondary mapping is reversed\n");
+		}
+	    }
+	}
+
+	if (pRADEONEnt->HasSecondary && pRADEONEnt->Controller[1].pPort->MonType == MT_NONE) {
+	    pRADEONEnt->HasSecondary = FALSE;
+	}
+    }
+
+    if(info->HasCRTC2) {   
+	if(info->IsSecondary) {
+	    info->DisplayType = pRADEONEnt->Controller[1].pPort->MonType;
+	    pScrn->monitor->DDC = pRADEONEnt->Controller[1].pPort->MonInfo;
+	} else {
+	    info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType; 
+	    pScrn->monitor->DDC = pRADEONEnt->Controller[0].pPort->MonInfo;
+	}
+	
+	if(!pRADEONEnt->HasSecondary) {
+	    info->MergeType = pRADEONEnt->Controller[1].pPort->MonType;
+	} 
+    } else {
+	if (pRADEONEnt->Controller[0].pPort->MonType == MT_NONE) 
+	    pRADEONEnt->Controller[0].pPort->MonType = MT_CRT;
+	info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType; 
+	pScrn->monitor->DDC = pRADEONEnt->Controller[0].pPort->MonInfo;
+	pRADEONEnt->Controller[1].pPort->MonType = MT_NONE;
+    }
 
     if (!info->IsSecondary) {
         xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head:   Port%d ---- \n", head_reversed?2:1);
diff-tree 7a0e4eb47655c4701fc3a4b33b6c8e9f378ccc9e (from 75bf69c868be6164d0041a32f52244f1ef83e050)
Author: Dave Airlie <airlied at linux.ie>
Date:   Fri Sep 22 07:05:56 2006 +1000

    radeon: add some info to the map controllers

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 930c9b1..f029301 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1269,7 +1269,21 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
 
 Bool RADEONMapControllers(ScrnInfoPtr pScrn)
 {
-  return RADEONQueryConnectedMonitors(pScrn);
+    Bool head_reversed = FALSE;
+    RADEONInfoPtr info       = RADEONPTR(pScrn);
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
+    RADEONQueryConnectedMonitors(pScrn);
+
+    if (!info->IsSecondary) {
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head:   Port%d ---- \n", head_reversed?2:1);
+	if (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE)
+            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Port%d ----\n", head_reversed?1:2);
+ 	else
+            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
+    }
+
+    return TRUE;
 }
 
 /*
diff-tree 75bf69c868be6164d0041a32f52244f1ef83e050 (from 8ba5abd1329347c7fbf4b4d09c95da0d23b4884a)
Author: Dave Airlie <airlied at linux.ie>
Date:   Fri Sep 22 07:03:52 2006 +1000

    radeon: add simple map controllers call

diff --git a/src/radeon.h b/src/radeon.h
index 247cc6f..e8cd54c 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -878,7 +878,10 @@ extern Bool        RADEONGetHardCodedEDI
 extern void        RADEONInitDispBandwidth(ScrnInfoPtr pScrn);
 extern Bool        RADEONI2cInit(ScrnInfoPtr pScrn);
 extern void        RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag);
+extern Bool        RADEONMapControllers(ScrnInfoPtr pScrn);
+extern void        RADEONEnableDisplay(ScrnInfoPtr pScrn, RADEONController* pCRTC, BOOL bEnable);
 extern void        RADEONGetPanelInfo(ScrnInfoPtr pScrn);
+extern void        RADEONGetTVDacAdjInfo(ScrnInfoPtr pScrn);
 extern void        RADEONUnblank(ScrnInfoPtr pScrn);
 extern void        RADEONBlank(ScrnInfoPtr pScrn);
 extern void        RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
diff --git a/src/radeon_display.c b/src/radeon_display.c
index a6151f7..930c9b1 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1267,6 +1267,10 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
     return TRUE;
 }
 
+Bool RADEONMapControllers(ScrnInfoPtr pScrn)
+{
+  return RADEONQueryConnectedMonitors(pScrn);
+}
 
 /*
  * Powering done DAC, needed for DPMS problem with ViewSonic P817 (or its variant).
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 5ef7d15..72cb22a 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -3561,14 +3561,14 @@ static Bool RADEONPreInitXv(ScrnInfoPtr 
 static Bool RADEONPreInitControllers(ScrnInfoPtr pScrn, xf86Int10InfoPtr  pInt10)
 {
     RADEONGetBIOSInfo(pScrn, pInt10);
-    if (!RADEONQueryConnectedMonitors(pScrn))    
-      goto fail;
+
+    RADEONMapControllers(pScrn);
+
     RADEONGetClockInfo(pScrn);
+    RADEONGetPanelInfo(pScrn);
     RADEONGetTVDacAdjInfo(pScrn);
     
     return TRUE;
- fail:
-    return FALSE;
 }
 
 static void
diff-tree 8ba5abd1329347c7fbf4b4d09c95da0d23b4884a (from e8d77b7c36fa791a2350a6f4b15728b15d8f3de0)
Author: Dave Airlie <airlied at linux.ie>
Date:   Fri Sep 22 06:58:41 2006 +1000

    radeon: move comment

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 31e93ff..a6151f7 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -815,45 +815,45 @@ static Bool RADEONGetLVDSInfo (ScrnInfoP
      */
     RADEONUpdatePanelSize(pScrn);
 
-    /* No timing information for the native mode,
-     * use whatever specified in the Modeline.
-     * If no Modeline specified, we'll just pick
-     * the VESA mode at 60Hz refresh rate which
-     * is likely to be the best for a flat panel.
-     */
     if (info->DotClock == 0) {
-        RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
-        DisplayModePtr  tmp_mode = NULL;
-        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-                   "No valid timing info from BIOS.\n");
-        tmp_mode = pScrn->monitor->Modes;
-        while(tmp_mode) {
-            if ((tmp_mode->HDisplay == info->PanelXRes) &&
-                (tmp_mode->VDisplay == info->PanelYRes)) {
-
-                float  refresh =
-                    (float)tmp_mode->Clock * 1000.0 / tmp_mode->HTotal / tmp_mode->VTotal;
-                if ((abs(60.0 - refresh) < 1.0) ||
-                    (tmp_mode->type == 0)) {
-                    info->HBlank     = tmp_mode->HTotal - tmp_mode->HDisplay;
-                    info->HOverPlus  = tmp_mode->HSyncStart - tmp_mode->HDisplay;
-                    info->HSyncWidth = tmp_mode->HSyncEnd - tmp_mode->HSyncStart;
-                    info->VBlank     = tmp_mode->VTotal - tmp_mode->VDisplay;
-                    info->VOverPlus  = tmp_mode->VSyncStart - tmp_mode->VDisplay;
-                    info->VSyncWidth = tmp_mode->VSyncEnd - tmp_mode->VSyncStart;
-                    info->DotClock   = tmp_mode->Clock;
-                    info->Flags = 0;
-                    break;
-                }
-            }
-            tmp_mode = tmp_mode->next;
-        }
-        if ((info->DotClock == 0) && !pRADEONEnt->PortInfo[0].MonInfo) {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Panel size is not correctly detected.\n"
-                       "Please try to use PanelSize option for correct settings.\n");
-            return FALSE;
-        }
+	RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+	DisplayModePtr  tmp_mode = NULL;
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "No valid timing info from BIOS.\n");
+	/* No timing information for the native mode,
+	   use whatever specified in the Modeline.
+	   If no Modeline specified, we'll just pick
+	   the VESA mode at 60Hz refresh rate which
+	   is likely to be the best for a flat panel.
+	*/
+	tmp_mode = pScrn->monitor->Modes;
+	while(tmp_mode) {
+	    if ((tmp_mode->HDisplay == info->PanelXRes) &&
+		(tmp_mode->VDisplay == info->PanelYRes)) {
+		    
+		float  refresh =
+		    (float)tmp_mode->Clock * 1000.0 / tmp_mode->HTotal / tmp_mode->VTotal;
+		if ((abs(60.0 - refresh) < 1.0) ||
+		    (tmp_mode->type == 0)) {
+		    info->HBlank     = tmp_mode->HTotal - tmp_mode->HDisplay;
+		    info->HOverPlus  = tmp_mode->HSyncStart - tmp_mode->HDisplay;
+		    info->HSyncWidth = tmp_mode->HSyncEnd - tmp_mode->HSyncStart;
+		    info->VBlank     = tmp_mode->VTotal - tmp_mode->VDisplay;
+		    info->VOverPlus  = tmp_mode->VSyncStart - tmp_mode->VDisplay;
+		    info->VSyncWidth = tmp_mode->VSyncEnd - tmp_mode->VSyncStart;
+		    info->DotClock   = tmp_mode->Clock;
+		    info->Flags = 0;
+		    break;
+		}
+		tmp_mode = tmp_mode->next;
+	    }
+	}
+	if ((info->DotClock == 0) && !pRADEONEnt->PortInfo[0].MonInfo) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		       "Panel size is not correctly detected.\n"
+		       "Please try to use PanelSize option for correct settings.\n");
+	    return FALSE;
+	}
     }
 
     return TRUE;
diff-tree e8d77b7c36fa791a2350a6f4b15728b15d8f3de0 (from 8534723f5710e2916b4a22efe22a6b7365cc8db6)
Author: Dave Airlie <airlied at linux.ie>
Date:   Fri Sep 22 06:55:51 2006 +1000

    radeon: refactor blank/unblank

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 893bdf2..31e93ff 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1784,35 +1784,107 @@ void RADEONInitDispBandwidth(ScrnInfoPtr
     }
 }
 
+static void RADEONBlankSet(ScrnInfoPtr pScrn, int controller)
+{
+    RADEONInfoPtr  info       = RADEONPTR(pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+
+    switch(pRADEONEnt->Controller[controller].pPort->MonType) {
+    case MT_LCD:
+        OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS);
+        break;
+
+    case MT_CRT:
+       if ((info->ChipFamily == CHIP_FAMILY_R200) && 
+ 	  (pRADEONEnt->Controller[controller].pPort->DACType == DAC_TVDAC))
+	    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
+      
+        break;
+    case MT_DFP:
+        if (pRADEONEnt->Controller[controller].pPort->TMDSType == TMDS_EXT)
+  	    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
+        else
+	    OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN);
+      
+        break;
+    case MT_NONE:
+    default:
+        break;
+    }   
+}
 
 /* Blank screen */
 void RADEONBlank(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
 
-    if (!info->IsSecondary) {
-	switch(info->DisplayType) {
-	case MT_LCD:
-	case MT_CRT:
-	case MT_DFP:
-	    OUTREGP(RADEON_CRTC_EXT_CNTL,
-		    RADEON_CRTC_DISPLAY_DIS,
-		    ~(RADEON_CRTC_DISPLAY_DIS));
-	    break;
-
-	case MT_NONE:
-	default:
-	    break;
+    if (!pRADEONEnt->HasSecondary ||
+	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
+	(info->IsSwitching && (!info->IsSecondary))) {
+      
+        RADEONBlankSet(pScrn, 0);
+	OUTREGP (RADEON_CRTC_EXT_CNTL,
+		 RADEON_CRTC_DISPLAY_DIS |
+		 RADEON_CRTC_VSYNC_DIS |
+		 RADEON_CRTC_HSYNC_DIS,
+		 ~(RADEON_CRTC_DISPLAY_DIS |
+		   RADEON_CRTC_VSYNC_DIS | 
+		   RADEON_CRTC_HSYNC_DIS));
+
+	if (!info->HasCRTC2) return;
+
+	if (info->MergedFB) {
+  	    RADEONBlankSet(pScrn, 1);
+	    OUTREGP (RADEON_CRTC2_GEN_CNTL,
+		     RADEON_CRTC2_DISP_DIS |
+		     RADEON_CRTC2_VSYNC_DIS |
+		     RADEON_CRTC2_HSYNC_DIS,
+		     ~(RADEON_CRTC2_DISP_DIS |
+		       RADEON_CRTC2_VSYNC_DIS | 
+		       RADEON_CRTC2_HSYNC_DIS));
 	}
-	if (info->MergedFB)
-	    OUTREGP(RADEON_CRTC2_GEN_CNTL,
-		    RADEON_CRTC2_DISP_DIS,
-		    ~(RADEON_CRTC2_DISP_DIS));
-    } else {
-	OUTREGP(RADEON_CRTC2_GEN_CNTL,
-		RADEON_CRTC2_DISP_DIS,
-		~(RADEON_CRTC2_DISP_DIS));
+    }
+
+    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
+	(info->IsSwitching && info->IsSecondary)) {
+        RADEONBlankSet(pScrn, 1);
+	OUTREGP (RADEON_CRTC2_GEN_CNTL,
+		 RADEON_CRTC2_DISP_DIS |
+		 RADEON_CRTC2_VSYNC_DIS |
+		 RADEON_CRTC2_HSYNC_DIS,
+		 ~(RADEON_CRTC2_DISP_DIS |
+		   RADEON_CRTC2_VSYNC_DIS | 
+		   RADEON_CRTC2_HSYNC_DIS));
+    }
+}
+
+static void RADEONUnblankSet(ScrnInfoPtr pScrn, int controller)
+{
+    RADEONInfoPtr info = RADEONPTR (pScrn);
+    unsigned char *RADEONMMIO = info->MMIO;
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
+
+    switch(pRADEONEnt->Controller[controller].pPort->MonType) {
+    case MT_LCD:
+        OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS);
+        break;
+    case MT_CRT:
+        if ((info->ChipFamily == CHIP_FAMILY_R200) &&
+	  (pRADEONEnt->Controller[controller].pPort->DACType == DAC_TVDAC))
+	      OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
+        break;
+    case MT_DFP:
+        if (pRADEONEnt->Controller[controller].pPort->TMDSType == TMDS_EXT)
+	    OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
+        else
+	    OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN);
+        break;
+    case MT_NONE:
+    default:
+        break;
     }
 }
 
@@ -1821,39 +1893,33 @@ void RADEONUnblank(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
+    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
 
-    if (!info->IsSecondary) {
-	switch (info->DisplayType) {
-	case MT_LCD:
-	case MT_CRT:
-	case MT_DFP:
-	    OUTREGP(RADEON_CRTC_EXT_CNTL,
-		    RADEON_CRTC_CRT_ON,
-		    ~(RADEON_CRTC_DISPLAY_DIS));
-	    break;
-
-	case MT_NONE:
-	default:
-	    break;
-	}
-	if (info->MergedFB)
-	    OUTREGP(RADEON_CRTC2_GEN_CNTL,
-		    0,
-		    ~(RADEON_CRTC2_DISP_DIS));
-    } else {
-	switch (info->DisplayType) {
-	case MT_LCD:
-	case MT_DFP:
-	case MT_CRT:
-	    OUTREGP(RADEON_CRTC2_GEN_CNTL,
-		    0,
-		    ~(RADEON_CRTC2_DISP_DIS));
-	    break;
+    if (!pRADEONEnt->HasSecondary || (info->IsSwitching  && !info->IsSecondary)) {
+      RADEONUnblankSet(pScrn, 0);
+      OUTREGP(RADEON_CRTC_EXT_CNTL,
+	      0,
+	      ~(RADEON_CRTC_DISPLAY_DIS |
+		RADEON_CRTC_VSYNC_DIS |
+		RADEON_CRTC_HSYNC_DIS));
+
+      if (!info->HasCRTC2) return;
+
+      if (info->MergedFB) {
+	RADEONUnblankSet(pScrn, 1);
+	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
+		~(RADEON_CRTC2_DISP_DIS |
+		  RADEON_CRTC2_VSYNC_DIS |
+		  RADEON_CRTC2_HSYNC_DIS));
+      }
+    }
 
-	case MT_NONE:
-	default:
-	    break;
-	}
+    if (info->IsSwitching && info->IsSecondary) {
+        RADEONUnblankSset(pScrn, 1);
+	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
+		~(RADEON_CRTC2_DISP_DIS |
+		  RADEON_CRTC2_VSYNC_DIS |
+		  RADEON_CRTC2_HSYNC_DIS));
     }
 }
 
diff-tree 8534723f5710e2916b4a22efe22a6b7365cc8db6 (from d7fc79fd9f094ac462de0883af7e6030cb6195a6)
Author: Alex Deucher <alexdeucher at gmail.com>
Date:   Fri Sep 22 06:36:03 2006 +1000

    radeon: make DVI_I default connector

diff --git a/src/radeon_display.c b/src/radeon_display.c
index c660831..893bdf2 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -960,7 +960,7 @@ BOOL RADEONQueryConnectedMonitors(ScrnIn
 	pRADEONEnt->PortInfo[0].DDCType = DDC_DVI;
 	pRADEONEnt->PortInfo[0].DACType = DAC_TVDAC;
 	pRADEONEnt->PortInfo[0].TMDSType = TMDS_INT;
-	pRADEONEnt->PortInfo[0].ConnectorType = CONNECTOR_DVI_D;
+	pRADEONEnt->PortInfo[0].ConnectorType = CONNECTOR_DVI_I;
 
 	pRADEONEnt->PortInfo[1].MonType = MT_UNKNOWN;
 	pRADEONEnt->PortInfo[1].MonInfo = NULL;
diff-tree d7fc79fd9f094ac462de0883af7e6030cb6195a6 (from 4a54886d510f26b29d27e5c9a73647554291b1a6)
Author: Dave Airlie <airlied at linux.ie>
Date:   Fri Sep 22 06:35:34 2006 +1000

    radeon: add enable display function

diff --git a/src/radeon_display.c b/src/radeon_display.c
index 250b543..c660831 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -1348,6 +1348,116 @@ static void RADEONDacPowerSet(ScrnInfoPt
     }
 }
 
+/* This is to be used enable/disable displays dynamically */
+void RADEONEnableDisplay(ScrnInfoPtr pScrn, RADEONController* pCRTC, BOOL bEnable)
+{
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+    RADEONSavePtr save = &info->ModeReg;
+    unsigned char * RADEONMMIO = info->MMIO;
+    unsigned long tmp;
+
+    if (bEnable) {
+        if (pCRTC->pPort->MonType == MT_CRT) {
+            if (pCRTC->pPort->DACType == DAC_PRIMARY) {
+                tmp = INREG(RADEON_CRTC_EXT_CNTL);
+                tmp |= RADEON_CRTC_CRT_ON;                    
+                OUTREG(RADEON_CRTC_EXT_CNTL, tmp);
+                save->crtc_ext_cntl |= RADEON_CRTC_CRT_ON;
+            } else if (pCRTC->pPort->DACType == DAC_TVDAC) {
+                if (info->ChipFamily == CHIP_FAMILY_R200) {
+                    tmp = INREG(RADEON_CRTC2_GEN_CNTL);
+                    tmp |= RADEON_CRTC2_CRT2_ON;  
+                    OUTREG(RADEON_CRTC2_GEN_CNTL, tmp);
+                    save->crtc2_gen_cntl |= RADEON_CRTC2_CRT2_ON;
+                } else {
+                    tmp = INREG(RADEON_FP2_GEN_CNTL);
+                    tmp |= (RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+                    OUTREG(RADEON_FP2_GEN_CNTL, tmp);
+                    save->fp2_gen_cntl |= (RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+                }
+            }
+	    RADEONDacPowerSet(pScrn, bEnable, (pCRTC->pPort->DACType == DAC_PRIMARY));
+        } else if (pCRTC->pPort->MonType == MT_DFP) {
+            if (pCRTC->pPort->TMDSType == TMDS_INT) {
+                tmp = INREG(RADEON_FP_GEN_CNTL);
+                tmp |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN);
+                OUTREG(RADEON_FP_GEN_CNTL, tmp);
+                save->fp_gen_cntl |= (RADEON_FP_FPON | RADEON_FP_TMDS_EN);
+            } else if (pCRTC->pPort->TMDSType == TMDS_EXT) {
+                tmp = INREG(RADEON_FP2_GEN_CNTL);
+                tmp |= (RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+                OUTREG(RADEON_FP2_GEN_CNTL, tmp);
+                save->fp2_gen_cntl |= (RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+            }
+        } else if (pCRTC->pPort->MonType == MT_LCD) {
+            tmp = INREG(RADEON_LVDS_GEN_CNTL);
+            tmp |= (RADEON_LVDS_ON | RADEON_LVDS_BLON);
+            tmp &= ~(RADEON_LVDS_DISPLAY_DIS);
+	    usleep (info->PanelPwrDly * 1000);
+            OUTREG(RADEON_LVDS_GEN_CNTL, tmp);
+            save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON);
+            save->lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS);
+        } 
+    } else {
+        if (pCRTC->pPort->MonType == MT_CRT || pCRTC->pPort->MonType == NONE) {
+            if (pCRTC->pPort->DACType == DAC_PRIMARY) {
+                tmp = INREG(RADEON_CRTC_EXT_CNTL);
+                tmp &= ~RADEON_CRTC_CRT_ON;                    
+                OUTREG(RADEON_CRTC_EXT_CNTL, tmp);
+                save->crtc_ext_cntl &= ~RADEON_CRTC_CRT_ON;
+            } else if (pCRTC->pPort->DACType == DAC_TVDAC) {
+                if (info->ChipFamily == CHIP_FAMILY_R200) {
+                    tmp = INREG(RADEON_FP2_GEN_CNTL);
+                    tmp &= ~(RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+                    OUTREG(RADEON_FP2_GEN_CNTL, tmp);
+                    save->fp2_gen_cntl &= ~(RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+                } else {
+                    tmp = INREG(RADEON_CRTC2_GEN_CNTL);
+                    tmp &= ~RADEON_CRTC2_CRT2_ON;  
+                    OUTREG(RADEON_CRTC2_GEN_CNTL, tmp);
+                    save->crtc2_gen_cntl &= ~RADEON_CRTC2_CRT2_ON;
+                }
+            }
+	    RADEONDacPowerSet(pScrn, bEnable, (pCRTC->pPort->DACType == DAC_PRIMARY));
+        }
+
+        if (pCRTC->pPort->MonType == MT_DFP || pCRTC->pPort->MonType == NONE) {
+            if (pCRTC->pPort->TMDSType == TMDS_INT) {
+                tmp = INREG(RADEON_FP_GEN_CNTL);
+                tmp &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN);
+                OUTREG(RADEON_FP_GEN_CNTL, tmp);
+                save->fp_gen_cntl &= ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN);
+            } else if (pCRTC->pPort->TMDSType == TMDS_EXT) {
+                tmp = INREG(RADEON_FP2_GEN_CNTL);
+                tmp &= ~(RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+                OUTREG(RADEON_FP2_GEN_CNTL, tmp);
+                save->fp2_gen_cntl &= ~(RADEON_FP2_ON | RADEON_FP2_DVO_EN);
+            }
+        }
+
+        if (pCRTC->pPort->MonType == MT_LCD || 
+            (pCRTC->pPort->MonType == NONE && pCRTC->pPort->ConnectorType == CONNECTOR_PROPRIETARY)) {
+	    unsigned long tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
+	    if (info->IsMobility || info->IsIGP) {
+	    /* Asic bug, when turning off LVDS_ON, we have to make sure
+	       RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off
+	    */
+		OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
+	    }
+            tmp = INREG(RADEON_LVDS_GEN_CNTL);
+            tmp |= (RADEON_LVDS_ON | RADEON_LVDS_DISPLAY_DIS);
+            tmp &= ~(RADEON_LVDS_BLON);
+            OUTREG(RADEON_LVDS_GEN_CNTL, tmp);
+            save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_DISPLAY_DIS);
+            save->lvds_gen_cntl &= ~(RADEON_LVDS_BLON);
+	    if (info->IsMobility || info->IsIGP) {
+		OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
+	    }
+        }
+    }
+    pCRTC->IsActive = bEnable;
+}
+
 /* Calculate display buffer watermark to prevent buffer underflow */
 void RADEONInitDispBandwidth(ScrnInfoPtr pScrn)
 {



More information about the xorg-commit mailing list