diff options
author | Dave Airlie <airlied@linux.ie> | 2006-12-03 15:56:38 +1100 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-12-03 15:56:38 +1100 |
commit | 9cfa82e1670ad85746926995972a535ddf03ee07 (patch) | |
tree | 09bda5774b67c8127038fc6d2860aa79f6927a71 | |
parent | 032a00d155ecdcdcab3ca0d047f552fe6b338a97 (diff) |
move monitor detection into single function
-rw-r--r-- | src/radeon_display.c | 136 |
1 files changed, 78 insertions, 58 deletions
diff --git a/src/radeon_display.c b/src/radeon_display.c index ec585c1..a248428 100644 --- a/src/radeon_display.c +++ b/src/radeon_display.c @@ -1140,6 +1140,50 @@ void RADEONSetupConnectors(ScrnInfoPtr pScrn) } } +static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, int connector) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + if (info->IsMobility) { + switch(connector) { + case 0: + /* non-DDC laptop panel connected on primary */ + if (INREG(RADEON_BIOS_4_SCRATCH) & 4) + return MT_LCD; + break; + case 1: + /* non-DDC TMDS panel connected through DVO */ + if (INREG(RADEON_FP2_GEN_CNTL) & RADEON_FP2_ON) + return MT_DFP; + break; + default: + break; + } + } + return MT_NONE; +} + +/* Primary Head (DVI or Laptop Int. panel)*/ +/* A ddc capable display connected on DVI port */ +/* Secondary Head (mostly VGA, can be DVI on some OEM boards)*/ +void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, int connector) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + RADEONConnector *pPort = pRADEONEnt->PortInfo[connector]; + + if (pPort->MonType == MT_UNKNOWN) { + if ((pPort->MonType = RADEONDisplayDDCConnected(pScrn, + pPort->DDCType, + pPort))); + else if((pPort->MonType = RADEONPortCheckNonDDC(pScrn, connector))); + else + pPort->MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pPort->DACType)); + } +} + static void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn) { @@ -1179,68 +1223,44 @@ static void RADEONQueryConnectedDisplays(ScrnInfoPtr pScrn) 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]))); - else - pRADEONEnt->PortInfo[0]->MonType = MT_CRT; - - if (!ignore_edid) { - if (pRADEONEnt->PortInfo[0]->MonInfo) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n"); - 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[0]->crtc_num = 1; - pRADEONEnt->PortInfo[1]->crtc_num = 2; - - 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]))); - else if (info->IsMobility && - (INREG(RADEON_BIOS_4_SCRATCH) & 4)) { - /* non-DDC laptop panel connected on primary */ - 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)); - } - } - - /* 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]))); - 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; - } else - pRADEONEnt->PortInfo[1]->MonType = RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[1]->DACType)); + 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; + + if (!ignore_edid) { + if (pRADEONEnt->PortInfo[0]->MonInfo) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor1 EDID data ---------------------------\n"); + 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[0]->crtc_num = 1; + pRADEONEnt->PortInfo[1]->crtc_num = 2; + + return; } + + RADEONConnectorFindMonitor(pScrn, 0); + RADEONConnectorFindMonitor(pScrn, 1); + + } if(ignore_edid) { pRADEONEnt->PortInfo[0]->MonInfo = NULL; |