aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-03-30 16:49:09 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-30 16:49:09 -0800
commitcb487640f5f09fa2c31b418d3036628c974b99b7 (patch)
treeb6b0a0bc1db97e292f7c0a877d2eaabf1d6b1b3d
parent2fc97ba68cb8685e2e9b4ae2899b18fd30b33dbc (diff)
downloadhistory-cb487640f5f09fa2c31b418d3036628c974b99b7.tar.gz
[PATCH] radeonfb: Fix mode setting on CRT monitors
Current radeonfb is a bit "anal" about accepting CRT modes, it basically only accepts modes that have the exact resolution, which tends to break with fbcon on console switches as it provides "approximate" modes. This patch fixes it by having the driver chose the closest possible mode instead of looking for an exact match. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/aty/radeon_monitor.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
index 4046d56031fb79..ea7c8630691845 100644
--- a/drivers/video/aty/radeon_monitor.c
+++ b/drivers/video/aty/radeon_monitor.c
@@ -901,7 +901,7 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_
*/
/*
- * This is used when looking for modes. We assign a "goodness" value
+ * This is used when looking for modes. We assign a "distance" value
* to a mode in the modedb depending how "close" it is from what we
* are looking for.
* Currently, we don't compare that much, we could do better but
@@ -910,13 +910,11 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_
static int radeon_compare_modes(const struct fb_var_screeninfo *var,
const struct fb_videomode *mode)
{
- int goodness = 0;
+ int distance = 0;
- if (var->yres == mode->yres)
- goodness += 10;
- if (var->xres == mode->xres)
- goodness += 9;
- return goodness;
+ distance = mode->yres - var->yres;
+ distance += (mode->xres - var->xres)/2;
+ return distance;
}
/*
@@ -938,7 +936,7 @@ int radeon_match_mode(struct radeonfb_info *rinfo,
const struct fb_videomode *db = vesa_modes;
int i, dbsize = 34;
int has_rmx, native_db = 0;
- int goodness = 0;
+ int distance = INT_MAX;
const struct fb_videomode *candidate = NULL;
/* Start with a copy of the requested mode */
@@ -974,19 +972,19 @@ int radeon_match_mode(struct radeonfb_info *rinfo,
/* Now look for a mode in the database */
while (db) {
for (i = 0; i < dbsize; i++) {
- int g;
+ int d;
if (db[i].yres < src->yres)
continue;
if (db[i].xres < src->xres)
continue;
- g = radeon_compare_modes(src, &db[i]);
+ d = radeon_compare_modes(src, &db[i]);
/* If the new mode is at least as good as the previous one,
* then it's our new candidate
*/
- if (g >= goodness) {
+ if (d < distance) {
candidate = &db[i];
- goodness = g;
+ distance = d;
}
}
db = NULL;