[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-ati: Changes to 'upstream-experimental'



 man/radeon.man       |   14 ++
 src/radeon.h         |   19 +++
 src/radeon_bios.c    |   17 ---
 src/radeon_crtc.c    |    8 +
 src/radeon_cursor.c  |   20 +++
 src/radeon_display.c |    2 
 src/radeon_driver.c  |   45 +++++---
 src/radeon_modes.c   |   60 +++++-----
 src/radeon_output.c  |  285 ++++++++++++++++++++++++++++++++++++++++++++++-----
 src/radeon_probe.h   |    2 
 10 files changed, 382 insertions(+), 90 deletions(-)

New commits:
commit 0241cac643fa1c08a45ea44f5c670b290e760ad8
Author: Michel Dänzer <michel@tungstengraphics.com>
Date:   Sat Sep 8 00:22:40 2007 +0200

    radeon: Reinstate sync in radeon_crtc_show/hide_cursor.
    
    Make sure the DRI lock is held though, as these can be called asynchronously.
    
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=12245 .

diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
index f19f2bc..3e60d23 100644
--- a/src/radeon_cursor.c
+++ b/src/radeon_cursor.c
@@ -98,12 +98,22 @@ radeon_crtc_show_cursor (xf86CrtcPtr crtc)
     RADEONInfoPtr      info       = RADEONPTR(pScrn);
     unsigned char     *RADEONMMIO = info->MMIO;
 
+#ifdef XF86DRI
+    if (info->CPStarted && pScrn->pScreen) DRILock(pScrn->pScreen, 0);
+#endif
+
+    RADEON_SYNC(info, pScrn);
+
     if (crtc_id == 0) 
 	OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN | 2 << 20, 
 		~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK));
     else if (crtc_id == 1)
 	OUTREGP(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_CUR_EN | 2 << 20,
 		~(RADEON_CRTC2_CUR_EN | RADEON_CRTC2_CUR_MODE_MASK));
+
+#ifdef XF86DRI
+    if (info->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen);
+#endif
 }
 
 void
@@ -115,12 +125,20 @@ radeon_crtc_hide_cursor (xf86CrtcPtr crtc)
     RADEONInfoPtr      info       = RADEONPTR(pScrn);
     unsigned char     *RADEONMMIO = info->MMIO;
 
+#ifdef XF86DRI
+    if (info->CPStarted && pScrn->pScreen) DRILock(pScrn->pScreen, 0);
+#endif
+
+    RADEON_SYNC(info, pScrn);
+
     if (crtc_id == 0)
 	OUTREGP(RADEON_CRTC_GEN_CNTL, 0, ~RADEON_CRTC_CUR_EN);
     else if (crtc_id == 1)
 	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~RADEON_CRTC2_CUR_EN);
 
-
+#ifdef XF86DRI
+    if (info->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen);
+#endif
 }
 
 void

commit 49933e2f7d590811f2bc8c0d51a09f3b7f14845e
Author: Alex Deucher <alex@botch2.(none)>
Date:   Sat Sep 1 12:23:07 2007 -0400

    RADEON: automatically disable tiling if requested virtual desktop exceeds surface limits
    
    Also, tweak default desktop sizes and add some informational messages

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 9472f93..14d31bd 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2692,30 +2692,28 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
 	crtc_max_X = pScrn->display->virtualX;
 	crtc_max_Y = pScrn->display->virtualY;
 	if (info->allowColorTiling) {
-	    if (crtc_max_X > info->MaxSurfaceWidth)
-		crtc_max_X = info->MaxSurfaceWidth;
-	    if (crtc_max_Y > info->MaxLines)
-		crtc_max_Y = info->MaxLines;
-	} else {
-	    if (crtc_max_X > 8192)
-		crtc_max_X = 8192;
-	    if (crtc_max_Y > 8192)
-		crtc_max_Y = 8192;
+	    if (crtc_max_X > info->MaxSurfaceWidth ||
+		crtc_max_Y > info->MaxLines) {
+		info->allowColorTiling = FALSE;
+		xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+			   "Requested desktop size exceeds surface limts for tiling, ColorTiling disabled\n");
+	    }
 	}
+	if (crtc_max_X > 8192)
+	    crtc_max_X = 8192;
+	if (crtc_max_Y > 8192)
+	    crtc_max_Y = 8192;
     } else {
-	if (pScrn->videoRam < 16384) {
+	if (pScrn->videoRam <= 16384) {
 	    crtc_max_X = 1600;
 	    crtc_max_Y = 1200;
-	} else if (pScrn->videoRam <= 32768) {
-	    crtc_max_X = 2048;
-	    crtc_max_Y = 1200;
-	} else if (pScrn->videoRam > 32768) {
+	} else {
 	    if (IS_R300_VARIANT) {
 		crtc_max_X = 2560;
-		crtc_max_Y = 2048;
+		crtc_max_Y = 1200;
 	    } else {
 		crtc_max_X = 2048;
-		crtc_max_Y = 2048;
+		crtc_max_Y = 1200;
 	    }
 	}
     }
@@ -2723,6 +2721,9 @@ _X_EXPORT Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
 	       crtc_max_X, crtc_max_Y);
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 	       "For a larger or smaller max desktop size, add a Virtual line to your xorg.conf\n");
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+	       "If you are having trouble with 3D, "
+	       "reduce the desktop size by adjusting the Virtual line to your xorg.conf\n");
 
     /*xf86CrtcSetSizeRange (pScrn, 320, 200, info->MaxSurfaceWidth, info->MaxLines);*/
     xf86CrtcSetSizeRange (pScrn, 320, 200, crtc_max_X, crtc_max_Y);

commit d49a60bc939c9f3e9d57c23e44263f5bb52f09fb
Author: Sjoerd Simons <sjoerd@luon.net>
Date:   Thu Aug 30 11:40:13 2007 +0200

    radeon: Fix Option "MacModel".

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 0d12168..9472f93 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -189,7 +189,7 @@ static const OptionInfoRec RADEONOptions[] = {
     { OPTION_DEFAULT_CONNECTOR_TABLE, "DefaultConnectorTable", OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_DEFAULT_TMDS_PLL, "DefaultTMDSPLL", OPTV_BOOLEAN, {0}, FALSE },
 #if defined(__powerpc__)
-    { OPTION_CONNECTORTABLE, "MacModel",         OPTV_STRING,  {0}, FALSE },
+    { OPTION_MAC_MODEL,      "MacModel",         OPTV_STRING,  {0}, FALSE },
 #endif
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };

commit 2b860726fff058623e0e8e1b0aca092c246875ce
Author: Michel Dänzer <michel@tungstengraphics.com>
Date:   Thu Aug 30 11:38:28 2007 +0200

    radeon: Don't build currently unused RADEONSavePalette.

diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 5c2efd3..0d12168 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -5229,6 +5229,7 @@ static void RADEONSavePLL2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save)
 			      >> 16));
 }
 
+#if 0
 /* Read palette data */
 static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save)
 {
@@ -5248,6 +5249,7 @@ static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save)
     for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT();
     save->palette_valid = TRUE;
 }
+#endif
 
 /* Save state that defines current video mode */
 static void RADEONSaveMode(ScrnInfoPtr pScrn, RADEONSavePtr save)

commit 12187a6aa93049c002a4171344d03c713f7f3c5d
Author: Alex Deucher <alex@botch2.(none)>
Date:   Wed Aug 29 23:11:30 2007 -0400

    RADEON: Add quirk and connector tables for apple laptops
    
    As far as I can tell there are three apple laptop variants:
    ibook              - LVDS, TVDAC drives TV or VGA via dongle
    powerbook-duallink - LVDS, TV, External TMDS/Primary DAC
    powerbook          - LVDS, TV, Internal TMDS/Primary DAC
    use Option "MacModel" "<string>"
    to enable the appropriate quirks where string is one of the above
    
    We can't yet init the external TMDS directly, but if OF inits it,
    it should work. This should also fix bug 9955.
    
    Please test!

diff --git a/man/radeon.man b/man/radeon.man
index 88665bf..8217262 100644
--- a/man/radeon.man
+++ b/man/radeon.man
@@ -397,6 +397,20 @@ driver defaults for each chip.
 The default is
 .B off 
 .TP
+.BI "Option \*qMacModel\*q \*q" string \*q
+.br
+Used to specify Mac models for connector tables and quirks.  Only valid
+ on PowerPC.
+.br
+ibook                \-\- ibooks
+.br
+powerbook-duallink   \-\- Powerbooks with dual link DVI
+.br
+powerbook            \-\- Powerbooks with single link DVI
+.br
+The default value is
+.B undefined.
+.TP
 
 .SH SEE ALSO
 __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
diff --git a/src/radeon.h b/src/radeon.h
index b7a69bd..4c99511 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -153,6 +153,9 @@ typedef enum {
     OPTION_CONNECTORTABLE,
     OPTION_DRI,
     OPTION_DEFAULT_CONNECTOR_TABLE,
+#if defined(__powerpc__)
+    OPTION_MAC_MODEL,
+#endif
     OPTION_DEFAULT_TMDS_PLL
 } RADEONOpts;
 
@@ -423,6 +426,14 @@ typedef enum {
        CHIP_ERRATA_PLL_DELAY           = 0x00000004
 } RADEONErrata;
 
+#if defined(__powerpc__)
+typedef enum {
+       RADEON_MAC_IBOOK             = 0x00000001,
+       RADEON_MAC_POWERBOOK_DL      = 0x00000002,
+       RADEON_MAC_POWERBOOK         = 0x00000004
+} RADEONMacModel;
+#endif
+
 typedef enum {
 	CARD_PCI,
 	CARD_AGP,
@@ -802,6 +813,10 @@ typedef struct {
     Bool              InternalTVOut;
     int               tvdac_use_count;
 
+#if defined(__powerpc__)
+    RADEONMacModel    MacModel;
+#endif
+
     Rotation rotation;
     void (*PointerMoved)(int, int, int);
     CreateScreenResourcesProcPtr CreateScreenResources;
diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c
index e976e2c..47e46f3 100644
--- a/src/radeon_crtc.c
+++ b/src/radeon_crtc.c
@@ -680,7 +680,15 @@ RADEONInitPLLRegisters(ScrnInfoPtr pScrn, RADEONInfoPtr info,
 		   save->post_div);
 
     save->ppll_ref_div   = pll->reference_div;
+
+#if defined(__powerpc__)
+    /* apparently programming this otherwise causes a hang??? */
+    if (info->MacModel == RADEON_MAC_IBOOK)
+	save->ppll_div_3 = 0x000600ad;
+    else
+#endif
     save->ppll_div_3     = (save->feedback_div | (post_div->bitvalue << 16));
+
     save->htotal_cntl    = 0;
 
     save->vclk_ecp_cntl = (info->SavedReg.vclk_ecp_cntl &
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index fc0f40b..5c2efd3 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -188,6 +188,9 @@ static const OptionInfoRec RADEONOptions[] = {
     { OPTION_CONNECTORTABLE, "ConnectorTable",   OPTV_STRING,  {0}, FALSE },
     { OPTION_DEFAULT_CONNECTOR_TABLE, "DefaultConnectorTable", OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_DEFAULT_TMDS_PLL, "DefaultTMDSPLL", OPTV_BOOLEAN, {0}, FALSE },
+#if defined(__powerpc__)
+    { OPTION_CONNECTORTABLE, "MacModel",         OPTV_STRING,  {0}, FALSE },
+#endif
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
@@ -4567,6 +4570,12 @@ void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn,
     unsigned char *RADEONMMIO = info->MMIO;
     CARD8 pllGain;
 
+#if defined(__powerpc__)
+    /* apparently restoring the pll causes a hang??? */
+    if (info->MacModel == RADEON_MAC_IBOOK)
+	return;
+#endif
+
     pllGain = RADEONComputePLLGain(info->pll.reference_freq,
 				   restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK,
 				   restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK);
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 168eab4..40d8873 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -2473,6 +2473,78 @@ void RADEONInitConnector(xf86OutputPtr output)
 
 }
 
+#if defined(__powerpc__)
+static Bool RADEONSetupAppleConnectors(ScrnInfoPtr pScrn)
+{
+    RADEONInfoPtr info       = RADEONPTR(pScrn);
+
+
+    switch (info->MacModel) {
+    case RADEON_MAC_IBOOK:
+	info->BiosConnector[0].DDCType = DDC_DVI;
+	info->BiosConnector[0].DACType = DAC_NONE;
+	info->BiosConnector[0].TMDSType = TMDS_NONE;
+	info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY;
+	info->BiosConnector[0].valid = TRUE;
+
+	info->BiosConnector[1].DDCType = DDC_VGA;
+	info->BiosConnector[1].DACType = DAC_TVDAC;
+	info->BiosConnector[1].TMDSType = TMDS_NONE;
+	info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
+	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_POWERBOOK_DL:
+	info->BiosConnector[0].DDCType = DDC_DVI;
+	info->BiosConnector[0].DACType = DAC_NONE;
+	info->BiosConnector[0].TMDSType = TMDS_NONE;
+	info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY;
+	info->BiosConnector[0].valid = TRUE;
+
+	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;
+
+	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_POWERBOOK:
+	info->BiosConnector[0].DDCType = DDC_DVI;
+	info->BiosConnector[0].DACType = DAC_NONE;
+	info->BiosConnector[0].TMDSType = TMDS_NONE;
+	info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY;
+	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;
+    default:
+	return FALSE;
+    }
+
+    return FALSE;
+}
+#endif
+
 static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn)
 {
     RADEONInfoPtr info       = RADEONPTR(pScrn);
@@ -2508,7 +2580,7 @@ static void RADEONSetupGenericConnectors(ScrnInfoPtr pScrn)
 
 	    info->BiosConnector[1].DDCType = DDC_VGA;
 	    info->BiosConnector[1].DACType = DAC_PRIMARY;
-	    info->BiosConnector[1].TMDSType = TMDS_EXT;
+	    info->BiosConnector[1].TMDSType = TMDS_UNKNOWN;
 	    info->BiosConnector[1].ConnectorType = CONNECTOR_CRT;
 	    info->BiosConnector[1].valid = TRUE;
 	}
@@ -2589,6 +2661,27 @@ Bool RADEONSetupConnectors(ScrnInfoPtr pScrn)
 	info->BiosConnector[i].ConnectorType = CONNECTOR_NONE;
     }
 
+#if defined(__powerpc__)
+    optstr = (char *)xf86GetOptValString(info->Options, OPTION_MAC_MODEL);
+
+    info->MacModel = 0;
+    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 {
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid Mac Model: %s\n", optstr);
+	    return FALSE;
+	}
+
+	if (!RADEONSetupAppleConnectors(pScrn))
+	    RADEONSetupGenericConnectors(pScrn);
+
+    } else
+#endif
     if (xf86ReturnOptValBool(info->Options, OPTION_DEFAULT_CONNECTOR_TABLE, FALSE)) {
 	RADEONSetupGenericConnectors(pScrn);
     } else {

commit 61c1fdaa8553581944f78a11e6f9aa76163a468a
Author: Alex Deucher <alex@botch2.(none)>
Date:   Tue Aug 28 23:47:19 2007 -0400

    RADEON: add option to force tmds pll to default table
    
    Also rework the tmds pll output attribute handling a bit

diff --git a/src/radeon.h b/src/radeon.h
index fa2bccd..b7a69bd 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -152,7 +152,8 @@ typedef enum {
     OPTION_CONSTANTDPI,
     OPTION_CONNECTORTABLE,
     OPTION_DRI,
-    OPTION_DEFAULT_CONNECTOR_TABLE
+    OPTION_DEFAULT_CONNECTOR_TABLE,
+    OPTION_DEFAULT_TMDS_PLL
 } RADEONOpts;
 
 
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 158e1e4..fc0f40b 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -187,6 +187,7 @@ static const OptionInfoRec RADEONOptions[] = {
     { OPTION_DRI,            "DRI",       	 OPTV_BOOLEAN, {0}, FALSE },
     { OPTION_CONNECTORTABLE, "ConnectorTable",   OPTV_STRING,  {0}, FALSE },
     { OPTION_DEFAULT_CONNECTOR_TABLE, "DefaultConnectorTable", OPTV_BOOLEAN, {0}, FALSE },
+    { OPTION_DEFAULT_TMDS_PLL, "DefaultTMDSPLL", OPTV_BOOLEAN, {0}, FALSE },
     { -1,                    NULL,               OPTV_NONE,    {0}, FALSE }
 };
 
diff --git a/src/radeon_output.c b/src/radeon_output.c
index c9b2ec7..168eab4 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1018,15 +1018,6 @@ radeon_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     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)
@@ -1672,6 +1663,10 @@ radeon_create_resources(xf86OutputPtr output)
 #else
 	s = "bios";
 #endif
+	if (xf86ReturnOptValBool(info->Options, OPTION_DEFAULT_TMDS_PLL, FALSE)) {
+	    s = "driver";
+	}
+
 	err = RRChangeOutputProperty(output->randr_output, tmds_pll_atom,
 				     XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s,
 				     FALSE, FALSE);
@@ -1900,10 +1895,11 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 	s = (char*)value->data;
 	if (value->size == strlen("bios") && !strncmp("bios", s, strlen("bios"))) {
-	    radeon_output->tmds_pll_table = TMDS_PLL_BIOS;
+	    if (!RADEONGetTMDSInfoFromBIOS(output))
+		RADEONGetTMDSInfoFromTable(output);
 	    return TRUE;
 	} else if (value->size == strlen("driver") && !strncmp("driver", s, strlen("driver"))) {
-	    radeon_output->tmds_pll_table = TMDS_PLL_DRIVER;
+	    RADEONGetTMDSInfoFromTable(output);
 	    return TRUE;
 	}
 	return FALSE;
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index b6ef59d..bc6f0b9 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -122,12 +122,6 @@ typedef enum
     DVI_ANALOG
 } RADEONDviType;
 
-typedef enum
-{
-    TMDS_PLL_BIOS,
-    TMDS_PLL_DRIVER
-} RADEONTMDSPllType;
-
 typedef struct {
     CARD32 freq;
     CARD32 value;
@@ -202,7 +196,6 @@ typedef struct _RADEONOutputPrivateRec {
     int               PanelPwrDly;
     int               DotClock;
     RADEONTMDSPll     tmds_pll[4];
-    RADEONTMDSPllType tmds_pll_table;
     /* TV out */
     TVStd             default_tvStd;
     TVStd             tvStd;

commit 0d9087bc60bb95c770b899cfed29699c02bdac49
Author: Alex Deucher <alex@botch2.(none)>
Date:   Tue Aug 28 23:08:20 2007 -0400

    RADEON: remove some cruft forgotten in a previous commit

diff --git a/src/radeon_output.c b/src/radeon_output.c
index 4df2597..c9b2ec7 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1973,10 +1973,7 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	if (value->type != XA_STRING || value->format != 8)
 	    return FALSE;
 	s = (char*)value->data;
-	if (value->size == strlen("default") && !strncmp("default", s, strlen("default"))) {
-	    radeon_output->tvStd = radeon_output->default_tvStd;
-	    return TRUE;
-	} else if (value->size == strlen("ntsc") && !strncmp("ntsc", s, strlen("ntsc"))) {
+	if (value->size == strlen("ntsc") && !strncmp("ntsc", s, strlen("ntsc"))) {
 	    if (radeon_output->SupportedTVStds & TV_STD_NTSC) {
 		radeon_output->tvStd = TV_STD_NTSC;
 		return TRUE;

commit 673f799729824f4439dd5f681f75dd5aab50947f
Author: Alex Deucher <alex@botch2.(none)>
Date:   Tue Aug 28 00:42:30 2007 -0400

    RADEON: Update tv attributes immediately

diff --git a/src/radeon_display.c b/src/radeon_display.c
index ed45d79..fa80e10 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -373,6 +373,7 @@ void RADEONEnableDisplay(xf86OutputPtr output, BOOL bEnable)
 	    tmp |= RADEON_TV_ON;
 	    OUTREG(RADEON_TV_MASTER_CNTL, tmp);
             tv_dac_change = 2;
+	    radeon_output->tv_on = TRUE;
 	}
     } else {
 	ErrorF("disable montype: %d\n", radeon_output->MonType);
@@ -431,6 +432,7 @@ void RADEONEnableDisplay(xf86OutputPtr output, BOOL bEnable)
 	    tmp &= ~RADEON_TV_ON;
 	    OUTREG(RADEON_TV_MASTER_CNTL, tmp);
             tv_dac_change = 2;
+	    radeon_output->tv_on = FALSE;
 	}
     }
 
diff --git a/src/radeon_output.c b/src/radeon_output.c
index 3003ead..4df2597 100644
--- a/src/radeon_output.c
+++ b/src/radeon_output.c
@@ -1695,7 +1695,7 @@ radeon_create_resources(xf86OutputPtr output)
 		       "RRConfigureOutputProperty error, %d\n", err);
 	}
 	/* Set the current value of the property */
-	s = "fill";
+	s = "full";
 	err = RRChangeOutputProperty(output->randr_output, rmx_atom,
 				     XA_STRING, 8, PropModeReplace, strlen(s), (pointer)s,
 				     FALSE, FALSE);
@@ -1935,7 +1935,8 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 
 	radeon_output->hSize = val;
-	/*RADEONUpdateHVPosition(output, NULL);*/
+	if (radeon_output->tv_on)
+	    RADEONUpdateHVPosition(output, &output->crtc->mode);
 	return TRUE;
     } else if (property == tv_hpos_atom) {
 	if (value->type != XA_INTEGER ||
@@ -1949,7 +1950,8 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 
 	radeon_output->hPos = val;
-	/*RADEONUpdateHVPosition(output, NULL);*/
+	if (radeon_output->tv_on)
+	    RADEONUpdateHVPosition(output, &output->crtc->mode);
 	return TRUE;
     } else if (property == tv_vpos_atom) {
 	if (value->type != XA_INTEGER ||
@@ -1963,7 +1965,8 @@ radeon_set_property(xf86OutputPtr output, Atom property,
 	    return FALSE;
 
 	radeon_output->vPos = val;
-	/*RADEONUpdateHVPosition(output, NULL);*/
+	if (radeon_output->tv_on)
+	    RADEONUpdateHVPosition(output, &output->crtc->mode);
 	return TRUE;
     } else if (property == tv_std_atom) {
 	const char *s;
@@ -2471,6 +2474,7 @@ void RADEONInitConnector(xf86OutputPtr output)
     }
 
     if (radeon_output->DACType == DAC_TVDAC) {
+	radeon_output->tv_on = FALSE;
 	RADEONGetTVDacAdjInfo(output);
     }
 
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 947bf88..b6ef59d 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -211,6 +211,7 @@ typedef struct _RADEONOutputPrivateRec {
     int               hSize;
     float             TVRefClk;
     int               SupportedTVStds;
+    Bool              tv_on;
     int               load_detection;
 } RADEONOutputPrivateRec, *RADEONOutputPrivatePtr;
 

commit ad6f7ad1b2ccae0bc0a416b9b0ca22709c9d5199
Author: Alex Deucher <alex@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 output)
 		       "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);

commit 17e0f9e6cbfdb115034d327bd34d46339fd632b7
Author: Alex Deucher <alex@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 output)
 	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 output)
     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 pScrn)
 	}
     }
 
+    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) ||

commit 42839fb5a8584196e7b18375bff6c426ed0347d9
Author: Alex Deucher <alex@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 output)
 #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(ScrnInfoPtr pScrn, xf86OutputPtr output)
 
     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 output)
 	}
     }
 
+    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, Atom property,
 
 	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 output)
     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;



Reply to: