diff options
author | Dave Airlie <airlied@redhat.com> | 2008-07-04 07:29:32 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-07-04 07:29:32 +1000 |
commit | 0b9ef835a0fe900c121b84e43989591e58ab1126 (patch) | |
tree | a1a4477a52fa7fbf41bfa502cf501eef573ec866 | |
parent | e317943c125d7fdbe62c750324640eb30c88fa15 (diff) |
modes: fix initial xorg.conf mode selection.
This was all kinds of broken, we ignored user preferred modes for multiple
monitors and also for side-by-side configurations.
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 733106c4f..a5a0a6392 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1006,6 +1006,54 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp, #define POSITION_UNSET -100000 +/* + * check if the user configured any outputs at all + * with either a position or a relative setting or a mode. + */ +static Bool +xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o; + Bool user_conf = FALSE; + + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + char *position; + char *relative_name; + OutputOpts relation; + int r; + static const OutputOpts relations[] = { + OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF + }; + + position = xf86GetOptValString (output->options, + OPTION_POSITION); + if (position) + user_conf = TRUE; + + relation = 0; + relative_name = NULL; + for (r = 0; r < 4; r++) + { + relation = relations[r]; + relative_name = xf86GetOptValString (output->options, + relation); + if (relative_name) + break; + } + if (relative_name) + user_conf = TRUE; + + modes[o] = xf86OutputHasUserPreferredMode(output); + if (modes[o]) + user_conf = TRUE; + } + + return user_conf; +} + static Bool xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) { @@ -1993,6 +2041,9 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, { int o; + if (xf86UserConfiguredOutputs(scrn, modes)) + return xf86TargetFallback(scrn, config, modes, enabled, width, height); + for (o = -1; nextEnabledOutput(config, enabled, &o); ) if (xf86OutputHasUserPreferredMode(config->output[o])) return |