xorg-video-intel: Implement option to ignore external fixed mode settings From: Mike Isely The Intel xorg driver tries mightily to determine the native fixed panel mode settings for the LVDS output. It does this through various means, including scanning video BIOS tables, and noticing if the pipe in question has already been set up by somebody else (and adopting those timings). This strategy works well for say a laptop where the LCD panel is an integral part of the machine. But for other applications where the display is unrelated to the system's BIOS or other software, then the BIOS will likely have no clue how to configure the LVDS output. Worse still, the BIOS can simply "get it wrong", leaving the pipe misconfigured. Unfortunately the Intel driver can potentially notice this, adopt the same settings, leaving a messed up display. All of this complexity normally happens independently, behind the scenes, from the mode timings that might otherwise be specified by the user. This driver has a concept of fixed, i.e. "native" mode, and then user-specified mode. If the corresponding resolutions between those concepts don't match, then the driver in theory will arrange for scaling to take place while adhering to the actual native mode of the panel. Said another way, if the user says 800x600 but the driver mistakenly (see above) thinks the native mode is 640x480, then 640x480 is the mode set with scaling to an 800x600 frame buffer. If the driver gets the wrong native mode, then the result is a miserable mess with no way for the user to override what the driver thinks is right. This patch provides a means to override the driver. This implements a new driver option, "LVDSFixedMode" which defaults to true (the normal, probe-what-I-need behavior). However when set to false, then all the guessing is skipped and the driver will assume no fixed, i.e. "native" mode for the display device. Instead with this option set to false, the driver will directly set the timings specified by the user, providing an escape hatch for situations where the driver can't correctly figure out the right mode. Under most scenarios of course, this option should not be needed. But in situations where the Intel video BIOS is hopelessly fouled up related to the LVDS output, this option provides the escape hatch for the user to get a working display in spite of the BIOS situation. Signed-off-by: Mike Isely --- Note: This patch was built against the 2.2.1 driver as patched in Debian 2.2.1-1. However it should apply reasonably well against the upstream tree (I hope). src/i830.h | 1 + src/i830_driver.c | 8 ++++++++ src/i830_lvds.c | 10 ++++++++++ 3 files changed, 19 insertions(+) Index: src/i830_driver.c =================================================================== --- src/i830_driver.c (.../debian-2.2.1-1) (revision 40) +++ src/i830_driver.c (.../patch-lvdsfixedmode) (revision 40) @@ -297,6 +297,7 @@ #ifdef XF86DRI_MM OPTION_INTELTEXPOOL, #endif + OPTION_LVDSFIXEDMODE, OPTION_TRIPLEBUFFER, OPTION_FORCEENABLEPIPEA } I830Opts; @@ -320,6 +321,7 @@ #ifdef XF86DRI_MM {OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE}, #endif + {OPTION_LVDSFIXEDMODE, "LVDSFixedMode", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_TRIPLEBUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_FORCEENABLEPIPEA, "ForceEnablePipeA", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} @@ -1195,6 +1197,12 @@ pI830->debug_modes = FALSE; } + if (xf86ReturnOptValBool(pI830->Options, OPTION_LVDSFIXEDMODE, TRUE)) { + pI830->lvds_fixed_mode = TRUE; + } else { + pI830->lvds_fixed_mode = FALSE; + } + if (xf86ReturnOptValBool(pI830->Options, OPTION_FORCEENABLEPIPEA, FALSE)) pI830->quirk_flag |= QUIRK_PIPEA_FORCE; Index: src/i830.h =================================================================== --- src/i830.h (.../debian-2.2.1-1) (revision 40) +++ src/i830.h (.../patch-lvdsfixedmode) (revision 40) @@ -622,6 +622,7 @@ /** Enables logging of debug output related to mode switching. */ Bool debug_modes; + Bool lvds_fixed_mode; unsigned int quirk_flag; } I830Rec; Index: src/i830_lvds.c =================================================================== --- src/i830_lvds.c (.../debian-2.2.1-1) (revision 40) +++ src/i830_lvds.c (.../patch-lvdsfixedmode) (revision 40) @@ -908,6 +908,14 @@ */ I830I2CInit(pScrn, &intel_output->pDDCBus, GPIOC, "LVDSDDC_C"); + if (!pI830->lvds_fixed_mode) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Skipping any attempt to determine panel fixed mode.\n"); + goto skip_panel_fixed_mode_setup; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Attempting to determine panel fixed mode.\n"); + /* Attempt to get the fixed panel mode from DDC. Assume that the preferred * mode is the right one. */ @@ -991,6 +999,8 @@ goto disable_exit; } + skip_panel_fixed_mode_setup: + /* Blacklist machines with BIOSes that list an LVDS panel without actually * having one. */