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

Subsystems: framebuffer layer, the rest

STALE7592d

4 messages, 2 authors, 2005-11-24 · open the first message on its own page

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

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2005-10-26 12:06:04

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

Signed-off-by: Antonino Daplas <redacted>
---
 i810/i810_main.c         |   17 ++++-------------
 nvidia/nvidia.c          |   18 +++---------------
 savage/savagefb_driver.c |   21 ++++-----------------
 3 files changed, 11 insertions(+), 45 deletions(-)

diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 96f5f62..c0c974b 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -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;
 		}
 
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 3ceb74e..8c4cc36 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -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];
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 46b1a9c..62c47ea 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -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

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

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2005-11-24 05:24:29

On Wed, 2005-10-26 at 20:04 +0800, Antonino A. Daplas wrote:
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

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

From: "Antonino A. Daplas" <adaplas@gmail.com>
Date: 2005-11-24 06:45:20

Benjamin Herrenschmidt wrote:
On Wed, 2005-10-26 at 20:04 +0800, Antonino A. Daplas wrote:
quoted
Convert i810fb, nvidiafb and savagefb to use the fb_find_best_display
helper when searching for the initial video mode.
quoted
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

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

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2005-11-24 06:58:08

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 :)
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help