xserver: Branch 'master'
Adam Jackson
ajax at kemper.freedesktop.org
Tue Mar 21 16:40:46 UTC 2017
hw/xfree86/modes/xf86EdidModes.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
New commits:
commit fdc79fe72bc0b97776df2c3a664076c60e08a87c
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Thu Mar 9 17:34:55 2017 +0900
edid: Prune duplicates after adding modes from DDC
Multiple calls to xf86EdidMonitorSet (which can be triggered e.g. by
running xrandr) would potentially keep adding the same modes, causing
the Monitor->Modes list to keep growing larger and using up more memory.
Fix this by calling xf86PruneDuplicateModes after adding the modes
returned by xf86DDCGetModes. This makes sure there's only one instance
of each unique mode in the list.
v2:
* Replace semicolon with {} for empty for loop (Emil Velikov)
* Slightly tweak commit log to avoid minor inaccuracy about what
xf86PruneDuplicateModes does
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99521
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index f0e1e974b..b4ab14fc5 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -1198,21 +1198,19 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
if (!Monitor->nHsync || !Monitor->nVrefresh)
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
- /* look for last Mode */
- Mode = Modes;
-
- while (Mode->next)
- Mode = Mode->next;
-
/* add to MonPtr */
if (Monitor->Modes) {
Monitor->Last->next = Modes;
Modes->prev = Monitor->Last;
- Monitor->Last = Mode;
}
else {
Monitor->Modes = Modes;
- Monitor->Last = Mode;
}
+
+ xf86PruneDuplicateModes(Monitor->Modes);
+
+ /* Update pointer to last mode */
+ for (Mode = Monitor->Modes; Mode && Mode->next; Mode = Mode->next) {}
+ Monitor->Last = Mode;
}
}
More information about the xorg-commit
mailing list