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

Alex Deucher agd5f at kemper.freedesktop.org
Mon Aug 27 21:08:49 PDT 2007


 src/radeon.h        |    1 
 src/radeon_bios.c   |   17 ----
 src/radeon_modes.c  |   60 ++++++++---------
 src/radeon_output.c |  177 +++++++++++++++++++++++++++++++++++++++++++++++-----
 src/radeon_probe.h  |    8 ++
 5 files changed, 200 insertions(+), 63 deletions(-)

New commits:
diff-tree ad6f7ad1b2ccae0bc0a416b9b0ca22709c9d5199 (from 17e0f9e6cbfdb115034d327bd34d46339fd632b7)
Author: Alex Deucher <alex at botch2.(none)>
Date:   Tue Aug 28 00:08:41 2007 -0400

    RADEON: remove the "default" tv_standard option

diff --git a/src/radeon_output.c b/src/radeon_output.c
index 6bd0d95..3003ead 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1806,7 +1806,27 @@ radeon_create_resources(xf86OutputPtr ou
 		       "RRConfigureOutputProperty error, %d\n", err);
 	}
 	/* Set the current value of the backlight property */
-	s = "default";
+	switch (radeon_output->default_tvStd) {
+	case TV_STD_PAL:
+	    s = "pal";
+	    break;
+	case TV_STD_PAL_M:
+	    s = "pal-m";
+	    break;
+	case TV_STD_PAL_60:
+	    s = "pal-60";
+	    break;
+	case TV_STD_NTSC_J:
+	    s = "ntsc-j";
+	    break;
+	case TV_STD_SCART_PAL:
+	    s = "scart-pal";
+	    break;
+	case TV_STD_NTSC:
+	default:
+	    s = "ntsc";
+	    break;
+	}
 	err = RRChangeOutputProperty(output->randr_output, tv_std_atom,
 				     XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s,
 				     FALSE, FALSE);
diff-tree 17e0f9e6cbfdb115034d327bd34d46339fd632b7 (from 42839fb5a8584196e7b18375bff6c426ed0347d9)
Author: Alex Deucher <alex at botch2.(none)>
Date:   Mon Aug 27 23:59:03 2007 -0400

    RADEON: enable load detection for tvdac if output count for tvdac < 2

diff --git a/src/radeon.h b/src/radeon.h
index 53fb5f7..fa2bccd 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -799,6 +799,7 @@ typedef struct {
     Bool              crtc2_on;
 
     Bool              InternalTVOut;
+    int               tvdac_use_count;
 
     Rotation rotation;
     void (*PointerMoved)(int, int, int);
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 78f451e..6bd0d95 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1637,14 +1637,13 @@ radeon_create_resources(xf86OutputPtr ou
 	if (err != 0) {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "RRConfigureOutputProperty error, %d\n", err);
-	}
+	}	
 
 	if (radeon_output->DACType == DAC_PRIMARY)
 	    data = 1; /* primary dac, only drives vga */
 	else if (radeon_output->DACType == DAC_TVDAC &&
-		 info->IsMobility &&
-		 !info->IsIGP)
-	    data = 1; /* laptops with tv only on tvdac */
+		 info->tvdac_use_count < 2)
+	    data = 1; /* only one output with tvdac */
 	else
 	    data = 0; /* shared tvdac between vga/dvi/tv */
 
@@ -2428,9 +2427,8 @@ void RADEONInitConnector(xf86OutputPtr o
     if (radeon_output->DACType == DAC_PRIMARY)
 	radeon_output->load_detection = 1; /* primary dac, only drives vga */
     else if (radeon_output->DACType == DAC_TVDAC &&
-	     info->IsMobility &&
-	     !info->IsIGP)
-	radeon_output->load_detection = 1; /* laptops with tv only on tvdac */
+	     info->tvdac_use_count < 2)
+	radeon_output->load_detection = 1; /* only one output with tvdac */
     else
 	radeon_output->load_detection = 0; /* shared tvdac between vga/dvi/tv */
 
@@ -2617,8 +2615,12 @@ Bool RADEONSetupConnectors(ScrnInfoPtr p
 	}
     }
 
+    info->tvdac_use_count = 0;
     for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) {
 	if (info->BiosConnector[i].valid) {
+	    if (info->BiosConnector[i].DACType == DAC_TVDAC)
+		info->tvdac_use_count++;
+
 	    if (info->IsAtomBios) {
 		if ((info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_D_ATOM) ||
 		    (info->BiosConnector[i].ConnectorType == CONNECTOR_DVI_I_ATOM) ||
diff-tree 42839fb5a8584196e7b18375bff6c426ed0347d9 (from a5a1055d64ab4fa16bfb03a412ae6c4fe69ff65d)
Author: Alex Deucher <alex at botch2.(none)>
Date:   Mon Aug 27 23:44:13 2007 -0400

    RADEON: make load detection an output attribute for analog outputs
    
    Since TV/VGA/DVI-I can share the TV DAC, we often get false detection
    of all inputs that share that DAC.  Make load detection an output
    attribute.  Enabled by default on primary dac and on cards where
    tv dac is (usually) dedicated to tv (non-IGP mobilities).

diff --git a/src/radeon_modes.c b/src/radeon_modes.c
index a5e1cc4..687e388 100644
--- a/src/radeon_modes.c
+++ b/src/radeon_modes.c
@@ -289,47 +289,47 @@ RADEONProbeOutputModes(xf86OutputPtr out
 #endif
     ErrorF("in RADEONProbeOutputModes\n");
 
-
-    if (radeon_output->type == OUTPUT_DVI || radeon_output->type == OUTPUT_VGA) {
-	edid_mon = xf86OutputGetEDID (output, radeon_output->pI2CBus);
-	xf86OutputSetEDID (output, edid_mon);
+    if (output->status == XF86OutputStatusConnected) {
+	if (radeon_output->type == OUTPUT_DVI || radeon_output->type == OUTPUT_VGA) {
+	    edid_mon = xf86OutputGetEDID (output, radeon_output->pI2CBus);
+	    xf86OutputSetEDID (output, edid_mon);
       
-	modes = xf86OutputGetEDIDModes (output);
-	return modes;
-    }
-    if (radeon_output->type == OUTPUT_STV || radeon_output->type == OUTPUT_CTV) {
-	modes = RADEONTVModes(output);
-	return modes;
-    }
-    if (radeon_output->type == OUTPUT_LVDS) {
-	/* okay we got DDC info */
-	if (output->MonInfo) {
-	    /* Debug info for now, at least */
-	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %d\n", radeon_output->num);
-	    xf86PrintEDID(output->MonInfo);
+	    modes = xf86OutputGetEDIDModes (output);
+	    return modes;
+	}
+	if (radeon_output->type == OUTPUT_STV || radeon_output->type == OUTPUT_CTV) {
+	    modes = RADEONTVModes(output);
+	    return modes;
+	}
+	if (radeon_output->type == OUTPUT_LVDS) {
+	    /* okay we got DDC info */
+	    if (output->MonInfo) {
+		/* Debug info for now, at least */
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID for output %d\n", radeon_output->num);
+		xf86PrintEDID(output->MonInfo);
 	
-	    modes = xf86DDCGetModes(pScrn->scrnIndex, output->MonInfo);
+		modes = xf86DDCGetModes(pScrn->scrnIndex, output->MonInfo);
 	
-	    for (mode = modes; mode != NULL; mode = mode->next) {
-		if (mode->Flags & V_DBLSCAN) {
-		    if ((mode->CrtcHDisplay >= 1024) || (mode->CrtcVDisplay >= 768))
-			mode->status = MODE_CLOCK_RANGE;
+		for (mode = modes; mode != NULL; mode = mode->next) {
+		    if (mode->Flags & V_DBLSCAN) {
+			if ((mode->CrtcHDisplay >= 1024) || (mode->CrtcVDisplay >= 768))
+			    mode->status = MODE_CLOCK_RANGE;
+		    }
 		}
-	    }
-	    xf86PruneInvalidModes(pScrn, &modes, TRUE);
+		xf86PruneInvalidModes(pScrn, &modes, TRUE);
 	
-	    /* do some physcial size stuff */
-	}
+		/* do some physcial size stuff */
+	    }
       
-	if (modes == NULL) {
-	    RADEONValidateFPModes(output, pScrn->display->modes, &modes);
+	    if (modes == NULL) {
+		RADEONValidateFPModes(output, pScrn->display->modes, &modes);
+	    }
 	}
     }
     
     if (modes) {
 	xf86ValidateModesUserConfig(pScrn, modes);
-	xf86PruneInvalidModes(pScrn, &modes,
-			      FALSE);
+	xf86PruneInvalidModes(pScrn, &modes, FALSE);
     }
 
     return modes;
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 35c6cbe..78f451e 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -536,21 +536,29 @@ void RADEONConnectorFindMonitor(ScrnInfo
 
     if (radeon_output->MonType == MT_UNKNOWN) {
 	if (radeon_output->type == OUTPUT_STV || radeon_output->type == OUTPUT_CTV) {
-	    if (info->InternalTVOut)
-		radeon_output->MonType = radeon_detect_tv(pScrn);
+	    if (info->InternalTVOut) {
+		if (radeon_output->load_detection)
+		    radeon_output->MonType = radeon_detect_tv(pScrn);
+		else
+		    radeon_output->MonType = MT_NONE;
+	    }
 	} else {
 	    radeon_output->MonType = RADEONDisplayDDCConnected(pScrn, output);
 	    if (!radeon_output->MonType) {
 		if (radeon_output->type == OUTPUT_LVDS || radeon_output->type == OUTPUT_DVI)
 		    radeon_output->MonType = RADEONPortCheckNonDDC(pScrn, output);
 		if (!radeon_output->MonType) {
-		    if (radeon_output->DACType == DAC_PRIMARY)
-			radeon_output->MonType = radeon_detect_primary_dac(pScrn, TRUE);
-		    else if (radeon_output->DACType == DAC_TVDAC) {
-			if (info->ChipFamily == CHIP_FAMILY_R200)
-			    radeon_output->MonType = radeon_detect_ext_dac(pScrn);
-			else
-			    radeon_output->MonType = radeon_detect_tv_dac(pScrn, TRUE);
+		    if (radeon_output->DACType == DAC_PRIMARY) {
+			if (radeon_output->load_detection)
+			    radeon_output->MonType = radeon_detect_primary_dac(pScrn, TRUE);
+		    } else if (radeon_output->DACType == DAC_TVDAC) {
+			if (radeon_output->load_detection) {
+			    if (info->ChipFamily == CHIP_FAMILY_R200)
+				radeon_output->MonType = radeon_detect_ext_dac(pScrn);
+			    else
+				radeon_output->MonType = radeon_detect_tv_dac(pScrn, TRUE);
+			} else
+			    radeon_output->MonType = MT_NONE;
 		    }
 		}
 	    }
@@ -1577,6 +1585,7 @@ static Atom backlight_atom;
 static Atom tmds_pll_atom;
 static Atom rmx_atom;
 static Atom monitor_type_atom;
+static Atom load_detection_atom;
 static Atom tv_hsize_atom;
 static Atom tv_hpos_atom;
 static Atom tv_vpos_atom;
@@ -1617,6 +1626,37 @@ radeon_create_resources(xf86OutputPtr ou
 	}
     }
 
+    if (radeon_output->DACType == DAC_PRIMARY ||
+	radeon_output->DACType == DAC_TVDAC) {
+	load_detection_atom = MAKE_ATOM("load_detection");
+
+	range[0] = 0; /* off */
+	range[1] = 1; /* on */
+	err = RRConfigureOutputProperty(output->randr_output, load_detection_atom,
+					FALSE, TRUE, FALSE, 2, range);
+	if (err != 0) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		       "RRConfigureOutputProperty error, %d\n", err);
+	}
+
+	if (radeon_output->DACType == DAC_PRIMARY)
+	    data = 1; /* primary dac, only drives vga */
+	else if (radeon_output->DACType == DAC_TVDAC &&
+		 info->IsMobility &&
+		 !info->IsIGP)
+	    data = 1; /* laptops with tv only on tvdac */
+	else
+	    data = 0; /* shared tvdac between vga/dvi/tv */
+
+	err = RRChangeOutputProperty(output->randr_output, load_detection_atom,
+				     XA_INTEGER, 32, PropModeReplace, 1, &data,
+				     FALSE, TRUE);
+	if (err != 0) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		       "RRChangeOutputProperty error, %d\n", err);
+	}
+    }
+
     if (radeon_output->type == OUTPUT_DVI &&
 	radeon_output->TMDSType == TMDS_INT) {
 	tmds_pll_atom = MAKE_ATOM("tmds_pll");
@@ -1803,6 +1843,19 @@ radeon_set_property(xf86OutputPtr output
 
 	radeon_set_backlight_level(output, val);
 
+    } else if (property == load_detection_atom) {
+	if (value->type != XA_INTEGER ||
+	    value->format != 32 ||
+	    value->size != 1) {
+	    return FALSE;
+	}
+
+	val = *(INT32 *)value->data;
+	if (val < 0 || val > 1)
+	    return FALSE;
+
+	radeon_output->load_detection = val;
+
     } else if (property == rmx_atom) {
 	xf86CrtcPtr	crtc = output->crtc;
 	RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
@@ -2358,6 +2411,7 @@ RADEONGetTVInfo(xf86OutputPtr output)
 void RADEONInitConnector(xf86OutputPtr output)
 {
     ScrnInfoPtr	    pScrn = output->scrn;
+    RADEONInfoPtr  info       = RADEONPTR(pScrn);
     RADEONOutputPrivatePtr radeon_output = output->driver_private;
     int DDCReg = 0;
     char* name = (char*) DDCTypeName[radeon_output->DDCType];
@@ -2370,7 +2424,16 @@ void RADEONInitConnector(xf86OutputPtr o
     case DDC_LCD  : DDCReg = RADEON_LCD_GPIO_MASK; break;
     default: break;
     }
-    
+
+    if (radeon_output->DACType == DAC_PRIMARY)
+	radeon_output->load_detection = 1; /* primary dac, only drives vga */
+    else if (radeon_output->DACType == DAC_TVDAC &&
+	     info->IsMobility &&
+	     !info->IsIGP)
+	radeon_output->load_detection = 1; /* laptops with tv only on tvdac */
+    else
+	radeon_output->load_detection = 0; /* shared tvdac between vga/dvi/tv */
+
     if (DDCReg) {
 	radeon_output->DDCReg = DDCReg;
 	RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, name);
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 3bbda49..947bf88 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -211,6 +211,7 @@ typedef struct _RADEONOutputPrivateRec {
     int               hSize;
     float             TVRefClk;
     int               SupportedTVStds;
+    int               load_detection;
 } RADEONOutputPrivateRec, *RADEONOutputPrivatePtr;
 
 #define RADEON_MAX_CRTC 2
diff-tree a5a1055d64ab4fa16bfb03a412ae6c4fe69ff65d (from a12e4aa01bf1c5723c3c791ff9bdc26eef21d5ea)
Author: Alex Deucher <alex at botch2.(none)>
Date:   Mon Aug 27 22:42:22 2007 -0400

    RADEON: make tmds pll an output attribute
    
    sometimes the bios tmds plls are busted for certain
    monitors. sometimes the dirver tables are.  Let the user
    pick at run time.

diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index 1ef0ff4..b24c481 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -879,23 +879,6 @@ Bool RADEONGetTMDSInfoFromBIOS (xf86Outp
 		}
 		return TRUE;
 	    }
-
-	    /* revision 4 has some problem as it appears in RV280, 
-	       comment it off for now, use default instead */ 
-	    /*    
-		  else if (RADEON_BIOS8(tmp) == 4) {
-		  int stride = 0;
-		  n = RADEON_BIOS8(tmp + 5) + 1;
-		  if (n > 4) n = 4;
-		  for (i=0; i<n; i++) {
-		  radeon_output->tmds_pll[i].value = RADEON_BIOS32(tmp+stride+0x08);
-		  radeon_output->tmds_pll[i].freq = RADEON_BIOS16(tmp+stride+0x10);
-		  if (i == 0) stride += 10;
-		  else stride += 6;
-		  }
-		  return TRUE;
-		  }
-	    */  
 	}
     }
     return FALSE;
diff --git a/src/radeon_output.c b/src/radeon_output.c
index c2b749a..35c6cbe 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -152,6 +152,7 @@ static RADEONMonitorType radeon_detect_t
 static RADEONMonitorType radeon_detect_primary_dac(ScrnInfoPtr pScrn, Bool color);
 static RADEONMonitorType radeon_detect_tv_dac(ScrnInfoPtr pScrn, Bool color);
 static RADEONMonitorType radeon_detect_ext_dac(ScrnInfoPtr pScrn);
+static void RADEONGetTMDSInfoFromTable(xf86OutputPtr output);
 
 void RADEONPrintPortMap(ScrnInfoPtr pScrn)
 {
@@ -1009,6 +1010,15 @@ radeon_mode_set(xf86OutputPtr output, Di
     xf86CrtcPtr	crtc = output->crtc;
     RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
 
+    if (radeon_output->type == OUTPUT_DVI &&
+	radeon_output->TMDSType == TMDS_INT) {
+	if (radeon_output->tmds_pll_table == TMDS_PLL_BIOS) {
+	    if (!RADEONGetTMDSInfoFromBIOS(output))
+		RADEONGetTMDSInfoFromTable(output);
+	} else
+	    RADEONGetTMDSInfoFromTable(output);
+    }
+
     RADEONInitOutputRegisters(pScrn, &info->ModeReg, adjusted_mode, output, radeon_crtc->crtc_id);
 
     if (radeon_crtc->crtc_id == 0)
@@ -1564,6 +1574,7 @@ radeon_set_backlight_level(xf86OutputPtr
 }
 
 static Atom backlight_atom;
+static Atom tmds_pll_atom;
 static Atom rmx_atom;
 static Atom monitor_type_atom;
 static Atom tv_hsize_atom;
@@ -1606,6 +1617,32 @@ radeon_create_resources(xf86OutputPtr ou
 	}
     }
 
+    if (radeon_output->type == OUTPUT_DVI &&
+	radeon_output->TMDSType == TMDS_INT) {
+	tmds_pll_atom = MAKE_ATOM("tmds_pll");
+
+	err = RRConfigureOutputProperty(output->randr_output, tmds_pll_atom,
+					FALSE, FALSE, FALSE, 0, NULL);
+	if (err != 0) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		       "RRConfigureOutputProperty error, %d\n", err);
+	}
+	/* Set the current value of the property */
+#if defined(__powerpc__)
+	s = "driver";
+#else
+	s = "bios";
+#endif
+	err = RRChangeOutputProperty(output->randr_output, tmds_pll_atom,
+				     XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s,
+				     FALSE, FALSE);
+	if (err != 0) {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		       "RRChangeOutputProperty error, %d\n", err);
+	}
+
+    }
+
     /* RMX control - fullscreen, centered, keep ratio */
     /* actually more of a crtc property as only crtc1 has rmx */
     if (radeon_output->type == OUTPUT_LVDS ||
@@ -1785,6 +1822,19 @@ radeon_set_property(xf86OutputPtr output
 	} else {
 	    return FALSE;
 	}
+    } else if (property == tmds_pll_atom) {
+	const char *s;
+	if (value->type != XA_STRING || value->format != 8)
+	    return FALSE;
+	s = (char*)value->data;
+	if (value->size == strlen("bios") && !strncmp("bios", s, strlen("bios"))) {
+	    radeon_output->tmds_pll_table = TMDS_PLL_BIOS;
+	    return TRUE;
+	} else if (value->size == strlen("driver") && !strncmp("driver", s, strlen("driver"))) {
+	    radeon_output->tmds_pll_table = TMDS_PLL_DRIVER;
+	    return TRUE;
+	}
+	return FALSE;
     } else if (property == monitor_type_atom) {
 	const char *s;
 	if (value->type != XA_STRING || value->format != 8)
@@ -2256,7 +2306,7 @@ RADEONGetLVDSInfo (xf86OutputPtr output)
 }
 
 static void
-RADEONGetTMDSInfo(xf86OutputPtr output)
+RADEONGetTMDSInfoFromTable(xf86OutputPtr output)
 {
     ScrnInfoPtr pScrn = output->scrn;
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
@@ -2264,16 +2314,26 @@ RADEONGetTMDSInfo(xf86OutputPtr output)
     int i;
 
     for (i=0; i<4; i++) {
+        radeon_output->tmds_pll[i].value = default_tmds_pll[info->ChipFamily][i].value;
+        radeon_output->tmds_pll[i].freq = default_tmds_pll[info->ChipFamily][i].freq;
+    }
+}
+
+static void
+RADEONGetTMDSInfo(xf86OutputPtr output)
+{
+    RADEONOutputPrivatePtr radeon_output = output->driver_private;
+    int i;
+
+    for (i=0; i<4; i++) {
         radeon_output->tmds_pll[i].value = 0;
         radeon_output->tmds_pll[i].freq = 0;
     }
 
     if (RADEONGetTMDSInfoFromBIOS(output)) return;
 
-    for (i=0; i<4; i++) {
-        radeon_output->tmds_pll[i].value = default_tmds_pll[info->ChipFamily][i].value;
-        radeon_output->tmds_pll[i].freq = default_tmds_pll[info->ChipFamily][i].freq;
-    }
+    RADEONGetTMDSInfoFromTable(output);
+
 }
 
 static void
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index d79e7ad..3bbda49 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -122,6 +122,12 @@ typedef enum
     DVI_ANALOG
 } RADEONDviType;
 
+typedef enum
+{
+    TMDS_PLL_BIOS,
+    TMDS_PLL_DRIVER
+} RADEONTMDSPllType;
+
 typedef struct {
     CARD32 freq;
     CARD32 value;
@@ -196,6 +202,7 @@ typedef struct _RADEONOutputPrivateRec {
     int               PanelPwrDly;
     int               DotClock;
     RADEONTMDSPll     tmds_pll[4];
+    RADEONTMDSPllType tmds_pll_table;
     /* TV out */
     TVStd             default_tvStd;
     TVStd             tvStd;


More information about the xorg-commit mailing list