Clean up i830_crt_detect_load() a bit more.

ADPA might not have been set right in some cases (DPMS-off monitor, for
example), and a wait for vsync that the bios does was missing.
This commit is contained in:
Eric Anholt 2006-11-08 19:53:31 -08:00
parent 9b267014b5
commit ff77e9d84f
1 changed files with 13 additions and 11 deletions

View File

@ -170,7 +170,7 @@ static Bool
i830_crt_detect_load(ScrnInfoPtr pScrn, I830OutputPtr output)
{
I830Ptr pI830 = I830PTR(pScrn);
CARD32 adpa, pipeconf, bclrpat;
CARD32 save_adpa, adpa, pipeconf, bclrpat;
CARD8 st00;
int pipeconf_reg, bclrpat_reg, dpll_reg;
int pipe;
@ -186,17 +186,17 @@ i830_crt_detect_load(ScrnInfoPtr pScrn, I830OutputPtr output)
dpll_reg = DPLL_B;
}
/* Don't try this if the DPLL isn't running. */
if (!(INREG(dpll_reg) & DPLL_VCO_ENABLE))
return FALSE;
adpa = INREG(ADPA);
save_adpa = adpa;
/* Enable CRT output if disabled. */
if (!(adpa & ADPA_DAC_ENABLE)) {
OUTREG(ADPA, adpa | ADPA_DAC_ENABLE |
((pipe == 1) ? ADPA_PIPE_B_SELECT : 0));
}
/* Enable CRT output. */
adpa |= ADPA_DAC_ENABLE;
if (pipe == 1)
adpa |= ADPA_PIPE_B_SELECT;
else
adpa &= ~ADPA_PIPE_B_SELECT;
adpa |= ADPA_VSYNC_CNTL_ENABLE | ADPA_HSYNC_CNTL_ENABLE;
OUTREG(ADPA, adpa);
/* Set the border color to purple. Maybe we should save/restore this
* reg.
@ -204,6 +204,8 @@ i830_crt_detect_load(ScrnInfoPtr pScrn, I830OutputPtr output)
bclrpat = INREG(bclrpat_reg);
OUTREG(bclrpat_reg, 0x00500050);
i830WaitForVblank(pScrn);
/* Force the border color through the active region */
pipeconf = INREG(pipeconf_reg);
OUTREG(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
@ -214,7 +216,7 @@ i830_crt_detect_load(ScrnInfoPtr pScrn, I830OutputPtr output)
/* Restore previous settings */
OUTREG(bclrpat_reg, bclrpat);
OUTREG(pipeconf_reg, pipeconf);
OUTREG(ADPA, adpa);
OUTREG(ADPA, save_adpa);
if (st00 & (1 << 4))
return TRUE;