I'd rather see a real loop than one simulated by an extra variable and a goto. You just need to move the fbdevHWSetMode up to where the break statement is, and only break if setting the mode succeeded--right?
Jamey On 9/22/11, Dave Airlie <[email protected]> wrote: > From: Adam Jackson <[email protected]> > > So on RHEL5 anaconda sets an xorg.conf with a fixed 800x600 mode in it, > we run radeonfb and fbdev since ati won't work in userspace due to domain > issues in the older codebase. > > On certain pseries blades the built-in KVM can't accept an 800x600-43 mode, > it requires the 800x600-60 mode, so we have to have the kernel radeonfb > driver reject the 800x600-43 mode when it sees it. However then fbdev > doesn't try any of the other 800x600 modes in the modelist, and we end up > getting a default 640x480 mode we don't want. > > This patch changes the mode validation loop to continue on with the other > modes > that match to find one that works. > > Reviewed-by: Dave Airlie <[email protected]> > Signed-off-by: Dave Airlie <[email protected]> > --- > hw/xfree86/fbdevhw/fbdevhw.c | 11 ++++++++--- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c > index dee731b..043a5ba 100644 > --- a/hw/xfree86/fbdevhw/fbdevhw.c > +++ b/hw/xfree86/fbdevhw/fbdevhw.c > @@ -509,19 +509,24 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn) > pScrn->virtualY = pScrn->display->virtualY; > > for (modename = pScrn->display->modes; *modename != NULL; modename++) { > - for (mode = pScrn->monitor->Modes; mode != NULL; mode = > mode->next) > + Bool found_this_pass = FALSE; > + mode = pScrn->monitor->Modes; > +next: > + for (; mode != NULL; mode = mode->next) > if (0 == strcmp(mode->name,*modename)) > break; > - if (NULL == mode) { > + if (NULL == mode && !found_this_pass) { > xf86DrvMsg(pScrn->scrnIndex, X_INFO, > "\tmode \"%s\" not found\n", *modename); > continue; > } > > + found_this_pass = TRUE; > if (!fbdevHWSetMode(pScrn, mode, TRUE)) { > xf86DrvMsg(pScrn->scrnIndex, X_INFO, > "\tmode \"%s\" test failed\n", *modename); > - continue; > + mode = mode->next; > + goto next; > } > xf86DrvMsg(pScrn->scrnIndex, X_INFO, > "\tmode \"%s\" ok\n", *modename); > -- > 1.7.6.2 > > _______________________________________________ > [email protected]: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel > _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
