diff mbox

gfx: Add the default modes for LVDS when no DS_RANGE block is found

Message ID 1259736679-28448-1-git-send-email-yakui.zhao@intel.com (mailing list archive)
State Deferred, archived
Headers show

Commit Message

Zhao, Yakui Dec. 2, 2009, 6:51 a.m. UTC
None
diff mbox

Patch

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index a469f6c..58435bf 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -721,6 +721,13 @@  static int drmmode_output_lvds_edid(xf86OutputPtr output,
 			ranges->max_v = 200;
 			ranges->min_h = 0;
 			ranges->max_h = 200;
+		} else {
+			/* When DS_RANGE block is not found, we will to add the
+			 * default mode list in our driver.
+			 * In such case we will clear the GTF flag to avoid
+			 * that xorg adds the default mode list again.
+			 */
+			edid_mon->features.msc &= ~(0x01);
 		}
 		return 0;
 	}
@@ -796,6 +803,7 @@  drmmode_output_get_modes(xf86OutputPtr output)
 	drmModePropertyPtr props;
 	struct fixed_panel_lvds *p_lvds;
 	drmModeModeInfo *mode_ptr;
+	xf86MonPtr	edid_mon = NULL;
 
 	/* look for an EDID property */
 	for (i = 0; i < koutput->count_props; i++) {
@@ -855,6 +863,14 @@  drmmode_output_get_modes(xf86OutputPtr output)
 			xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
 				"Incorrect KMS mode.\n");
 		drmmode_output_lvds_edid(output, p_lvds);
+		edid_mon = output->MonInfo;
+		if ((edid_mon->features.msc & 0x01) == 0) {
+			/* If the GTF flag is not set, it means that DS_RANGE
+			 * block is found. And we had better add the default
+			 * mode list.
+			 */
+			Modes = xf86ModesAdd(Modes, xf86GetDefaultModes());
+		}
 	}
 	return Modes;
 }