diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 064ff16..78479bb 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1400,25 +1400,33 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) if (preferred_mode) { - for (mode = output->probed_modes; mode; mode = mode->next) + mode = output->probed_modes; + while (mode) { + DisplayModePtr next; + if (!strcmp (preferred_mode, mode->name)) { + next = mode->next; if (mode != output->probed_modes) { if (mode->prev) - mode->prev->next = mode->next; - if (mode->next) - mode->next->prev = mode->prev; + mode->prev->next = next; + if (next) + next->prev = mode->prev; mode->next = output->probed_modes; output->probed_modes->prev = mode; mode->prev = NULL; output->probed_modes = mode; } mode->type |= M_T_PREFERRED; + mode = next; + continue; } else mode->type &= ~M_T_PREFERRED; + + mode = mode->next; } }