summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-12-31 15:39:20 -0800
committerKeith Packard <keithp@guitar.keithp.com>2006-12-31 15:39:20 -0800
commit25d5a892319b02dc6eb81390dea29cd88a1e7da4 (patch)
tree4425c217fe37aa6c2431b48aa7eb4316aac1a711
parentfeeefc92e450e9de58da51147325300ffabd2059 (diff)
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.
-rw-r--r--src/i830_xf86Crtc.c14
1 files changed, 13 insertions, 1 deletions
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)