From d57a25815398ae83eae8bdcb3a1b607760aa30b6 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Dec 2006 22:48:21 -0800 Subject: [PATCH] Elide duplicate modes in pScrn->monitor. xf86DDCMonitorSet dumps all of the DDC-discovered modes into the monitor mode list without checking to see if they are already present. This provides an ever-changing list of modes for outputs which have no DDC and which simply duplicate the monitor mode list. --- src/i830_xf86Crtc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c index a222382d..6f96d448 100644 --- a/src/i830_xf86Crtc.c +++ b/src/i830_xf86Crtc.c @@ -337,6 +337,30 @@ xf86DefaultScreenLimits (ScrnInfoPtr pScrn, int *widthp, int *heightp) *heightp = height; } +/* + * XXX walk the monitor mode list and prune out duplicates that + * are inserted by xf86DDCMonitorSet. In an ideal world, that + * function would do this work by itself. + */ + +static void +xf86PruneDuplicateMonitorModes (MonPtr Monitor) +{ + DisplayModePtr master, clone, next; + + for (master = Monitor->Modes; + master && master != Monitor->Last; + master = master->next) + { + for (clone = master->next; clone && clone != Monitor->Modes; clone = next) + { + next = clone->next; + if (xf86ModesEqual (master, clone)) + xf86DeleteMode (&Monitor->Modes, clone); + } + } +} + void xf86ProbeOutputModes (ScrnInfoPtr pScrn) { @@ -344,6 +368,9 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn) Bool properties_set = FALSE; int o; + /* Elide duplicate modes before defaulting code uses them */ + xf86PruneDuplicateMonitorModes (pScrn->monitor); + /* Probe the list of modes for each output. */ for (o = 0; o < config->num_output; o++) {