From 25d5a892319b02dc6eb81390dea29cd88a1e7da4 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 31 Dec 2006 15:39:20 -0800 Subject: Elide identical modes from reported list. Where two modes would produce precisely the same crtc settings and have the same name, remove the latter mode from the mode list. --- src/i830_xf86Crtc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c index 3a68985c..33f96abc 100644 --- a/src/i830_xf86Crtc.c +++ b/src/i830_xf86Crtc.c @@ -499,8 +499,9 @@ i830xf86ModeCompare (DisplayModePtr a, DisplayModePtr b) static DisplayModePtr i830xf86SortModes (DisplayModePtr input) { - DisplayModePtr output = NULL, i, o, *op, prev; + DisplayModePtr output = NULL, i, o, n, *op, prev; + /* sort by preferred status and pixel area */ while (input) { i = input; @@ -511,6 +512,17 @@ i830xf86SortModes (DisplayModePtr input) i->next = *op; *op = i; } + /* prune identical modes */ + for (o = output; o && (n = o->next); o = n) + { + if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n)) + { + o->next = n->next; + xfree (n->name); + xfree (n); + n = o; + } + } /* hook up backward links */ prev = NULL; for (o = output; o; o = o->next) -- cgit v1.2.3