disable vga plane before doing CRT hotplug --- src/i830_crt.c | 34 ++++++++++++++++++++++++++++++++++ src/i830_display.c | 13 +++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) Index: xf86_video_intel/src/i830_crt.c =================================================================== --- xf86_video_intel.orig/src/i830_crt.c 2009-08-31 13:10:19.000000000 +0800 +++ xf86_video_intel/src/i830_crt.c 2009-09-18 13:16:21.000000000 +0800 @@ -33,6 +33,7 @@ #include "i830.h" #include "xf86Modes.h" #include "i830_display.h" +#include static void i830_crt_dpms(xf86OutputPtr output, int mode) @@ -156,6 +157,38 @@ OUTREG(ADPA, adpa); } +#define VGA_CENTER_MODE (3 << 24) +static void +disable_vga_plane (xf86OutputPtr output) +{ + ScrnInfoPtr pScrn = output->scrn; + I830Ptr pI830 = I830PTR(pScrn); + uint8_t sr01; + uint32_t vgadisable; + + vgadisable = INREG(VGACNTRL); + + vgadisable &= ~(VGA_DISP_DISABLE | VGA_CENTER_MODE | VGA_2X_MODE); + /* + * 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(300); + + OUTREG(VGACNTRL, vgadisable); + i830WaitForVblank(pScrn); + + OUTREG8(SRX, 1); + OUTREG8(SRX + 1, sr01); +} + /** * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence. @@ -176,6 +209,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)) Index: xf86_video_intel/src/i830_display.c =================================================================== --- xf86_video_intel.orig/src/i830_display.c 2009-09-15 08:53:06.000000000 +0800 +++ xf86_video_intel/src/i830_display.c 2009-09-18 13:14:36.000000000 +0800 @@ -1070,14 +1070,16 @@ return; } #endif /* DRM_IOCTL_MODESET_CTL */ - +#define VGA_CENTER_MODE (3 << 24) static void i830_disable_vga_plane (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); uint8_t sr01; + uint32_t vgadisable; + vgadisable = INREG(VGACNTRL); /* * Bug #17235: G4X machine needs following steps * for disable VGA. @@ -1086,18 +1088,17 @@ * - disable vga plane; * - restore SR01; */ - if (IS_G4X(pI830)) { - OUTREG8(SRX, 1); + vgadisable &= ~(VGA_DISP_DISABLE | VGA_2X_MODE | VGA_CENTER_MODE); + { OUTREG8(SRX, 1); sr01 = INREG8(SRX + 1); OUTREG8(SRX + 1, sr01 | (1 << 5)); usleep(30); } - OUTREG(VGACNTRL, VGA_DISP_DISABLE); + OUTREG(VGACNTRL, vgadisable); i830WaitForVblank(pScrn); - /* restore SR01 */ - if (IS_G4X(pI830)) { + /* restore SR01 */{ OUTREG8(SRX, 1); OUTREG8(SRX + 1, sr01); }