diff options
author | marha <marha@users.sourceforge.net> | 2009-11-16 13:46:01 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-11-16 13:46:01 +0000 |
commit | 578938f1cdd5a06dd6fa28167d575ec980322a5d (patch) | |
tree | e31cf77fab7cc6e005b0e726e7951d7eef79550f /xorg-server/hw/xfree86/modes/xf86Modes.c | |
parent | 0032f9b66d63a4b1c5222edb8603fb60da379fb0 (diff) | |
download | vcxsrv-578938f1cdd5a06dd6fa28167d575ec980322a5d.tar.gz vcxsrv-578938f1cdd5a06dd6fa28167d575ec980322a5d.tar.bz2 vcxsrv-578938f1cdd5a06dd6fa28167d575ec980322a5d.zip |
Update to git master branch of xserver.
Diffstat (limited to 'xorg-server/hw/xfree86/modes/xf86Modes.c')
-rw-r--r-- | xorg-server/hw/xfree86/modes/xf86Modes.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c index d105b48ab..75aedaa99 100644 --- a/xorg-server/hw/xfree86/modes/xf86Modes.c +++ b/xorg-server/hw/xfree86/modes/xf86Modes.c @@ -136,10 +136,12 @@ xf86ModeBandwidth(DisplayModePtr mode, int depth) void xf86SetModeDefaultName(DisplayModePtr mode) { - if (mode->name != NULL) - xfree(mode->name); + Bool interlaced = !!(mode->Flags & V_INTERLACE); - mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay); + xfree(mode->name); + + mode->name = XNFprintf("%dx%d%s", mode->HDisplay, mode->VDisplay, + interlaced ? "i" : ""); } /* @@ -689,3 +691,37 @@ xf86GetDefaultModes (void) } return head; } + +/* + * Walk a mode list and prune out duplicates. Will preserve the preferred + * mode of an otherwise-duplicate pair. + * + * Probably best to call this on lists that are all of a single class + * (driver, default, user, etc.), otherwise, which mode gets deleted is + * not especially well defined. + * + * Returns the new list. + */ + +DisplayModePtr +xf86PruneDuplicateModes(DisplayModePtr modes) +{ + DisplayModePtr m, n, o; + +top: + for (m = modes; m; m = m->next) { + for (n = m->next; n; n = o) { + o = n->next; + if (xf86ModesEqual(m, n)) { + if (n->type & M_T_PREFERRED) { + xf86DeleteMode(&modes, m); + goto top; + } + else + xf86DeleteMode(&modes, n); + } + } + } + + return modes; +} |