diff options
author | Alan Hourihane <alanh@vmware.com> | 2011-02-16 18:53:14 +0100 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-02-16 19:50:34 +0100 |
commit | c208a5380b20f910ab49433abc0d39dce6bb5528 (patch) | |
tree | bfe141474fb0b4dc77d991380068eb2f9c4597fb /src/vmwaremodes.c | |
parent | 2e5001b7e93c63c2cd25d7d8ebdee8a420c13b96 (diff) |
vmwlegacy: Fix mode lookup
In situations where we have trouble finding a specified mode,
use the resolution given by the width and height device registers.
Signed-off-by: Alan Hourihane <alanh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'src/vmwaremodes.c')
-rw-r--r-- | src/vmwaremodes.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/vmwaremodes.c b/src/vmwaremodes.c index 2f1e5b4..ceeedf6 100644 --- a/src/vmwaremodes.c +++ b/src/vmwaremodes.c @@ -42,6 +42,7 @@ #ifdef HAVE_XORG_SERVER_1_2_0 #include <xf86Modes.h> #endif +#include "vm_basic_types.h" #ifndef M_T_DRIVER # define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ @@ -109,9 +110,13 @@ static DisplayModeRec VMwareModes[] = { */ void -vmwareGetSupportedModelines(DisplayModePtr *monitorModes) +vmwareGetSupportedModelines(ScrnInfoPtr pScrn, uint32 dwidth, uint32 dheight) { + MonPtr monitor = pScrn->monitor; + DisplayModePtr *monitorModes = &pScrn->monitor->Modes; DisplayModePtr modes = NULL, mode = NULL; + DisplayModeRec dynamic = + { MODEPREFIX, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIX }; int i = 0; if (monitorModes == NULL || *monitorModes == NULL) { @@ -124,6 +129,32 @@ vmwareGetSupportedModelines(DisplayModePtr *monitorModes) modes = xf86ModesAdd(modes, mode); } + /* + * Let's add a mode of current SVGA register values and so we can + * match against this for subsequent login. + */ + if (dwidth && dheight) { + dynamic.HDisplay = dwidth; + dynamic.HSyncStart = dynamic.HDisplay + 1; + dynamic.HSyncEnd = dynamic.HSyncStart + 1; + dynamic.HTotal = dynamic.HSyncEnd * 5 / 4; + if (monitor->nHsync > 0) + dynamic.Clock = dynamic.HTotal * monitor->hsync[0].lo; + else + dynamic.Clock = 75000; + dynamic.VDisplay = dheight; + dynamic.VSyncStart = dynamic.VDisplay + 1; + dynamic.VSyncEnd = dynamic.VSyncStart + 1; + dynamic.VTotal = dynamic.VSyncEnd + 1; + if (monitor->nVrefresh > 0) + dynamic.VRefresh = monitor->vrefresh[0].lo; + else + dynamic.VRefresh = 60000; + + mode = xf86DuplicateMode(&dynamic); + modes = xf86ModesAdd(modes, mode); + } + *monitorModes = xf86ModesAdd(*monitorModes, modes); #endif } |