summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2006-12-03 09:53:35 +1100
committerDave Airlie <airlied@linux.ie>2006-12-03 09:53:35 +1100
commit218cb7f8db35d0ce8f9fc4ece72bd5ec3f52106f (patch)
tree7be15f46a96c7deabe95a13545d91865b4d61a5e
parentf22fd02bc7f7ef67e33c9bd93eae2d7488669b5e (diff)
radeon: dynamically allocate connectors
-rw-r--r--src/radeon.h1
-rw-r--r--src/radeon_bios.c102
-rw-r--r--src/radeon_display.c237
-rw-r--r--src/radeon_driver.c10
-rw-r--r--src/radeon_probe.h3
5 files changed, 190 insertions, 163 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 922afa5..32692cd 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -905,6 +905,7 @@ extern void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode,
int flags);
extern Bool RADEONAllocateControllers(ScrnInfoPtr pScrn);
+extern Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn);
extern int RADEONValidateMergeModes(ScrnInfoPtr pScrn);
extern int RADEONValidateDDCModes(ScrnInfoPtr pScrn1, char **ppModeName,
diff --git a/src/radeon_bios.c b/src/radeon_bios.c
index 38a5f8b..1d4c9bb 100644
--- a/src/radeon_bios.c
+++ b/src/radeon_bios.c
@@ -148,46 +148,46 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
/* sharing same port with id[0] */
if (((portinfo>>8) & 0xf) == id[0]) {
if (i == 3)
- pRADEONEnt->PortInfo[0].TMDSType = TMDS_INT;
+ pRADEONEnt->PortInfo[0]->TMDSType = TMDS_INT;
else if (i == 7)
- pRADEONEnt->PortInfo[0].TMDSType = TMDS_EXT;
+ pRADEONEnt->PortInfo[0]->TMDSType = TMDS_EXT;
- if (pRADEONEnt->PortInfo[0].DACType == DAC_UNKNOWN)
- pRADEONEnt->PortInfo[0].DACType = (portinfo & 0xf) - 1;
+ if (pRADEONEnt->PortInfo[0]->DACType == DAC_UNKNOWN)
+ pRADEONEnt->PortInfo[0]->DACType = (portinfo & 0xf) - 1;
continue;
}
}
id[crtc] = (portinfo>>8) & 0xf;
- pRADEONEnt->PortInfo[crtc].DACType = (portinfo & 0xf) - 1;
- pRADEONEnt->PortInfo[crtc].ConnectorType = (portinfo>>4) & 0xf;
+ pRADEONEnt->PortInfo[crtc]->DACType = (portinfo & 0xf) - 1;
+ pRADEONEnt->PortInfo[crtc]->ConnectorType = (portinfo>>4) & 0xf;
if (i == 3)
- pRADEONEnt->PortInfo[crtc].TMDSType = TMDS_INT;
+ pRADEONEnt->PortInfo[crtc]->TMDSType = TMDS_INT;
else if (i == 7)
- pRADEONEnt->PortInfo[crtc].TMDSType = TMDS_EXT;
+ pRADEONEnt->PortInfo[crtc]->TMDSType = TMDS_EXT;
if((tmp0 = RADEON_BIOS16 (info->MasterDataStart + 24)) && id[crtc]) {
switch (RADEON_BIOS16 (tmp0 + 4 + 27 * id[crtc]) * 4)
{
case RADEON_GPIO_MONID:
- pRADEONEnt->PortInfo[crtc].DDCType = DDC_MONID;
+ pRADEONEnt->PortInfo[crtc]->DDCType = DDC_MONID;
break;
case RADEON_GPIO_DVI_DDC:
- pRADEONEnt->PortInfo[crtc].DDCType = DDC_DVI;
+ pRADEONEnt->PortInfo[crtc]->DDCType = DDC_DVI;
break;
case RADEON_GPIO_VGA_DDC:
- pRADEONEnt->PortInfo[crtc].DDCType = DDC_VGA;
+ pRADEONEnt->PortInfo[crtc]->DDCType = DDC_VGA;
break;
case RADEON_GPIO_CRT2_DDC:
- pRADEONEnt->PortInfo[crtc].DDCType = DDC_CRT2;
+ pRADEONEnt->PortInfo[crtc]->DDCType = DDC_CRT2;
break;
default:
- pRADEONEnt->PortInfo[crtc].DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[crtc]->DDCType = DDC_NONE_DETECTED;
break;
}
} else {
- pRADEONEnt->PortInfo[crtc].DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[crtc]->DDCType = DDC_NONE_DETECTED;
}
crtc++;
} else {
@@ -197,12 +197,12 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
for (j=0; j<2; j++) {
if (((portinfo>>8) & 0xf) == id[j]) {
if (i == 3)
- pRADEONEnt->PortInfo[j].TMDSType = TMDS_INT;
+ pRADEONEnt->PortInfo[j]->TMDSType = TMDS_INT;
else if (i == 7)
- pRADEONEnt->PortInfo[j].TMDSType = TMDS_EXT;
+ pRADEONEnt->PortInfo[j]->TMDSType = TMDS_EXT;
- if (pRADEONEnt->PortInfo[j].DACType == DAC_UNKNOWN)
- pRADEONEnt->PortInfo[j].DACType = (portinfo & 0xf) - 1;
+ if (pRADEONEnt->PortInfo[j]->DACType == DAC_UNKNOWN)
+ pRADEONEnt->PortInfo[j]->DACType = (portinfo & 0xf) - 1;
}
}
}
@@ -211,8 +211,8 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
for (i=0; i<2; i++) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Port%d: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
- i, pRADEONEnt->PortInfo[i].DDCType, pRADEONEnt->PortInfo[i].DACType,
- pRADEONEnt->PortInfo[i].TMDSType, pRADEONEnt->PortInfo[i].ConnectorType);
+ i, pRADEONEnt->PortInfo[i]->DDCType, pRADEONEnt->PortInfo[i]->DACType,
+ pRADEONEnt->PortInfo[i]->TMDSType, pRADEONEnt->PortInfo[i]->ConnectorType);
}
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n");
@@ -239,25 +239,25 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
tmp0 = RADEON_BIOS16(tmp + i*2);
if (((tmp0 >> 12) & 0x0f) == 0) continue; /* no connector */
if (connector_found > 0) {
- if (pRADEONEnt->PortInfo[tmp1].DDCType == ((tmp0 >> 8) & 0x0f))
+ if (pRADEONEnt->PortInfo[tmp1]->DDCType == ((tmp0 >> 8) & 0x0f))
continue; /* same connector */
}
/* internal DDC_DVI port will get assigned to PortInfo[0], or if there is no DDC_DVI (like in some IGPs). */
tmp1 = ((((tmp0 >> 8) & 0xf) == DDC_DVI) || (tmp1 == 1)) ? 0 : 1; /* determine port info index */
- pRADEONEnt->PortInfo[tmp1].DDCType = (tmp0 >> 8) & 0x0f;
- if (pRADEONEnt->PortInfo[tmp1].DDCType > DDC_CRT2) pRADEONEnt->PortInfo[tmp1].DDCType = DDC_NONE_DETECTED;
- pRADEONEnt->PortInfo[tmp1].DACType = (tmp0 & 0x01) ? DAC_TVDAC : DAC_PRIMARY;
- pRADEONEnt->PortInfo[tmp1].ConnectorType = (tmp0 >> 12) & 0x0f;
- if (pRADEONEnt->PortInfo[tmp1].ConnectorType > CONNECTOR_UNSUPPORTED) pRADEONEnt->PortInfo[tmp1].ConnectorType = CONNECTOR_UNSUPPORTED;
- pRADEONEnt->PortInfo[tmp1].TMDSType = ((tmp0 >> 4) & 0x01) ? TMDS_EXT : TMDS_INT;
+ pRADEONEnt->PortInfo[tmp1]->DDCType = (tmp0 >> 8) & 0x0f;
+ if (pRADEONEnt->PortInfo[tmp1]->DDCType > DDC_CRT2) pRADEONEnt->PortInfo[tmp1]->DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[tmp1]->DACType = (tmp0 & 0x01) ? DAC_TVDAC : DAC_PRIMARY;
+ pRADEONEnt->PortInfo[tmp1]->ConnectorType = (tmp0 >> 12) & 0x0f;
+ if (pRADEONEnt->PortInfo[tmp1]->ConnectorType > CONNECTOR_UNSUPPORTED) pRADEONEnt->PortInfo[tmp1]->ConnectorType = CONNECTOR_UNSUPPORTED;
+ pRADEONEnt->PortInfo[tmp1]->TMDSType = ((tmp0 >> 4) & 0x01) ? TMDS_EXT : TMDS_INT;
/* some sanity checks */
- if (((pRADEONEnt->PortInfo[tmp1].ConnectorType != CONNECTOR_DVI_D) &&
- (pRADEONEnt->PortInfo[tmp1].ConnectorType != CONNECTOR_DVI_I)) &&
- pRADEONEnt->PortInfo[tmp1].TMDSType == TMDS_INT)
- pRADEONEnt->PortInfo[tmp1].TMDSType = TMDS_UNKNOWN;
+ if (((pRADEONEnt->PortInfo[tmp1]->ConnectorType != CONNECTOR_DVI_D) &&
+ (pRADEONEnt->PortInfo[tmp1]->ConnectorType != CONNECTOR_DVI_I)) &&
+ pRADEONEnt->PortInfo[tmp1]->TMDSType == TMDS_INT)
+ pRADEONEnt->PortInfo[tmp1]->TMDSType = TMDS_UNKNOWN;
connector_found += (tmp1 + 1);
}
@@ -271,15 +271,15 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
we assume LVDS is not listed in the connector table,
add it in here as the first port.
*/
- if ((connector_found < 3) && (pRADEONEnt->PortInfo[tmp1].ConnectorType == CONNECTOR_CRT)) {
+ if ((connector_found < 3) && (pRADEONEnt->PortInfo[tmp1]->ConnectorType == CONNECTOR_CRT)) {
if (connector_found == 1) {
memcpy (&pRADEONEnt->PortInfo[1], &pRADEONEnt->PortInfo[0],
sizeof (pRADEONEnt->PortInfo[0]));
}
- pRADEONEnt->PortInfo[0].DACType = DAC_TVDAC;
- pRADEONEnt->PortInfo[0].TMDSType = TMDS_UNKNOWN;
- pRADEONEnt->PortInfo[0].DDCType = DDC_NONE_DETECTED;
- pRADEONEnt->PortInfo[0].ConnectorType = CONNECTOR_PROPRIETARY;
+ pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
+ pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
+ pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_PROPRIETARY;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "LVDS port is not in connector table, added in.\n");
if (connector_found == 0) connector_found = 1;
@@ -289,12 +289,12 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
if ((tmp = RADEON_BIOS16(info->ROMHeaderStart + 0x42))) {
if ((tmp0 = RADEON_BIOS16(tmp + 0x15))) {
if ((tmp1 = RADEON_BIOS8(tmp0+2) & 0x07)) {
- pRADEONEnt->PortInfo[0].DDCType = tmp1;
- if (pRADEONEnt->PortInfo[0].DDCType > DDC_CRT2) {
+ pRADEONEnt->PortInfo[0]->DDCType = tmp1;
+ if (pRADEONEnt->PortInfo[0]->DDCType > DDC_CRT2) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Unknown DDCType %d found\n",
- pRADEONEnt->PortInfo[0].DDCType);
- pRADEONEnt->PortInfo[0].DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[0]->DDCType);
+ pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED;
}
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "LCD DDC Info Table found!\n");
}
@@ -303,10 +303,10 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
} else if (connector_found == 2) {
memcpy (&pRADEONEnt->PortInfo[0], &pRADEONEnt->PortInfo[1],
sizeof (pRADEONEnt->PortInfo[0]));
- pRADEONEnt->PortInfo[1].DACType = DAC_UNKNOWN;
- pRADEONEnt->PortInfo[1].TMDSType = TMDS_UNKNOWN;
- pRADEONEnt->PortInfo[1].DDCType = DDC_NONE_DETECTED;
- pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_NONE;
+ pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
+ pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
+ pRADEONEnt->PortInfo[1]->DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_NONE;
connector_found = 1;
}
@@ -314,22 +314,22 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No connector found in Connector Info Table.\n");
} else {
xf86DrvMsg(0, X_INFO, "Connector0: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
- pRADEONEnt->PortInfo[0].DDCType, pRADEONEnt->PortInfo[0].DACType,
- pRADEONEnt->PortInfo[0].TMDSType, pRADEONEnt->PortInfo[0].ConnectorType);
+ pRADEONEnt->PortInfo[0]->DDCType, pRADEONEnt->PortInfo[0]->DACType,
+ pRADEONEnt->PortInfo[0]->TMDSType, pRADEONEnt->PortInfo[0]->ConnectorType);
}
if (connector_found == 3) {
xf86DrvMsg(0, X_INFO, "Connector1: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n",
- pRADEONEnt->PortInfo[1].DDCType, pRADEONEnt->PortInfo[1].DACType,
- pRADEONEnt->PortInfo[1].TMDSType, pRADEONEnt->PortInfo[1].ConnectorType);
+ pRADEONEnt->PortInfo[1]->DDCType, pRADEONEnt->PortInfo[1]->DACType,
+ pRADEONEnt->PortInfo[1]->TMDSType, pRADEONEnt->PortInfo[1]->ConnectorType);
}
#if 0
/* External TMDS Table, not used now */
if ((tmp0 = RADEON_BIOS16(info->ROMHeaderStart + 0x58))) {
- //pRADEONEnt->PortInfo[1].DDCType = (RADEON_BIOS8(tmp0 + 7) & 0x07);
- //pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_DVI_I;
- //pRADEONEnt->PortInfo[1].TMDSType = TMDS_EXT;
+ //pRADEONEnt->PortInfo[1]->DDCType = (RADEON_BIOS8(tmp0 + 7) & 0x07);
+ //pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_DVI_I;
+ //pRADEONEnt->PortInfo[1]->TMDSType = TMDS_EXT;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "External TMDS found.\n");
} else {
diff --git a/src/radeon_display.c b/src/radeon_display.c
index 76dfc49..bf068d6 100644
--- a/src/radeon_display.c
+++ b/src/radeon_display.c
@@ -850,7 +850,7 @@ static Bool RADEONGetLVDSInfo (ScrnInfoPtr pScrn)
tmp_mode = tmp_mode->next;
}
}
- if ((info->DotClock == 0) && !pRADEONEnt->PortInfo[0].MonInfo) {
+ if ((info->DotClock == 0) && !pRADEONEnt->PortInfo[0]->MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Panel size is not correctly detected.\n"
"Please try to use PanelSize option for correct settings.\n");
@@ -935,12 +935,12 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
* If not, we may have problem -- need to use MonitorLayout option.
*/
for (i = 0; i < 2; i++) {
- pRADEONEnt->PortInfo[i].MonType = MT_UNKNOWN;
- pRADEONEnt->PortInfo[i].MonInfo = NULL;
- pRADEONEnt->PortInfo[i].DDCType = DDC_NONE_DETECTED;
- pRADEONEnt->PortInfo[i].DACType = DAC_UNKNOWN;
- pRADEONEnt->PortInfo[i].TMDSType = TMDS_UNKNOWN;
- pRADEONEnt->PortInfo[i].ConnectorType = CONNECTOR_NONE;
+ pRADEONEnt->PortInfo[i]->MonType = MT_UNKNOWN;
+ pRADEONEnt->PortInfo[i]->MonInfo = NULL;
+ pRADEONEnt->PortInfo[i]->DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[i]->DACType = DAC_UNKNOWN;
+ pRADEONEnt->PortInfo[i]->TMDSType = TMDS_UNKNOWN;
+ pRADEONEnt->PortInfo[i]->ConnectorType = CONNECTOR_NONE;
}
pRADEONEnt->Controller[0]->IsUsed = FALSE;
pRADEONEnt->Controller[1]->IsUsed = FALSE;
@@ -948,48 +948,48 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
pRADEONEnt->Controller[1]->IsActive = FALSE;
if (!RADEONGetConnectorInfoFromBIOS(pScrn) ||
- ((pRADEONEnt->PortInfo[0].DDCType == 0) &&
- (pRADEONEnt->PortInfo[1].DDCType == 0))) {
+ ((pRADEONEnt->PortInfo[0]->DDCType == 0) &&
+ (pRADEONEnt->PortInfo[1]->DDCType == 0))) {
/* Below is the most common setting, but may not be true */
- pRADEONEnt->PortInfo[0].MonType = MT_UNKNOWN;
- pRADEONEnt->PortInfo[0].MonInfo = NULL;
- pRADEONEnt->PortInfo[0].DDCType = DDC_DVI;
- pRADEONEnt->PortInfo[0].DACType = DAC_TVDAC;
- pRADEONEnt->PortInfo[0].TMDSType = TMDS_INT;
- pRADEONEnt->PortInfo[0].ConnectorType = CONNECTOR_DVI_I;
+ pRADEONEnt->PortInfo[0]->MonType = MT_UNKNOWN;
+ pRADEONEnt->PortInfo[0]->MonInfo = NULL;
+ pRADEONEnt->PortInfo[0]->DDCType = DDC_DVI;
+ pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
+ pRADEONEnt->PortInfo[0]->TMDSType = TMDS_INT;
+ pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_DVI_I;
- pRADEONEnt->PortInfo[1].MonType = MT_UNKNOWN;
- pRADEONEnt->PortInfo[1].MonInfo = NULL;
- pRADEONEnt->PortInfo[1].DDCType = DDC_VGA;
- pRADEONEnt->PortInfo[1].DACType = DAC_PRIMARY;
- pRADEONEnt->PortInfo[1].TMDSType = TMDS_EXT;
- pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_CRT;
+ pRADEONEnt->PortInfo[1]->MonType = MT_UNKNOWN;
+ pRADEONEnt->PortInfo[1]->MonInfo = NULL;
+ pRADEONEnt->PortInfo[1]->DDCType = DDC_VGA;
+ pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
+ pRADEONEnt->PortInfo[1]->TMDSType = TMDS_EXT;
+ pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_CRT;
/* Some cards have the DDC lines swapped and we have no way to
* detect it yet (Mac cards)
*/
if (xf86ReturnOptValBool(info->Options, OPTION_REVERSE_DDC, FALSE)) {
- pRADEONEnt->PortInfo[0].DDCType = DDC_VGA;
- pRADEONEnt->PortInfo[1].DDCType = DDC_DVI;
+ pRADEONEnt->PortInfo[0]->DDCType = DDC_VGA;
+ pRADEONEnt->PortInfo[1]->DDCType = DDC_DVI;
}
}
/* always make TMDS_INT port first*/
- if (pRADEONEnt->PortInfo[1].TMDSType == TMDS_INT) {
- RADEONConnector connector;
+ if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) {
+ RADEONConnector *connector;
connector = pRADEONEnt->PortInfo[0];
pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
pRADEONEnt->PortInfo[1] = connector;
- } else if ((pRADEONEnt->PortInfo[0].TMDSType != TMDS_INT &&
- pRADEONEnt->PortInfo[1].TMDSType != TMDS_INT)) {
+ } else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT &&
+ pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) {
/* no TMDS_INT port, make primary DAC port first */
/* On my Inspiron 8600 both internal and external ports are
marked DAC_PRIMARY in BIOS. So be extra careful - only
swap when the first port is not DAC_PRIMARY */
- if ((!(pRADEONEnt->PortInfo[0].ConnectorType == CONNECTOR_PROPRIETARY)) && (pRADEONEnt->PortInfo[1].DACType == DAC_PRIMARY) &&
- (pRADEONEnt->PortInfo[0].DACType != DAC_PRIMARY)) {
- RADEONConnector connector;
+ if ((!(pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_PROPRIETARY)) && (pRADEONEnt->PortInfo[1]->DACType == DAC_PRIMARY) &&
+ (pRADEONEnt->PortInfo[0]->DACType != DAC_PRIMARY)) {
+ RADEONConnector *connector;
connector = pRADEONEnt->PortInfo[0];
pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1];
pRADEONEnt->PortInfo[1] = connector;
@@ -998,15 +998,15 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
if (info->HasSingleDAC) {
/* For RS300/RS350/RS400 chips, there is no primary DAC. Force VGA port to use TVDAC*/
- if (pRADEONEnt->PortInfo[0].ConnectorType == CONNECTOR_CRT) {
- pRADEONEnt->PortInfo[0].DACType = DAC_TVDAC;
- pRADEONEnt->PortInfo[1].DACType = DAC_PRIMARY;
+ if (pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_CRT) {
+ pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
+ pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
} else {
- pRADEONEnt->PortInfo[1].DACType = DAC_TVDAC;
- pRADEONEnt->PortInfo[0].DACType = DAC_PRIMARY;
+ pRADEONEnt->PortInfo[1]->DACType = DAC_TVDAC;
+ pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY;
}
} else if (!pRADEONEnt->HasCRTC2) {
- pRADEONEnt->PortInfo[0].DACType = DAC_PRIMARY;
+ pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY;
}
/* IgnoreEDID option is different from the NoDDCxx options used by DDC module
@@ -1084,7 +1084,7 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
{
if (strcmp(s1, MonTypeName[i]) == 0)
{
- pRADEONEnt->PortInfo[0].MonType = MonTypeID[i];
+ pRADEONEnt->PortInfo[0]->MonType = MonTypeID[i];
break;
}
}
@@ -1096,7 +1096,7 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
{
if (strcmp(s2, MonTypeName[i]) == 0)
{
- pRADEONEnt->PortInfo[1].MonType = MonTypeID[i];
+ pRADEONEnt->PortInfo[1]->MonType = MonTypeID[i];
break;
}
@@ -1112,29 +1112,29 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"MonitorLayout Option: \n\tMonitor1--Type %s, Monitor2--Type %s\n\n", s1, s2);
#if 0
- if (pRADEONEnt->PortInfo[1].MonType == MT_CRT) {
- pRADEONEnt->PortInfo[1].DACType = DAC_PRIMARY;
- pRADEONEnt->PortInfo[1].TMDSType = TMDS_UNKNOWN;
- pRADEONEnt->PortInfo[1].DDCType = DDC_VGA;
- pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_CRT;
- pRADEONEnt->PortInfo[0].DACType = DAC_TVDAC;
- pRADEONEnt->PortInfo[0].TMDSType = TMDS_UNKNOWN;
- pRADEONEnt->PortInfo[0].DDCType = DDC_NONE_DETECTED;
- pRADEONEnt->PortInfo[0].ConnectorType = pRADEONEnt->PortInfo[0].MonType+1;
- pRADEONEnt->PortInfo[0].MonInfo = NULL;
+ if (pRADEONEnt->PortInfo[1]->MonType == MT_CRT) {
+ pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY;
+ pRADEONEnt->PortInfo[1]->TMDSType = TMDS_UNKNOWN;
+ pRADEONEnt->PortInfo[1]->DDCType = DDC_VGA;
+ pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_CRT;
+ pRADEONEnt->PortInfo[0]->DACType = DAC_TVDAC;
+ pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
+ pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[0]->ConnectorType = pRADEONEnt->PortInfo[0]->MonType+1;
+ pRADEONEnt->PortInfo[0]->MonInfo = NULL;
}
#endif
/* some thinkpads and powerbooks use lvds and internal tmds
* at the same time. --AGD
*/
- if ((pRADEONEnt->PortInfo[0].MonType == MT_LCD) &&
- (pRADEONEnt->PortInfo[1].MonType == MT_DFP)) {
- pRADEONEnt->PortInfo[1].DDCType = DDC_DVI;
- pRADEONEnt->PortInfo[0].DDCType = DDC_MONID;
- pRADEONEnt->PortInfo[1].TMDSType = TMDS_INT;
- pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_DVI_I;
- pRADEONEnt->PortInfo[0].TMDSType = TMDS_UNKNOWN;
+ if ((pRADEONEnt->PortInfo[0]->MonType == MT_LCD) &&
+ (pRADEONEnt->PortInfo[1]->MonType == MT_DFP)) {
+ pRADEONEnt->PortInfo[1]->DDCType = DDC_DVI;
+ pRADEONEnt->PortInfo[0]->DDCType = DDC_MONID;
+ pRADEONEnt->PortInfo[1]->TMDSType = TMDS_INT;
+ pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_DVI_I;
+ pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN;
}
}
@@ -1163,96 +1163,96 @@ static void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn)
if ((s = xf86GetOptValString(info->Options, OPTION_MONITOR_LAYOUT))) {
if (!ignore_edid) {
- if ((pRADEONEnt->PortInfo[0].MonType > MT_NONE) &&
- (pRADEONEnt->PortInfo[0].MonType < MT_STV))
- RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[0].DDCType,
- &pRADEONEnt->PortInfo[0]);
- if ((pRADEONEnt->PortInfo[1].MonType > MT_NONE) &&
- (pRADEONEnt->PortInfo[1].MonType < MT_STV))
- RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[1].DDCType,
- &pRADEONEnt->PortInfo[1]);
+ if ((pRADEONEnt->PortInfo[0]->MonType > MT_NONE) &&
+ (pRADEONEnt->PortInfo[0]->MonType < MT_STV))
+ RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[0]->DDCType,
+ pRADEONEnt->PortInfo[0]);
+ if ((pRADEONEnt->PortInfo[1]->MonType > MT_NONE) &&
+ (pRADEONEnt->PortInfo[1]->MonType < MT_STV))
+ RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[1]->DDCType,
+ pRADEONEnt->PortInfo[1]);
}
}
else {
/* force monitor redetection */
- pRADEONEnt->PortInfo[0].MonType = MT_UNKNOWN;
- pRADEONEnt->PortInfo[1].MonType = MT_UNKNOWN;
+ pRADEONEnt->PortInfo[0]->MonType = MT_UNKNOWN;
+ pRADEONEnt->PortInfo[1]->MonType = MT_UNKNOWN;
}
- if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN || pRADEONEnt->PortInfo[1].MonType == MT_UNKNOWN) {
+ if (pRADEONEnt->PortInfo[0]->MonType == MT_UNKNOWN || pRADEONEnt->PortInfo[1]->MonType == MT_UNKNOWN) {
- if ((!pRADEONEnt->HasCRTC2) && (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN)) {
- if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_DVI,
- &pRADEONEnt->PortInfo[0])));
- else if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_VGA,
- &pRADEONEnt->PortInfo[0])));
- else if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn, DDC_CRT2,
- &pRADEONEnt->PortInfo[0])));
+ if ((!pRADEONEnt->HasCRTC2) && (pRADEONEnt->PortInfo[0]->MonType == MT_UNKNOWN)) {
+ if((pRADEONEnt->PortInfo[0]->MonType = RADEONDisplayDDCConnected(pScrn, DDC_DVI,
+ pRADEONEnt->PortInfo[0])));
+ else if((pRADEONEnt->PortInfo[0]->MonType = RADEONDisplayDDCConnected(pScrn, DDC_VGA,
+ pRADEONEnt->PortInfo[0])));
+ else if((pRADEONEnt->PortInfo[0]->MonType = RADEONDisplayDDCConnected(pScrn, DDC_CRT2,
+ pRADEONEnt->PortInfo[0])));
else
- pRADEONEnt->PortInfo[0].MonType = MT_CRT;
+ pRADEONEnt->PortInfo[0]->MonType = MT_CRT;
if (!ignore_edid) {
- if (pRADEONEnt->PortInfo[0].MonInfo) {
+ if (pRADEONEnt->PortInfo[0]->MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n");
- xf86PrintEDID(pRADEONEnt->PortInfo[0].MonInfo );
+ xf86PrintEDID(pRADEONEnt->PortInfo[0]->MonInfo );
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "End of Monitor1 EDID data --------------------\n");
}
}
- pRADEONEnt->PortInfo[1].MonType = MT_NONE;
- pRADEONEnt->PortInfo[1].MonInfo = NULL;
- pRADEONEnt->PortInfo[1].DDCType = DDC_NONE_DETECTED;
- pRADEONEnt->PortInfo[1].DACType = DAC_UNKNOWN;
- pRADEONEnt->PortInfo[1].TMDSType = TMDS_UNKNOWN;
- pRADEONEnt->PortInfo[1].ConnectorType = CONNECTOR_NONE;
+ pRADEONEnt->PortInfo[1]->MonType = MT_NONE;
+ pRADEONEnt->PortInfo[1]->MonInfo = NULL;
+ pRADEONEnt->PortInfo[1]->DDCType = DDC_NONE_DETECTED;
+ pRADEONEnt->PortInfo[1]->DACType = DAC_UNKNOWN;
+ 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;
}
/* Primary Head (DVI or Laptop Int. panel)*/
/* A ddc capable display connected on DVI port */
- if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN) {
- if((pRADEONEnt->PortInfo[0].MonType = RADEONDisplayDDCConnected(pScrn,
- pRADEONEnt->PortInfo[0].DDCType,
- &pRADEONEnt->PortInfo[0])));
+ if (pRADEONEnt->PortInfo[0]->MonType == MT_UNKNOWN) {
+ if((pRADEONEnt->PortInfo[0]->MonType = RADEONDisplayDDCConnected(pScrn,
+ pRADEONEnt->PortInfo[0]->DDCType,
+ pRADEONEnt->PortInfo[0])));
else if (info->IsMobility &&
(INREG(RADEON_BIOS_4_SCRATCH) & 4)) {
/* non-DDC laptop panel connected on primary */
- pRADEONEnt->PortInfo[0].MonType = MT_LCD;
+ pRADEONEnt->PortInfo[0]->MonType = MT_LCD;
} else {
/* CRT on DVI, TODO: not reliable, make it always return false for now*/
- pRADEONEnt->PortInfo[0].MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[0].DACType));
+ pRADEONEnt->PortInfo[0]->MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[0]->DACType));
}
}
/* Secondary Head (mostly VGA, can be DVI on some OEM boards)*/
- if (pRADEONEnt->PortInfo[1].MonType == MT_UNKNOWN) {
- if((pRADEONEnt->PortInfo[1].MonType =
- RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[1].DDCType, &pRADEONEnt->PortInfo[1])));
+ if (pRADEONEnt->PortInfo[1]->MonType == MT_UNKNOWN) {
+ if((pRADEONEnt->PortInfo[1]->MonType =
+ RADEONDisplayDDCConnected(pScrn, pRADEONEnt->PortInfo[1]->DDCType, pRADEONEnt->PortInfo[1])));
else if (info->IsMobility &&
(INREG(RADEON_FP2_GEN_CNTL) & RADEON_FP2_ON)) {
/* non-DDC TMDS panel connected through DVO */
- pRADEONEnt->PortInfo[1].MonType = MT_DFP;
+ pRADEONEnt->PortInfo[1]->MonType = MT_DFP;
} else
- pRADEONEnt->PortInfo[1].MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[1].DACType));
+ pRADEONEnt->PortInfo[1]->MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[1]->DACType));
}
}
if(ignore_edid) {
- pRADEONEnt->PortInfo[0].MonInfo = NULL;
- pRADEONEnt->PortInfo[1].MonInfo = NULL;
+ pRADEONEnt->PortInfo[0]->MonInfo = NULL;
+ pRADEONEnt->PortInfo[1]->MonInfo = NULL;
} else {
- if (pRADEONEnt->PortInfo[0].MonInfo) {
+ if (pRADEONEnt->PortInfo[0]->MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on 1st port ----------------------\n");
- xf86PrintEDID( pRADEONEnt->PortInfo[0].MonInfo );
+ xf86PrintEDID( pRADEONEnt->PortInfo[0]->MonInfo );
}
- if (pRADEONEnt->PortInfo[1].MonInfo) {
+ if (pRADEONEnt->PortInfo[1]->MonInfo) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EDID data from the display on 2nd port -----------------------\n");
- xf86PrintEDID( pRADEONEnt->PortInfo[1].MonInfo );
+ xf86PrintEDID( pRADEONEnt->PortInfo[1]->MonInfo );
}
}
@@ -1273,8 +1273,8 @@ 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",
@@ -1300,8 +1300,8 @@ Bool RADEONMapControllers(ScrnInfoPtr pScrn)
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 */
@@ -1313,8 +1313,8 @@ Bool RADEONMapControllers(ScrnInfoPtr pScrn)
(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[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");
@@ -1330,8 +1330,8 @@ 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");
}
@@ -2326,3 +2326,22 @@ Bool RADEONAllocateControllers(ScrnInfoPtr pScrn)
return TRUE;
}
+
+Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn)
+{
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+ int num_connectors;
+ int i;
+
+ if (pRADEONEnt->PortInfo[0])
+ return TRUE;
+
+ /* for now always allocate max connectors */
+ for (i = 0 ; i < RADEON_MAX_CONNECTOR; i++) {
+ pRADEONEnt->PortInfo[i] = xcalloc(sizeof(RADEONConnector), 1);
+ if (!pRADEONEnt->PortInfo[i])
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 405d96f..8b1a374 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -2821,8 +2821,14 @@ static Bool RADEONPreInitControllers(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10
{
RADEONInfoPtr info = RADEONPTR(pScrn);
- if (!info->IsSecondary)
- RADEONAllocateControllers(pScrn);
+ if (!info->IsSecondary) {
+ if (!RADEONAllocateConnectors(pScrn))
+ return FALSE;
+
+ if (!RADEONAllocateControllers(pScrn))
+ return FALSE;
+
+ }
RADEONGetBIOSInfo(pScrn, pInt10);
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 34dad61..355e935 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -121,6 +121,7 @@ typedef struct
RADEONConnector* pPort;
} RADEONController;
+#define RADEON_MAX_CONNECTOR 2
#define RADEON_MAX_CRTC 2
typedef struct
@@ -139,7 +140,7 @@ typedef struct
Bool ReversedDAC; /* TVDAC used as primary dac */
Bool ReversedTMDS; /* DDC_DVI is used for external TMDS */
- RADEONConnector PortInfo[2];
+ RADEONConnector *PortInfo[RADEON_MAX_CONNECTOR];
RADEONController *Controller[RADEON_MAX_CRTC]; /* pointer to a controller */
} RADEONEntRec, *RADEONEntPtr;