From 0a2c5a6d931dd4f77181d3fd16ea6326f0bb40ac Mon Sep 17 00:00:00 2001 From: Connor Behan Date: Mon, 1 Feb 2016 22:33:12 -0500 Subject: [PATCH] Do not rely on DDC detection Since an output has no pDDCBus when in serial mode, we must support something besides EDID detection. Guessing modes like the pre-RandR driver did, we prefer small resolutions unless large ones are present in xorg.conf Closes: X.Org Bugzilla #22100 Signed-off-by: Connor Behan --- src/geode.h | 4 ++++ src/lx_driver.c | 3 --- src/lx_output.c | 26 ++++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/geode.h b/src/geode.h index eb61c28..b00dfa7 100644 --- a/src/geode.h +++ b/src/geode.h @@ -114,6 +114,10 @@ the size of the *actual* cursor. */ #define LX_CURSOR_MAX_WIDTH 32 #define LX_CURSOR_MAX_HEIGHT 32 +#define LX_MAX_PITCH 8192 +#define LX_MAX_WIDTH 1940 +#define LX_MAX_HEIGHT 1600 + /* FIXME: Get rid of this from GX */ #define DEBUGMSG(cond, drv_msg) diff --git a/src/lx_driver.c b/src/lx_driver.c index 47f6875..6ffbee9 100644 --- a/src/lx_driver.c +++ b/src/lx_driver.c @@ -59,9 +59,6 @@ /* Bring in VGA functions */ #include "lx_vga.c" -#define LX_MAX_WIDTH 1940 -#define LX_MAX_HEIGHT 1600 - /* Size of the register blocks */ #define LX_GP_REG_SIZE 0x4000 diff --git a/src/lx_output.c b/src/lx_output.c index 40455ce..12e5805 100644 --- a/src/lx_output.c +++ b/src/lx_output.c @@ -227,14 +227,36 @@ lx_output_get_modes(xf86OutputPtr output) xf86MonPtr mon; DisplayModePtr modes; + DisplayModePtr mode; + Bool flagged = FALSE; - if (!(pGeode->Output & OUTPUT_PANEL)) { + if (pGeode->Output & OUTPUT_PANEL) { + modes = xf86DuplicateMode(pGeode->panelMode); + } + else if (lx_output->pDDCBus) { mon = xf86OutputGetEDID(output, lx_output->pDDCBus); xf86OutputSetEDID(output, mon); modes = xf86OutputGetEDIDModes(output); } + else if (pScrni->display->modes[0] != NULL) { + /* Modes are in the config file, use these */ + modes = xf86GetDefaultModes(); + xf86ValidateModesUserConfig(pScrni, modes); + xf86ValidateModesSize(pScrni, modes, LX_MAX_WIDTH, LX_MAX_HEIGHT, LX_MAX_PITCH); + xf86PruneInvalidModes(pScrni, &modes, FALSE); + } else { - modes = xf86DuplicateMode(pGeode->panelMode); + modes = xf86GetDefaultModes(); + xf86ValidateModesSize(pScrni, modes, 1280, 1024, LX_MAX_PITCH); + xf86PruneInvalidModes(pScrni, &modes, FALSE); + + for (mode = modes; mode != NULL; mode = mode->next) { + mode->type &= ~M_T_PREFERRED; + if (!flagged && !strncmp(mode->name, "800x600", 7)) { + mode->type |= (M_T_DRIVER | M_T_PREFERRED); + flagged = TRUE; + } + } } return modes; -- 2.7.0