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

(-)a/src/radeon.h (-3 / +1 lines)
Lines 904-917 extern void RADEONEnableDisplay(S Link Here
904
extern void        RADEONDisableDisplays(ScrnInfoPtr pScrn);
904
extern void        RADEONDisableDisplays(ScrnInfoPtr pScrn);
905
extern void        RADEONGetPanelInfo(ScrnInfoPtr pScrn);
905
extern void        RADEONGetPanelInfo(ScrnInfoPtr pScrn);
906
extern void        RADEONGetTVDacAdjInfo(ScrnInfoPtr pScrn);
906
extern void        RADEONGetTVDacAdjInfo(ScrnInfoPtr pScrn);
907
extern void        RADEONUnblank(ScrnInfoPtr pScrn);
907
extern void        RADEONBlank(ScrnInfoPtr pScrn, Bool Blank);
908
extern void        RADEONBlank(ScrnInfoPtr pScrn);
909
extern void        RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
908
extern void        RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
910
						   int PowerManagementMode,
909
						   int PowerManagementMode,
911
						   int flags);
910
						   int flags);
912
extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn);
911
extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn);
913
extern Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn);
912
extern Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn);
914
extern RADEONConnector *RADEONGetCrtcConnector(ScrnInfoPtr pScrn, int crtc_num);
915
extern int RADEONValidateMergeModes(ScrnInfoPtr pScrn);
913
extern int RADEONValidateMergeModes(ScrnInfoPtr pScrn);
916
extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
914
extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
917
				  RADEONMonitorType DisplayType, int crtc2);
915
				  RADEONMonitorType DisplayType, int crtc2);
(-)a/src/radeon_display.c (-335 / +228 lines)
Lines 941-946 void RADEONGetTVDacAdjInfo(ScrnInfoPtr p Link Here
941
    }
941
    }
942
}
942
}
943
943
944
static void
945
RADEONConnectorReverse(RADEONEntPtr pRADEONEnt)
946
{
947
    RADEONConnector *connector;
948
949
    connector = pRADEONEnt->PortInfo[0];
950
    pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
951
    pRADEONEnt->PortInfo[1] = connector;
952
}
953
944
/*
954
/*
945
 * initialise the static data sos we don't have to re-do at randr change */
955
 * initialise the static data sos we don't have to re-do at randr change */
946
void RADEONSetupConnectors(ScrnInfoPtr pScrn)
956
void RADEONSetupConnectors(ScrnInfoPtr pScrn)
Lines 998-1009 void RADEONSetupConnectors(ScrnInfoPtr p Link Here
998
    }
1008
    }
999
1009
1000
    /* always make TMDS_INT port first*/
1010
    /* always make TMDS_INT port first*/
1001
    if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) {
1011
    if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT)
1002
        RADEONConnector *connector;
1012
	RADEONConnectorReverse(pRADEONEnt);
1003
        connector = pRADEONEnt->PortInfo[0];
1013
    else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
1004
        pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
1005
        pRADEONEnt->PortInfo[1] = connector;
1006
    } else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
1007
                pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
1014
                pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
1008
        /* no TMDS_INT port, make primary DAC port first */
1015
        /* no TMDS_INT port, make primary DAC port first */
1009
	/* On my Inspiron 8600 both internal and external ports are
1016
	/* On my Inspiron 8600 both internal and external ports are
Lines 1011-1020 void RADEONSetupConnectors(ScrnInfoPtr p Link Here
1011
	   swap when the first port is not DAC_PRIMARY */
1018
	   swap when the first port is not DAC_PRIMARY */
1012
        if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) &&  (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
1019
        if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) &&  (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
1013
	     (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
1020
	     (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
1014
            RADEONConnector *connector;
1021
	    RADEONConnectorReverse(pRADEONEnt);
1015
            connector = pRADEONEnt->PortInfo[0];
1016
            pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
1017
            pRADEONEnt->PortInfo[1] = connector;
1018
        }
1022
        }
1019
    }
1023
    }
1020
1024
Lines 1269-1278 static void RADEONQueryConnectedDisplays Link Here
1269
	    pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
1273
	    pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
1270
	    pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
1274
	    pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
1271
	    pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_NONE;
1275
	    pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_NONE;
1272
	    
1276
1273
	    pRADEONEnt->PortInfo[0]->crtc_num = 1;
1274
	    pRADEONEnt->PortInfo[1]->crtc_num = 2;
1275
	    
1276
	    return;
1277
	    return;
1277
	}
1278
	}
1278
	
1279
	
Lines 1307-1322 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1307
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
1308
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
1308
    unsigned char *RADEONMMIO = info->MMIO;
1309
    unsigned char *RADEONMMIO = info->MMIO;
1309
    Bool head_reversed = FALSE;
1310
    Bool head_reversed = FALSE;
1310
    RADEONConnector *connector;
1311
1311
1312
    info->MergeType = MT_NONE;
1312
    info->MergeType = MT_NONE;
1313
1313
1314
    if (!info->IsSecondary) {
1314
    if (!info->IsSecondary) {
1315
      RADEONQueryConnectedDisplays(pScrn);
1315
      RADEONQueryConnectedDisplays(pScrn);
1316
1316
1317
      pRADEONEnt->PortInfo[0]->crtc_num = 1;
1318
      pRADEONEnt->PortInfo[1]->crtc_num = 2;
1319
1320
      xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
1317
      xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
1321
		 "Port1:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n", 
1318
		 "Port1:\n Monitor   -- %s\n Connector -- %s\n DAC Type  -- %s\n TMDS Type -- %s\n DDC Type  -- %s\n", 
1322
		 MonTypeName[pRADEONEnt->PortInfo[0]->MonType+1], 
1319
		 MonTypeName[pRADEONEnt->PortInfo[0]->MonType+1], 
Lines 1341-1348 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1341
	if (pRADEONEnt->PortInfo[0]->MonType == MT_NONE) {
1338
	if (pRADEONEnt->PortInfo[0]->MonType == MT_NONE) {
1342
	    if (pRADEONEnt->PortInfo[1]->MonType != MT_NONE) {
1339
	    if (pRADEONEnt->PortInfo[1]->MonType != MT_NONE) {
1343
		/* Only one detected on secondary, let it to be primary */
1340
		/* Only one detected on secondary, let it to be primary */
1344
		pRADEONEnt->PortInfo[0]->crtc_num = 2;
1341
		if (!head_reversed)
1345
		pRADEONEnt->PortInfo[1]->crtc_num = 1;
1342
		    RADEONConnectorReverse(pRADEONEnt);
1346
		head_reversed = TRUE;
1343
		head_reversed = TRUE;
1347
	    } else {
1344
	    } else {
1348
		/* None detected, Default to a CRT connected */
1345
		/* None detected, Default to a CRT connected */
Lines 1354-1363 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1354
	    (pRADEONEnt->PortInfo[1]->MonType == MT_CRT)) {
1351
	    (pRADEONEnt->PortInfo[1]->MonType == MT_CRT)) {
1355
	    if (!(INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON)) {
1352
	    if (!(INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON)) {
1356
		/* LCD is switched off, don't turn it on, otherwise it may casue lockup due to SS issue. */
1353
		/* LCD is switched off, don't turn it on, otherwise it may casue lockup due to SS issue. */
1357
		pRADEONEnt->PortInfo[0]->crtc_num = 2;
1354
		if (!head_reversed)
1358
		pRADEONEnt->PortInfo[1]->crtc_num = 1;
1355
		    RADEONConnectorReverse(pRADEONEnt);
1359
		pRADEONEnt->PortInfo[0]->MonType = MT_NONE;
1360
		head_reversed = TRUE;
1356
		head_reversed = TRUE;
1357
		pRADEONEnt->PortInfo[0]->MonType = MT_NONE;
1361
		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD is switched off, only CRT will be used\n");
1358
		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD is switched off, only CRT will be used\n");
1362
	    }
1359
	    }
1363
	}
1360
	}
Lines 1371-1378 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1371
		    */
1368
		    */
1372
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Reverse Display cannot be used for mobility chip\n");
1369
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Reverse Display cannot be used for mobility chip\n");
1373
		} else {
1370
		} else {
1374
		    pRADEONEnt->PortInfo[0]->crtc_num = 2;
1371
		    if (!head_reversed)
1375
		    pRADEONEnt->PortInfo[1]->crtc_num = 1;
1372
			RADEONConnectorReverse(pRADEONEnt);
1376
		    head_reversed = TRUE;
1373
		    head_reversed = TRUE;
1377
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Primary and Secondary mapping is reversed\n");
1374
		    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Primary and Secondary mapping is reversed\n");
1378
		}
1375
		}
Lines 1386-1431 Bool RADEONMapControllers(ScrnInfoPtr pS Link Here
1386
1383
1387
    if(pRADEONEnt->HasCRTC2) {
1384
    if(pRADEONEnt->HasCRTC2) {
1388
	if(info->IsSecondary) {
1385
	if(info->IsSecondary) {
1389
	    connector = RADEONGetCrtcConnector(pScrn, 2);
1390
  	    pRADEONEnt->Controller[1]->binding = 2;
1386
  	    pRADEONEnt->Controller[1]->binding = 2;
1391
	    if (connector) {
1387
	    info->DisplayType = pRADEONEnt->PortInfo[1]->MonType;
1392
		info->DisplayType = connector->MonType;
1388
	    pScrn->monitor->DDC = pRADEONEnt->PortInfo[1]->MonInfo;
1393
		pScrn->monitor->DDC = connector->MonInfo;
1394
	    }
1395
	} else {
1389
	} else {
1396
	    connector = RADEONGetCrtcConnector(pScrn, 1);
1397
  	    pRADEONEnt->Controller[0]->binding = 1;
1390
  	    pRADEONEnt->Controller[0]->binding = 1;
1398
	    if (connector) {
1391
	    info->DisplayType = pRADEONEnt->PortInfo[0]->MonType;
1399
		info->DisplayType = connector->MonType; 
1392
	    pScrn->monitor->DDC = pRADEONEnt->PortInfo[0]->MonInfo;
1400
		pScrn->monitor->DDC = connector->MonInfo;
1401
	    }
1402
	}
1393
	}
1403
	
1394
1404
	if(!pRADEONEnt->HasSecondary) {
1395
	if(!pRADEONEnt->HasSecondary) {
1405
	    connector = RADEONGetCrtcConnector(pScrn, 2);
1396
	    info->MergeType = pRADEONEnt->PortInfo[1]->MonType;
1406
	    if (connector)
1407
		info->MergeType = connector->MonType;
1408
	    if (info->MergeType)
1397
	    if (info->MergeType)
1409
  	    	pRADEONEnt->Controller[1]->binding = 1;
1398
  	    	pRADEONEnt->Controller[1]->binding = 1;
1410
	} 
1411
    } else {
1412
	connector = RADEONGetCrtcConnector(pScrn, 1);
1413
	if (connector) {
1414
	    if (connector->MonType == MT_NONE) 
1415
		connector->MonType = MT_CRT;
1416
	    info->DisplayType = connector->MonType; 
1417
	    pScrn->monitor->DDC = connector->MonInfo;
1418
	}
1399
	}
1419
	connector = RADEONGetCrtcConnector(pScrn, 2);
1400
    } else {
1420
	if (connector)
1401
	if (pRADEONEnt->PortInfo[0]->MonType == MT_NONE)
1421
	    connector->MonType = MT_NONE;
1402
	    pRADEONEnt->PortInfo[0]->MonType = MT_CRT;
1403
	info->DisplayType = pRADEONEnt->PortInfo[0]->MonType;
1404
	pScrn->monitor->DDC = pRADEONEnt->PortInfo[0]->MonInfo;
1405
1406
	pRADEONEnt->PortInfo[1]->MonType = MT_NONE;
1422
	pRADEONEnt->Controller[1]->binding = 1;
1407
	pRADEONEnt->Controller[1]->binding = 1;
1423
    }
1408
    }
1424
1409
1425
    if (!info->IsSecondary) {
1410
    if (!info->IsSecondary) {
1426
	connector = RADEONGetCrtcConnector(pScrn, 2);
1427
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head:   Port%d ---- \n", head_reversed?2:1);
1411
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head:   Port%d ---- \n", head_reversed?2:1);
1428
	if (connector->MonType != MT_NONE)
1412
	if (pRADEONEnt->PortInfo[1]->MonType != MT_NONE)
1429
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Port%d ----\n", head_reversed?1:2);
1413
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Port%d ----\n", head_reversed?1:2);
1430
 	else
1414
 	else
1431
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
1415
            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
Lines 2031-2289 void RADEONInitDispBandwidth(ScrnInfoPtr Link Here
2031
    RADEONInitDispBandwidth2(pScrn, info, info2, mode1, mode2);
2015
    RADEONInitDispBandwidth2(pScrn, info, info2, mode1, mode2);
2032
}
2016
}
2033
2017
2034
static void RADEONBlankSet(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2018
static void
2019
RADEONOutputsBlank(ScrnInfoPtr pScrn, RADEONConnector *pPort, Bool Blank)
2035
{
2020
{
2036
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2021
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2037
    unsigned char *RADEONMMIO = info->MMIO;
2022
    unsigned char *RADEONMMIO = info->MMIO;
2038
2023
2039
    switch(pPort->MonType) {
2024
    switch(pPort->MonType) {
2040
    case MT_LCD:
2025
    case MT_LCD:
2041
        OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS);
2026
	if (Blank)
2027
	    OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS);
2028
	else
2029
	    OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS);
2042
        break;
2030
        break;
2043
2044
    case MT_CRT:
2031
    case MT_CRT:
2045
       if ((info->ChipFamily == CHIP_FAMILY_R200) && 
2032
	if ((info->ChipFamily == CHIP_FAMILY_R200) && (pPort->DACType == DAC_TVDAC)) {
2046
 	  (pPort->DACType == DAC_TVDAC))
2033
	    if (Blank)
2047
	    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2034
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2048
      
2035
	    else
2036
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2037
	}
2049
        break;
2038
        break;
2050
    case MT_DFP:
2039
    case MT_DFP:
2051
        if (pPort->TMDSType == TMDS_EXT)
2040
        if (pPort->TMDSType == TMDS_EXT) {
2052
  	    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2041
	    if (Blank)
2053
        else
2042
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2054
	    OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN);
2043
	    else
2055
      
2044
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2045
        } else {
2046
	    if (Blank)
2047
		OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN);
2048
	    else
2049
		OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN);
2050
	}
2056
        break;
2051
        break;
2057
    case MT_NONE:
2052
    case MT_NONE:
2058
    default:
2053
    default:
2059
        break;
2054
        break;
2060
    }   
2055
    }
2056
}
2057
2058
static void
2059
RADEONCRTC1Blank(RADEONInfoPtr info, Bool Blank)
2060
{
2061
    unsigned char *RADEONMMIO = info->MMIO;
2062
2063
    if (Blank)
2064
	OUTREGP(RADEON_CRTC_EXT_CNTL,
2065
		RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS,
2066
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS));
2067
    else
2068
	OUTREGP(RADEON_CRTC_EXT_CNTL, 0,
2069
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS | RADEON_CRTC_HSYNC_DIS));
2070
}
2071
2072
static void
2073
RADEONCRTC2Blank(RADEONInfoPtr info, Bool Blank)
2074
{
2075
    unsigned char *RADEONMMIO = info->MMIO;
2076
2077
    if (Blank)
2078
	OUTREGP(RADEON_CRTC2_GEN_CNTL,
2079
		RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS,
2080
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2081
    else
2082
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2083
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2061
}
2084
}
2062
2085
2063
/* Blank screen */
2086
/* Blank screen */
2064
void RADEONBlank(ScrnInfoPtr pScrn)
2087
void RADEONBlank(ScrnInfoPtr pScrn, Bool Blank)
2065
{
2088
{
2066
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2089
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2067
    unsigned char *RADEONMMIO = info->MMIO;
2090
    unsigned char *RADEONMMIO = info->MMIO;
2068
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2091
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2069
    RADEONConnector *pPort;
2070
2092
2071
    if (!pRADEONEnt->HasSecondary ||
2093
    if (!pRADEONEnt->HasSecondary ||
2072
	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2094
	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2073
	(info->IsSwitching && (!info->IsSecondary))) {
2095
	(info->IsSwitching && (!info->IsSecondary))) {
2074
        pPort = RADEONGetCrtcConnector(pScrn, 1);
2096
2075
	if (pPort)
2097
	RADEONOutputsBlank(pScrn, pRADEONEnt->PortInfo[0], Blank);
2076
	  RADEONBlankSet(pScrn, pPort);
2098
	RADEONCRTC1Blank(info, Blank);
2077
	OUTREGP (RADEON_CRTC_EXT_CNTL,
2099
2078
		 RADEON_CRTC_DISPLAY_DIS |
2100
	if (!pRADEONEnt->HasCRTC2)
2079
		 RADEON_CRTC_VSYNC_DIS |
2101
	    return;
2080
		 RADEON_CRTC_HSYNC_DIS,
2081
		 ~(RADEON_CRTC_DISPLAY_DIS |
2082
		   RADEON_CRTC_VSYNC_DIS | 
2083
		   RADEON_CRTC_HSYNC_DIS));
2084
2085
	if (!pRADEONEnt->HasCRTC2) return;
2086
2102
2087
	if (pRADEONEnt->Controller[1]->binding == 1) {
2103
	if (pRADEONEnt->Controller[1]->binding == 1) {
2088
	    pPort = RADEONGetCrtcConnector(pScrn, 2);
2104
	    RADEONOutputsBlank(pScrn, pRADEONEnt->PortInfo[1], Blank);
2089
	    if (pPort)
2105
	    RADEONCRTC2Blank(info, Blank);
2090
		RADEONBlankSet(pScrn, pPort);
2091
	    OUTREGP (RADEON_CRTC2_GEN_CNTL,
2092
		     RADEON_CRTC2_DISP_DIS |
2093
		     RADEON_CRTC2_VSYNC_DIS |
2094
		     RADEON_CRTC2_HSYNC_DIS,
2095
		     ~(RADEON_CRTC2_DISP_DIS |
2096
		       RADEON_CRTC2_VSYNC_DIS | 
2097
		       RADEON_CRTC2_HSYNC_DIS));
2098
	}
2106
	}
2099
    }
2107
    }
2100
2108
2101
    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2109
    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2102
	(info->IsSwitching && info->IsSecondary)) {
2110
	(info->IsSwitching && info->IsSecondary)) {
2103
	pPort = RADEONGetCrtcConnector(pScrn, 2);
2111
	RADEONOutputsBlank(pScrn, pRADEONEnt->PortInfo[1], Blank);
2104
	if (pPort)
2112
	RADEONCRTC2Blank(info, Blank);
2105
	    RADEONBlankSet(pScrn, pPort);
2106
	OUTREGP (RADEON_CRTC2_GEN_CNTL,
2107
		 RADEON_CRTC2_DISP_DIS |
2108
		 RADEON_CRTC2_VSYNC_DIS |
2109
		 RADEON_CRTC2_HSYNC_DIS,
2110
		 ~(RADEON_CRTC2_DISP_DIS |
2111
		   RADEON_CRTC2_VSYNC_DIS | 
2112
		   RADEON_CRTC2_HSYNC_DIS));
2113
    }
2113
    }
2114
}
2114
}
2115
2115
2116
static void RADEONUnblankSet(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2116
static void
2117
RADEONOutputsDPMS(ScrnInfoPtr pScrn, RADEONConnector *pPort, int Mode)
2117
{
2118
{
2118
    RADEONInfoPtr info = RADEONPTR (pScrn);
2119
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2119
    unsigned char *RADEONMMIO = info->MMIO;
2120
    unsigned char *RADEONMMIO = info->MMIO;
2121
    RADEONMonitorType MonType;
2122
    RADEONTmdsType TmdsType;
2123
    RADEONDacType DacType;
2120
2124
2121
    switch(pPort->MonType) {
2125
    MonType = pPort->MonType;
2126
    TmdsType = pPort->TMDSType;
2127
    DacType = pPort->DACType;
2128
2129
    switch (MonType) {
2122
    case MT_LCD:
2130
    case MT_LCD:
2123
        OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS);
2131
	if (Mode == DPMSModeOn) {
2124
        break;
2132
	    OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_BLON, ~RADEON_LVDS_BLON);
2125
    case MT_CRT:
2133
	    usleep (info->PanelPwrDly * 1000);
2126
        if ((info->ChipFamily == CHIP_FAMILY_R200) &&
2134
	    OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_ON, ~RADEON_LVDS_ON);
2127
	  (pPort->DACType == DAC_TVDAC))
2135
	} else {
2128
	      OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2136
	    unsigned int tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
2129
        break;
2137
2138
	    /* Asic bug, when turning off LVDS_ON, we have to make sure
2139
	       RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off */
2140
	    if (info->IsMobility || info->IsIGP)
2141
		OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
2142
	    OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~(RADEON_LVDS_BLON | RADEON_LVDS_ON));
2143
	    if (info->IsMobility || info->IsIGP)
2144
		OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
2145
	}
2146
	break;
2130
    case MT_DFP:
2147
    case MT_DFP:
2131
        if (pPort->TMDSType == TMDS_EXT)
2148
	if (Mode == DPMSModeOn) {
2132
	    OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2149
	    if (TmdsType == TMDS_EXT) {
2133
        else
2150
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2134
	    OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN);
2151
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_ON, ~RADEON_FP2_ON);
2135
        break;
2152
		if (info->ChipFamily >= CHIP_FAMILY_R200)
2136
    case MT_NONE:
2153
		    OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_DVO_EN, ~RADEON_FP2_DVO_EN);
2154
	    } else
2155
		OUTREGP(RADEON_FP_GEN_CNTL, (RADEON_FP_FPON | RADEON_FP_TMDS_EN),
2156
			~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2157
	} else {
2158
	    if (TmdsType == TMDS_EXT) {
2159
		OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2160
		OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_ON);
2161
		if (info->ChipFamily >= CHIP_FAMILY_R200) {
2162
		    OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_DVO_EN);
2163
		}
2164
	    } else
2165
		OUTREGP(RADEON_FP_GEN_CNTL, 0, ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2166
	}
2167
	break;
2168
    case MT_CRT:
2137
    default:
2169
    default:
2138
        break;
2170
	RADEONDacPowerSet(pScrn, (Mode == DPMSModeOn), (DacType == DAC_PRIMARY));
2171
	break;
2139
    }
2172
    }
2140
}
2173
}
2141
2174
2142
/* Unblank screen */
2175
void
2143
void RADEONUnblank(ScrnInfoPtr pScrn)
2176
RADEONCRTC1DPMS(RADEONInfoPtr info, int Mode)
2144
{
2177
{
2145
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2146
    unsigned char *RADEONMMIO = info->MMIO;
2178
    unsigned char *RADEONMMIO = info->MMIO;
2147
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2148
    RADEONConnector *pPort;
2149
2179
2150
    if (!pRADEONEnt->HasSecondary ||
2180
    switch (Mode) {
2151
	(pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2181
    case DPMSModeOn:
2152
	(info->IsSwitching && (!info->IsSecondary))) {
2182
	/* Screen: On; HSync: On, VSync: On */
2153
	pPort = RADEONGetCrtcConnector(pScrn, 1);
2183
	OUTREGP(RADEON_CRTC_EXT_CNTL, 0,
2154
	if (pPort)
2184
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2155
	    RADEONUnblankSet(pScrn, pPort);
2185
	break;
2156
      OUTREGP(RADEON_CRTC_EXT_CNTL,
2186
    case DPMSModeStandby:
2157
	      0,
2187
	/* Screen: Off; HSync: Off, VSync: On */
2158
	      ~(RADEON_CRTC_DISPLAY_DIS |
2188
	OUTREGP(RADEON_CRTC_EXT_CNTL, (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS),
2159
		RADEON_CRTC_VSYNC_DIS |
2189
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2160
		RADEON_CRTC_HSYNC_DIS));
2190
	break;
2161
2191
    case DPMSModeSuspend:
2162
      if (!pRADEONEnt->HasCRTC2) return;
2192
	/* Screen: Off; HSync: On, VSync: Off */
2163
2193
	OUTREGP(RADEON_CRTC_EXT_CNTL, (RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS),
2164
      if (pRADEONEnt->Controller[1]->binding == 1) {
2194
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2165
	pPort = RADEONGetCrtcConnector(pScrn, 2);
2195
	break;
2166
	if (pPort)
2196
    case DPMSModeOff:
2167
	    RADEONUnblankSet(pScrn, pPort);
2197
    default:
2168
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2198
	/* Screen: Off; HSync: Off, VSync: Off */
2169
		~(RADEON_CRTC2_DISP_DIS |
2199
	OUTREGP(RADEON_CRTC_EXT_CNTL,
2170
		  RADEON_CRTC2_VSYNC_DIS |
2200
		(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS),
2171
		  RADEON_CRTC2_HSYNC_DIS));
2201
		~(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS | RADEON_CRTC_VSYNC_DIS));
2172
      }
2202
	break;
2173
    }
2174
2175
    if ((pRADEONEnt->HasSecondary && !info->IsSwitching) ||
2176
	(info->IsSwitching && info->IsSecondary)) {
2177
	pPort = RADEONGetCrtcConnector(pScrn, 2);
2178
	if (pPort)
2179
	    RADEONUnblankSet(pScrn, pPort);
2180
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2181
		~(RADEON_CRTC2_DISP_DIS |
2182
		  RADEON_CRTC2_VSYNC_DIS |
2183
		  RADEON_CRTC2_HSYNC_DIS));
2184
    }
2203
    }
2185
}
2204
}
2186
2205
2187
static void RADEONDPMSSetOn(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2188
{
2189
  RADEONInfoPtr  info       = RADEONPTR(pScrn);
2190
  unsigned char *RADEONMMIO = info->MMIO;
2191
  RADEONMonitorType MonType;
2192
  RADEONTmdsType TmdsType;
2193
  RADEONDacType DacType;
2194
2195
  MonType = pPort->MonType;
2196
  TmdsType = pPort->TMDSType;
2197
  DacType = pPort->DACType;
2198
2199
  switch(MonType) {
2200
  case MT_LCD:
2201
    OUTREGP (RADEON_LVDS_GEN_CNTL, RADEON_LVDS_BLON, ~RADEON_LVDS_BLON);
2202
    usleep (info->PanelPwrDly * 1000);
2203
    OUTREGP (RADEON_LVDS_GEN_CNTL, RADEON_LVDS_ON, ~RADEON_LVDS_ON);
2204
    break;
2205
  case MT_DFP:
2206
    if (TmdsType == TMDS_EXT) {
2207
      OUTREGP (RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
2208
      OUTREGP (RADEON_FP2_GEN_CNTL, RADEON_FP2_ON, ~RADEON_FP2_ON);
2209
      if (info->ChipFamily >= CHIP_FAMILY_R200) {
2210
	OUTREGP (RADEON_FP2_GEN_CNTL, RADEON_FP2_DVO_EN, 
2211
		 ~RADEON_FP2_DVO_EN);
2212
      }
2213
    } else
2214
      OUTREGP (RADEON_FP_GEN_CNTL, (RADEON_FP_FPON | RADEON_FP_TMDS_EN),
2215
	       ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2216
    break;
2217
  case MT_CRT:
2218
  default:
2219
    RADEONDacPowerSet(pScrn, TRUE, (DacType == DAC_PRIMARY));
2220
    break;
2221
  }
2222
}
2223
2206
2224
static void RADEONDPMSSetOff(ScrnInfoPtr pScrn, RADEONConnector *pPort)
2207
void
2208
RADEONCRTC2DPMS(RADEONInfoPtr info, int Mode)
2225
{
2209
{
2226
  RADEONInfoPtr  info       = RADEONPTR(pScrn);
2210
    unsigned char *RADEONMMIO = info->MMIO;
2227
  unsigned char *RADEONMMIO = info->MMIO;
2211
2228
  RADEONMonitorType MonType;
2212
    switch (Mode) {
2229
  RADEONTmdsType TmdsType;
2213
    case DPMSModeOn:
2230
  RADEONDacType DacType;
2214
	/* Screen: On; HSync: On, VSync: On */
2231
  unsigned long tmpPixclksCntl;
2215
	OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
2232
2216
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2233
  MonType = pPort->MonType;
2217
	break;
2234
  TmdsType = pPort->TMDSType;
2218
    case DPMSModeStandby:
2235
  DacType = pPort->DACType;
2219
	/* Screen: Off; HSync: Off, VSync: On */
2236
2220
	OUTREGP(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
2237
  switch(MonType) {
2221
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2238
  case MT_LCD:
2222
	break;
2239
    tmpPixclksCntl = INPLL(pScrn, RADEON_PIXCLKS_CNTL);
2223
    case DPMSModeSuspend:
2240
    if (info->IsMobility || info->IsIGP) {
2224
	/* Screen: Off; HSync: On, VSync: Off */
2241
      /* Asic bug, when turning off LVDS_ON, we have to make sure
2225
	OUTREGP(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
2242
	 RADEON_PIXCLK_LVDS_ALWAYS_ON bit is off
2226
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2243
      */
2227
	break;
2244
      OUTPLLP(pScrn, RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
2228
    case DPMSModeOff:
2245
    }
2229
    default:
2246
    OUTREGP (RADEON_LVDS_GEN_CNTL, 0,
2230
	/* Screen: Off; HSync: Off, VSync: Off */
2247
	     ~(RADEON_LVDS_BLON | RADEON_LVDS_ON));
2231
	OUTREGP(RADEON_CRTC2_GEN_CNTL,
2248
    if (info->IsMobility || info->IsIGP) {
2232
		(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS),
2249
      OUTPLL(pScrn, RADEON_PIXCLKS_CNTL, tmpPixclksCntl);
2233
		~(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS | RADEON_CRTC2_HSYNC_DIS));
2234
	break;
2250
    }
2235
    }
2251
    break;
2252
  case MT_DFP:
2253
    if (TmdsType == TMDS_EXT) {
2254
      OUTREGP (RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
2255
      OUTREGP (RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_ON);
2256
      if (info->ChipFamily >= CHIP_FAMILY_R200) {
2257
	OUTREGP (RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_DVO_EN);
2258
      }
2259
    } else
2260
      OUTREGP (RADEON_FP_GEN_CNTL, 0, ~(RADEON_FP_FPON | RADEON_FP_TMDS_EN));
2261
    break;
2262
  case MT_CRT:
2263
  default:
2264
    RADEONDacPowerSet(pScrn, FALSE, (DacType == DAC_PRIMARY));
2265
    break;
2266
  }
2267
}
2236
}
2268
2237
2269
2270
/* Sets VESA Display Power Management Signaling (DPMS) Mode */
2238
/* Sets VESA Display Power Management Signaling (DPMS) Mode */
2271
void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
2239
void
2272
					    int PowerManagementMode,
2240
RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
2273
					    int flags)
2274
{
2241
{
2275
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2242
    RADEONInfoPtr  info       = RADEONPTR(pScrn);
2276
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2243
    RADEONEntPtr pRADEONEnt   = RADEONEntPriv(pScrn);
2277
    unsigned char *RADEONMMIO = info->MMIO;
2278
    RADEONConnector *pPort;
2244
    RADEONConnector *pPort;
2279
    if (!pScrn->vtSema) return;
2245
2246
    if (!pScrn->vtSema)
2247
	return;
2280
2248
2281
    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
2249
    xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
2282
		   "RADEONDisplayPowerManagementSet(%d,0x%x)\n",
2250
		   "RADEONDisplayPowerManagementSet(%d,0x%x)\n",
2283
		   PowerManagementMode, flags);
2251
		   PowerManagementMode, flags);
2284
2252
2285
#ifdef XF86DRI
2253
#ifdef XF86DRI
2286
    if (info->CPStarted) DRILock(pScrn->pScreen, 0);
2254
    if (info->CPStarted)
2255
	DRILock(pScrn->pScreen, 0);
2287
#endif
2256
#endif
2288
2257
2289
    if (info->accelOn)
2258
    if (info->accelOn)
Lines 2292-2383 void RADEONDisplayPowerManagementSet(Scr Link Here
2292
    if (info->FBDev) {
2261
    if (info->FBDev) {
2293
	fbdevHWDPMSSet(pScrn, PowerManagementMode, flags);
2262
	fbdevHWDPMSSet(pScrn, PowerManagementMode, flags);
2294
    } else {
2263
    } else {
2295
	int             mask1     = (RADEON_CRTC_DISPLAY_DIS |
2264
	if (info->IsSecondary) {
2296
				     RADEON_CRTC_HSYNC_DIS |
2265
	    RADEONCRTC2DPMS(info, PowerManagementMode);
2297
				     RADEON_CRTC_VSYNC_DIS);
2266
	    RADEONOutputsDPMS(pScrn, pRADEONEnt->PortInfo[1], PowerManagementMode);
2298
	int             mask2     = (RADEON_CRTC2_DISP_DIS |
2267
	} else {
2299
				     RADEON_CRTC2_VSYNC_DIS |
2268
	    RADEONCRTC1DPMS(info, PowerManagementMode);
2300
				     RADEON_CRTC2_HSYNC_DIS);
2269
	    RADEONOutputsDPMS(pScrn, pRADEONEnt->PortInfo[0], PowerManagementMode);
2301
2302
	switch (PowerManagementMode) {
2303
	case DPMSModeOn:
2304
	    /* Screen: On; HSync: On, VSync: On */
2305
	    if (info->IsSecondary)
2306
		OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2);
2307
	    else {
2308
		if (pRADEONEnt->Controller[1]->binding == 1)
2309
		    OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2);
2310
		OUTREGP(RADEON_CRTC_EXT_CNTL, 0, ~mask1);
2311
	    }
2312
	    break;
2313
2314
	case DPMSModeStandby:
2315
	    /* Screen: Off; HSync: Off, VSync: On */
2316
	    if (info->IsSecondary)
2317
		OUTREGP(RADEON_CRTC2_GEN_CNTL,
2318
			(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
2319
			~mask2);
2320
	    else {
2321
		if (pRADEONEnt->Controller[1]->binding == 1)
2322
		    OUTREGP(RADEON_CRTC2_GEN_CNTL,
2323
			    (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
2324
			    ~mask2);
2325
		OUTREGP(RADEON_CRTC_EXT_CNTL,
2326
			(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS),
2327
			~mask1);
2328
	    }
2329
	    break;
2330
2331
	case DPMSModeSuspend:
2332
	    /* Screen: Off; HSync: On, VSync: Off */
2333
	    if (info->IsSecondary)
2334
		OUTREGP(RADEON_CRTC2_GEN_CNTL,
2335
			(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
2336
			~mask2);
2337
	    else {
2338
		if (pRADEONEnt->Controller[1]->binding == 1)
2339
		    OUTREGP(RADEON_CRTC2_GEN_CNTL,
2340
			    (RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
2341
			    ~mask2);
2342
		OUTREGP(RADEON_CRTC_EXT_CNTL,
2343
			(RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS),
2344
			~mask1);
2345
	    }
2346
	    break;
2347
2348
	case DPMSModeOff:
2349
	    /* Screen: Off; HSync: Off, VSync: Off */
2350
	    if (info->IsSecondary)
2351
		OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2);
2352
	    else {
2353
		if (pRADEONEnt->Controller[1]->binding == 1)
2354
		    OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2);
2355
		OUTREGP(RADEON_CRTC_EXT_CNTL, mask1, ~mask1);
2356
	    }
2357
	    break;
2358
	}
2359
2270
2360
	if (PowerManagementMode == DPMSModeOn) {
2361
  	    pPort = RADEONGetCrtcConnector(pScrn, info->IsSecondary ? 2 : 1);
2362
   	    RADEONDPMSSetOn(pScrn, pPort);
2363
	    if (pRADEONEnt->Controller[1]->binding == 1) {
2364
	      pPort = RADEONGetCrtcConnector(pScrn, 2);
2365
	      RADEONDPMSSetOn(pScrn, pPort);
2366
	    }
2367
	} else if ((PowerManagementMode == DPMSModeOff) ||
2368
		   (PowerManagementMode == DPMSModeSuspend) ||
2369
		   (PowerManagementMode == DPMSModeStandby)) {
2370
	    pPort = RADEONGetCrtcConnector(pScrn, info->IsSecondary ? 2 : 1);
2371
	    RADEONDPMSSetOff(pScrn, pPort);
2372
	    if (pRADEONEnt->Controller[1]->binding == 1) {
2271
	    if (pRADEONEnt->Controller[1]->binding == 1) {
2373
	        pPort = RADEONGetCrtcConnector(pScrn, 2);	        
2272
		RADEONCRTC2DPMS(info, PowerManagementMode);
2374
	        RADEONDPMSSetOff(pScrn, pPort);
2273
		RADEONOutputsDPMS(pScrn, pRADEONEnt->PortInfo[1], PowerManagementMode);
2375
	    }
2274
	    }
2376
        }
2275
	}
2377
    }
2276
    }
2378
2277
2379
#ifdef XF86DRI
2278
#ifdef XF86DRI
2380
    if (info->CPStarted) DRIUnlock(pScrn->pScreen);
2279
    if (info->CPStarted)
2280
	DRIUnlock(pScrn->pScreen);
2381
#endif
2281
#endif
2382
}
2282
}
2383
2283
Lines 2405-2432 Bool RADEONAllocateControllers(ScrnInfoP Link Here
2405
Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
2305
Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
2406
{
2306
{
2407
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
2307
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
2408
    int i;
2409
2308
2410
    if (pRADEONEnt->PortInfo[0])
2309
    if (pRADEONEnt->PortInfo[0])
2411
        return TRUE;
2310
        return TRUE;
2412
    
2311
2413
    /* for now always allocate max connectors */
2312
    /* for now always allocate both connectors */
2414
    for (i = 0 ; i < RADEON_MAX_CONNECTOR; i++) {
2313
    pRADEONEnt->PortInfo[0] = xcalloc(sizeof(RADEONConnector), 1);
2415
      pRADEONEnt->PortInfo[i] = xcalloc(sizeof(RADEONConnector), 1);
2314
    if (!pRADEONEnt->PortInfo[0])
2416
      if (!pRADEONEnt->PortInfo[i])
2315
	return FALSE;
2316
2317
    pRADEONEnt->PortInfo[1] = xcalloc(sizeof(RADEONConnector), 1);
2318
    if (!pRADEONEnt->PortInfo[1]) {
2319
	xfree(pRADEONEnt->PortInfo[0]);
2417
	return FALSE;
2320
	return FALSE;
2418
    }
2321
    }
2419
2322
2420
    return TRUE;
2323
    return TRUE;
2421
}
2324
}
2422
2325
2423
RADEONConnector *RADEONGetCrtcConnector(ScrnInfoPtr pScrn, int crtc_num)
2424
{
2425
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
2426
2427
    if (pRADEONEnt->PortInfo[0]->crtc_num == crtc_num)
2428
      return pRADEONEnt->PortInfo[0];
2429
    else if (pRADEONEnt->PortInfo[1]->crtc_num == crtc_num)
2430
      return pRADEONEnt->PortInfo[1];
2431
    return NULL;
2432
}
(-)a/src/radeon_driver.c (-59 / +32 lines)
Lines 2034-2042 static Bool RADEONPreInitModes(ScrnInfoP Link Here
2034
	xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE);
2034
	xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE);
2035
2035
2036
    /* don't use RMX if we have a dual-tmds panels */
2036
    /* don't use RMX if we have a dual-tmds panels */
2037
    if ((connector = RADEONGetCrtcConnector(pScrn, 2)))
2037
    if (pRADEONEnt->PortInfo[1]->MonType == MT_DFP)
2038
	if (connector->MonType == MT_DFP)
2038
	info->ddc_mode = TRUE;
2039
	    info->ddc_mode = TRUE;
2040
    /* don't use RMX if we are Dell Server */  
2039
    /* don't use RMX if we are Dell Server */  
2041
    if (info->IsDellServer)
2040
    if (info->IsDellServer)
2042
	info->ddc_mode = TRUE;
2041
	info->ddc_mode = TRUE;
Lines 5176-5186 static void RADEONRestoreMode(ScrnInfoPt Link Here
5176
	    RADEONRestoreCrtc2Registers(pScrn, restore);
5175
	    RADEONRestoreCrtc2Registers(pScrn, restore);
5177
	    RADEONRestorePLL2Registers(pScrn, restore);
5176
	    RADEONRestorePLL2Registers(pScrn, restore);
5178
	    RADEONRestoreFPRegisters(pScrn, restore);
5177
	    RADEONRestoreFPRegisters(pScrn, restore);
5179
	    pPort = RADEONGetCrtcConnector(pScrn, 2);
5178
	    RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[1], TRUE);
5180
	    if (pPort) {
5179
	    pCRTC2->IsActive = TRUE;
5181
		RADEONEnableDisplay(pScrn, pPort, TRUE);
5182
		pCRTC2->IsActive = TRUE;
5183
	    }
5184
	} else {
5180
	} else {
5185
	    RADEONRestoreMemMapRegisters(pScrn, restore);
5181
	    RADEONRestoreMemMapRegisters(pScrn, restore);
5186
	    RADEONRestoreCommonRegisters(pScrn, restore);
5182
	    RADEONRestoreCommonRegisters(pScrn, restore);
Lines 5192-5208 static void RADEONRestoreMode(ScrnInfoPt Link Here
5192
            RADEONRestoreCrtcRegisters(pScrn, restore);
5188
            RADEONRestoreCrtcRegisters(pScrn, restore);
5193
            RADEONRestorePLLRegisters(pScrn, restore);
5189
            RADEONRestorePLLRegisters(pScrn, restore);
5194
	    RADEONRestoreFPRegisters(pScrn, restore);
5190
	    RADEONRestoreFPRegisters(pScrn, restore);
5195
	    pPort = RADEONGetCrtcConnector(pScrn, 1);
5191
	    RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[0], TRUE);
5196
	    if (pPort) {
5192
	    pCRTC1->IsActive = TRUE;
5197
		RADEONEnableDisplay(pScrn, pPort, TRUE);
5198
		pCRTC1->IsActive = TRUE;
5199
	    }
5200
	    if (pCRTC2->binding == 1) {
5193
	    if (pCRTC2->binding == 1) {
5201
		pPort = RADEONGetCrtcConnector(pScrn, 2);
5194
		RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[1], TRUE);
5202
		if (pPort) {
5195
		pCRTC2->IsActive = TRUE;
5203
		    RADEONEnableDisplay(pScrn, pPort, TRUE);
5204
		    pCRTC2->IsActive = TRUE;
5205
		}
5206
	    }
5196
	    }
5207
	}
5197
	}
5208
    } else {
5198
    } else {
Lines 5216-5232 static void RADEONRestoreMode(ScrnInfoPt Link Here
5216
	RADEONRestoreCrtcRegisters(pScrn, restore);
5206
	RADEONRestoreCrtcRegisters(pScrn, restore);
5217
	RADEONRestorePLLRegisters(pScrn, restore);
5207
	RADEONRestorePLLRegisters(pScrn, restore);
5218
	RADEONRestoreFPRegisters(pScrn, restore);
5208
	RADEONRestoreFPRegisters(pScrn, restore);
5219
	pPort = RADEONGetCrtcConnector(pScrn, 1);
5209
	RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[0], TRUE);
5220
	if (pPort) {
5210
	pCRTC1->IsActive = TRUE;
5221
	    RADEONEnableDisplay(pScrn, pPort, TRUE);
5211
	if (pCRTC2->binding == 1) {
5222
	    pCRTC1->IsActive = TRUE;
5212
	    RADEONEnableDisplay(pScrn, pRADEONEnt->PortInfo[1], TRUE);
5223
	}
5213
	    pCRTC2->IsActive = TRUE;
5224
	if ((pCRTC2->binding == 1) || pRADEONEnt->HasSecondary) {
5225
	    pPort = RADEONGetCrtcConnector(pScrn, 2);
5226
	    if (pPort) {
5227
		RADEONEnableDisplay(pScrn, pPort, TRUE);
5228
		pCRTC2->IsActive = TRUE;
5229
	    }
5230
	}
5214
	}
5231
    }
5215
    }
5232
5216
Lines 5538-5544 static void RADEONRestore(ScrnInfoPtr pS Link Here
5538
	fbdevHWRestore(pScrn);
5522
	fbdevHWRestore(pScrn);
5539
	return;
5523
	return;
5540
    }
5524
    }
5541
    RADEONBlank(pScrn);
5525
    RADEONBlank(pScrn, TRUE);
5542
5526
5543
    OUTREG(RADEON_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
5527
    OUTREG(RADEON_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
5544
    RADEONPllErrataAfterIndex(info);
5528
    RADEONPllErrataAfterIndex(info);
Lines 5910-5919 static void RADEONInitDAC2Registers(Scrn Link Here
5910
    }
5894
    }
5911
}
5895
}
5912
5896
5913
static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, RADEONConnector *pPort, int crtc_num)
5897
static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, DisplayModePtr mode, RADEONConnector *pPort, Bool IsPrimary)
5914
{
5898
{
5915
    Bool IsPrimary = crtc_num == 1 ? TRUE : FALSE;
5916
5917
    if (pPort->MonType == MT_CRT) {
5899
    if (pPort->MonType == MT_CRT) {
5918
	if (pPort->DACType == DAC_PRIMARY) {
5900
	if (pPort->DACType == DAC_PRIMARY) {
5919
	    RADEONInitDACRegisters(pScrn, save, mode, IsPrimary);
5901
	    RADEONInitDACRegisters(pScrn, save, mode, IsPrimary);
Lines 5921-5931 static void RADEONInitOutputRegisters(Sc Link Here
5921
	    RADEONInitDAC2Registers(pScrn, save, mode, IsPrimary);
5903
	    RADEONInitDAC2Registers(pScrn, save, mode, IsPrimary);
5922
	}
5904
	}
5923
    } else if (pPort->MonType == MT_LCD) {
5905
    } else if (pPort->MonType == MT_LCD) {
5924
	if (crtc_num == 1)
5906
	if (IsPrimary)
5925
	    RADEONInitRMXRegisters(pScrn, save, mode);
5907
	    RADEONInitRMXRegisters(pScrn, save, mode);
5926
	RADEONInitLVDSRegisters(pScrn, save, mode, IsPrimary);
5908
	RADEONInitLVDSRegisters(pScrn, save, mode, IsPrimary);
5927
    } else if (pPort->MonType == MT_DFP) {
5909
    } else if (pPort->MonType == MT_DFP) {
5928
	if (crtc_num == 1)
5910
	if (IsPrimary)
5929
	    RADEONInitRMXRegisters(pScrn, save, mode);
5911
	    RADEONInitRMXRegisters(pScrn, save, mode);
5930
	if (pPort->TMDSType == TMDS_INT) {
5912
	if (pPort->TMDSType == TMDS_INT) {
5931
	    RADEONInitFPRegisters(pScrn, save, mode, IsPrimary);
5913
	    RADEONInitFPRegisters(pScrn, save, mode, IsPrimary);
Lines 6095-6105 static Bool RADEONInitCrtcRegisters(Scrn Link Here
6095
    }
6077
    }
6096
6078
6097
    /* get the output connected to this CRTC */
6079
    /* get the output connected to this CRTC */
6098
    if (pRADEONEnt->PortInfo[0]->crtc_num == 1) {
6080
    RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[0], TRUE);
6099
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[0], 1);
6100
    } else if (pRADEONEnt->PortInfo[1]->crtc_num == 1) {
6101
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[1], 1);
6102
    }
6103
6081
6104
    if (info->IsDellServer) {
6082
    if (info->IsDellServer) {
6105
	save->dac2_cntl = info->SavedReg.dac2_cntl;
6083
	save->dac2_cntl = info->SavedReg.dac2_cntl;
Lines 6230-6241 static Bool RADEONInitCrtc2Registers(Scr Link Here
6230
    save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid;
6208
    save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid;
6231
6209
6232
    /* get the output connected to this CRTC */
6210
    /* get the output connected to this CRTC */
6233
    if (pRADEONEnt->PortInfo[0]->crtc_num == 2) {
6211
    RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[1], FALSE);
6234
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[0], 2);
6212
    
6235
    } else if (pRADEONEnt->PortInfo[1]->crtc_num == 2) {
6236
	RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->PortInfo[1], 2);
6237
    }
6238
6239
    /* We must set SURFACE_CNTL properly on the second screen too */
6213
    /* We must set SURFACE_CNTL properly on the second screen too */
6240
    save->surface_cntl = 0;
6214
    save->surface_cntl = 0;
6241
#if X_BYTE_ORDER == X_BIG_ENDIAN
6215
#if X_BYTE_ORDER == X_BIG_ENDIAN
Lines 6568-6576 static Bool RADEONModeInit(ScrnInfoPtr p Link Here
6568
    if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE;
6542
    if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE;
6569
6543
6570
    pScrn->vtSema = TRUE;
6544
    pScrn->vtSema = TRUE;
6571
    RADEONBlank(pScrn);
6545
    RADEONBlank(pScrn, TRUE);
6572
    RADEONRestoreMode(pScrn, &info->ModeReg);
6546
    RADEONRestoreMode(pScrn, &info->ModeReg);
6573
    RADEONUnblank(pScrn);
6547
    RADEONBlank(pScrn, FALSE);
6574
6548
6575
    info->CurrentLayout.mode = mode;
6549
    info->CurrentLayout.mode = mode;
6576
6550
Lines 6592-6599 static Bool RADEONSaveScreen(ScreenPtr p Link Here
6592
    if (unblank) SetTimeSinceLastInputEvent();
6566
    if (unblank) SetTimeSinceLastInputEvent();
6593
6567
6594
    if ((pScrn != NULL) && pScrn->vtSema) {
6568
    if ((pScrn != NULL) && pScrn->vtSema) {
6595
	if (unblank)  RADEONUnblank(pScrn);
6569
	if (unblank)
6596
	else          RADEONBlank(pScrn);
6570
	    RADEONBlank(pScrn, FALSE);
6571
	else
6572
	    RADEONBlank(pScrn, TRUE);
6597
    }
6573
    }
6598
    return TRUE;
6574
    return TRUE;
6599
}
6575
}
Lines 7152-7158 static void Link Here
7152
RADEONGetMergedFBOptions(ScrnInfoPtr pScrn)
7128
RADEONGetMergedFBOptions(ScrnInfoPtr pScrn)
7153
{
7129
{
7154
    RADEONInfoPtr      info       = RADEONPTR(pScrn);
7130
    RADEONInfoPtr      info       = RADEONPTR(pScrn);
7155
    RADEONConnector *connector;
7131
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
7156
    char        *strptr;
7132
    char        *strptr;
7157
    char	*default_hsync = "28-33";
7133
    char	*default_hsync = "28-33";
7158
    char	*default_vrefresh = "43-72";
7134
    char	*default_vrefresh = "43-72";
Lines 7182-7193 RADEONGetMergedFBOptions(ScrnInfoPtr pSc Link Here
7182
	info->MergedFB = FALSE;
7158
	info->MergedFB = FALSE;
7183
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7159
        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7184
        "Failed to detect secondary monitor, MergedFB/Clone mode disabled\n");
7160
        "Failed to detect secondary monitor, MergedFB/Clone mode disabled\n");
7185
    } else if ((connector = RADEONGetCrtcConnector(pScrn, 2))) {
7161
    } else if (!pRADEONEnt->PortInfo[1]->MonInfo) {
7186
	if (!connector->MonInfo) {
7162
	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7187
	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
7163
		   "Failed to detect secondary monitor DDC, default HSync and VRefresh used\n");
7188
		       "Failed to detect secondary monitor DDC, default HSync and VRefresh used\n");
7164
	default_range = TRUE;
7189
	    default_range = TRUE;
7190
	}
7191
    }
7165
    }
7192
7166
7193
    if (xf86GetOptValBool(info->Options, OPTION_MERGEDFB, &val)) {
7167
    if (xf86GetOptValBool(info->Options, OPTION_MERGEDFB, &val)) {
Lines 7352-7359 RADEONGetMergedFBOptions(ScrnInfoPtr pSc Link Here
7352
7326
7353
	  /* xf86SetDDCproperties(info->CRT2pScrn, pRADEONEnt->MonInfo2); */
7327
	  /* xf86SetDDCproperties(info->CRT2pScrn, pRADEONEnt->MonInfo2); */
7354
7328
7355
	  connector = RADEONGetCrtcConnector(pScrn, 2);
7329
	  info->CRT2pScrn->monitor->DDC = pRADEONEnt->PortInfo[1]->MonInfo;
7356
	  info->CRT2pScrn->monitor->DDC = connector ? connector->MonInfo : NULL;
7357
7330
7358
          if (default_range) {
7331
          if (default_range) {
7359
             RADEONStrToRanges(info->CRT2pScrn->monitor->hsync, default_hsync, MAX_HSYNC);
7332
             RADEONStrToRanges(info->CRT2pScrn->monitor->hsync, default_hsync, MAX_HSYNC);
(-)a/src/radeon_probe.h (-4 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
128
- 

Return to bug 264720