[Intel-gfx] [PATCH 2/2]fix up all sdvo lvds mode.

Ma Ling ling.ma at intel.com
Fri Mar 13 07:16:13 CET 2009


based on sdvo lvds fixed mode adjust incoming mode.

Signed-off-by: Ma Ling <ling.ma at intel.com>
---
 src/i830_sdvo.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 700301a..21ef750 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -994,6 +994,51 @@ i830_sdvo_set_tv_format(xf86OutputPtr output)
     }
 }
 
+static void i830_sdvo_lvds_fixup(xf86OutputPtr output,
+                                 DisplayModePtr adjusted_mode,
+                                 DisplayModePtr mode)
+{
+    I830Ptr pI830 = I830PTR(output->scrn);
+    int left_border = 0, right_border = 0,
+        top_border = 0, bottom_border = 0;
+
+    adjusted_mode->HDisplay = pI830->lvds_fixed_mode->HDisplay;
+    adjusted_mode->HSyncStart = pI830->lvds_fixed_mode->HSyncStart;
+    adjusted_mode->HSyncEnd = pI830->lvds_fixed_mode->HSyncEnd;
+    adjusted_mode->HTotal = pI830->lvds_fixed_mode->HTotal;
+    adjusted_mode->VDisplay = pI830->lvds_fixed_mode->VDisplay;
+    adjusted_mode->VSyncStart = pI830->lvds_fixed_mode->VSyncStart;
+    adjusted_mode->VSyncEnd = pI830->lvds_fixed_mode->VSyncEnd;
+    adjusted_mode->VTotal = pI830->lvds_fixed_mode->VTotal;
+    adjusted_mode->Clock = pI830->lvds_fixed_mode->Clock;
+    adjusted_mode->Clock *=
+        i830_sdvo_get_pixel_multiplier(pI830->lvds_fixed_mode);
+    xf86SetModeCrtc(adjusted_mode, INTERLACE_HALVE_V);
+
+    /* Currently only support fitting mode as Center */
+    left_border = (adjusted_mode->HDisplay - mode->HDisplay) / 2;
+    right_border = left_border;
+    if (mode->HDisplay & 1)
+        right_border++;
+    top_border = (adjusted_mode->VDisplay - mode->VDisplay) / 2;
+    bottom_border = top_border;
+    if (mode->VDisplay & 1)
+        bottom_border++;
+
+    adjusted_mode->CrtcHDisplay = mode->HDisplay;
+    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->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;
+}
+
 static Bool
 i830_sdvo_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
 		     DisplayModePtr adjusted_mode)
@@ -1001,11 +1046,16 @@ i830_sdvo_mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
     I830OutputPrivatePtr    intel_output = output->driver_private;
     struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
 
-    if (!dev_priv->is_tv) {
+    if (!dev_priv->is_tv && !dev_priv->is_lvds) {
 	/* Make the CRTC code factor in the SDVO pixel multiplier.  The SDVO
 	 * device will be told of the multiplier during mode_set.
 	 */
 	adjusted_mode->Clock *= i830_sdvo_get_pixel_multiplier(mode);
+    } else if(dev_priv->is_lvds == TRUE) {
+        /* scale mode as adjusted mode based on
+         * fixed mode from init function.
+         */
+        i830_sdvo_lvds_fixup(output, adjusted_mode, mode);
     } else {
 	struct i830_sdvo_dtd output_dtd;
 	Bool success;
@@ -1135,7 +1185,8 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     i830_sdvo_set_input_timing(output, &input_dtd);
 #endif
 
-    switch (i830_sdvo_get_pixel_multiplier(mode)) {
+    switch (i830_sdvo_get_pixel_multiplier(
+                dev_priv->is_lvds == TRUE ? pI830->lvds_fixed_mode : mode)) {
     case 1:
 	i830_sdvo_set_clock_rate_mult(output, SDVO_CLOCK_RATE_MULT_1X);
 	break;
@@ -1167,7 +1218,8 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (intel_crtc->pipe == 1)
 	sdvox |= SDVO_PIPE_B_SELECT;
 
-    sdvo_pixel_multiply = i830_sdvo_get_pixel_multiplier(mode);
+    sdvo_pixel_multiply = i830_sdvo_get_pixel_multiplier(
+            dev_priv->is_lvds == TRUE ? pI830->lvds_fixed_mode : mode);
     if (IS_I965G(pI830)) {
 	/* done in crtc_mode_set as the dpll_md reg must be written early */
     } else if (IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830)) {
-- 
1.5.4.4






More information about the Intel-gfx mailing list