disable vga plane before doing CRT hotplug --- src/i830_crt.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) Index: xf86_video_intel/src/i830_crt.c =================================================================== --- xf86_video_intel.orig/src/i830_crt.c 2009-08-25 17:20:07.000000000 +0800 +++ xf86_video_intel/src/i830_crt.c 2009-08-31 11:23:59.000000000 +0800 @@ -156,6 +156,38 @@ OUTREG(ADPA, adpa); } +static void +disable_vga_plane (xf86OutputPtr output) +{ + ScrnInfoPtr pScrn = output->scrn; + I830Ptr pI830 = I830PTR(pScrn); + uint8_t sr01; + uint32_t vgadisable; + + vgadisable = INREG(VGACNTRL); + if (vgadisable & VGA_DISP_DISABLE) + return; + + /* + * Bug #17235: G4X machine needs following steps + * for disable VGA. + * - set bit 5 of SR01; + * - Wait 30us; + * - disable vga plane; + * - restore SR01; + */ + OUTREG8(SRX, 1); + sr01 = INREG8(SRX + 1); + OUTREG8(SRX + 1, sr01 | (1 << 5)); + usleep(30); + + OUTREG(VGACNTRL, VGA_DISP_DISABLE); + i830WaitForVblank(pScrn); + + OUTREG8(SRX, 1); + OUTREG8(SRX + 1, sr01); +} + /** * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence. @@ -176,6 +208,7 @@ int tries = 1; int try; + disable_vga_plane(output); /* On 4 series desktop, CRT detect sequence need to be done twice * to get a reliable result. */ if (IS_G4X(pI830) && !IS_GM45(pI830))