--- src/i830_lvds.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) Index: xf86_video_intel/src/i830_lvds.c =================================================================== --- xf86_video_intel.orig/src/i830_lvds.c 2009-06-10 16:07:42.000000000 +0800 +++ xf86_video_intel/src/i830_lvds.c 2009-06-10 17:31:55.000000000 +0800 @@ -608,6 +608,8 @@ int left_border = 0, right_border = 0, top_border = 0, bottom_border = 0; int i; Bool border = 0; + uint32_t hsync_width, vsync_width, hblank_width, vblank_width; + uint32_t hsync_pos, vsync_pos; for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr other_output = xf86_config->output[i]; @@ -645,6 +647,8 @@ adjusted_mode->VTotal = pI830->lvds_fixed_mode->VTotal; adjusted_mode->Clock = pI830->lvds_fixed_mode->Clock; xf86SetModeCrtc(adjusted_mode, INTERLACE_HALVE_V); + hsync_width = adjusted_mode->HSyncEnd - adjusted_mode->HSyncStart; + vsync_width = adjusted_mode->VSyncEnd - adjusted_mode->VSyncStart; /* Make sure pre-965s set dither correctly */ if (!IS_I965G(pI830) && pI830->lvds_dither) @@ -703,14 +707,32 @@ adjusted_mode->CrtcHBlankStart = mode->HDisplay + right_border - 1; adjusted_mode->CrtcHBlankEnd = adjusted_mode->CrtcHTotal - left_border - 1; - adjusted_mode->CrtcHSyncStart = adjusted_mode->CrtcHBlankStart; - adjusted_mode->CrtcHSyncEnd = adjusted_mode->CrtcHBlankEnd; + adjusted_mode->CrtcHBlankEnd += 1; + adjusted_mode->CrtcHBlankEnd &= ~(0x02); + adjusted_mode->CrtcHBlankStart &= ~(0x02); + /* make the hblank start/end be a multiple of two */ + hblank_width = adjusted_mode->CrtcHBlankEnd - adjusted_mode->CrtcHBlankStart; + hsync_pos = (hblank_width - hsync_width ) / 2; + if (hsync_pos % 2) + hsync_pos++; + adjusted_mode->CrtcHSyncStart = adjusted_mode->CrtcHBlankStart + hsync_pos; + adjusted_mode->CrtcHSyncEnd = adjusted_mode->CrtcHSyncStart + hsync_width; + /* Don't change the hsync width */ adjusted_mode->CrtcVDisplay = mode->VDisplay; adjusted_mode->CrtcVBlankStart = mode->VDisplay + bottom_border - 1; adjusted_mode->CrtcVBlankEnd = adjusted_mode->CrtcVTotal - top_border - 1; - adjusted_mode->CrtcVSyncStart = adjusted_mode->CrtcVBlankStart; - adjusted_mode->CrtcVSyncEnd = adjusted_mode->CrtcVBlankEnd; + adjusted_mode->CrtcVBlankEnd += 1; + adjusted_mode->CrtcVBlankEnd &= ~(0x02); + adjusted_mode->CrtcVBlankStart &= ~(0x02); + /* make the vblank start/end be a multiple of two */ + vblank_width = adjusted_mode->CrtcVBlankEnd - adjusted_mode->CrtcVBlankStart; + vsync_pos = (vblank_width - vsync_width ) / 2; + if (vsync_pos % 2) + vsync_pos++; + adjusted_mode->CrtcVSyncStart = adjusted_mode->CrtcVBlankStart + vsync_pos; + adjusted_mode->CrtcVSyncEnd = adjusted_mode->CrtcVSyncStart + vsync_width; + /* Don't change the vsync width */ border = 1; break; case FULL_ASPECT: @@ -763,8 +785,17 @@ right_border - 1; adjusted_mode->CrtcHBlankEnd = adjusted_mode->CrtcHTotal - left_border - 1; - adjusted_mode->CrtcHSyncStart = adjusted_mode->CrtcHBlankStart; - adjusted_mode->CrtcHSyncEnd = adjusted_mode->CrtcHBlankEnd; + adjusted_mode->CrtcHBlankEnd = (adjusted_mode->CrtcHBlankEnd + 1) + & ~(0x02); + adjusted_mode->CrtcHBlankStart &= ~(0x02); + /* make the hblank start/end be a multiple of two */ + hblank_width = adjusted_mode->CrtcHBlankEnd - adjusted_mode->CrtcHBlankStart; + hsync_pos = (hblank_width - hsync_width ) / 2; + if (hsync_pos % 2) + hsync_pos++; + adjusted_mode->CrtcHSyncStart = adjusted_mode->CrtcHBlankStart + hsync_pos; + adjusted_mode->CrtcHSyncEnd = adjusted_mode->CrtcHSyncStart + hsync_width; + /* don't change the Hsync width*/ border = 1; } else if (panel_ratio < desired_ratio) { /* Letter */ unsigned long scaled_height = (float)mode->VDisplay * @@ -786,8 +817,17 @@ bottom_border - 1; adjusted_mode->CrtcVBlankEnd = adjusted_mode->CrtcVTotal - top_border - 1; - adjusted_mode->CrtcVSyncStart = adjusted_mode->CrtcVBlankStart; - adjusted_mode->CrtcVSyncEnd = adjusted_mode->CrtcVBlankEnd; + adjusted_mode->CrtcVBlankEnd = (adjusted_mode->CrtcVBlankEnd + 1) & + ~(0x02); + adjusted_mode->CrtcVBlankStart &= ~(0x02); + /* make the vblank start/end be a multiple of two */ + vblank_width = adjusted_mode->CrtcVBlankEnd - adjusted_mode->CrtcVBlankStart; + vsync_pos = (vblank_width - vsync_width ) / 2; + if (vsync_pos % 2) + vsync_pos++; + adjusted_mode->CrtcVSyncStart = adjusted_mode->CrtcVBlankStart + vsync_pos; + adjusted_mode->CrtcVSyncEnd = adjusted_mode->CrtcVSyncStart + vsync_width; + /* don't change the Vsync width */ border = 1; } else { /* Aspects match, let hw scale both directions */ pfit_control |= VERT_AUTO_SCALE | HORIZ_AUTO_SCALE |