summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2009-06-10 11:17:27 +0800
committerZhenyu Wang <zhenyu.z.wang@intel.com>2009-06-16 11:27:18 +0800
commit5d1dc7677004d445a7a781decd8c1ef9747c14fb (patch)
tree57e11ceb3c6f51ca47208c791e94fd8b41db9406
parent115e28639fbf6a1eba636dafac02fadd83036c75 (diff)
Get the LVDS panel limit and check whether the given modeline is valid
When the connector type is LVDS, it will traverse the mode list returned by KMS kernel to get the LVDS panel limit. Then it will use the panel limit to check whether the given modeline is valid. If the given modeline exceeds the LVDS panel limit, it will be invalid. http://bugs.freedesktop.org/show_bug.cgi?id=20801 http://bugs.freedesktop.org/show_bug.cgi?id=21094 http://bugs.freedesktop.org/show_bug.cgi?id=21346 http://bugs.freedesktop.org/show_bug.cgi?id=21417 http://bugs.freedesktop.org/show_bug.cgi?id=21671 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r--src/drmmode_display.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index c9e15a45..aee885a0 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -471,6 +471,21 @@ drmmode_output_detect(xf86OutputPtr output)
static Bool
drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)
{
+ drmmode_output_private_ptr drmmode_output = output->driver_private;
+ drmModeConnectorPtr koutput = drmmode_output->mode_output;
+ struct fixed_panel_lvds *p_lvds = drmmode_output->private_data;
+
+ /*
+ * If the connector type is LVDS, we will use the panel limit to
+ * verfiy whether the mode is valid.
+ */
+ if ((koutput->connector_type == DRM_MODE_CONNECTOR_LVDS) && p_lvds) {
+ if (pModes->HDisplay > p_lvds->hdisplay ||
+ pModes->VDisplay > p_lvds->vdisplay)
+ return MODE_PANEL;
+ else
+ return MODE_OK;
+ }
return MODE_OK;
}
@@ -483,6 +498,8 @@ drmmode_output_get_modes(xf86OutputPtr output)
int i;
DisplayModePtr Modes = NULL, Mode;
drmModePropertyPtr props;
+ struct fixed_panel_lvds *p_lvds;
+ drmModeModeInfo *mode_ptr;
/* look for an EDID property */
for (i = 0; i < koutput->count_props; i++) {
@@ -518,6 +535,27 @@ drmmode_output_get_modes(xf86OutputPtr output)
Modes = xf86ModesAdd(Modes, Mode);
}
+ p_lvds = drmmode_output->private_data;
+ /*
+ * If the connector type is LVDS, we will traverse the kernel mode to
+ * get the panel limit.
+ * If it is incorrect, please fix me.
+ */
+ if ((koutput->connector_type == DRM_MODE_CONNECTOR_LVDS) && p_lvds) {
+ p_lvds->hdisplay = 0;
+ p_lvds->vdisplay = 0;
+ for (i = 0; i < koutput->count_modes; i++) {
+ mode_ptr = &koutput->modes[i];
+ if ((mode_ptr->hdisplay >= p_lvds->hdisplay) &&
+ (mode_ptr->vdisplay >= p_lvds->vdisplay)) {
+ p_lvds->hdisplay = mode_ptr->hdisplay;
+ p_lvds->vdisplay = mode_ptr->vdisplay;
+ }
+ }
+ if (!p_lvds->hdisplay || !p_lvds->vdisplay)
+ xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+ "Incorrect KMS mode.\n");
+ }
return Modes;
}