diff options
author | Alex Deucher <alex@t41p.hsd1.va.comcast.net> | 2007-05-13 11:37:35 -0400 |
---|---|---|
committer | Alex Deucher <alex@t41p.hsd1.va.comcast.net> | 2007-05-13 11:37:35 -0400 |
commit | 117220527de9fd3158f600645bcfcaf46847f45f (patch) | |
tree | 731d92c5b0a4a20a059b7e8d4659cceb40877bf9 | |
parent | 7e5c29961ac2a9e9dbe5d6d2d73d11cd018d62b5 (diff) |
RADEON: remove hardcoded output limit and PortInfo stuff
-rw-r--r-- | src/radeon.h | 4 | ||||
-rw-r--r-- | src/radeon_bios.c | 127 | ||||
-rw-r--r-- | src/radeon_display.c | 556 | ||||
-rw-r--r-- | src/radeon_driver.c | 94 | ||||
-rw-r--r-- | src/radeon_probe.h | 12 |
5 files changed, 297 insertions, 496 deletions
diff --git a/src/radeon.h b/src/radeon.h index e58747a..4f674ed 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -763,7 +763,7 @@ typedef struct { CARD32 tv_dac_adj; - int max_connectors; + RADEONBIOSConnector BiosConnector[RADEON_MAX_BIOS_CONNECTOR]; CreateScreenResourcesProcPtr CreateScreenResources; } RADEONInfoRec, *RADEONInfoPtr; @@ -844,7 +844,7 @@ extern Bool RADEONGetHardCodedEDIDFromBIOS (xf86OutputPtr output); extern void RADEONInitDispBandwidth(ScrnInfoPtr pScrn); extern Bool RADEONI2cInit(ScrnInfoPtr pScrn); extern void RADEONSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag); -extern void RADEONSetupConnectors(ScrnInfoPtr pScrn); +extern Bool RADEONSetupConnectors(ScrnInfoPtr pScrn); extern Bool RADEONMapControllers(ScrnInfoPtr pScrn); extern void RADEONEnableDisplay(ScrnInfoPtr pScrn, xf86OutputPtr pPort, BOOL bEnable); extern void RADEONDisableDisplays(ScrnInfoPtr pScrn); diff --git a/src/radeon_bios.c b/src/radeon_bios.c index 4b3ec56..6e08f24 100644 --- a/src/radeon_bios.c +++ b/src/radeon_bios.c @@ -148,49 +148,49 @@ 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; + info->BiosConnector[0].TMDSType = TMDS_INT; else if (i == 7) - pRADEONEnt->PortInfo[0]->TMDSType = TMDS_EXT; + info->BiosConnector[0].TMDSType = TMDS_EXT; - if (pRADEONEnt->PortInfo[0]->DACType == DAC_UNKNOWN) - pRADEONEnt->PortInfo[0]->DACType = (portinfo & 0xf) - 1; + if (info->BiosConnector[0].DACType == DAC_UNKNOWN) + info->BiosConnector[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; + info->BiosConnector[crtc].DACType = (portinfo & 0xf) - 1; + info->BiosConnector[crtc].ConnectorType = (portinfo>>4) & 0xf; if (i == 3) - pRADEONEnt->PortInfo[crtc]->TMDSType = TMDS_INT; + info->BiosConnector[crtc].TMDSType = TMDS_INT; else if (i == 7) - pRADEONEnt->PortInfo[crtc]->TMDSType = TMDS_EXT; + info->BiosConnector[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; + info->BiosConnector[crtc].DDCType = DDC_MONID; break; case RADEON_GPIO_DVI_DDC: - pRADEONEnt->PortInfo[crtc]->DDCType = DDC_DVI; + info->BiosConnector[crtc].DDCType = DDC_DVI; break; case RADEON_GPIO_VGA_DDC: - pRADEONEnt->PortInfo[crtc]->DDCType = DDC_VGA; + info->BiosConnector[crtc].DDCType = DDC_VGA; break; case RADEON_GPIO_CRT2_DDC: - pRADEONEnt->PortInfo[crtc]->DDCType = DDC_CRT2; + info->BiosConnector[crtc].DDCType = DDC_CRT2; break; case RADEON_LCD_GPIO_MASK: - pRADEONEnt->PortInfo[crtc]->DDCType = DDC_LCD; + info->BiosConnector[crtc].DDCType = DDC_LCD; break; default: - pRADEONEnt->PortInfo[crtc]->DDCType = DDC_NONE_DETECTED; + info->BiosConnector[crtc].DDCType = DDC_NONE_DETECTED; break; } } else { - pRADEONEnt->PortInfo[crtc]->DDCType = DDC_NONE_DETECTED; + info->BiosConnector[crtc].DDCType = DDC_NONE_DETECTED; } crtc++; } else { @@ -200,22 +200,22 @@ 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; + info->BiosConnector[j].TMDSType = TMDS_INT; else if (i == 7) - pRADEONEnt->PortInfo[j]->TMDSType = TMDS_EXT; + info->BiosConnector[j].TMDSType = TMDS_EXT; - if (pRADEONEnt->PortInfo[j]->DACType == DAC_UNKNOWN) - pRADEONEnt->PortInfo[j]->DACType = (portinfo & 0xf) - 1; + if (info->BiosConnector[j].DACType == DAC_UNKNOWN) + info->BiosConnector[j].DACType = (portinfo & 0xf) - 1; } } } } } - + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bios Connector table: \n"); 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, info->BiosConnector[i].DDCType, info->BiosConnector[i].DACType, + info->BiosConnector[i].TMDSType, info->BiosConnector[i].ConnectorType); } } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No Device Info Table found!\n"); @@ -242,25 +242,27 @@ 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 (info->BiosConnector[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; + info->BiosConnector[tmp1].DDCType = (tmp0 >> 8) & 0x0f; + if (info->BiosConnector[tmp1].DDCType > DDC_CRT2) + info->BiosConnector[tmp1].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[tmp1].DACType = (tmp0 & 0x01) ? DAC_TVDAC : DAC_PRIMARY; + info->BiosConnector[tmp1].ConnectorType = (tmp0 >> 12) & 0x0f; + if (info->BiosConnector[tmp1].ConnectorType > CONNECTOR_UNSUPPORTED) + info->BiosConnector[tmp1].ConnectorType = CONNECTOR_UNSUPPORTED; + info->BiosConnector[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 (((info->BiosConnector[tmp1].ConnectorType != CONNECTOR_DVI_D) && + (info->BiosConnector[tmp1].ConnectorType != CONNECTOR_DVI_I)) && + info->BiosConnector[tmp1].TMDSType == TMDS_INT) + info->BiosConnector[tmp1].TMDSType = TMDS_UNKNOWN; connector_found += (tmp1 + 1); } @@ -270,19 +272,20 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn) } if (info->IsMobility) { +#if 0 /* For the cases where only one VGA connector is found, 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) && (info->BiosConnector[tmp1]->ConnectorType == CONNECTOR_CRT)) { if (connector_found == 1) { - memcpy (&pRADEONEnt->PortInfo[1], &pRADEONEnt->PortInfo[0], - sizeof (pRADEONEnt->PortInfo[0])); + memcpy (&info->BiosConnector[1], &info->BiosConnector[0], + sizeof (info->BiosConnector)); } - 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; + info->BiosConnector[0].DACType = DAC_TVDAC; + info->BiosConnector[0].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[0].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[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; @@ -290,54 +293,54 @@ Bool RADEONGetConnectorInfoFromBIOS (ScrnInfoPtr pScrn) } /* some bioses seem to list the LVDS port as DVI hack around that here */ - if (pRADEONEnt->PortInfo[0]->ConnectorType == CONNECTOR_DVI_D) { - pRADEONEnt->PortInfo[0]->ConnectorType = CONNECTOR_PROPRIETARY; + if (info->BiosConnector[0].ConnectorType == CONNECTOR_DVI_D) { + info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY; } - +#endif 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_LCD) { + info->BiosConnector[0].DDCType = tmp1; + if (info->BiosConnector[0].DDCType > DDC_LCD) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unknown DDCType %d found\n", - pRADEONEnt->PortInfo[0]->DDCType); - pRADEONEnt->PortInfo[0]->DDCType = DDC_NONE_DETECTED; + info->BiosConnector[0].DDCType); + info->BiosConnector[0].DDCType = DDC_NONE_DETECTED; } xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "LCD DDC Info Table found!\n"); } } } } 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; + memcpy (&info->BiosConnector[0], &info->BiosConnector[1], + sizeof (info->BiosConnector[0])); + info->BiosConnector[1].DACType = DAC_UNKNOWN; + info->BiosConnector[1].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[1].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[1].ConnectorType = CONNECTOR_NONE; connector_found = 1; } if (connector_found == 0) { 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); + xf86DrvMsg(0, X_INFO, "Bios Connector0: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n", + info->BiosConnector[0].DDCType, info->BiosConnector[0].DACType, + info->BiosConnector[0].TMDSType, info->BiosConnector[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); + xf86DrvMsg(0, X_INFO, "Bios Connector1: DDCType-%d, DACType-%d, TMDSType-%d, ConnectorType-%d\n", + info->BiosConnector[1].DDCType, info->BiosConnector[1].DACType, + info->BiosConnector[1].TMDSType, info->BiosConnector[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; + //info->BiosConnector[1].DDCType = (RADEON_BIOS8(tmp0 + 7) & 0x07); + //info->BiosConnector[1].ConnectorType = CONNECTOR_DVI_I; + //info->BiosConnector[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 c77ff64..897db27 100644 --- a/src/radeon_display.c +++ b/src/radeon_display.c @@ -871,7 +871,7 @@ static Bool RADEONGetLVDSInfo (xf86OutputPtr output) tmp_mode = tmp_mode->next; } } - if ((radeon_output->DotClock == 0) && !pRADEONEnt->pOutput[0]->MonInfo) { + if ((radeon_output->DotClock == 0) && !output->MonInfo) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Panel size is not correctly detected.\n" "Please try to use PanelSize option for correct settings.\n"); @@ -934,283 +934,14 @@ void RADEONGetTVDacAdjInfo(xf86OutputPtr output) static void RADEONSwapOutputs(ScrnInfoPtr pScrn) { - RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - xf86OutputPtr connector; - RADEONOutputPrivatePtr conn_priv; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONBIOSConnector tmp; - connector = pRADEONEnt->pOutput[0]; - pRADEONEnt->pOutput[0] = pRADEONEnt->pOutput[1]; - pRADEONEnt->pOutput[1] = connector; + tmp = info->BiosConnector[0]; + info->BiosConnector[0] = info->BiosConnector[1]; + info->BiosConnector[1] = tmp; - conn_priv = pRADEONEnt->PortInfo[0]; - pRADEONEnt->PortInfo[0] = pRADEONEnt->PortInfo[1]; - pRADEONEnt->PortInfo[1] = conn_priv; -} -#if 0 -/* - * initialise the static data sos we don't have to re-do at randr change */ -void RADEONSetupConnectors(ScrnInfoPtr pScrn) -{ - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - xf86OutputPtr output; - const char *s; - int i = 0, second = 0, max_mt = 5; - - /* We first get the information about all connectors from BIOS. - * This is how the card is phyiscally wired up. - * The information should be correct even on a OEM card. - * If not, we may have problem -- need to use MonitorLayout option. - */ - for (i = 0; i < info->max_connectors; i++) { - pRADEONEnt->PortInfo[i]->MonType = MT_UNKNOWN; - 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; - } - - if (!RADEONGetConnectorInfoFromBIOS(pScrn) || - ((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]->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]->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; - } - } - - /* always make TMDS_INT port first*/ - if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) { - RADEONSwapOutputs(pScrn); - } 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)) { - RADEONSwapOutputs(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; - } else { - pRADEONEnt->PortInfo[1]->DACType = DAC_TVDAC; - pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY; - } - } else if (!pRADEONEnt->HasCRTC2) { - pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY; - } - - /* - * MonitorLayout option takes a string for two monitors connected in following format: - * Option "MonitorLayout" "primary-port-display, secondary-port-display" - * primary and secondary port displays can have one of following: - * NONE, CRT, LVDS, TMDS - * With this option, driver will bring up monitors as specified, - * not using auto-detection routines to probe monitors. - * - * This option can be used when the false monitor detection occurs. - * - * This option can also be used to disable one connected display. - * For example, if you have a laptop connected to an external CRT - * and you want to disable the internal LCD panel, you can specify - * Option "MonitorLayout" "NONE, CRT" - * - * This option can also used to disable Clone mode. One there is only - * one monitor is specified, clone mode will be turned off automatically - * even you have two monitors connected. - * - * Another usage of this option is you want to config the server - * to start up with a certain monitor arrangement even one monitor - * is not plugged in when server starts. - * For example, you can config your laptop with - * Option "MonitorLayout" "LVDS, CRT" - * Option "CloneHSync" "40-150" - * Option "CloneVRefresh" "60-120" - * With these options, you can connect in your CRT monitor later - * after the X server has started. - */ - if ((s = xf86GetOptValString(info->Options, OPTION_MONITOR_LAYOUT))) { - char s1[5], s2[5]; - i = 0; - /* When using user specified monitor types, we will not do DDC detection - * - */ - do { - switch(*s) { - case ',': - s1[i] = '\0'; - i = 0; - second = 1; - break; - case ' ': - case '\t': - case '\n': - case '\r': - break; - default: - if (second) - s2[i] = *s; - else - s1[i] = *s; - i++; - break; - } - if (i > 4) i = 4; - } while(*s++); - s2[i] = '\0'; - - for (i = 0; i < max_mt; i++) - { - if (strcmp(s1, MonTypeName[i]) == 0) - { - pRADEONEnt->PortInfo[0]->MonType = MonTypeID[i]; - break; - } - } - if (i == max_mt) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Invalid Monitor type specified for 1st port \n"); - - for (i = 0; i < max_mt; i++) - { - if (strcmp(s2, MonTypeName[i]) == 0) - { - pRADEONEnt->PortInfo[1]->MonType = MonTypeID[i]; - break; - } - - } - if (i == max_mt) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Invalid Monitor type specified for 2nd port \n"); - - if (i == max_mt) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Invalid Monitor type specified for 2nd port \n"); - - 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; - } -#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 1 - if (info->IsMobility) { - pRADEONEnt->PortInfo[2]->DDCType = DDC_DVI; - pRADEONEnt->PortInfo[2]->TMDSType = TMDS_INT; - pRADEONEnt->PortInfo[2]->ConnectorType = CONNECTOR_DVI_D; - pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN; - if (pRADEONEnt->PortInfo[0]->DDCType == DDC_DVI) { - pRADEONEnt->PortInfo[0]->DDCType = DDC_MONID; - } - if (pRADEONEnt->PortInfo[0]->TMDSType == TMDS_INT) { - pRADEONEnt->PortInfo[0]->TMDSType = TMDS_UNKNOWN; - } - } -#endif - - // for (i = 0; i < xf86_config->num_output; i++) { - for (i = 0 ; i < info->max_connectors; i++) { - RADEONOutputPrivatePtr radeon_output = pRADEONEnt->PortInfo[i]; - - int DDCReg = 0; - char *names[] = { "DDC1", "DDC2", "DDC3" }; - - RADEONSetOutputType(pScrn, radeon_output); - - pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]); - if (!pRADEONEnt->pOutput[i]) - return FALSE; - - pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i]; - pRADEONEnt->PortInfo[i]->num = i; - - pRADEONEnt->pOutput[i]->possible_crtcs = 1; - if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS) - pRADEONEnt->pOutput[i]->possible_crtcs |= 2; - - pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/; - - switch(radeon_output->DDCType) { - case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break; - case DDC_DVI : DDCReg = RADEON_GPIO_DVI_DDC; break; - case DDC_VGA: DDCReg = RADEON_GPIO_VGA_DDC; break; - case DDC_CRT2: DDCReg = RADEON_GPIO_CRT2_DDC; break; - default: break; - } - - if (DDCReg) { - radeon_output->DDCReg = DDCReg; - RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, names[i]); - } - - if (radeon_output->type == OUTPUT_LVDS) { - RADEONGetLVDSInfo(output); - } - - if (radeon_output->type == OUTPUT_DVI) { - RADEONGetTMDSInfo(output); - - if (i == 0) - RADEONGetHardCodedEDIDFromBIOS(output); - - /*RADEONUpdatePanelSize(output);*/ - } - - if (radeon_output->DACType == DAC_TVDAC) { - RADEONGetTVDacAdjInfo(output); - } - } } -#endif static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, xf86OutputPtr output) { @@ -1266,6 +997,7 @@ void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output) } } +#if 0 void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn) { @@ -1362,6 +1094,7 @@ void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn) return; } +#endif Bool RADEONMapControllers(ScrnInfoPtr pScrn) { @@ -2330,7 +2063,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, switch (radeon_crtc->crtc_id) { case 0: ErrorF("init crtc1\n"); - RADEONInitCrtcRegisters(pScrn, &info->ModeReg, adjusted_mode, info); + RADEONInitCrtcRegisters(crtc, &info->ModeReg, adjusted_mode, info); dot_clock = adjusted_mode->Clock / 1000.0; if (dot_clock) { ErrorF("init pll1\n"); @@ -2343,7 +2076,7 @@ radeon_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, break; case 1: ErrorF("init crtc2\n"); - RADEONInitCrtc2Registers(pScrn, &info->ModeReg, adjusted_mode, info); + RADEONInitCrtc2Registers(crtc, &info->ModeReg, adjusted_mode, info); dot_clock = adjusted_mode->Clock / 1000.0; if (dot_clock) { ErrorF("init pll2\n"); @@ -2684,6 +2417,7 @@ Bool RADEONAllocateControllers(ScrnInfoPtr pScrn) return TRUE; } +#if 0 Bool RADEONAllocatePortInfo(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -2711,6 +2445,7 @@ Bool RADEONAllocatePortInfo(ScrnInfoPtr pScrn) } return TRUE; } +#endif void RADEONSetOutputType(ScrnInfoPtr pScrn, RADEONOutputPrivatePtr radeon_output) { @@ -2747,113 +2482,133 @@ void RADEONSetOutputType(ScrnInfoPtr pScrn, RADEONOutputPrivatePtr radeon_output radeon_output->type = output; } -Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn) +void RADEONInitConnector(xf86OutputPtr output) { - RADEONInfoPtr info = RADEONPTR(pScrn); - RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - int i; + ScrnInfoPtr pScrn = output->scrn; + RADEONOutputPrivatePtr radeon_output = output->driver_private; + int DDCReg = 0; + char* name = "DDC Bus";//OutputType[radeon_output->type]; - if (pRADEONEnt->pOutput[0]) - return TRUE; + switch(radeon_output->DDCType) { + case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break; + case DDC_DVI : DDCReg = RADEON_GPIO_DVI_DDC; break; + case DDC_VGA: DDCReg = RADEON_GPIO_VGA_DDC; break; + case DDC_CRT2: DDCReg = RADEON_GPIO_CRT2_DDC; break; + default: break; + } + + if (DDCReg) { + radeon_output->DDCReg = DDCReg; + RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, name); + } - /* for now always allocate max connectors */ - for (i = 0 ; i < info->max_connectors; i++) { + if (radeon_output->type == OUTPUT_LVDS) { + RADEONGetLVDSInfo(output); + } - pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]); - if (!pRADEONEnt->pOutput[i]) - return FALSE; - - pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i]; - pRADEONEnt->PortInfo[i]->num = i; + if (radeon_output->type == OUTPUT_DVI) { + RADEONGetTMDSInfo(output); - pRADEONEnt->pOutput[i]->possible_crtcs = 1; - if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS) - pRADEONEnt->pOutput[i]->possible_crtcs |= 2; + // FIXME + /*if (i == 0) + RADEONGetHardCodedEDIDFromBIOS(output);*/ - pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/; + /*RADEONUpdatePanelSize(output);*/ + } + + if (radeon_output->DACType == DAC_TVDAC) { + RADEONGetTVDacAdjInfo(output); } - return TRUE; } /* * initialise the static data sos we don't have to re-do at randr change */ -void RADEONSetupConnectors(ScrnInfoPtr pScrn) +Bool RADEONSetupConnectors(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); xf86OutputPtr output; const char *s; int i = 0, second = 0, max_mt = 5; + /* We first get the information about all connectors from BIOS. * This is how the card is phyiscally wired up. * The information should be correct even on a OEM card. * If not, we may have problem -- need to use MonitorLayout option. */ - for (i = 0; i < info->max_connectors; i++) { - pRADEONEnt->PortInfo[i]->MonType = MT_UNKNOWN; - 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; + for (i = 0; i < RADEON_MAX_BIOS_CONNECTOR; i++) { + info->BiosConnector[i].DDCType = DDC_NONE_DETECTED; + info->BiosConnector[i].DACType = DAC_UNKNOWN; + info->BiosConnector[i].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[i].ConnectorType = CONNECTOR_NONE; } if (!RADEONGetConnectorInfoFromBIOS(pScrn) || - ((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]->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]->DDCType = DDC_VGA; - pRADEONEnt->PortInfo[1]->DACType = DAC_PRIMARY; - pRADEONEnt->PortInfo[1]->TMDSType = TMDS_EXT; - pRADEONEnt->PortInfo[1]->ConnectorType = CONNECTOR_CRT; + ((info->BiosConnector[0].DDCType == 0) && + (info->BiosConnector[1].DDCType == 0))) { + if (info->IsMobility) { + /* Below is the most common setting, but may not be true */ + info->BiosConnector[0].DDCType = DDC_LCD; + info->BiosConnector[0].DACType = DAC_UNKNOWN; + info->BiosConnector[0].TMDSType = TMDS_UNKNOWN; + info->BiosConnector[0].ConnectorType = CONNECTOR_PROPRIETARY; + + info->BiosConnector[1].DDCType = DDC_VGA; + info->BiosConnector[1].DACType = DAC_PRIMARY; + info->BiosConnector[1].TMDSType = TMDS_EXT; + info->BiosConnector[1].ConnectorType = CONNECTOR_CRT; + } else { + /* Below is the most common setting, but may not be true */ + info->BiosConnector[0].DDCType = DDC_DVI; + info->BiosConnector[0].DACType = DAC_TVDAC; + info->BiosConnector[0].TMDSType = TMDS_INT; + info->BiosConnector[0].ConnectorType = CONNECTOR_DVI_I; + info->BiosConnector[1].DDCType = DDC_VGA; + info->BiosConnector[1].DACType = DAC_PRIMARY; + info->BiosConnector[1].TMDSType = TMDS_EXT; + info->BiosConnector[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; + info->BiosConnector[0].DDCType = DDC_VGA; + info->BiosConnector[1].DDCType = DDC_DVI; } } /* always make TMDS_INT port first*/ - if (pRADEONEnt->PortInfo[1]->TMDSType == TMDS_INT) { + if (info->BiosConnector[1].TMDSType == TMDS_INT) { RADEONSwapOutputs(pScrn); - } else if ((pRADEONEnt->PortInfo[0]->TMDSType != TMDS_INT && - pRADEONEnt->PortInfo[1]->TMDSType != TMDS_INT)) { + } else if ((info->BiosConnector[0].TMDSType != TMDS_INT && + info->BiosConnector[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)) { + if ((!(info->BiosConnector[0].ConnectorType == CONNECTOR_PROPRIETARY)) && (info->BiosConnector[1].DACType == DAC_PRIMARY) && + (info->BiosConnector[0].DACType != DAC_PRIMARY)) { RADEONSwapOutputs(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 (info->BiosConnector[0].ConnectorType == CONNECTOR_CRT) { + info->BiosConnector[0].DACType = DAC_TVDAC; + info->BiosConnector[1].DACType = DAC_PRIMARY; } else { - pRADEONEnt->PortInfo[1]->DACType = DAC_TVDAC; - pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY; + info->BiosConnector[1].DACType = DAC_TVDAC; + info->BiosConnector[0].DACType = DAC_PRIMARY; } } else if (!pRADEONEnt->HasCRTC2) { - pRADEONEnt->PortInfo[0]->DACType = DAC_PRIMARY; + info->BiosConnector[0].DACType = DAC_PRIMARY; } - +#if 0 /* * MonitorLayout option takes a string for two monitors connected in following format: * Option "MonitorLayout" "primary-port-display, secondary-port-display" @@ -2971,7 +2726,6 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn) } } -#if 1 if (info->IsMobility) { pRADEONEnt->PortInfo[2]->DDCType = DDC_DVI; pRADEONEnt->PortInfo[2]->TMDSType = TMDS_INT; @@ -2986,61 +2740,117 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn) } #endif - // for (i = 0; i < xf86_config->num_output; i++) { - for (i = 0 ; i < info->max_connectors; i++) { - RADEONOutputPrivatePtr radeon_output = pRADEONEnt->PortInfo[i]; - - int DDCReg = 0; - char *names[] = { "DDC1", "DDC2", "DDC3" }; - + for (i = 0 ; i < RADEON_MAX_BIOS_CONNECTOR; i++) { + RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1); + if (!radeon_output) { + return FALSE; + } + radeon_output->MonType = MT_UNKNOWN; + radeon_output->DDCType = info->BiosConnector[i].DDCType; + radeon_output->DACType = info->BiosConnector[i].DACType; + radeon_output->TMDSType = info->BiosConnector[i].TMDSType; + radeon_output->ConnectorType = info->BiosConnector[i].ConnectorType; RADEONSetOutputType(pScrn, radeon_output); + output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]); + if (!output) { + return FALSE; + } + output->driver_private = radeon_output; + output->possible_crtcs = 1; + if (radeon_output->type != OUTPUT_LVDS) + output->possible_crtcs |= 2; - pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]); - /*if (!pRADEONEnt->pOutput[i]) - return FALSE;*/ - - pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i]; - pRADEONEnt->PortInfo[i]->num = i; + output->possible_clones = 0 /*1|2*/; - pRADEONEnt->pOutput[i]->possible_crtcs = 1; - if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS) - pRADEONEnt->pOutput[i]->possible_crtcs |= 2; + RADEONInitConnector(output); + } - pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/; + /* if it's a mobility make sure we have a LVDS port */ + if (info->IsMobility) { + if (info->IsAtomBios) { + if (info->BiosConnector[0].ConnectorType != CONNECTOR_LVDS_ATOM && + info->BiosConnector[1].ConnectorType != CONNECTOR_LVDS_ATOM) { + /* add LVDS port */ + RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1); + if (!radeon_output) { + return FALSE; + } + radeon_output->MonType = MT_UNKNOWN; + radeon_output->DDCType = DDC_LCD; + radeon_output->DACType = DAC_UNKNOWN; + radeon_output->TMDSType = TMDS_UNKNOWN; + radeon_output->ConnectorType = CONNECTOR_LVDS_ATOM; + RADEONSetOutputType(pScrn, radeon_output); + output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]); + if (!output) { + return FALSE; + } + output->driver_private = radeon_output; + output->possible_crtcs = 1; + output->possible_clones = 0 /*1|2*/; - output = pRADEONEnt->pOutput[i]; + RADEONInitConnector(output); - switch(radeon_output->DDCType) { - case DDC_MONID: DDCReg = RADEON_GPIO_MONID; break; - case DDC_DVI : DDCReg = RADEON_GPIO_DVI_DDC; break; - case DDC_VGA: DDCReg = RADEON_GPIO_VGA_DDC; break; - case DDC_CRT2: DDCReg = RADEON_GPIO_CRT2_DDC; break; - default: break; - } + } + } else { + if (info->BiosConnector[0].ConnectorType != CONNECTOR_PROPRIETARY && + info->BiosConnector[1].ConnectorType != CONNECTOR_PROPRIETARY) { + /* add LVDS port */ + RADEONOutputPrivatePtr radeon_output = xnfcalloc(sizeof(RADEONOutputPrivateRec), 1); + if (!radeon_output) { + return FALSE; + } + radeon_output->MonType = MT_UNKNOWN; + radeon_output->DDCType = DDC_LCD; + radeon_output->DACType = DAC_UNKNOWN; + radeon_output->TMDSType = TMDS_UNKNOWN; + radeon_output->ConnectorType = CONNECTOR_PROPRIETARY; + RADEONSetOutputType(pScrn, radeon_output); + output = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[radeon_output->type]); + if (!output) { + return FALSE; + } + output->driver_private = radeon_output; + output->possible_crtcs = 1; + output->possible_clones = 0 /*1|2*/; - if (DDCReg) { - radeon_output->DDCReg = DDCReg; - RADEONI2CInit(pScrn, &radeon_output->pI2CBus, DDCReg, names[i]); + RADEONInitConnector(output); + } } + } + return TRUE; +} - if (radeon_output->type == OUTPUT_LVDS) { - RADEONGetLVDSInfo(output); - } +#if 0 +Bool RADEONAllocateConnectors(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + int i; + + if (pRADEONEnt->pOutput[0]) + return TRUE; - if (radeon_output->type == OUTPUT_DVI) { - RADEONGetTMDSInfo(output); + /* for now always allocate max connectors */ + for (i = 0 ; i < info->max_connectors; i++) { - if (i == 0) - RADEONGetHardCodedEDIDFromBIOS(output); + pRADEONEnt->pOutput[i] = xf86OutputCreate(pScrn, &radeon_output_funcs, OutputType[pRADEONEnt->PortInfo[i]->type]); + if (!pRADEONEnt->pOutput[i]) + return FALSE; + + pRADEONEnt->pOutput[i]->driver_private = pRADEONEnt->PortInfo[i]; + pRADEONEnt->PortInfo[i]->num = i; - /*RADEONUpdatePanelSize(output);*/ - } + pRADEONEnt->pOutput[i]->possible_crtcs = 1; + if (pRADEONEnt->PortInfo[i]->type != OUTPUT_LVDS) + pRADEONEnt->pOutput[i]->possible_crtcs |= 2; - if (radeon_output->DACType == DAC_TVDAC) { - RADEONGetTVDacAdjInfo(output); - } + pRADEONEnt->pOutput[i]->possible_clones = 0 /*1|2*/; } + + return TRUE; } +#endif #if 0 xf86OutputPtr RADEONGetCrtcConnector(ScrnInfoPtr pScrn, int crtc_num) diff --git a/src/radeon_driver.c b/src/radeon_driver.c index d5cd60e..a261d0d 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -117,7 +117,7 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode); static void RADEONSave(ScrnInfoPtr pScrn); //static void RADEONRestore(ScrnInfoPtr pScrn); -static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +//static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void RADEONSetDynamicClock(ScrnInfoPtr pScrn, int mode); static void RADEONForceSomeClocks(ScrnInfoPtr pScrn); @@ -2528,28 +2528,20 @@ static Bool RADEONPreInitControllers(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10 if (!info->IsSecondary) { - if (!RADEONAllocatePortInfo(pScrn)) - return FALSE; - if (!RADEONAllocateControllers(pScrn)) return FALSE; } - /* if (!info->IsSecondary) { - if (!RADEONAllocateConnectors(pScrn)) - return FALSE; - }*/ - RADEONGetBIOSInfo(pScrn, pInt10); - RADEONSetupConnectors(pScrn); + if (!RADEONSetupConnectors(pScrn)) { + return FALSE; + } RADEONMapControllers(pScrn); RADEONGetClockInfo(pScrn); - /* RADEONGetPanelInfo(pScrn); - RADEONGetTVDacAdjInfo(pScrn);*/ for (i = 0; i < config->num_output; i++) { @@ -4638,21 +4630,23 @@ void RADEONChangeSurfaces(ScrnInfoPtr pScrn) RADEONSaveSurfaces(pScrn, &info->ModeReg); } +// hack, but it's going away soon void RADEONEnableOutputs(ScrnInfoPtr pScrn, int crtc_num) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcPtr crtc = pRADEONEnt->pCrtc[0]; int i; - xf86OutputPtr output; - for (i = 0; i < info->max_connectors; i++) { - if (pRADEONEnt->PortInfo[i]->crtc_num == crtc_num) { - output = pRADEONEnt->pOutput[i]; - RADEONEnableDisplay(pScrn, output, TRUE); - } + /* get the output connected to this CRTC */ + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + if (output->crtc == crtc) { + RADEONEnableDisplay(pScrn, output, TRUE); + } } - } /* Write out state to define a new video mode */ @@ -4702,7 +4696,7 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) RADEONRestorePLL2Registers(pScrn, restore); RADEONRestoreFPRegisters(pScrn, restore); RADEONRestoreDACRegisters(pScrn, restore); - RADEONEnableOuputs(pScrn, 2); + RADEONEnableOutputs(pScrn, 2); } else { RADEONRestoreMemMapRegisters(pScrn, restore); RADEONRestoreCommonRegisters(pScrn, restore); @@ -4715,9 +4709,9 @@ void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore) RADEONRestorePLLRegisters(pScrn, restore); RADEONRestoreFPRegisters(pScrn, restore); RADEONRestoreDACRegisters(pScrn, restore); - RADEONEnableOuputs(pScrn, 1); + RADEONEnableOutputs(pScrn, 1); if (pCRTC2->binding == 1) { - RADEONEnableOuputs(pScrn, 2); + RADEONEnableOutputs(pScrn, 2); } } } else { @@ -5454,15 +5448,18 @@ static void RADEONInitOutputRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, Dis } /* Define CRTC registers for requested video mode */ -Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, +Bool RADEONInitCrtcRegisters(xf86CrtcPtr crtc, RADEONSavePtr save, DisplayModePtr mode, RADEONInfoPtr info) { + ScrnInfoPtr pScrn = crtc->scrn; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); int format; int hsync_start; int hsync_wid; int vsync_wid; int i; - RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); switch (info->CurrentLayout.pixel_code) { @@ -5599,19 +5596,12 @@ Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, } /* get the output connected to this CRTC */ - for (i = 0; i < info->max_connectors; i++) { - if (pRADEONEnt->PortInfo[i]->crtc_num == 1) { - ErrorF("init output for crtc1\n"); - RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[i], 1); - } - } -#if 0 - if (pRADEONEnt->PortInfo[0]->crtc_num == 1) { - RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[0], 1); - } else if (pRADEONEnt->PortInfo[1]->crtc_num == 1) { - RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[1], 1); + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + if (output->crtc == crtc) { + RADEONInitOutputRegisters(pScrn, save, mode, output, 1); + } } -#endif if (info->IsDellServer) { save->dac2_cntl = info->SavedReg.dac2_cntl; @@ -5634,19 +5624,18 @@ Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save, } /* Define CRTC2 registers for requested video mode */ -Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, +Bool RADEONInitCrtc2Registers(xf86CrtcPtr crtc, RADEONSavePtr save, DisplayModePtr mode, RADEONInfoPtr info) { + ScrnInfoPtr pScrn = crtc->scrn; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); int format; int hsync_start; int hsync_wid; int vsync_wid; int i; - RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); - RADEONInfoPtr info0 = NULL; - - if (info->IsSecondary) - info0 = RADEONPTR(pRADEONEnt->pPrimaryScrn); switch (info->CurrentLayout.pixel_code) { case 4: format = 1; break; @@ -5739,19 +5728,12 @@ Bool RADEONInitCrtc2Registers(ScrnInfoPtr pScrn, RADEONSavePtr save, save->fp_v2_sync_strt_wid = save->crtc2_v_sync_strt_wid; /* get the output connected to this CRTC */ - for (i = 0; i < info->max_connectors; i++) { - if (pRADEONEnt->PortInfo[i]->crtc_num == 2) { - ErrorF("init output for crtc2\n"); - RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[i], 2); - } - } -#if 0 - if (pRADEONEnt->PortInfo[0]->crtc_num == 2) { - RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[0], 2); - } else if (pRADEONEnt->PortInfo[1]->crtc_num == 2) { - RADEONInitOutputRegisters(pScrn, save, mode, pRADEONEnt->pOutput[1], 2); + for (i = 0; i < xf86_config->num_output; i++) { + xf86OutputPtr output = xf86_config->output[i]; + if (output->crtc == crtc) { + RADEONInitOutputRegisters(pScrn, save, mode, output, 2); + } } -#endif /* We must set SURFACE_CNTL properly on the second screen too */ save->surface_cntl = 0; @@ -5925,6 +5907,7 @@ static void RADEONInitPalette(RADEONSavePtr save) } #endif +#if 0 /* Define registers for a requested video mode */ Bool RADEONInit2(ScrnInfoPtr pScrn, DisplayModePtr crtc1, DisplayModePtr crtc2, int crtc_mask, @@ -6095,6 +6078,7 @@ static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) return TRUE; } +#endif static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) { @@ -6177,7 +6161,7 @@ Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) RADEONRestoreFBDevRegisters(pScrn, &info->ModeReg); } else { info->IsSwitching = TRUE; - ret = RADEONModeInit(xf86Screens[scrnIndex], mode); + ret = TRUE; //RADEONModeInit(xf86Screens[scrnIndex], mode); info->IsSwitching = FALSE; } diff --git a/src/radeon_probe.h b/src/radeon_probe.h index 9a4a52d..3e18b05 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -132,6 +132,13 @@ typedef struct _RADEONCrtcPrivateRec { Bool UseBiosDividers; } RADEONCrtcPrivateRec, *RADEONCrtcPrivatePtr; +typedef struct { + RADEONDDCType DDCType; + RADEONDacType DACType; + RADEONTmdsType TMDSType; + RADEONConnectorType ConnectorType; +} RADEONBIOSConnector; + typedef struct _RADEONOutputPrivateRec { int num; RADEONOutputType type; @@ -160,8 +167,8 @@ typedef struct _RADEONOutputPrivateRec { RADEONTMDSPll tmds_pll[4]; } RADEONOutputPrivateRec, *RADEONOutputPrivatePtr; -#define RADEON_MAX_CONNECTOR 3 /* actually 4: DVI/VGA, DVI on docks, TV, LVDS */ #define RADEON_MAX_CRTC 2 +#define RADEON_MAX_BIOS_CONNECTOR 2 typedef struct { @@ -179,9 +186,6 @@ typedef struct Bool ReversedDAC; /* TVDAC used as primary dac */ Bool ReversedTMDS; /* DDC_DVI is used for external TMDS */ - xf86OutputPtr pOutput[RADEON_MAX_CONNECTOR]; - RADEONOutputPrivatePtr PortInfo[RADEON_MAX_CONNECTOR]; - xf86CrtcPtr pCrtc[RADEON_MAX_CRTC]; RADEONCrtcPrivatePtr Controller[RADEON_MAX_CRTC]; |