All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] fbdev: Convert a few drivers to use the fb_find_best_display helper
@ 2005-10-26 12:04 Antonino A. Daplas
  2005-11-24  5:20 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Antonino A. Daplas @ 2005-10-26 12:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Fbdev development list

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 <adaplas@pol.net>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/4] fbdev: Convert a few drivers to use the fb_find_best_display helper
  2005-10-26 12:04 [PATCH 4/4] fbdev: Convert a few drivers to use the fb_find_best_display helper Antonino A. Daplas
@ 2005-11-24  5:20 ` Benjamin Herrenschmidt
  2005-11-24  6:44   ` Antonino A. Daplas
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-24  5:20 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Andrew Morton

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/4] fbdev: Convert a few drivers to use the fb_find_best_display helper
  2005-11-24  5:20 ` Benjamin Herrenschmidt
@ 2005-11-24  6:44   ` Antonino A. Daplas
  2005-11-24  6:53     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Antonino A. Daplas @ 2005-11-24  6:44 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Andrew Morton, Benjamin Herrenschmidt

Benjamin Herrenschmidt wrote:
> 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.
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/4] fbdev: Convert a few drivers to use the fb_find_best_display helper
  2005-11-24  6:44   ` Antonino A. Daplas
@ 2005-11-24  6:53     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-24  6:53 UTC (permalink / raw)
  To: Antonino A. Daplas; +Cc: linux-fbdev-devel, Andrew Morton


> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-24  6:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-26 12:04 [PATCH 4/4] fbdev: Convert a few drivers to use the fb_find_best_display helper Antonino A. Daplas
2005-11-24  5:20 ` Benjamin Herrenschmidt
2005-11-24  6:44   ` Antonino A. Daplas
2005-11-24  6:53     ` Benjamin Herrenschmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.