[patch] xserver: fix deadloop when preferred mode > 1

Hong Liu hong.liu at intel.com
Sat Sep 29 01:58:29 PDT 2007


I think we should fix this deadloop problem first and later
we could think out some solutions, for example we may add
refresh rate to mode name to uniquely identify mode.

Thanks,
Hong

On Fri, 2007-09-28 at 09:18 -0400, Alex Deucher wrote:
> On 9/28/07, Hong Liu <hong.liu at intel.com> wrote:
> > When preferred mode option is enabled and there are more than 1 mode
> > matches the preferred mode, X will get in dead-loop.
> >
> 
> Keithp and I discussed this last weekend and I came up with a similar
> patch (http://www.botchco.com/alex/xorg/fix_crtc_loop.diff)
> However, the question is, if we have multiple modes with the same
> name, which one does the user want?  The first one we find?  Do we
> care?  Yeah for non-unique strings.
> 
> Alex
> 
> > Thanks,
> > Hong
> >
> > 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;
> >             }
> >         }
> >
> > _______________________________________________
> > xorg mailing list
> > xorg at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/xorg
> >



More information about the xorg mailing list