View | Details | Raw Unified | Return to bug 264720
Collapse All | Expand All

(-)../xf86-video-ati-6.6.192.orig/src/radeon.h (-3 / +1 lines)
Lines 907-920 extern void RADEONEnableDisplay(S Link Here
907
extern void        RADEONDisableDisplays(ScrnInfoPtr pScrn);
907
extern void        RADEONDisableDisplays(ScrnInfoPtr pScrn);
908
extern void        RADEONGetPanelInfo(ScrnInfoPtr pScrn);
908
extern void        RADEONGetPanelInfo(ScrnInfoPtr pScrn);
909
extern void        RADEONGetTVDacAdjInfo(ScrnInfoPtr pScrn);
909
extern void        RADEONGetTVDacAdjInfo(ScrnInfoPtr pScrn);
910
extern void        RADEONUnblank(ScrnInfoPtr pScrn);
910
extern void        RADEONBlank(ScrnInfoPtr pScrn, Bool Blank);
911
extern void        RADEONBlank(ScrnInfoPtr pScrn);
912
extern void        RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
911
extern void        RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
913
						   int PowerManagementMode,
912
						   int PowerManagementMode,
914
						   int flags);
913
						   int flags);
915
extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn);
914
extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn);
916
extern Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn);
915
extern Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn);
917
extern RADEONConnector *RADEONGetCrtcConnector(ScrnInfoPtr pScrn, int crtc_num);
918
extern int RADEONValidateMergeModes(ScrnInfoPtr pScrn);
916
extern int RADEONValidateMergeModes(ScrnInfoPtr pScrn);
919
extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
917
extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
920
				  RADEONMonitorType DisplayType, int crtc2);
918
				  RADEONMonitorType DisplayType, int crtc2);
(-)../xf86-video-ati-6.6.192.orig/src/radeon_display.c (-335 / +231 lines)
Lines 935-940 void RADEONGetTVDacAdjInfo(ScrnInfoPtr p Link Here
935
    }
935
    }
936
}
936
}
937
937
938
static void
939
RADEONConnectorReverse(RADEONEntPtr pRADEONEnt)
940
{
941
    RADEONConnector *connector;
942
943
    connector = pRADEONEnt->PortInfo[0];
944
    pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
945
    pRADEONEnt->PortInfo[1] = connector;
946
}
947
938
/*
948
/*
939
 * initialise the static data sos we don't have to re-do at randr change */
949
 * initialise the static data sos we don't have to re-do at randr change */
940
void RADEONSetupConnectors(ScrnInfoPtr pScrn)
950
void RADEONSetupConnectors(ScrnInfoPtr pScrn)
Lines 992-1003 void RADEONSetupConnectors(ScrnInfoPtr p Link Here
992
    }
1002
    }
993
1003
994
    /* always make TMDS_INT port first*/
1004
    /* always make TMDS_INT port first*/
995
    if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) {
1005
    if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT)
996
        RADEONConnector *connector;
1006
	RADEONConnectorReverse(pRADEONEnt);
997
        connector = pRADEONEnt->PortInfo[0];
1007
    else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
998
        pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
999
        pRADEONEnt->PortInfo[1] = connector;
1000
    } else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
1001
                pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
1008
                pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
1002
        /* no TMDS_INT port, make primary DAC port first */
1009
        /* no TMDS_INT port, make primary DAC port first */
1003
	/* On my Inspiron 8600 both internal and external ports are
1010
	/* On my Inspiron 8600 both internal and external ports are
Lines 1005-1014 void RADEONSetupConnectors(ScrnInfoPtr p Link Here
1005
	   swap when the first port is not DAC_PRIMARY */
1012
	   swap when the first port is not DAC_PRIMARY */
1006
        if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) &&  (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
1013
        if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) &&  (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
1007
	     (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
1014
	     (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
1008
            RADEONConnector *connector;
1015
	    RADEONConnectorReverse(pRADEONEnt);
1009
            connector = pRADEONEnt->PortInfo[0];
1010
            pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
1011
            pRADEONEnt->PortInfo[1] = connector;
1012
        }
1016
        }
1013
    }
1017
    }
1014
1018
Lines 1263-1272 static void RADEONQueryConnectedDisplays Link Here
1263
	    pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
1267
	    pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
1264
	    pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
1268
	    pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
1265
	    pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_NONE;
1269
	    pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_NONE;
1266
	    
1270
1267
	    pRADEONEnt->PortInfo[0]->crtc_num = 1;
1268
	    pRADEONEnt->PortInfo[1]->crtc_num = 2;
1269
	    
1270
	    return;
1271
	    return;
1271
	}
1272
	}
1272
	
1273
	
Lines 1301-1316 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1301
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
1302
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
1302
    unsigned char *RADEONMMIO = info->MMIO;
1303
    unsigned char *RADEONMMIO = info->MMIO;
1303
    Bool head_reversed = FALSE;
1304
    Bool head_reversed = FALSE;
1304
    RADEONConnector *connector;
1305
1305
1306
    info->MergeType = MT_NONE;
1306
    info->MergeType = MT_NONE;
1307
1307
1308
    if (!info->IsSecondary) {
1308
    if (!info->IsSecondary) {
1309
      RADEONQueryConnectedDisplays(pScrn);
1309
      RADEONQueryConnectedDisplays(pScrn);
1310
1310
1311
      pRADEONEnt->PortInfo[0]->crtc_num = 1;
1312
      pRADEONEnt->PortInfo[1]->crtc_num = 2;
1313
1314
      xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
1311
      xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
1315
		 "Port1:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n", 
1312
		 "Port1:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n", 
1316
		 MonTypeName[pRADEONEnt->PortInfo[0]->MonType+1], 
1313
		 MonTypeName[pRADEONEnt->PortInfo[0]->MonType+1], 
Lines 1335-1342 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1335
	if (pRADEONEnt->PortInfo[0]->MonType == MT_NONE) {
1332
	if (pRADEONEnt->PortInfo[0]->MonType == MT_NONE) {
1336
	    if (pRADEONEnt->PortInfo[1]->MonType != MT_NONE) {
1333
	    if (pRADEONEnt->PortInfo[1]->MonType != MT_NONE) {
1337
		/* Only one detected on secondary, let it to be primary */
1334
		/* Only one detected on secondary, let it to be primary */
1338
		pRADEONEnt->PortInfo[0]->crtc_num = 2;
1335
		if (!head_reversed)
1339
		pRADEONEnt->PortInfo[1]->crtc_num = 1;
1336
		    RADEONConnectorReverse(pRADEONEnt);
1340
		head_reversed = TRUE;
1337
		head_reversed = TRUE;
1341
	    } else {
1338
	    } else {
1342
		/* None detected, Default to a CRT connected */
1339
		/* None detected, Default to a CRT connected */
Lines 1348-1357 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1348
	    (pRADEONEnt->PortInfo[1]->MonType == MT_CRT)) {
1345
	    (pRADEONEnt->PortInfo[1]->MonType == MT_CRT)) {
1349
	    if (!(INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON)) {
1346
	    if (!(INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON)) {
1350
		/* LCD is switched off, don't turn it on, otherwise it may casue lockup due to SS issue. */
1347
		/* LCD is switched off, don't turn it on, otherwise it may casue lockup due to SS issue. */
1351
		pRADEONEnt->PortInfo[0]->crtc_num = 2;
1348
		if (!head_reversed)
1352
		pRADEONEnt->PortInfo[1]->crtc_num = 1;
1349
		    RADEONConnectorReverse(pRADEONEnt);
1353
		pRADEONEnt->PortInfo[0]->MonType = MT_NONE;
1354
		head_reversed = TRUE;
1350
		head_reversed = TRUE;
1351
		pRADEONEnt->PortInfo[0]->MonType = MT_NONE;
1355
		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD is switched off, only CRT will be used\n");
1352
		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD is switched off, only CRT will be used\n");
1356
	    }
1353
	    }
1357
	}
1354
	}
Lines 1365-1372 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1365
		    */
1362
		    */
1366
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Reverse Display cannot be used for mobility chip\n");
1363
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Reverse Display cannot be used for mobility chip\n");
1367
		} else {
1364
		} else {
1368
		    pRADEONEnt->PortInfo[0]->crtc_num = 2;
1365
		    if (!head_reversed)
1369
		    pRADEONEnt->PortInfo[1]->crtc_num = 1;
1366
			RADEONConnectorReverse(pRADEONEnt);
1370
		    head_reversed = TRUE;
1367
		    head_reversed = TRUE;
1371
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Primary and Secondary mapping is reversed\n");
1368
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Primary and Secondary mapping is reversed\n");
1372
		}
1369
		}
Lines 1380-1425 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1380
1377
1381
    if(pRADEONEnt->HasCRTC2) {
1378
    if(pRADEONEnt->HasCRTC2) {
1382
	if(info->IsSecondary) {
1379
	if(info->IsSecondary) {
1383
	    connector = RADEONGetCrtcConnector(pScrn, 2);
1384
  	    pRADEONEnt->Controller[1]->binding = 2;
1380
  	    pRADEONEnt->Controller[1]->binding = 2;
1385
	    if (connector) {
1381
	    info->DisplayType = pRADEONEnt->PortInfo[1]->MonType;
1386
		info->DisplayType = connector->MonType;
1382
	    pScrn->monitor->DDC = pRADEONEnt->PortInfo[1]->MonInfo;
1387
		pScrn->monitor->DDC = connector->MonInfo;
1388
	    }
1389
	} else {
1383
	} else {
1390
	    connector = RADEONGetCrtcConnector(pScrn, 1);
1391
  	    pRADEONEnt->Controller[0]->binding = 1;
1384
  	    pRADEONEnt->Controller[0]->binding = 1;
1392
	    if (connector) {
1385
	    info->DisplayType = pRADEONEnt->PortInfo[0]->MonType;
1393
		info->DisplayType = connector->MonType; 
1386
	    pScrn->monitor->DDC = pRADEONEnt->PortInfo[0]->MonInfo;
1394
		pScrn->monitor->DDC = connector->MonInfo;
1395
	    }
1396
	}
1387
	}
1397
	
1388
1398
	if(!pRADEONEnt->HasSecondary) {
1389
	if(!pRADEONEnt->HasSecondary) {
1399
	    connector = RADEONGetCrtcConnector(pScrn, 2);
1390
	    info->MergeType = pRADEONEnt->PortInfo[1]->MonType;
1400
	    if (connector)
1401
		info->MergeType = connector->MonType;
1402
	    if (info->MergeType)
1391
	    if (info->MergeType)
1403
  	    	pRADEONEnt->Controller[1]->binding = 1;
1392
  	    	pRADEONEnt->Controller[1]->binding = 1;
1404
	} 
1393
	}
1405
    } else {
1394
    } else {
1406
	connector = RADEONGetCrtcConnector(pScrn, 1);
1395
	if (pRADEONEnt->PortInfo[0]->MonType == MT_NONE)
1407
	if (connector) {
1396
	    pRADEONEnt->PortInfo[0]->MonType = MT_CRT;
1408
	    if (connector->MonType == MT_NONE) 
1397
	info->DisplayType = pRADEONEnt->PortInfo[0]->MonType;
1409
		connector->MonType = MT_CRT;
1398
	pScrn->monitor->DDC = pRADEONEnt->PortInfo[0]->MonInfo;
1410
	    info->DisplayType = connector->MonType; 
1399
1411
	    pScrn->monitor->DDC = connector->MonInfo;
1400
	pRADEONEnt->PortInfo[1]->MonType = MT_NONE;
1412
	}
1413
	connector = RADEONGetCrtcConnector(pScrn, 2);
1414
	if (connector)
1415
	    connector->MonType = MT_NONE;
1416
	pRADEONEnt->Controller[1]->binding = 1;
1401
	pRADEONEnt->Controller[1]->binding = 1;
1417
    }
1402
    }
1418
1403
1419
    if (!info->IsSecondary) {
1404
    if (!info->IsSecondary) {
1420
	connector = RADEONGetCrtcConnector(pScrn, 2);
1421
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head:   Port%d ---- \n", head_reversed?2:1);
1405
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head:   Port%d ---- \n", head_reversed?2:1);
1422
	if (connector->MonType != MT_NONE)
1406
	if (pRADEONEnt->PortInfo[1]->MonType != MT_NONE)
1423
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Port%d ----\n", head_reversed?1:2);
1407
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Port%d ----\n", head_reversed?1:2);
1424
 	else
1408
 	else
1425
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
1409
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
Lines 2019-2275 void RADEONInitDispBandwidth(ScrnInfoPtr Link Here
2019
    RADEONInitDispBandwidth2(pScrn, info, info2, mode1, mode2);
2003
    RADEONInitDispBandwidth2(pScrn, info, info2, mode1, mode2);
2020
}
2004
}
2021
2005
2022
static void RADEONBlankSet(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2006
static void
2007
RADEONOutputsBlank(ScrnInfoPtr pScrn, RADEONConnector *pPort, Bool Blank)
2023
{
2008
{
2024
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2009
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2025
    unsigned char *RADEONMMIO = info->MMIO;
2010
    unsigned char *RADEONMMIO = info->MMIO;
2026
2011
2027
    switch(pPort->MonType) {
2012
    switch(pPort->MonType) {
2028
    case MT_LCD:
2013
    case MT_LCD:
2029
        OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS);
2014
	if (Blank)
2015
	    OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS);
2016
	else
2017
	    OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS);
2030
        break;
2018
        break;
2031
2032
    case MT_CRT:
2019
    case MT_CRT:
2033
       if ((info->ChipFamily == CHIP_FAMILY_R200) && 
2020
	if ((info->ChipFamily == CHIP_FAMILY_R200) && (pPort->DACType == DAC_TVDAC)) {
2034
 	  (pPort->DACType == DAC_TVDAC))
2021
	    if (Blank)
2035
	    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2022
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2036
      
2023
	    else
2024
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2025
	}
2037
        break;
2026
        break;
2038
    case MT_DFP:
2027
    case MT_DFP:
2039
        if (pPort->TMDSType == TMDS_EXT)
2028
	if (pPort->TMDSType == TMDS_EXT) {
2040
  	    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2029
	    if (Blank)
2041
        else
2030
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2042
	    OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN);
2031
	    else
2043
      
2032
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2033
	} else {
2034
	    if (Blank)
2035
		OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN);
2036
	    else
2037
		OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN);
2038
	}
2044
        break;
2039
        break;
2045
    case MT_NONE:
2040
    case MT_NONE:
2046
    default:
2041
    default:
2047
        break;
2042
        break;
2048
    }   
2043
    }
2044
}
2045
 
2046
static void
2047
RADEONCRTC1Blank(RADEONInfoPtr info, Bool Blank)
2048
{
2049
    unsigned char *RADEONMMIO = info->MMIO;
2050
    
2051
    if (Blank)
2052
	OUTREGP(RADEON_CRTC_EXT_CNTL,
2053
		RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS,
2054
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS));
2055
    else
2056
	OUTREGP(RADEON_CRTC_EXT_CNTL, 0,
2057
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS));
2058
}
2059
2060
static void
2061
RADEONCRTC2Blank(RADEONInfoPtr info, Bool Blank)
2062
{
2063
    unsigned char *RADEONMMIO = info->MMIO;
2064
    
2065
    if (Blank)
2066
	OUTREGP(RADEON_CRTC2_GEN_CNTL,
2067
		RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS,
2068
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2069
    else
2070
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2071
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2049
}
2072
}
2050
2073
2051
/* Blank screen */
2074
/* Blank screen */
2052
void RADEONBlank(ScrnInfoPtr pScrn)
2075
void RADEONBlank(ScrnInfoPtr pScrn, Bool Blank)
2053
{
2076
{
2054
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2077
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2055
    unsigned char *RADEONMMIO = info->MMIO;
2078
    unsigned char *RADEONMMIO = info->MMIO;
2056
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2079
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2057
    RADEONConnector *pPort;
2058
2080
2059
    if (!pRADEONEnt->HasSecondary ||
2081
    if (!pRADEONEnt->HasSecondary ||
2060
	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2082
	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2061
	(info->IsSwitching && (!info->IsSecondary))) {
2083
	(info->IsSwitching && (!info->IsSecondary))) {
2062
        pPort = RADEONGetCrtcConnector(pScrn, 1);
2084
 
2063
	if (pPort)
2085
	RADEONOutputsBlank(pScrn, pRADEONEnt->PortInfo[0], Blank);
2064
	  RADEONBlankSet(pScrn, pPort);
2086
	RADEONCRTC1Blank(info, Blank);
2065
	OUTREGP (RADEON_CRTC_EXT_CNTL,
2087
 
2066
		 RADEON_CRTC_DISPLAY_DIS |
2088
	if (!pRADEONEnt->HasCRTC2)
2067
		 RADEON_CRTC_VSYNC_DIS |
2089
	    return;
2068
		 RADEON_CRTC_HSYNC_DIS,
2069
		 ~(RADEON_CRTC_DISPLAY_DIS |
2070
		   RADEON_CRTC_VSYNC_DIS | 
2071
		   RADEON_CRTC_HSYNC_DIS));
2072
2073
	if (!pRADEONEnt->HasCRTC2) return;
2074
2090
2075
	if (pRADEONEnt->Controller[1]->binding == 1) {
2091
	if (pRADEONEnt->Controller[1]->binding == 1) {
2076
	    pPort = RADEONGetCrtcConnector(pScrn, 2);
2092
	    RADEONOutputsBlank(pScrn, pRADEONEnt->PortInfo[1], Blank);
2077
	    if (pPort)
2093
	    RADEONCRTC2Blank(info, Blank);
2078
		RADEONBlankSet(pScrn, pPort);
2079
	    OUTREGP (RADEON_CRTC2_GEN_CNTL,
2080
		     RADEON_CRTC2_DISP_DIS |
2081
		     RADEON_CRTC2_VSYNC_DIS |
2082
		     RADEON_CRTC2_HSYNC_DIS,
2083
		     ~(RADEON_CRTC2_DISP_DIS |
2084
		       RADEON_CRTC2_VSYNC_DIS | 
2085
		       RADEON_CRTC2_HSYNC_DIS));
2086
	}
2094
	}
2087
    }
2095
    }
2088
2096
2089
    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2097
    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2090
	(info->IsSwitching && info->IsSecondary)) {
2098
	(info->IsSwitching && info->IsSecondary)) {
2091
	pPort = RADEONGetCrtcConnector(pScrn, 2);
2099
	RADEONOutputsBlank(pScrn, pRADEONEnt->PortInfo[1], Blank);
2092
	if (pPort)
2100
	RADEONCRTC2Blank(info, Blank);
2093
	    RADEONBlankSet(pScrn, pPort);
2094
	OUTREGP (RADEON_CRTC2_GEN_CNTL,
2095
		 RADEON_CRTC2_DISP_DIS |
2096
		 RADEON_CRTC2_VSYNC_DIS |
2097
		 RADEON_CRTC2_HSYNC_DIS,
2098
		 ~(RADEON_CRTC2_DISP_DIS |
2099
		   RADEON_CRTC2_VSYNC_DIS | 
2100
		   RADEON_CRTC2_HSYNC_DIS));
2101
    }
2101
    }
2102
}
2102
}
2103
2103
2104
static void RADEONUnblankSet(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2104
2105
static void
2106
RADEONOutputsDPMS(ScrnInfoPtr pScrn, RADEONConnector *pPort, int Mode)
2105
{
2107
{
2106
    RADEONInfoPtr info = RADEONPTR (pScrn);
2108
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2107
    unsigned char *RADEONMMIO = info->MMIO;
2109
    unsigned char *RADEONMMIO = info->MMIO;
2108
2110
2109
    switch(pPort->MonType) {
2111
    RADEONMonitorType MonType;
2112
    RADEONTmdsType TmdsType;
2113
    RADEONDacType DacType;
2114
  
2115
    MonType = pPort->MonType;
2116
    TmdsType = pPort->TMDSType;
2117
    DacType = pPort->DACType;
2118
    
2119
    switch (MonType) {
2110
    case MT_LCD:
2120
    case MT_LCD:
2111
        OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS);
2121
	if (Mode == DPMSModeOn) {
2112
        break;
2122
	    OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_BLON, ~RADEON_LVDS_BLON);
2113
    case MT_CRT:
2123
	    usleep (info->PanelPwrDly * 1000);
2114
        if ((info->ChipFamily == CHIP_FAMILY_R200) &&
2124
	    OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_ON, ~RADEON_LVDS_ON);
2115
	  (pPort->DACType == DAC_TVDAC))
2125
	} else {
2116
	      OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2126
	    unsigned int tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
2117
        break;
2127
	    
2128
	    /* Asic bug, when turning off LVDS_ON, we have to make sure
2129
	       RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off */
2130
	    if (info->IsMobility || info->IsIGP)
2131
		OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
2132
	    OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~(RADEON_LVDS_BLON | RADEON_LVDS_ON));
2133
	    if (info->IsMobility || info->IsIGP)
2134
		OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
2135
	}
2136
	break;
2118
    case MT_DFP:
2137
    case MT_DFP:
2119
        if (pPort->TMDSType == TMDS_EXT)
2138
	if (Mode == DPMSModeOn) {
2120
	    OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2139
	    if (TmdsType == TMDS_EXT) {
2121
        else
2140
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2122
	    OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN);
2141
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_ON, ~RADEON_FP2_ON);
2123
        break;
2142
		if (info->ChipFamily >= CHIP_FAMILY_R200)
2124
    case MT_NONE:
2143
		    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_DVO_EN, ~RADEON_FP2_DVO_EN);
2144
	    } else
2145
		OUTREGP(RADEON_FP_GEN_CNTL, (RADEON_FP_FPON | RADEON_FP_TMDS_EN),
2146
			~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2147
	} else {
2148
	    if (TmdsType == TMDS_EXT) {
2149
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2150
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_ON);
2151
		if (info->ChipFamily >= CHIP_FAMILY_R200) {
2152
		    OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_DVO_EN);
2153
		}
2154
	    } else
2155
		OUTREGP(RADEON_FP_GEN_CNTL, 0, ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2156
	}
2157
	break;
2158
    case MT_CRT:
2125
    default:
2159
    default:
2126
        break;
2160
	RADEONDacPowerSet(pScrn, (Mode == DPMSModeOn), (DacType == DAC_PRIMARY));
2161
	break;
2127
    }
2162
    }
2128
}
2163
}
2129
2164
2130
/* Unblank screen */
2165
void
2131
void RADEONUnblank(ScrnInfoPtr pScrn)
2166
RADEONCRTC1DPMS(RADEONInfoPtr info, int Mode)
2132
{
2167
{
2133
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2134
    unsigned char *RADEONMMIO = info->MMIO;
2168
    unsigned char *RADEONMMIO = info->MMIO;
2135
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2136
    RADEONConnector *pPort;
2137
2138
    if (!pRADEONEnt->HasSecondary ||
2139
	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2140
	(info->IsSwitching && (!info->IsSecondary))) {
2141
	pPort = RADEONGetCrtcConnector(pScrn, 1);
2142
	if (pPort)
2143
	    RADEONUnblankSet(pScrn, pPort);
2144
      OUTREGP(RADEON_CRTC_EXT_CNTL,
2145
	      0,
2146
	      ~(RADEON_CRTC_DISPLAY_DIS |
2147
		RADEON_CRTC_VSYNC_DIS |
2148
		RADEON_CRTC_HSYNC_DIS));
2149
2150
      if (!pRADEONEnt->HasCRTC2) return;
2151
2152
      if (pRADEONEnt->Controller[1]->binding == 1) {
2153
	pPort = RADEONGetCrtcConnector(pScrn, 2);
2154
	if (pPort)
2155
	    RADEONUnblankSet(pScrn, pPort);
2156
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2157
		~(RADEON_CRTC2_DISP_DIS |
2158
		  RADEON_CRTC2_VSYNC_DIS |
2159
		  RADEON_CRTC2_HSYNC_DIS));
2160
      }
2161
    }
2162
2169
2163
    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2170
    switch (Mode) {
2164
	(info->IsSwitching && info->IsSecondary)) {
2171
	case DPMSModeOn:
2165
	pPort = RADEONGetCrtcConnector(pScrn, 2);
2172
	    /* Screen: On; HSync: On, VSync: On */
2166
	if (pPort)
2173
	    OUTREGP(RADEON_CRTC_EXT_CNTL, 0,
2167
	    RADEONUnblankSet(pScrn, pPort);
2174
		    ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2168
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2175
	    break;
2169
		~(RADEON_CRTC2_DISP_DIS |
2176
	case DPMSModeStandby:
2170
		  RADEON_CRTC2_VSYNC_DIS |
2177
	    /* Screen: Off; HSync: Off, VSync: On */
2171
		  RADEON_CRTC2_HSYNC_DIS));
2178
	    OUTREGP(RADEON_CRTC_EXT_CNTL, (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS),
2179
		    ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2180
	    break;
2181
	case DPMSModeSuspend:
2182
	    /* Screen: Off; HSync: On, VSync: Off */
2183
	    OUTREGP(RADEON_CRTC_EXT_CNTL, (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS),
2184
		    ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2185
	    break;
2186
	case DPMSModeOff:
2187
	default:
2188
	    /* Screen: Off; HSync: Off, VSync: Off */
2189
	    OUTREGP(RADEON_CRTC_EXT_CNTL,
2190
		    (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS),
2191
		    ~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2192
	    break;
2172
    }
2193
    }
2173
}
2194
}
2174
2195
2175
static void RADEONDPMSSetOn(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2196
void
2176
{
2197
RADEONCRTC2DPMS(RADEONInfoPtr info, int Mode)
2177
  RADEONInfoPtr  info       = RADEONPTR(pScrn);
2178
  unsigned char *RADEONMMIO = info->MMIO;
2179
  RADEONMonitorType MonType;
2180
  RADEONTmdsType TmdsType;
2181
  RADEONDacType DacType;
2182
2183
  MonType = pPort->MonType;
2184
  TmdsType = pPort->TMDSType;
2185
  DacType = pPort->DACType;
2186
2187
  switch(MonType) {
2188
  case MT_LCD:
2189
    OUTREGP (RADEON_LVDS_GEN_CNTL, RADEON_LVDS_BLON, ~RADEON_LVDS_BLON);
2190
    usleep (info->PanelPwrDly * 1000);
2191
    OUTREGP (RADEON_LVDS_GEN_CNTL, RADEON_LVDS_ON, ~RADEON_LVDS_ON);
2192
    break;
2193
  case MT_DFP:
2194
    if (TmdsType == TMDS_EXT) {
2195
      OUTREGP (RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2196
      OUTREGP (RADEON_FP2_GEN_CNTL, RADEON_FP2_ON, ~RADEON_FP2_ON);
2197
      if (info->ChipFamily >= CHIP_FAMILY_R200) {
2198
	OUTREGP (RADEON_FP2_GEN_CNTL, RADEON_FP2_DVO_EN, 
2199
		 ~RADEON_FP2_DVO_EN);
2200
      }
2201
    } else
2202
      OUTREGP (RADEON_FP_GEN_CNTL, (RADEON_FP_FPON | RADEON_FP_TMDS_EN),
2203
	       ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2204
    break;
2205
  case MT_CRT:
2206
  default:
2207
    RADEONDacPowerSet(pScrn, TRUE, (DacType == DAC_PRIMARY));
2208
    break;
2209
  }
2210
}
2211
2212
static void RADEONDPMSSetOff(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2213
{
2198
{
2214
  RADEONInfoPtr  info       = RADEONPTR(pScrn);
2199
    unsigned char *RADEONMMIO = info->MMIO;
2215
  unsigned char *RADEONMMIO = info->MMIO;
2200
    
2216
  RADEONMonitorType MonType;
2201
    switch (Mode) {
2217
  RADEONTmdsType TmdsType;
2202
	case DPMSModeOn:
2218
  RADEONDacType DacType;
2203
	    /* Screen: On; HSync: On, VSync: On */
2219
  unsigned long tmpPixclksCntl;
2204
	    OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2220
2205
		    ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2221
  MonType = pPort->MonType;
2206
	    break;
2222
  TmdsType = pPort->TMDSType;
2207
	case DPMSModeStandby:
2223
  DacType = pPort->DACType;
2208
	    /* Screen: Off; HSync: Off, VSync: On */
2224
2209
	    OUTREGP(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
2225
  switch(MonType) {
2210
		    ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2226
  case MT_LCD:
2211
	    break;
2227
    tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
2212
	case DPMSModeSuspend:
2228
    if (info->IsMobility || info->IsIGP) {
2213
	    /* Screen: Off; HSync: On, VSync: Off */
2229
      /* Asic bug, when turning off LVDS_ON, we have to make sure
2214
	    OUTREGP(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
2230
	 RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off
2215
		    ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2231
      */
2216
	    break;
2232
      OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
2217
	case DPMSModeOff:
2233
    }
2218
	default:
2234
    OUTREGP (RADEON_LVDS_GEN_CNTL, 0,
2219
	    /* Screen: Off; HSync: Off, VSync: Off */
2235
	     ~(RADEON_LVDS_BLON | RADEON_LVDS_ON));
2220
	    OUTREGP(RADEON_CRTC2_GEN_CNTL,
2236
    if (info->IsMobility || info->IsIGP) {
2221
		    (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS),
2237
      OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
2222
		    ~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2223
	    break;
2224
	    
2238
    }
2225
    }
2239
    break;
2240
  case MT_DFP:
2241
    if (TmdsType == TMDS_EXT) {
2242
      OUTREGP (RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2243
      OUTREGP (RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_ON);
2244
      if (info->ChipFamily >= CHIP_FAMILY_R200) {
2245
	OUTREGP (RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_DVO_EN);
2246
      }
2247
    } else
2248
      OUTREGP (RADEON_FP_GEN_CNTL, 0, ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2249
    break;
2250
  case MT_CRT:
2251
  default:
2252
    RADEONDacPowerSet(pScrn, FALSE, (DacType == DAC_PRIMARY));
2253
    break;
2254
  }
2255
}
2226
}
2256
2227
2257
2228
2258
/* Sets VESA Display Power Management Signaling (DPMS) Mode */
2229
/* Sets VESA Display Power Management Signaling (DPMS) Mode */
2259
void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
2230
void
2260
					    int PowerManagementMode,
2231
RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
2261
					    int flags)
2262
{
2232
{
2263
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2233
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2264
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2234
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2265
    unsigned char *RADEONMMIO = info->MMIO;
2266
    RADEONConnector *pPort;
2235
    RADEONConnector *pPort;
2267
    if (!pScrn->vtSema) return;
2236
2237
    if (!pScrn->vtSema)
2238
	return;
2268
2239
2269
    RADEONTRACE(("RADEONDisplayPowerManagementSet(%d,0x%x)\n", PowerManagementMode, flags));
2240
    RADEONTRACE(("RADEONDisplayPowerManagementSet(%d,0x%x)\n", PowerManagementMode, flags));
2270
2241
2271
#ifdef XF86DRI
2242
#ifdef XF86DRI
2272
    if (info->CPStarted) DRILock(pScrn->pScreen, 0);
2243
    if (info->CPStarted)
2244
	DRILock(pScrn->pScreen, 0);
2273
#endif
2245
#endif
2274
2246
2275
    if (info->accelOn)
2247
    if (info->accelOn)
Lines 2278-2369 void RADEONDisplayPowerManagementSet(Scr Link Here
2278
    if (info->FBDev) {
2250
    if (info->FBDev) {
2279
	fbdevHWDPMSSet(pScrn, PowerManagementMode, flags);
2251
	fbdevHWDPMSSet(pScrn, PowerManagementMode, flags);
2280
    } else {
2252
    } else {
2281
	int             mask1     = (RADEON_CRTC_DISPLAY_DIS |
2253
	if (info->IsSecondary) {
2282
				     RADEON_CRTC_HSYNC_DIS |
2254
	    RADEONCRTC2DPMS(info, PowerManagementMode);
2283
				     RADEON_CRTC_VSYNC_DIS);
2255
	    RADEONOutputsDPMS(pScrn, pRADEONEnt->PortInfo[1], PowerManagementMode);
2284
	int             mask2     = (RADEON_CRTC2_DISP_DIS |
2256
	} else {
2285
				     RADEON_CRTC2_VSYNC_DIS |
2257
	    RADEONCRTC1DPMS(info, PowerManagementMode);
2286
				     RADEON_CRTC2_HSYNC_DIS);
2258
	    RADEONOutputsDPMS(pScrn, pRADEONEnt->PortInfo[0], PowerManagementMode);
2287
2288
	switch (PowerManagementMode) {
2289
	case DPMSModeOn:
2290
	    /* Screen: On; HSync: On, VSync: On */
2291
	    if (info->IsSecondary)
2292
		OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2);
2293
	    else {
2294
		if (pRADEONEnt->Controller[1]->binding == 1)
2295
		    OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2);
2296
		OUTREGP(RADEON_CRTC_EXT_CNTL, 0, ~mask1);
2297
	    }
2298
	    break;
2299
2300
	case DPMSModeStandby:
2301
	    /* Screen: Off; HSync: Off, VSync: On */
2302
	    if (info->IsSecondary)
2303
		OUTREGP(RADEON_CRTC2_GEN_CNTL,
2304
			(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
2305
			~mask2);
2306
	    else {
2307
		if (pRADEONEnt->Controller[1]->binding == 1)
2308
		    OUTREGP(RADEON_CRTC2_GEN_CNTL,
2309
			    (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
2310
			    ~mask2);
2311
		OUTREGP(RADEON_CRTC_EXT_CNTL,
2312
			(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS),
2313
			~mask1);
2314
	    }
2315
	    break;
2316
2317
	case DPMSModeSuspend:
2318
	    /* Screen: Off; HSync: On, VSync: Off */
2319
	    if (info->IsSecondary)
2320
		OUTREGP(RADEON_CRTC2_GEN_CNTL,
2321
			(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
2322
			~mask2);
2323
	    else {
2324
		if (pRADEONEnt->Controller[1]->binding == 1)
2325
		    OUTREGP(RADEON_CRTC2_GEN_CNTL,
2326
			    (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
2327
			    ~mask2);
2328
		OUTREGP(RADEON_CRTC_EXT_CNTL,
2329
			(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS),
2330
			~mask1);
2331
	    }
2332
	    break;
2333
2334
	case DPMSModeOff:
2335
	    /* Screen: Off; HSync: Off, VSync: Off */
2336
	    if (info->IsSecondary)
2337
		OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2);
2338
	    else {
2339
		if (pRADEONEnt->Controller[1]->binding == 1)
2340
		    OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2);
2341
		OUTREGP(RADEON_CRTC_EXT_CNTL, mask1, ~mask1);
2342
	    }
2343
	    break;
2344
	}
2345
2259
2346
	if (PowerManagementMode == DPMSModeOn) {
2347
  	    pPort = RADEONGetCrtcConnector(pScrn, info->IsSecondary ? 2 : 1);
2348
   	    RADEONDPMSSetOn(pScrn, pPort);
2349
	    if (pRADEONEnt->Controller[1]->binding == 1) {
2260
	    if (pRADEONEnt->Controller[1]->binding == 1) {
2350
	      pPort = RADEONGetCrtcConnector(pScrn, 2);
2261
		RADEONCRTC2DPMS(info, PowerManagementMode);
2351
	      RADEONDPMSSetOn(pScrn, pPort);
2262
		RADEONOutputsDPMS(pScrn, pRADEONEnt->PortInfo[1], PowerManagementMode);
2352
	    }
2263
	    }
2353
	} else if ((PowerManagementMode == DPMSModeOff) ||
2264
	}
2354
		   (PowerManagementMode == DPMSModeSuspend) ||
2355
		   (PowerManagementMode == DPMSModeStandby)) {
2356
	    pPort = RADEONGetCrtcConnector(pScrn, info->IsSecondary ? 2 : 1);
2357
	    RADEONDPMSSetOff(pScrn, pPort);
2358
	    if (pRADEONEnt->Controller[1]->binding == 1) {
2359
	        pPort = RADEONGetCrtcConnector(pScrn, 2);	        
2360
	        RADEONDPMSSetOff(pScrn, pPort);
2361
	    }
2362
        }
2363
    }
2265
    }
2364
2266
2365
#ifdef XF86DRI
2267
#ifdef XF86DRI
2366
    if (info->CPStarted) DRIUnlock(pScrn->pScreen);
2268
    if (info->CPStarted)
2269
	DRIUnlock(pScrn->pScreen);
2367
#endif
2270
#endif
2368
}
2271
}
2369
2272
Lines 2391-2418 Bool RADEONAllocateControllers(ScrnInfoP Link Here
2391
Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
2294
Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
2392
{
2295
{
2393
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
2296
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
2394
    int i;
2395
2297
2396
    if (pRADEONEnt->PortInfo[0])
2298
    if (pRADEONEnt->PortInfo[0])
2397
        return TRUE;
2299
        return TRUE;
2398
    
2300
2399
    /* for now always allocate max connectors */
2301
    /* for now always allocate both connectors */
2400
    for (i = 0 ; i < RADEON_MAX_CONNECTOR; i++) {
2302
    pRADEONEnt->PortInfo[0] = xcalloc(sizeof(RADEONConnector), 1);
2401
      pRADEONEnt->PortInfo[i] = xcalloc(sizeof(RADEONConnector), 1);
2303
    if (!pRADEONEnt->PortInfo[0])
2402
      if (!pRADEONEnt->PortInfo[i])
2304
	return FALSE;
2305
2306
    pRADEONEnt->PortInfo[1] = xcalloc(sizeof(RADEONConnector), 1);
2307
    if (!pRADEONEnt->PortInfo[1]) {
2308
	xfree(pRADEONEnt->PortInfo[0]);
2403
	return FALSE;
2309
	return FALSE;
2404
    }
2310
    }
2405
2311
2406
    return TRUE;
2312
    return TRUE;
2407
}
2313
}
2408
2314
2409
RADEONConnector *RADEONGetCrtcConnector(ScrnInfoPtr pScrn, int crtc_num)
2410
{
2411
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
2412
2413
    if (pRADEONEnt->PortInfo[0]->crtc_num == crtc_num)
2414
      return pRADEONEnt->PortInfo[0];
2415
    else if (pRADEONEnt->PortInfo[1]->crtc_num == crtc_num)
2416
      return pRADEONEnt->PortInfo[1];
2417
    return NULL;
2418
}
(-)../xf86-video-ati-6.6.192.orig/src/radeon_driver.c (-59 / +32 lines)
Lines 2029-2037 static Bool RADEONPreInitModes(ScrnInfoP Link Here
2029
	xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE);
2029
	xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE);
2030
2030
2031
    /* don't use RMX if we have a dual-tmds panels */
2031
    /* don't use RMX if we have a dual-tmds panels */
2032
    if ((connector = RADEONGetCrtcConnector(pScrn, 2)))
2032
    if (pRADEONEnt->PortInfo[1]->MonType == MT_DFP)
2033
	if (connector->MonType == MT_DFP)
2033
	info->ddc_mode = TRUE;
2034
	    info->ddc_mode = TRUE;
2035
    /* don't use RMX if we are Dell Server */  
2034
    /* don't use RMX if we are Dell Server */  
2036
    if (info->IsDellServer)
2035
    if (info->IsDellServer)
2037
	info->ddc_mode = TRUE;
2036
	info->ddc_mode = TRUE;
Lines 5129-5139 static void RADEONRestoreMode(ScrnInfoPt Link Here
5129
	    RADEONRestoreCrtc2Registers(pScrn, restore);
5128
	    RADEONRestoreCrtc2Registers(pScrn, restore);
5130
	    RADEONRestorePLL2Registers(pScrn, restore);
5129
	    RADEONRestorePLL2Registers(pScrn, restore);
5131
	    RADEONRestoreFPRegisters(pScrn, restore);
5130
	    RADEONRestoreFPRegisters(pScrn, restore);
5132
	    pPort = RADEONGetCrtcConnector(pScrn, 2);
5131
	    RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[1], TRUE);
5133
	    if (pPort) {
5132
	    pCRTC2->IsActive = TRUE;
5134
		RADEONEnableDisplay(pScrn, pPort, TRUE);
5135
		pCRTC2->IsActive = TRUE;
5136
	    }
5137
	} else {
5133
	} else {
5138
	    RADEONRestoreMemMapRegisters(pScrn, restore);
5134
	    RADEONRestoreMemMapRegisters(pScrn, restore);
5139
	    RADEONRestoreCommonRegisters(pScrn, restore);
5135
	    RADEONRestoreCommonRegisters(pScrn, restore);
Lines 5145-5161 static void RADEONRestoreMode(ScrnInfoPt Link Here
5145
            RADEONRestoreCrtcRegisters(pScrn, restore);
5141
            RADEONRestoreCrtcRegisters(pScrn, restore);
5146
            RADEONRestorePLLRegisters(pScrn, restore);
5142
            RADEONRestorePLLRegisters(pScrn, restore);
5147
	    RADEONRestoreFPRegisters(pScrn, restore);
5143
	    RADEONRestoreFPRegisters(pScrn, restore);
5148
	    pPort = RADEONGetCrtcConnector(pScrn, 1);
5144
	    RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[0], TRUE);
5149
	    if (pPort) {
5145
	    pCRTC1->IsActive = TRUE;
5150
		RADEONEnableDisplay(pScrn, pPort, TRUE);
5151
		pCRTC1->IsActive = TRUE;
5152
	    }
5153
	    if (pCRTC2->binding == 1) {
5146
	    if (pCRTC2->binding == 1) {
5154
		pPort = RADEONGetCrtcConnector(pScrn, 2);
5147
		RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[1], TRUE);
5155
		if (pPort) {
5148
		pCRTC2->IsActive = TRUE;
5156
		    RADEONEnableDisplay(pScrn, pPort, TRUE);
5157
		    pCRTC2->IsActive = TRUE;
5158
		}
5159
	    }
5149
	    }
5160
	}
5150
	}
5161
    } else {
5151
    } else {
Lines 5169-5185 static void RADEONRestoreMode(ScrnInfoPt Link Here
5169
	RADEONRestoreCrtcRegisters(pScrn, restore);
5159
	RADEONRestoreCrtcRegisters(pScrn, restore);
5170
	RADEONRestorePLLRegisters(pScrn, restore);
5160
	RADEONRestorePLLRegisters(pScrn, restore);
5171
	RADEONRestoreFPRegisters(pScrn, restore);
5161
	RADEONRestoreFPRegisters(pScrn, restore);
5172
	pPort = RADEONGetCrtcConnector(pScrn, 1);
5162
	RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[0], TRUE);
5173
	if (pPort) {
5163
	pCRTC1->IsActive = TRUE;
5174
	    RADEONEnableDisplay(pScrn, pPort, TRUE);
5164
	if (pCRTC2->binding == 1) {
5175
	    pCRTC1->IsActive = TRUE;
5165
	    RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[1], TRUE);
5176
	}
5166
	    pCRTC2->IsActive = TRUE;
5177
	if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
5178
	    pPort = RADEONGetCrtcConnector(pScrn, 2);
5179
	    if (pPort) {
5180
		RADEONEnableDisplay(pScrn, pPort, TRUE);
5181
		pCRTC2->IsActive = TRUE;
5182
	    }
5183
	}
5167
	}
5184
    }
5168
    }
5185
5169
Lines 5475-5481 static void RADEONRestore(ScrnInfoPtr pS Link Here
5475
	fbdevHWRestore(pScrn);
5459
	fbdevHWRestore(pScrn);
5476
	return;
5460
	return;
5477
    }
5461
    }
5478
    RADEONBlank(pScrn);
5462
    RADEONBlank(pScrn, TRUE);
5479
5463
5480
    OUTREG(RADEON_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
5464
    OUTREG(RADEON_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
5481
    RADEONPllErrataAfterIndex(info);
5465
    RADEONPllErrataAfterIndex(info);
Lines 5847-5856 static void RADEONInitDAC2Registers(Scrn Link Here
5847
    }
5831
    }
5848
}
5832
}
5849
5833
5850
static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, RADEONConnector *pPort, int crtc_num)
5834
static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, RADEONConnector *pPort, Bool IsPrimary)
5851
{
5835
{
5852
    Bool IsPrimary = crtc_num == 1 ? TRUE : FALSE;
5853
5854
    if (pPort->MonType == MT_CRT) {
5836
    if (pPort->MonType == MT_CRT) {
5855
	if (pPort->DACType == DAC_PRIMARY) {
5837
	if (pPort->DACType == DAC_PRIMARY) {
5856
	    RADEONInitDACRegisters(pScrn, save, mode, IsPrimary);
5838
	    RADEONInitDACRegisters(pScrn, save, mode, IsPrimary);
Lines 5858-5868 static void RADEONInitOutputRegisters(Sc Link Here
5858
	    RADEONInitDAC2Registers(pScrn, save, mode, IsPrimary);
5840
	    RADEONInitDAC2Registers(pScrn, save, mode, IsPrimary);
5859
	}
5841
	}
5860
    } else if (pPort->MonType == MT_LCD) {
5842
    } else if (pPort->MonType == MT_LCD) {
5861
	if (crtc_num == 1)
5843
	if (IsPrimary)
5862
	    RADEONInitRMXRegisters(pScrn, save, mode);
5844
	    RADEONInitRMXRegisters(pScrn, save, mode);
5863
	RADEONInitLVDSRegisters(pScrn, save, mode, IsPrimary);
5845
	RADEONInitLVDSRegisters(pScrn, save, mode, IsPrimary);
5864
    } else if (pPort->MonType == MT_DFP) {
5846
    } else if (pPort->MonType == MT_DFP) {
5865
	if (crtc_num == 1)
5847
	if (IsPrimary)
5866
	    RADEONInitRMXRegisters(pScrn, save, mode);
5848
	    RADEONInitRMXRegisters(pScrn, save, mode);
5867
	if (pPort->TMDSType == TMDS_INT) {
5849
	if (pPort->TMDSType == TMDS_INT) {
5868
	    RADEONInitFPRegisters(pScrn, save, mode, IsPrimary);
5850
	    RADEONInitFPRegisters(pScrn, save, mode, IsPrimary);
Lines 6032-6042 static Bool RADEONInitCrtcRegisters(Scrn Link Here
6032
    }
6014
    }
6033
6015
6034
    /* get the output connected to this CRTC */
6016
    /* get the output connected to this CRTC */
6035
    if (pRADEONEnt->PortInfo[0]->crtc_num == 1) {
6017
    RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[0], TRUE);
6036
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[0], 1);
6037
    } else if (pRADEONEnt->PortInfo[1]->crtc_num == 1) {
6038
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[1], 1);
6039
    }
6040
6018
6041
    if (info->IsDellServer) {
6019
    if (info->IsDellServer) {
6042
	save->dac2_cntl = info->SavedReg.dac2_cntl;
6020
	save->dac2_cntl = info->SavedReg.dac2_cntl;
Lines 6167-6178 static Bool RADEONInitCrtc2Registers(Scr Link Here
6167
    save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid;
6145
    save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid;
6168
6146
6169
    /* get the output connected to this CRTC */
6147
    /* get the output connected to this CRTC */
6170
    if (pRADEONEnt->PortInfo[0]->crtc_num == 2) {
6148
    RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[1], FALSE);
6171
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[0], 2);
6149
    
6172
    } else if (pRADEONEnt->PortInfo[1]->crtc_num == 2) {
6173
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[1], 2);
6174
    }
6175
6176
    /* We must set SURFACE_CNTL properly on the second screen too */
6150
    /* We must set SURFACE_CNTL properly on the second screen too */
6177
    save->surface_cntl = 0;
6151
    save->surface_cntl = 0;
6178
#if X_BYTE_ORDER == X_BIG_ENDIAN
6152
#if X_BYTE_ORDER == X_BIG_ENDIAN
Lines 6496-6504 static Bool RADEONModeInit(ScrnInfoPtr p Link Here
6496
    if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE;
6470
    if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE;
6497
6471
6498
    pScrn->vtSema = TRUE;
6472
    pScrn->vtSema = TRUE;
6499
    RADEONBlank(pScrn);
6473
    RADEONBlank(pScrn, TRUE);
6500
    RADEONRestoreMode(pScrn, &info->ModeReg);
6474
    RADEONRestoreMode(pScrn, &info->ModeReg);
6501
    RADEONUnblank(pScrn);
6475
    RADEONBlank(pScrn, FALSE);
6502
6476
6503
    info->CurrentLayout.mode = mode;
6477
    info->CurrentLayout.mode = mode;
6504
6478
Lines 6519-6526 static Bool RADEONSaveScreen(ScreenPtr p Link Here
6519
    if (unblank) SetTimeSinceLastInputEvent();
6493
    if (unblank) SetTimeSinceLastInputEvent();
6520
6494
6521
    if ((pScrn != NULL) && pScrn->vtSema) {
6495
    if ((pScrn != NULL) && pScrn->vtSema) {
6522
	if (unblank)  RADEONUnblank(pScrn);
6496
	if (unblank)
6523
	else          RADEONBlank(pScrn);
6497
	    RADEONBlank(pScrn, FALSE);
6498
	else
6499
	    RADEONBlank(pScrn, TRUE);
6524
    }
6500
    }
6525
    return TRUE;
6501
    return TRUE;
6526
}
6502
}
Lines 7065-7071 static void Link Here
7065
RADEONGetMergedFBOptions(ScrnInfoPtr pScrn)
7041
RADEONGetMergedFBOptions(ScrnInfoPtr pScrn)
7066
{
7042
{
7067
    RADEONInfoPtr      info       = RADEONPTR(pScrn);
7043
    RADEONInfoPtr      info       = RADEONPTR(pScrn);
7068
    RADEONConnector *connector;
7044
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
7069
    char        *strptr;
7045
    char        *strptr;
7070
    char	*default_hsync = "28-33";
7046
    char	*default_hsync = "28-33";
7071
    char	*default_vrefresh = "43-72";
7047
    char	*default_vrefresh = "43-72";
Lines 7095-7106 RADEONGetMergedFBOptions(ScrnInfoPtr pSc Link Here
7095
	info->MergedFB = FALSE;
7071
	info->MergedFB = FALSE;
7096
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7072
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7097
        "Failed to detect secondary monitor, MergedFB/Clone mode disabled\n");
7073
        "Failed to detect secondary monitor, MergedFB/Clone mode disabled\n");
7098
    } else if ((connector = RADEONGetCrtcConnector(pScrn, 2))) {
7074
    } else if (!pRADEONEnt->PortInfo[1]->MonInfo) {
7099
	if (!connector->MonInfo) {
7075
	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7100
	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7076
		   "Failed to detect secondary monitor DDC, default HSync and VRefresh used\n");
7101
		       "Failed to detect secondary monitor DDC, default HSync and VRefresh used\n");
7077
	default_range = TRUE;
7102
	    default_range = TRUE;
7103
	}
7104
    }
7078
    }
7105
7079
7106
    if (xf86GetOptValBool(info->Options, OPTION_MERGEDFB, &val)) {
7080
    if (xf86GetOptValBool(info->Options, OPTION_MERGEDFB, &val)) {
Lines 7264-7271 RADEONGetMergedFBOptions(ScrnInfoPtr pSc Link Here
7264
7238
7265
	  /* xf86SetDDCproperties(info->CRT2pScrn, pRADEONEnt->MonInfo2); */
7239
	  /* xf86SetDDCproperties(info->CRT2pScrn, pRADEONEnt->MonInfo2); */
7266
7240
7267
	  connector = RADEONGetCrtcConnector(pScrn, 2);
7241
	  info->CRT2pScrn->monitor->DDC = pRADEONEnt->PortInfo[1]->MonInfo;
7268
	  info->CRT2pScrn->monitor->DDC = connector ? connector->MonInfo : NULL;
7269
7242
7270
          if (default_range) {
7243
          if (default_range) {
7271
             RADEONStrToRanges(info->CRT2pScrn->monitor->hsync, default_hsync, MAX_HSYNC);
7244
             RADEONStrToRanges(info->CRT2pScrn->monitor->hsync, default_hsync, MAX_HSYNC);
(-)../xf86-video-ati-6.6.192.orig/src/radeon_probe.h (-3 lines)
Lines 119-127 typedef struct Link Here
119
    RADEONConnectorType ConnectorType;
119
    RADEONConnectorType ConnectorType;
120
    RADEONMonitorType MonType;
120
    RADEONMonitorType MonType;
121
    xf86MonPtr MonInfo;
121
    xf86MonPtr MonInfo;
122
123
    /* one connector can be bound to one CRTC */
124
    int crtc_num;
125
} RADEONConnector;
122
} RADEONConnector;
126
123
127
124

Return to bug 264720