diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 064810f..7c11d82 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -672,6 +672,8 @@ i830_lvds_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, desired_ratio = (float)mode->HDisplay / (float)mode->VDisplay; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"native ratio: %f, desired ratio: %f\n", panel_ratio, desired_ratio); + /* * Enable automatic panel scaling for non-native modes so that they fill * the screen. Should be enabled before the pipe is enabled, according to @@ -747,6 +749,10 @@ i830_lvds_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, if (panel_ratio > desired_ratio) { /* Pillar */ unsigned long scaled_width = (float)mode->HDisplay * vert_scale; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"pillarbox scaling\n"); + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"scaled_width: %ld\n", scaled_width); + horiz_ratio = vert_ratio; pfit_control |= VERT_AUTO_SCALE | VERT_INTERP_BILINEAR | HORIZ_INTERP_BILINEAR; @@ -758,18 +764,39 @@ i830_lvds_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, if (mode->HDisplay & 1) /* odd resolutions */ right_border++; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"left border %d, right border %d\n", left_border, + right_border); + adjusted_mode->CrtcHDisplay = scaled_width; adjusted_mode->CrtcHBlankStart = scaled_width + 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->CrtcHSyncStart = adjusted_mode->CrtcHBlankStart + 2; + adjusted_mode->CrtcHSyncEnd = adjusted_mode->CrtcHBlankEnd - 2; + + /* Even out the timings for dual-channel configs */ + adjusted_mode->CrtcHBlankStart += adjusted_mode->CrtcHBlankStart & 1; + adjusted_mode->CrtcHBlankEnd += adjusted_mode->CrtcHBlankEnd & 1; + adjusted_mode->CrtcHSyncStart += adjusted_mode->CrtcHSyncStart & 1; + adjusted_mode->CrtcHSyncEnd += adjusted_mode->CrtcHSyncEnd & 1; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"mapping %dx%d to %dx%d\n", + mode->HDisplay, mode->VDisplay, + adjusted_mode->HDisplay, adjusted_mode->VDisplay); + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"CRTC timings: %d %d %d %d %d\n", + adjusted_mode->CrtcHDisplay, adjusted_mode->CrtcHBlankStart, + adjusted_mode->CrtcHBlankEnd, adjusted_mode->CrtcHSyncStart, + adjusted_mode->CrtcHSyncEnd); + border = 1; } else if (panel_ratio < desired_ratio) { /* Letter */ unsigned long scaled_height = (float)mode->VDisplay * horiz_scale; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"letterbox scaling\n"); + vert_ratio = horiz_ratio; pfit_control |= HORIZ_AUTO_SCALE | VERT_INTERP_BILINEAR | HORIZ_INTERP_BILINEAR; @@ -801,6 +828,8 @@ i830_lvds_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, PFIT_VERT_SCALE_MASK) | ((horiz_bits << PFIT_HORIZ_SCALE_SHIFT) & PFIT_HORIZ_SCALE_MASK)); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"pfit ratios: vertical 0x%08x, horizontal 0x%08x\n", + vert_bits, horiz_bits); } break; case FULL: