xf86-video-intel: Branch 'modesetting' - src/i830_xf86Crtc.c

Keith Packard keithp at kemper.freedesktop.org
Mon Jan 1 01:39:17 EET 2007


 src/i830_xf86Crtc.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletion(-)

New commits:
diff-tree 25d5a892319b02dc6eb81390dea29cd88a1e7da4 (from feeefc92e450e9de58da51147325300ffabd2059)
Author: Keith Packard <keithp at guitar.keithp.com>
Date:   Sun Dec 31 15:39:20 2006 -0800

    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.

diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c
index 3a68985..33f96ab 100644
--- a/src/i830_xf86Crtc.c
+++ b/src/i830_xf86Crtc.c
@@ -499,8 +499,9 @@ i830xf86ModeCompare (DisplayModePtr a, D
 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)



More information about the xorg-commit mailing list