Thread (5 messages) 5 messages, 3 authors, 2007-07-12

Re: [PATCH 1/4] fbdev: make fb_find_mode look for a mode with the highest refresh rate

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2007-07-12 08:32:00
Also in: lkml

On Sat, 2007-06-23 at 12:50 +0200, Michal Januszewski wrote:
quoted hunk ↗ jump to hunk
If the refresh rate hasn't been explicitly specified, fd_find_mode
currently returns the first mode with the requested resolution. Change
it so that it returns a mode with the requested resolution and the
highest refresh rate.

Also export fb_destroy_modelist, which is used in uvesafb.

Signed-off-by: Michal Januszewski <spock@gentoo.org>
---
drivers/video/modedb.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 3741ad7..98ee77b 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -606,16 +606,18 @@ done:
 	DPRINTK("Trying specified video mode%s %ix%i\n",
 	    refresh_specified ? "" : " (ignoring refresh rate)", xres, yres);
 
+	if (!refresh_specified)
+		refresh = 200;
 	diff = refresh;
How about..?

	if (!refresh_specified)
		diff = 0;
	else
		diff = refresh;
 	best = -1;
 	for (i = 0; i < dbsize; i++) {
 		if (name_matches(db[i], name, namelen) ||
 		    (res_specified && res_matches(db[i], xres, yres))) {
 			if(!fb_try_mode(var, info, &db[i], bpp)) {
-				if(!refresh_specified || db[i].refresh == refresh)
+				if (refresh_specified && db[i].refresh == refresh)
 					return 1;
 				else {
-					if(diff > abs(db[i].refresh - refresh)) {
+					if (diff > abs(db[i].refresh - refresh)) {
 						diff = abs(db[i].refresh - refresh);
 						best = i;
 					}
then
					if (diff < db[i].refresh) {
						diff = db[i].refresh;
						best = i;
					}

Tony



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help