# # Updated but not checked in: # (will commit) # # modified: src/radeon_driver.c # diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 54a868a..2484a32 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -136,6 +136,8 @@ static void RADEONSetDynamicClock(ScrnIn 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 index); +static RADEONMonitorType RADEONCrtIsPhysicallyConnected(ScrnInfoPtr pScrn, int IsCrtDac); /* psuedo xinerama support */ @@ -1014,6 +1016,10 @@ static RADEONMonitorType RADEONDisplayDD RADEONMonitorType MonType = MT_NONE; xf86MonPtr* MonInfo = &port->MonInfo; int i, j; + RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + int vbeProbe = FALSE; + + DDCReg = info->DDCReg; switch(DDCType) @@ -1032,7 +1038,10 @@ static RADEONMonitorType RADEONDisplayDD 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 */ @@ -1098,6 +1107,17 @@ static RADEONMonitorType RADEONDisplayDD 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, @@ -1107,14 +1127,28 @@ static RADEONMonitorType RADEONDisplayDD * 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; @@ -1123,14 +1157,15 @@ static RADEONMonitorType RADEONDisplayDD "DDC Type: %d, Detected Type: %d\n", DDCType, MonType); return MonType; + } static RADEONMonitorType RADEONCrtIsPhysicallyConnected(ScrnInfoPtr pScrn, int IsCrtDac) { - RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int bConnected = 0; + int bConnected = 0; /* the monitor either wasn't connected or it is a non-DDC CRT. * try to probe it @@ -1172,6 +1207,11 @@ RADEONCrtIsPhysicallyConnected(ScrnInfoP 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 @@ -1752,7 +1792,7 @@ static void RADEONGetClockInfo(ScrnInfoP * 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); } @@ -1886,7 +1926,9 @@ static BOOL RADEONQueryConnectedMonitors 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; @@ -4804,14 +4846,16 @@ static Bool RADEONPreInitXv(ScrnInfoPtr return TRUE; } -static void -RADEONProbeDDC(ScrnInfoPtr pScrn, int indx) +static xf86MonPtr +RADEONProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; + xf86MonPtr monitor; if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(NULL,indx); - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + pVbe = VBEInit(NULL, index); + monitor = vbeDoEDID(pVbe, NULL); + return monitor; } } @@ -4905,7 +4949,7 @@ #endif } 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;