summaryrefslogtreecommitdiff
path: root/src/i830_crt.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-11-08 19:53:31 -0800
committerEric Anholt <eric@anholt.net>2006-11-08 19:53:31 -0800
commitff77e9d84f2037b99a8e4ac55da0b0ac92ed6b9b (patch)
tree59197ec3f35fff12d58c4d5ddb867b75223220e0 /src/i830_crt.c
parent9b267014b55f49d9362c1d432d6ba19ddd0ad95d (diff)
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.
Diffstat (limited to 'src/i830_crt.c')
-rw-r--r--src/i830_crt.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/i830_crt.c b/src/i830_crt.c
index 9287a205..68006f99 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -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;