Skip to contentSkip to conversation

fbdev: Convert a few drivers to use the fb_find_best_display helper

PATCH In review Antonino A. Daplas 2 participants 4 messages Oct 26, 2005 – Nov 24, 2005 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 fbdev: Convert a few drivers to use the fb_find_best_display helper

Convert i810fb, nvidiafb and savagefb to use the fb_find_best_display helper when searching for the initial video mode.

---
 i810/i810_main.c         |   17 ++++-------------
 nvidia/nvidia.c          |   18 +++---------------
 savage/savagefb_driver.c |   21 ++++-----------------
 3 files changed, 11 insertions(+), 45 deletions(-)
drivers/video/i810/i810_main.c +4 -13
index 96f5f62..c0c974b 100644
@@ -1871,27 +1871,18 @@ static void __devinit i810fb_find_init_m
 	fb_videomode_to_modelist(specs->modedb, specs->modedb_len,
 				 &info->modelist);
 	if (specs->modedb != NULL) {
-		if (xres && yres) {
-			struct fb_videomode *m;
+		struct fb_videomode *m;
 
+		if (xres && yres) {
 			if ((m = fb_find_best_mode(&var, &info->modelist))) {
 				mode = *m;
 				found  = 1;
 			}
 		}
 
-		if (!found && specs->misc & FB_MISC_1ST_DETAIL) {
-			for (i = 0; i < specs->modedb_len; i++) {
-				if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
-					mode = specs->modedb[i];
-					found = 1;
-					break;
-				}
-			}
-		}
-
 		if (!found) {
-			mode = specs->modedb[0];
+			m = fb_find_best_display(&info->monspecs, &info->modelist);
+			mode = *m;
 			found = 1;
 		}
 
drivers/video/nvidia/nvidia.c +3 -15
index 3ceb74e..8c4cc36 100644
@@ -1375,22 +1375,10 @@ static int __devinit nvidia_set_fbinfo(s
 	fb_var_to_videomode(&modedb, &nvidiafb_default_var);
 
 	if (specs->modedb != NULL) {
-		/* get preferred timing */
-		if (specs->misc & FB_MISC_1ST_DETAIL) {
-			int i;
-
-			for (i = 0; i < specs->modedb_len; i++) {
-				if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
-					modedb = specs->modedb[i];
-					break;
-				}
-			}
-		} else {
-			/* otherwise, get first mode in database */
-			modedb = specs->modedb[0];
-		}
+		struct fb_videomode *modedb;
 
-		fb_videomode_to_var(&nvidiafb_default_var, &modedb);
+		modedb = fb_find_best_display(specs, &info->modelist);
+		fb_videomode_to_var(&nvidiafb_default_var, modedb);
 		nvidiafb_default_var.bits_per_pixel = 8;
 	} else if (par->fpWidth && par->fpHeight) {
 		char buf[16];
drivers/video/savage/savagefb_driver.c +4 -17
index 46b1a9c..62c47ea 100644
@@ -2052,24 +2052,11 @@ static int __devinit savagefb_probe (str
 			     info->monspecs.modedb, info->monspecs.modedb_len,
 			     NULL, 8);
 	} else if (info->monspecs.modedb != NULL) {
-		struct fb_monspecs *specs = &info->monspecs;
-		struct fb_videomode modedb;
+		struct fb_videomode *modedb;
 
-		if (info->monspecs.misc & FB_MISC_1ST_DETAIL) {
-			int i;
-
-			for (i = 0; i < specs->modedb_len; i++) {
-				if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
-					modedb = specs->modedb[i];
-					break;
-				}
-			}
-		} else {
-			/* otherwise, get first mode in database */
-			modedb = specs->modedb[0];
-		}
-
-		savage_update_var(&info->var, &modedb);
+		modedb = fb_find_best_display(&info->monspecs,
+					      &info->modelist);
+		savage_update_var(&info->var, modedb);
 	}
 
 	/* maximize virtual vertical length */

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information

#1 lore raw
Quoted 2 lines · Antonino A. Daplas

Convert i810fb, nvidiafb and savagefb to use the fb_find_best_display helper when searching for the initial video mode.

From my experience, the 1st detailed timing is only good for flat panels... A lot of CRTs put junk in there. In fact, I suspect for CRT, the only sane thing is to default to 1024x768 if it fits the timings or 640x480 if not =P and let the user/distro deal with changing to something else.

Ben.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

#2 lore raw
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 4 lines · Antonino A. Daplas

Convert i810fb, nvidiafb and savagefb to use the fb_find_best_display helper when searching for the initial video mode.

From my experience, the 1st detailed timing is only good for flat

panels... A lot of CRTs put junk in there. In fact, I suspect for CRT, the only sane thing is to default to 1024x768 if it fits the timings or 640x480 if not =P and let the user/distro deal with changing to something else.

My experience though is the contrary. I find that if the edid has detailed timings and the 'prefer first detailed timing' flag is set, the detailed timings are reliable even on CRT displays.

However, there are buggy edid blocks where the flag is set, but there are no detailed timings at all, and that's when I get garbage. (I already sent a patch that fixes these buggy edid blocks).

And still, there are edid blocks where they enumerate detailed timings but does not set the flag. This should not present with problems though.

Anyway, if there are such bad edid's out there, it's good if users refer them to the list so I can add them to the monitor blacklist database (we already have that in fbmon.c which currently has 2 entries). Anyway, users can always override the chosen default mode if it does not work for them.

Tony

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

#3 lore raw
Quoted 8 lines

My experience though is the contrary. I find that if the edid has detailed timings and the 'prefer first detailed timing' flag is set, the detailed timings are reliable even on CRT displays.

However, there are buggy edid blocks where the flag is set, but there are no detailed timings at all, and that's when I get garbage. (I already sent a patch that fixes these buggy edid blocks).

Ok, it may have been these then, I remember issues with some IBM CRTs a while ago :)

Quoted 8 lines

And still, there are edid blocks where they enumerate detailed timings but does not set the flag. This should not present with problems though.

Anyway, if there are such bad edid's out there, it's good if users refer them to the list so I can add them to the monitor blacklist database (we already have that in fbmon.c which currently has 2 entries). Anyway, users can always override the chosen default mode if it does not work for them.

Ben.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click