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.
This commit is contained in:
Dave Airlie 2008-07-04 07:29:32 +10:00
parent e317943c12
commit 0b9ef835a0

View File

@ -1006,6 +1006,54 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
#define POSITION_UNSET -100000 #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 static Bool
xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
{ {
@ -1993,6 +2041,9 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
{ {
int o; int o;
if (xf86UserConfiguredOutputs(scrn, modes))
return xf86TargetFallback(scrn, config, modes, enabled, width, height);
for (o = -1; nextEnabledOutput(config, enabled, &o); ) for (o = -1; nextEnabledOutput(config, enabled, &o); )
if (xf86OutputHasUserPreferredMode(config->output[o])) if (xf86OutputHasUserPreferredMode(config->output[o]))
return return