summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/radeon.h1
-rw-r--r--src/radeon_display.c171
-rw-r--r--src/radeon_driver.c53
-rw-r--r--src/radeon_probe.h4
4 files changed, 131 insertions, 98 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 3592b2b9..922afa55 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -904,6 +904,7 @@ extern void RADEONBlank(ScrnInfoPtr pScrn);
extern void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode,
int flags);
+extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn);
extern int RADEONValidateMergeModes(ScrnInfoPtr pScrn);
extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
diff --git a/src/radeon_display.c b/src/radeon_display.c
index 10296525..76dfc49f 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -942,10 +942,10 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
pRADEONEnt->PortInfo[i].TMDSType = TMDS_UNKNOWN;
pRADEONEnt->PortInfo[i].ConnectorType = CONNECTOR_NONE;
}
- pRADEONEnt->Controller[0].IsUsed = FALSE;
- pRADEONEnt->Controller[1].IsUsed = FALSE;
- pRADEONEnt->Controller[0].IsActive = FALSE;
- pRADEONEnt->Controller[1].IsActive = FALSE;
+ pRADEONEnt->Controller[0]->IsUsed = FALSE;
+ pRADEONEnt->Controller[1]->IsUsed = FALSE;
+ pRADEONEnt->Controller[0]->IsActive = FALSE;
+ pRADEONEnt->Controller[1]->IsActive = FALSE;
if (!RADEONGetConnectorInfoFromBIOS(pScrn) ||
((pRADEONEnt->PortInfo[0].DDCType == 0) &&
@@ -1207,8 +1207,8 @@ static void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn)
pRADEONEnt->PortInfo[1].TMDSType = TMDS_UNKNOWN;
pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_NONE;
- pRADEONEnt->Controller[0].pPort = &pRADEONEnt->PortInfo[0];
- pRADEONEnt->Controller[1].pPort = &pRADEONEnt->PortInfo[1];
+ pRADEONEnt->Controller[0]->pPort = &pRADEONEnt->PortInfo[0];
+ pRADEONEnt->Controller[1]->pPort = &pRADEONEnt->PortInfo[1];
return;
}
@@ -1273,56 +1273,56 @@ Bool RADEONMapControllers(ScrnInfoPtr pScrn)
if (!info->IsSecondary) {
RADEONQueryConnectedDisplays(pScrn);
- pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[0]);
- pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[1]);
+ pRADEONEnt->Controller[0]->pPort = &(pRADEONEnt->PortInfo[0]);
+ pRADEONEnt->Controller[1]->pPort = &(pRADEONEnt->PortInfo[1]);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Port1:\n Monitor -- %s\n Connector -- %s\n DAC Type -- %s\n TMDS Type -- %s\n DDC Type -- %s\n",
- MonTypeName[pRADEONEnt->Controller[0].pPort->MonType+1],
+ MonTypeName[pRADEONEnt->Controller[0]->pPort->MonType+1],
info->IsAtomBios ?
- ConnectorTypeNameATOM[pRADEONEnt->Controller[0].pPort->ConnectorType]:
- ConnectorTypeName[pRADEONEnt->Controller[0].pPort->ConnectorType],
- DACTypeName[pRADEONEnt->Controller[0].pPort->DACType+1],
- TMDSTypeName[pRADEONEnt->Controller[0].pPort->TMDSType+1],
- DDCTypeName[pRADEONEnt->Controller[0].pPort->DDCType]);
+ ConnectorTypeNameATOM[pRADEONEnt->Controller[0]->pPort->ConnectorType]:
+ ConnectorTypeName[pRADEONEnt->Controller[0]->pPort->ConnectorType],
+ DACTypeName[pRADEONEnt->Controller[0]->pPort->DACType+1],
+ TMDSTypeName[pRADEONEnt->Controller[0]->pPort->TMDSType+1],
+ DDCTypeName[pRADEONEnt->Controller[0]->pPort->DDCType]);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Port2:\n Monitor -- %s\n Connector -- %s\n DAC Type -- %s\n TMDS Type -- %s\n DDC Type -- %s\n",
- MonTypeName[pRADEONEnt->Controller[1].pPort->MonType+1],
+ MonTypeName[pRADEONEnt->Controller[1]->pPort->MonType+1],
info->IsAtomBios ?
- ConnectorTypeNameATOM[pRADEONEnt->Controller[1].pPort->ConnectorType]:
- ConnectorTypeName[pRADEONEnt->Controller[1].pPort->ConnectorType],
- DACTypeName[pRADEONEnt->Controller[1].pPort->DACType+1],
- TMDSTypeName[pRADEONEnt->Controller[1].pPort->TMDSType+1],
- DDCTypeName[pRADEONEnt->Controller[1].pPort->DDCType]);
+ ConnectorTypeNameATOM[pRADEONEnt->Controller[1]->pPort->ConnectorType]:
+ ConnectorTypeName[pRADEONEnt->Controller[1]->pPort->ConnectorType],
+ DACTypeName[pRADEONEnt->Controller[1]->pPort->DACType+1],
+ TMDSTypeName[pRADEONEnt->Controller[1]->pPort->TMDSType+1],
+ DDCTypeName[pRADEONEnt->Controller[1]->pPort->DDCType]);
/* no display detected on primary port*/
- if (pRADEONEnt->Controller[0].pPort->MonType == MT_NONE) {
- if (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE) {
+ if (pRADEONEnt->Controller[0]->pPort->MonType == MT_NONE) {
+ if (pRADEONEnt->Controller[1]->pPort->MonType != MT_NONE) {
/* Only one detected on secondary, let it to be primary */
- pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
- pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
+ pRADEONEnt->Controller[0]->pPort = &(pRADEONEnt->PortInfo[1]);
+ pRADEONEnt->Controller[1]->pPort = &(pRADEONEnt->PortInfo[0]);
head_reversed = TRUE;
} else {
/* None detected, Default to a CRT connected */
- pRADEONEnt->Controller[0].pPort->MonType = MT_CRT;
+ pRADEONEnt->Controller[0]->pPort->MonType = MT_CRT;
}
}
- if ((pRADEONEnt->Controller[0].pPort->MonType == MT_LCD) &&
- (pRADEONEnt->Controller[1].pPort->MonType == MT_CRT)) {
+ if ((pRADEONEnt->Controller[0]->pPort->MonType == MT_LCD) &&
+ (pRADEONEnt->Controller[1]->pPort->MonType == MT_CRT)) {
if (!(INREG(RADEON_LVDS_GEN_CNTL) & RADEON_LVDS_ON)) {
/* LCD is switched off, don't turn it on, otherwise it may casue lockup due to SS issue. */
- pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
- pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
- pRADEONEnt->Controller[1].pPort->MonType = MT_NONE;
+ pRADEONEnt->Controller[0]->pPort = &(pRADEONEnt->PortInfo[1]);
+ pRADEONEnt->Controller[1]->pPort = &(pRADEONEnt->PortInfo[0]);
+ pRADEONEnt->Controller[1]->pPort->MonType = MT_NONE;
head_reversed = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD is switched off, only CRT will be used\n");
}
}
- if ((pRADEONEnt->Controller[0].pPort->MonType != MT_NONE) &&
- (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE)) {
+ if ((pRADEONEnt->Controller[0]->pPort->MonType != MT_NONE) &&
+ (pRADEONEnt->Controller[1]->pPort->MonType != MT_NONE)) {
if (xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DISPLAY, FALSE)) {
if (info->IsMobility) {
/* Don't reverse display for mobility chips, as only CRTC1 path has RMX which
@@ -1330,47 +1330,47 @@ Bool RADEONMapControllers(ScrnInfoPtr pScrn)
*/
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Reverse Display cannot be used for mobility chip\n");
} else {
- pRADEONEnt->Controller[0].pPort = &(pRADEONEnt->PortInfo[1]);
- pRADEONEnt->Controller[1].pPort = &(pRADEONEnt->PortInfo[0]);
+ pRADEONEnt->Controller[0]->pPort = &(pRADEONEnt->PortInfo[1]);
+ pRADEONEnt->Controller[1]->pPort = &(pRADEONEnt->PortInfo[0]);
head_reversed = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Primary and Secondary mapping is reversed\n");
}
}
}
- if (pRADEONEnt->HasSecondary && pRADEONEnt->Controller[1].pPort->MonType == MT_NONE) {
+ if (pRADEONEnt->HasSecondary && pRADEONEnt->Controller[1]->pPort->MonType == MT_NONE) {
pRADEONEnt->HasSecondary = FALSE;
}
}
if(pRADEONEnt->HasCRTC2) {
if(info->IsSecondary) {
- pRADEONEnt->Controller[1].binding = 2;
- info->DisplayType = pRADEONEnt->Controller[1].pPort->MonType;
- pScrn->monitor->DDC = pRADEONEnt->Controller[1].pPort->MonInfo;
+ pRADEONEnt->Controller[1]->binding = 2;
+ info->DisplayType = pRADEONEnt->Controller[1]->pPort->MonType;
+ pScrn->monitor->DDC = pRADEONEnt->Controller[1]->pPort->MonInfo;
} else {
- pRADEONEnt->Controller[0].binding = 1;
- info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType;
- pScrn->monitor->DDC = pRADEONEnt->Controller[0].pPort->MonInfo;
+ pRADEONEnt->Controller[0]->binding = 1;
+ info->DisplayType = pRADEONEnt->Controller[0]->pPort->MonType;
+ pScrn->monitor->DDC = pRADEONEnt->Controller[0]->pPort->MonInfo;
}
if(!pRADEONEnt->HasSecondary) {
- info->MergeType = pRADEONEnt->Controller[1].pPort->MonType;
+ info->MergeType = pRADEONEnt->Controller[1]->pPort->MonType;
if (info->MergeType)
- pRADEONEnt->Controller[1].binding = 1;
+ pRADEONEnt->Controller[1]->binding = 1;
}
} else {
- if (pRADEONEnt->Controller[0].pPort->MonType == MT_NONE)
- pRADEONEnt->Controller[0].pPort->MonType = MT_CRT;
- info->DisplayType = pRADEONEnt->Controller[0].pPort->MonType;
- pScrn->monitor->DDC = pRADEONEnt->Controller[0].pPort->MonInfo;
- pRADEONEnt->Controller[1].pPort->MonType = MT_NONE;
- pRADEONEnt->Controller[1].binding = 1;
+ if (pRADEONEnt->Controller[0]->pPort->MonType == MT_NONE)
+ pRADEONEnt->Controller[0]->pPort->MonType = MT_CRT;
+ info->DisplayType = pRADEONEnt->Controller[0]->pPort->MonType;
+ pScrn->monitor->DDC = pRADEONEnt->Controller[0]->pPort->MonInfo;
+ pRADEONEnt->Controller[1]->pPort->MonType = MT_NONE;
+ pRADEONEnt->Controller[1]->binding = 1;
}
if (!info->IsSecondary) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Primary Head: Port%d ---- \n", head_reversed?2:1);
- if (pRADEONEnt->Controller[1].pPort->MonType != MT_NONE)
+ if (pRADEONEnt->Controller[1]->pPort->MonType != MT_NONE)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Port%d ----\n", head_reversed?1:2);
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "---- Secondary Head: Not used ----\n");
@@ -1673,7 +1673,7 @@ void RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, RADEONInfoPtr info, RADEONInfoP
*/
if ((info->DispPriority == 2) && IS_R300_VARIANT) {
CARD32 mc_init_misc_lat_timer = INREG(R300_MC_INIT_MISC_LAT_TIMER);
- if (pRADEONEnt->Controller[1].IsActive) {
+ if (pRADEONEnt->Controller[1]->IsActive) {
mc_init_misc_lat_timer |= 0x1100; /* display 0 and 1 */
} else {
mc_init_misc_lat_timer |= 0x0100; /* display 0 only */
@@ -1688,7 +1688,7 @@ void RADEONInitDispBandwidth2(ScrnInfoPtr pScrn, RADEONInfoPtr info, RADEONInfoP
if (pRADEONEnt->pSecondaryScrn) {
if (info->IsSecondary) return;
info2 = RADEONPTR(pRADEONEnt->pSecondaryScrn);
- } else if (pRADEONEnt->Controller[1].binding == 1) info2 = info;
+ } else if (pRADEONEnt->Controller[1]->binding == 1) info2 = info;
/*
* Determine if there is enough bandwidth for current display mode
@@ -1956,7 +1956,7 @@ void RADEONInitDispBandwidth(ScrnInfoPtr pScrn)
if (pRADEONEnt->pSecondaryScrn) {
if (info->IsSecondary) return;
info2 = RADEONPTR(pRADEONEnt->pSecondaryScrn);
- } else if (pRADEONEnt->Controller[1].binding == 1) info2 = info;
+ } else if (pRADEONEnt->Controller[1]->binding == 1) info2 = info;
mode1 = info->CurrentLayout.mode;
if (info->MergedFB) {
@@ -1977,19 +1977,19 @@ static void RADEONBlankSet(ScrnInfoPtr pScrn, int controller)
unsigned char *RADEONMMIO = info->MMIO;
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- switch(pRADEONEnt->Controller[controller].pPort->MonType) {
+ switch(pRADEONEnt->Controller[controller]->pPort->MonType) {
case MT_LCD:
OUTREGP(RADEON_LVDS_GEN_CNTL, RADEON_LVDS_DISPLAY_DIS, ~RADEON_LVDS_DISPLAY_DIS);
break;
case MT_CRT:
if ((info->ChipFamily == CHIP_FAMILY_R200) &&
- (pRADEONEnt->Controller[controller].pPort->DACType == DAC_TVDAC))
+ (pRADEONEnt->Controller[controller]->pPort->DACType == DAC_TVDAC))
OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
break;
case MT_DFP:
- if (pRADEONEnt->Controller[controller].pPort->TMDSType == TMDS_EXT)
+ if (pRADEONEnt->Controller[controller]->pPort->TMDSType == TMDS_EXT)
OUTREGP(RADEON_FP2_GEN_CNTL, RADEON_FP2_BLANK_EN, ~RADEON_FP2_BLANK_EN);
else
OUTREGP(RADEON_FP_GEN_CNTL, RADEON_FP_BLANK_EN, ~RADEON_FP_BLANK_EN);
@@ -2023,7 +2023,7 @@ void RADEONBlank(ScrnInfoPtr pScrn)
if (!pRADEONEnt->HasCRTC2) return;
- if (pRADEONEnt->Controller[1].binding == 1) {
+ if (pRADEONEnt->Controller[1]->binding == 1) {
RADEONBlankSet(pScrn, 1);
OUTREGP (RADEON_CRTC2_GEN_CNTL,
RADEON_CRTC2_DISP_DIS |
@@ -2054,17 +2054,17 @@ static void RADEONUnblankSet(ScrnInfoPtr pScrn, int controller)
unsigned char *RADEONMMIO = info->MMIO;
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- switch(pRADEONEnt->Controller[controller].pPort->MonType) {
+ switch(pRADEONEnt->Controller[controller]->pPort->MonType) {
case MT_LCD:
OUTREGP(RADEON_LVDS_GEN_CNTL, 0, ~RADEON_LVDS_DISPLAY_DIS);
break;
case MT_CRT:
if ((info->ChipFamily == CHIP_FAMILY_R200) &&
- (pRADEONEnt->Controller[controller].pPort->DACType == DAC_TVDAC))
+ (pRADEONEnt->Controller[controller]->pPort->DACType == DAC_TVDAC))
OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
break;
case MT_DFP:
- if (pRADEONEnt->Controller[controller].pPort->TMDSType == TMDS_EXT)
+ if (pRADEONEnt->Controller[controller]->pPort->TMDSType == TMDS_EXT)
OUTREGP(RADEON_FP2_GEN_CNTL, 0, ~RADEON_FP2_BLANK_EN);
else
OUTREGP(RADEON_FP_GEN_CNTL, 0, ~RADEON_FP_BLANK_EN);
@@ -2092,7 +2092,7 @@ void RADEONUnblank(ScrnInfoPtr pScrn)
if (!pRADEONEnt->HasCRTC2) return;
- if (pRADEONEnt->Controller[1].binding == 1) {
+ if (pRADEONEnt->Controller[1]->binding == 1) {
RADEONUnblankSet(pScrn, 1);
OUTREGP(RADEON_CRTC2_GEN_CNTL, 0,
~(RADEON_CRTC2_DISP_DIS |
@@ -2119,9 +2119,9 @@ static void RADEONDPMSSetOn(ScrnInfoPtr pScrn, int controller)
RADEONTmdsType TmdsType;
RADEONDacType DacType;
- MonType = pRADEONEnt->Controller[controller].pPort->MonType;
- TmdsType = pRADEONEnt->Controller[controller].pPort->TMDSType;
- DacType = pRADEONEnt->Controller[controller].pPort->DACType;
+ MonType = pRADEONEnt->Controller[controller]->pPort->MonType;
+ TmdsType = pRADEONEnt->Controller[controller]->pPort->TMDSType;
+ DacType = pRADEONEnt->Controller[controller]->pPort->DACType;
switch(MonType) {
case MT_LCD:
@@ -2158,9 +2158,9 @@ static void RADEONDPMSSetOff(ScrnInfoPtr pScrn, int controller)
RADEONDacType DacType;
unsigned long tmpPixclksCntl;
- MonType = pRADEONEnt->Controller[controller].pPort->MonType;
- TmdsType = pRADEONEnt->Controller[controller].pPort->TMDSType;
- DacType = pRADEONEnt->Controller[controller].pPort->DACType;
+ MonType = pRADEONEnt->Controller[controller]->pPort->MonType;
+ TmdsType = pRADEONEnt->Controller[controller]->pPort->TMDSType;
+ DacType = pRADEONEnt->Controller[controller]->pPort->DACType;
switch(MonType) {
case MT_LCD:
@@ -2231,7 +2231,7 @@ void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
if (info->IsSecondary)
OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2);
else {
- if (pRADEONEnt->Controller[1].binding == 1)
+ if (pRADEONEnt->Controller[1]->binding == 1)
OUTREGP(RADEON_CRTC2_GEN_CNTL, 0, ~mask2);
OUTREGP(RADEON_CRTC_EXT_CNTL, 0, ~mask1);
}
@@ -2244,7 +2244,7 @@ void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
~mask2);
else {
- if (pRADEONEnt->Controller[1].binding == 1)
+ if (pRADEONEnt->Controller[1]->binding == 1)
OUTREGP(RADEON_CRTC2_GEN_CNTL,
(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_HSYNC_DIS),
~mask2);
@@ -2261,7 +2261,7 @@ void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
~mask2);
else {
- if (pRADEONEnt->Controller[1].binding == 1)
+ if (pRADEONEnt->Controller[1]->binding == 1)
OUTREGP(RADEON_CRTC2_GEN_CNTL,
(RADEON_CRTC2_DISP_DIS | RADEON_CRTC2_VSYNC_DIS),
~mask2);
@@ -2276,7 +2276,7 @@ void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
if (info->IsSecondary)
OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2);
else {
- if (pRADEONEnt->Controller[1].binding == 1)
+ if (pRADEONEnt->Controller[1]->binding == 1)
OUTREGP(RADEON_CRTC2_GEN_CNTL, mask2, ~mask2);
OUTREGP(RADEON_CRTC_EXT_CNTL, mask1, ~mask1);
}
@@ -2285,14 +2285,14 @@ void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
if (PowerManagementMode == DPMSModeOn) {
RADEONDPMSSetOn(pScrn, info->IsSecondary ? 1 : 0);
- if (pRADEONEnt->Controller[1].binding == 1)
+ if (pRADEONEnt->Controller[1]->binding == 1)
RADEONDPMSSetOn(pScrn, 1);
} else if ((PowerManagementMode == DPMSModeOff) ||
(PowerManagementMode == DPMSModeSuspend) ||
(PowerManagementMode == DPMSModeStandby)) {
RADEONDPMSSetOff(pScrn, info->IsSecondary ? 1 : 0);
- if (pRADEONEnt->Controller[1].binding == 1)
+ if (pRADEONEnt->Controller[1]->binding == 1)
RADEONDPMSSetOff(pScrn, 1);
}
}
@@ -2301,3 +2301,28 @@ void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
if (info->CPStarted) DRIUnlock(pScrn->pScreen);
#endif
}
+
+Bool RADEONAllocateControllers(ScrnInfoPtr pScrn)
+{
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+ int num_crtc;
+
+ if (pRADEONEnt->Controller[0])
+ return TRUE;
+
+ pRADEONEnt->Controller[0] = xcalloc(sizeof(RADEONController), 1);
+ if (!pRADEONEnt->Controller[0])
+ return FALSE;
+
+ if (!pRADEONEnt->HasCRTC2)
+ return TRUE;
+
+ pRADEONEnt->Controller[1] = xcalloc(sizeof(RADEONController), 1);
+ if (!pRADEONEnt->Controller[1])
+ {
+ xfree(pRADEONEnt->Controller[0]);
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 7dcfbb2a..405d96fc 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2020,7 +2020,7 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
xf86ReturnOptValBool(info->Options, OPTION_DDC_MODE, FALSE);
/* don't use RMX if we have a dual-tmds panels */
- if (pRADEONEnt->Controller[1].pPort->MonType == MT_DFP)
+ if (pRADEONEnt->Controller[1]->pPort->MonType == MT_DFP)
info->ddc_mode = TRUE;
/* don't use RMX if we are Dell Server */
if (info->IsDellServer)
@@ -2031,7 +2031,7 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
"Validating modes on %s head ---------\n",
info->IsSecondary ? "Secondary" : "Primary");
- if (!pRADEONEnt->Controller[0].pPort->MonInfo && !pRADEONEnt->Controller[1].pPort->MonInfo && info->ddc_mode) {
+ if (!pRADEONEnt->Controller[0]->pPort->MonInfo && !pRADEONEnt->Controller[1]->pPort->MonInfo && info->ddc_mode) {
info->ddc_mode = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"No DDC data available, DDCMode option is dismissed\n");
@@ -2238,7 +2238,7 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
xf86SetCrtcForModes(pScrn, 0);
if (pRADEONEnt->HasCRTC2) {
- if (pRADEONEnt->Controller[1].binding == 1) {
+ if (pRADEONEnt->Controller[1]->binding == 1) {
/* If we have 2 screens from the config file, we don't need
* to do clone thing, let each screen handles one head.
@@ -2267,7 +2267,7 @@ static Bool RADEONPreInitModes(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
}
xf86PrintModes(pScrn);
- if(pRADEONEnt->Controller[1].binding == 1) {
+ if(pRADEONEnt->Controller[1]->binding == 1) {
xf86SetCrtcForModes(info->CRT2pScrn, INTERLACE_HALVE_V);
@@ -2819,6 +2819,11 @@ static Bool RADEONPreInitXv(ScrnInfoPtr pScrn)
static Bool RADEONPreInitControllers(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10)
{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (!info->IsSecondary)
+ RADEONAllocateControllers(pScrn);
+
RADEONGetBIOSInfo(pScrn, pInt10);
RADEONSetupConnectors(pScrn);
@@ -5062,8 +5067,8 @@ static void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- RADEONController* pCRTC1 = &pRADEONEnt->Controller[0];
- RADEONController* pCRTC2 = &pRADEONEnt->Controller[1];
+ RADEONController* pCRTC1 = pRADEONEnt->Controller[0];
+ RADEONController* pCRTC2 = pRADEONEnt->Controller[1];
RADEONTRACE(("RADEONRestoreMode(%p)\n", restore));
@@ -5790,9 +5795,9 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
- pRADEONEnt->Controller[0].IsUsed = TRUE;
- pRADEONEnt->Controller[0].IsActive = TRUE;
- pRADEONEnt->Controller[0].pCurMode = mode;
+ pRADEONEnt->Controller[0]->IsUsed = TRUE;
+ pRADEONEnt->Controller[0]->IsActive = TRUE;
+ pRADEONEnt->Controller[0]->pCurMode = mode;
switch (info->CurrentLayout.pixel_code) {
case 4: format = 1; break;
@@ -5936,18 +5941,18 @@ static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
RADEON_HORZ_AUTO_RATIO_INC);
}
- if (pRADEONEnt->Controller[0].pPort->MonType == MT_CRT) {
- if (pRADEONEnt->Controller[0].pPort->DACType == DAC_PRIMARY) {
+ if (pRADEONEnt->Controller[0]->pPort->MonType == MT_CRT) {
+ if (pRADEONEnt->Controller[0]->pPort->DACType == DAC_PRIMARY) {
RADEONInitDACRegisters(pScrn, save, mode, TRUE);
} else {
RADEONInitDAC2Registers(pScrn, save, mode, TRUE);
}
- } else if (pRADEONEnt->Controller[0].pPort->MonType == MT_LCD) {
+ } else if (pRADEONEnt->Controller[0]->pPort->MonType == MT_LCD) {
RADEONInitRMXRegisters(pScrn, save, mode);
RADEONInitLVDSRegisters(pScrn, save, mode, TRUE);
- } else if (pRADEONEnt->Controller[0].pPort->MonType == MT_DFP) {
+ } else if (pRADEONEnt->Controller[0]->pPort->MonType == MT_DFP) {
RADEONInitRMXRegisters(pScrn, save, mode);
- if (pRADEONEnt->Controller[0].pPort->TMDSType == TMDS_INT) {
+ if (pRADEONEnt->Controller[0]->pPort->TMDSType == TMDS_INT) {
RADEONInitFPRegisters(pScrn, save, mode, TRUE);
} else {
RADEONInitFP2Registers(pScrn, save, mode, TRUE);
@@ -5988,9 +5993,9 @@ static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save,
if (info->IsSecondary)
info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn);
- pRADEONEnt->Controller[1].IsUsed = TRUE;
- pRADEONEnt->Controller[1].IsActive = TRUE;
- pRADEONEnt->Controller[1].pCurMode = mode;
+ pRADEONEnt->Controller[1]->IsUsed = TRUE;
+ pRADEONEnt->Controller[1]->IsActive = TRUE;
+ pRADEONEnt->Controller[1]->pCurMode = mode;
switch (info->CurrentLayout.pixel_code) {
case 4: format = 1; break;
@@ -6082,16 +6087,16 @@ static Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save,
save->fp_h2_sync_strt_wid = save->crtc2_h_sync_strt_wid;
save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid;
- if (pRADEONEnt->Controller[1].pPort->MonType == MT_CRT) {
- if (pRADEONEnt->Controller[1].pPort->DACType == DAC_PRIMARY) {
+ if (pRADEONEnt->Controller[1]->pPort->MonType == MT_CRT) {
+ if (pRADEONEnt->Controller[1]->pPort->DACType == DAC_PRIMARY) {
RADEONInitDACRegisters(pScrn, save, mode, FALSE);
} else {
RADEONInitDAC2Registers(pScrn, save, mode, FALSE);
}
- } else if (pRADEONEnt->Controller[1].pPort->MonType == MT_LCD) {
+ } else if (pRADEONEnt->Controller[1]->pPort->MonType == MT_LCD) {
RADEONInitLVDSRegisters(pScrn, save, mode, FALSE);
- } else if (pRADEONEnt->Controller[1].pPort->MonType == MT_DFP) {
- if (pRADEONEnt->Controller[1].pPort->TMDSType == TMDS_INT) {
+ } else if (pRADEONEnt->Controller[1]->pPort->MonType == MT_DFP) {
+ if (pRADEONEnt->Controller[1]->pPort->TMDSType == TMDS_INT) {
RADEONInitFPRegisters(pScrn, save, mode, FALSE);
} else {
RADEONInitFP2Registers(pScrn, save, mode, FALSE);
@@ -7005,7 +7010,7 @@ RADEONGetMergedFBOptions(ScrnInfoPtr pScrn)
info->MergedFB = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to detect secondary monitor, MergedFB/Clone mode disabled\n");
- } else if (!pRADEONEnt->Controller[1].pPort->MonInfo) {
+ } else if (!pRADEONEnt->Controller[1]->pPort->MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to detect secondary monitor DDC, default HSync and VRefresh used\n");
default_range = TRUE;
@@ -7171,7 +7176,7 @@ RADEONGetMergedFBOptions(ScrnInfoPtr pScrn)
}
/* xf86SetDDCproperties(info->CRT2pScrn, pRADEONEnt->MonInfo2); */
- info->CRT2pScrn->monitor->DDC = pRADEONEnt->Controller[1].pPort->MonInfo;
+ info->CRT2pScrn->monitor->DDC = pRADEONEnt->Controller[1]->pPort->MonInfo;
if (default_range) {
RADEONStrToRanges(info->CRT2pScrn->monitor->hsync, default_hsync, MAX_HSYNC);
RADEONStrToRanges(info->CRT2pScrn->monitor->vrefresh, default_vrefresh, MAX_VREFRESH);
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 9946cf80..34dad61d 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -121,6 +121,8 @@ typedef struct
RADEONConnector* pPort;
} RADEONController;
+#define RADEON_MAX_CRTC 2
+
typedef struct
{
Bool HasSecondary;
@@ -138,7 +140,7 @@ typedef struct
Bool ReversedDAC; /* TVDAC used as primary dac */
Bool ReversedTMDS; /* DDC_DVI is used for external TMDS */
RADEONConnector PortInfo[2];
- RADEONController Controller[2];
+ RADEONController *Controller[RADEON_MAX_CRTC]; /* pointer to a controller */
} RADEONEntRec, *RADEONEntPtr;
/* radeon_probe.c */