From: Michal Januszewski <spock@gentoo.org> Date: 2005-10-09 09:29:54
Currently the fb_find_nearest_mode() function finds a mode with
screen resolution closest to that described by the 'var' argument
and with some arbitrary refresh rate (eg. in the following sequence
of refresh rates: 70 60 53 85 75, 53 is selected).
This patch fixes the function so that it looks for the closest mode as
far as both resolution and refresh rate are concerned. The function's
first argument is changed to fb_videomode so that the refresh rate can
be specified by the caller, as fb_var_screeninfo doesn't have any fields
that could directly hold this data.
Signed-off-by: Michal Januszewski <spock@gentoo.org>
---
diff -Nurp fbdev-orig/drivers/video/console/fbcon.c fbdev/drivers/video/console/fbcon.c
From: "Antonino A. Daplas" <adaplas@gmail.com> Date: 2005-10-10 08:22:32
Michal Januszewski wrote:
Currently the fb_find_nearest_mode() function finds a mode with
screen resolution closest to that described by the 'var' argument
and with some arbitrary refresh rate (eg. in the following sequence
of refresh rates: 70 60 53 85 75, 53 is selected).
This patch fixes the function so that it looks for the closest mode as
far as both resolution and refresh rate are concerned. The function's
first argument is changed to fb_videomode so that the refresh rate can
be specified by the caller, as fb_var_screeninfo doesn't have any fields
that could directly hold this data.
I like it. I always wanted to fix this but I keep on forgetting :-)
quoted hunk
Signed-off-by: Michal Januszewski <spock@gentoo.org>
---
diff -Nurp fbdev-orig/drivers/video/console/fbcon.c fbdev/drivers/video/console/fbcon.c
Any reason why you need to set mode->refresh to 0?
Tony
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Any reason why you need to set mode->refresh to 0?
This is something I had to use in a driver I'm currently working on and
I thought it might be a good idea to include it in the patch I sent.
The thing is, if the var struct has the pixclock field set to 0,
mode->refresh is left untouched, which could mean that it's either
set to a random value or to an invalid refresh rate coming from a
previously processed videomode (in case the fb_videomode struct is
reused).
I actually dealt with modes with var->pixclock == 0, and it always resulted
in a getting U:<xres>x<yres>-<random> in /sys/class/graphics/fb0/modes.
In case you're wondering why would anyone ever need to have
var->pixclock set to 0 -- I was using it to denote modes with a default
refresh rate set by the hardware (well, the Video BIOS to be more
specific). Please let me know is this is very wrong, but I just didn't
see any other way of doing it.
--
Michal Januszewski Gentoo Linux Developer
cell: +48504917690 http://dev.gentoo.org/~spock/
JID: spock@im.gentoo.org freenode: #gentoo-dev, #gentoo-pl
Any reason why you need to set mode->refresh to 0?
This is something I had to use in a driver I'm currently working on and
I thought it might be a good idea to include it in the patch I sent.
The thing is, if the var struct has the pixclock field set to 0,
mode->refresh is left untouched, which could mean that it's either
set to a random value or to an invalid refresh rate coming from a
previously processed videomode (in case the fb_videomode struct is
reused).
Ok.
I actually dealt with modes with var->pixclock == 0, and it always resulted
in a getting U:<xres>x<yres>-<random> in /sys/class/graphics/fb0/modes.
In case you're wondering why would anyone ever need to have
var->pixclock set to 0 -- I was using it to denote modes with a default
refresh rate set by the hardware (well, the Video BIOS to be more
specific). Please let me know is this is very wrong, but I just didn't
see any other way of doing it.
No, it's not wrong. But it is preferrable to have a nonzero value in
var->pixclock (whether calculated or via a VBE function call).
Still, I agree with you to initialize mode->refresh to zero (or perhaps
-1 to to denote a divide by zero) for these cases.
Tony
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
From: Michal Januszewski <spock@gentoo.org> Date: 2005-10-14 15:04:27
On Fri, Oct 14, 2005 at 08:18:08AM +0800, Antonino A. Daplas wrote:
quoted
In case you're wondering why would anyone ever need to have
var->pixclock set to 0 -- I was using it to denote modes with a default
refresh rate set by the hardware (well, the Video BIOS to be more
specific). Please let me know is this is very wrong, but I just didn't
see any other way of doing it.
No, it's not wrong. But it is preferrable to have a nonzero value in
var->pixclock (whether calculated or via a VBE function call).
Still, I agree with you to initialize mode->refresh to zero (or perhaps
-1 to to denote a divide by zero) for these cases.
OK, nice. I'd say that 0 might be a little cleaner (we're avoiding
<nn>x<nn>-4294967295 entries in the sysfs nodes without having to
write any additional code). Also, no one should be dividing anything by
mode->refresh without checking its contents first, so having a zero
there doesn't seem like something dangerous. But, ultimately it's
up to you to decide, of course.
--
Michal Januszewski Gentoo Linux Developer
cell: +48504917690 http://dev.gentoo.org/~spock/
JID: spock@im.gentoo.org freenode: #gentoo-dev, #gentoo-pl