| diff -aur xorg-server-1.12.4/hw/xfree86/modes/xf86Crtc.c xorg-server-1.12.4.work/hw/xfree86/modes/xf86Crtc.c |
| --- xorg-server-1.12.4/hw/xfree86/modes/xf86Crtc.c 2012-08-26 22:11:00.000000000 -0700 |
| +++ xorg-server-1.12.4.work/hw/xfree86/modes/xf86Crtc.c 2012-10-26 16:34:34.316834000 -0700 |
| @@ -2208,6 +2208,53 @@ |
| } |
| |
| static Bool |
| +xf86TargetChromeOS(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, |
| + DisplayModePtr *modes, Bool *enabled, |
| + int width, int height) |
| +{ |
| + int o, p; |
| + DisplayModePtr main_output_mode; |
| + xf86OutputPtr main_output = NULL; |
| + Bool found = FALSE; |
| + |
| + /* Find the main output */ |
| + for (o = -1; nextEnabledOutput(config, enabled, &o); ) |
| + { |
| + if ( !strncmp(config->output[o]->name, "LVDS", 4) || |
| + !strncmp(config->output[o]->name, "eDP", 3) ) |
| + { |
| + main_output = config->output[o]; |
| + break; |
| + } |
| + } |
| + |
| + /* If we didn't find anything, grab the first enabled output */ |
| + if (!main_output) { |
| + o = -1; |
| + nextEnabledOutput(config, enabled, &o); |
| + main_output = config->output[o]; |
| + } |
| + |
| + if (!main_output) |
| + return FALSE; |
| + |
| + if (!(main_output_mode = xf86OutputHasPreferredMode(main_output, |
| + width, height))) |
| + return FALSE; |
| + |
| + /* Actually do the modesetting: turn off all non-main monitors */ |
| + for (o = -1; nextEnabledOutput(config, enabled, &o); ) |
| + { |
| + if (config->output[o] == main_output) |
| + modes[o] = main_output_mode; |
| + else |
| + (*config->output[o]->funcs->dpms)(config->output[o], DPMSModeOff); |
| + } |
| + |
| + return TRUE; |
| +} |
| + |
| +static Bool |
| xf86CrtcSetInitialGamma(xf86CrtcPtr crtc, float gamma_red, float gamma_green, |
| float gamma_blue) |
| { |
| @@ -2369,6 +2416,8 @@ |
| else { |
| if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) |
| xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); |
| + else if (xf86TargetChromeOS(scrn, config, modes, enabled, width, height)) |
| + xf86DrvMsg(i, X_INFO, "Using ChromeOS mode for initial modes\n"); |
| else if (xf86TargetPreferred |
| (scrn, config, modes, enabled, width, height)) |
| xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n"); |