mirror of
https://github.com/genesi/linux-legacy.git
synced 2026-09-24 23:54:24 +00:00
fb_find_best_nearest_mode - actually pick highest refresh this time
also optimize out the abs, since mode > cmode, it will always be positive
This commit is contained in:
@@ -938,15 +938,15 @@ const struct fb_videomode *fb_find_best_nearest_mode(const struct fb_videomode *
|
||||
/* the calculations here assume that every other mode than the one
|
||||
passed is somewhat smaller :) */
|
||||
if (mode->xres >= cmode->xres && mode->yres >= cmode->yres) {
|
||||
d = abs(mode->xres - cmode->xres) +
|
||||
abs(mode->yres - cmode->yres);
|
||||
d = (mode->xres - cmode->xres) +
|
||||
(mode->yres - cmode->yres);
|
||||
if (diff > d) {
|
||||
/* as d grows smaller, best gets closer to the
|
||||
* passed mode */
|
||||
diff = d;
|
||||
best = cmode;
|
||||
} else if (diff == d && best &&
|
||||
mode->refresh > best->refresh) {
|
||||
cmode->refresh > best->refresh) {
|
||||
best = cmode;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user