------- radeon_driver.c ------- --- /tmp/geta20059 Thu Jun 8 22:09:43 2006 +++ /tmp/getb20059 Thu Jun 8 22:09:43 2006 @@ -132,7 +132,10 @@ static void RADEONUpdatePanelSize(ScrnInfoPtr pScrn); static void RADEONSaveMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); +static xf86MonPtr RADEONProbeDDC(ScrnInfoPtr pScrn, int indx); +static RADEONMonitorType RADEONCrtIsPhysicallyConnected(ScrnInfoPtr pScrn, int IsCrtDac); + /* psuedo xinerama support */ extern Bool RADEONnoPanoramiXExtension; @@ -999,6 +1002,7 @@ return (n + (d / 2)) / d; } + static RADEONMonitorType RADEONDisplayDDCConnected(ScrnInfoPtr pScrn, RADEONDDCType DDCType, RADEONConnector* port) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1007,6 +1011,8 @@ RADEONMonitorType MonType = MT_NONE; xf86MonPtr* MonInfo = &port->MonInfo; int i, j; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + int vbeProbe = FALSE;; DDCReg = info->DDCReg; switch(DDCType) @@ -1025,7 +1031,10 @@ break; default: info->DDCReg = DDCReg; + /* Do not return, can still try to get monitor type */ + /* return MT_NONE; + */ } /* Read and output monitor info using DDC2 over I2C bus */ @@ -1091,6 +1100,17 @@ OUTREG(info->DDCReg, INREG(info->DDCReg) & ~(RADEON_GPIO_EN_0 | RADEON_GPIO_EN_1)); + if ((!*MonInfo) && ((port == &pRADEONEnt->PortInfo[0]) || + (RADEONCrtIsPhysicallyConnected(pScrn, !(pRADEONEnt->PortInfo[1].DACType)) + == MT_CRT))) { + int entityIndex = pScrn->entityList[0]; + + usleep(15000); + vbeProbe = TRUE; + if (xf86LoadSubModule(pScrn, "vbe")) + *MonInfo = RADEONProbeDDC(pScrn, entityIndex); + } + if (*MonInfo) { if ((*MonInfo)->rawData[0x14] & 0x80) { /* Note some laptops have a DVI output that uses internal TMDS, @@ -1100,14 +1120,28 @@ * Also for laptop, when X starts with lid closed (no DVI connection) * both LDVS and TMDS are disable, we still need to treat it as a LVDS panel. */ - if (port->TMDSType == TMDS_EXT) MonType = MT_DFP; - else { - if ((INREG(RADEON_FP_GEN_CNTL) & (1<<7)) || !info->IsMobility) - MonType = MT_DFP; - else - MonType = MT_LCD; + if (vbeProbe && + (RADEONCrtIsPhysicallyConnected(pScrn, !(port->DACType)) == MT_CRT)) { + MonType = MT_NONE; + *MonInfo = NULL; + } else { + if (port->TMDSType == TMDS_EXT) MonType = MT_DFP; + else { + if ((INREG(RADEON_FP_GEN_CNTL) & (1<<7)) || !info->IsMobility) + MonType = MT_DFP; + else + MonType = MT_LCD; + } } - } else MonType = MT_CRT; + } else { + if (vbeProbe && (port == &pRADEONEnt->PortInfo[0]) && + (RADEONCrtIsPhysicallyConnected(pScrn, + !(pRADEONEnt->PortInfo[1].DACType)) == MT_CRT)) { + MonType = MT_NONE; + *MonInfo = NULL; + } else + MonType = MT_CRT; + } } else MonType = MT_NONE; info->DDCReg = DDCReg; @@ -1165,6 +1199,10 @@ OUTREG(RADEON_DAC_EXT_CNTL, ulData); ulOrigDAC_CNTL = INREG(RADEON_DAC_CNTL); + if (ulOrigDAC_CNTL & RADEON_DAC_PDWN) + /* Powered down */ + return (MT_NONE); + ulData = ulOrigDAC_CNTL; ulData |= RADEON_DAC_CMP_EN; ulData &= ~(RADEON_DAC_RANGE_CNTL_MASK @@ -1745,7 +1783,7 @@ * 18 is an empirical value based on the databook and Windows driver. */ pll->max_pll_freq = min(pll->max_pll_freq, - 18 * info->mclk * 100 / pScrn->bitsPerPixel * + 24 * info->mclk * 100 / pScrn->bitsPerPixel * info->RamWidth / 16); } @@ -1879,7 +1917,9 @@ pRADEONEnt->PortInfo[i].ConnectorType = CONNECTOR_NONE; } - if (!RADEONGetConnectorInfoFromBIOS(pScrn)) { + if (!RADEONGetConnectorInfoFromBIOS(pScrn) || + ((pRADEONEnt->PortInfo[0].DDCType == 0) && + (pRADEONEnt->PortInfo[0].DDCType == 0))) { /* Below is the most common setting, but may not be true */ pRADEONEnt->PortInfo[0].MonType = MT_UNKNOWN; pRADEONEnt->PortInfo[0].MonInfo = NULL; @@ -2046,7 +2086,7 @@ &pRADEONEnt->PortInfo[1]); } - } + } if(((!info->HasCRTC2) || info->IsDellServer)) { if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN) { @@ -2085,8 +2125,8 @@ return TRUE; } - 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) { /* Primary Head (DVI or Laptop Int. panel)*/ /* A ddc capable display connected on DVI port */ if (pRADEONEnt->PortInfo[0].MonType == MT_UNKNOWN) { @@ -4871,14 +4911,16 @@ return TRUE; } -static void +static xf86MonPtr RADEONProbeDDC(ScrnInfoPtr pScrn, int indx) { vbeInfoPtr pVbe; + xf86MonPtr monitor; if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,indx); - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + monitor = vbeDoEDID(pVbe, NULL); + return (monitor); } } @@ -4971,7 +5013,7 @@ } if (flags & PROBE_DETECT) { - RADEONProbeDDC(pScrn, info->pEnt->index); + ConfiguredMonitor = RADEONProbeDDC(pScrn, info->pEnt->index); RADEONPostInt10Check(pScrn, int10_save); if(info->MMIO) RADEONUnmapMMIO(pScrn); return TRUE;