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.
This commit is contained in:
Keith Packard 2006-12-31 15:39:20 -08:00
parent feeefc92e4
commit 25d5a89231
1 changed files with 13 additions and 1 deletions

View File

@ -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)