linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antonino Daplas <adaplas@pol.net>
To: James Simmons <jsimmons@infradead.org>
Cc: Linux Fbdev development list
	<linux-fbdev-devel@lists.sourceforge.net>,
	Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [Linux-fbdev-devel] [RFC][PATCH][FBDEV]: Setting fbcon's windows size
Date: 07 Jan 2003 12:23:30 +0800	[thread overview]
Message-ID: <1041910441.1032.64.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44.0301062215250.491-100000@phoenix.infradead.org>

On Tue, 2003-01-07 at 06:27, James Simmons wrote:

> 
> > This approach has one major problem though.  In the 2.4 interface, we
> > have fbset that basically "assists" fbdev with the changes.  The fbset
> > utility will fill up fb_var_screeninfo with correct information such as
> > video timings from /etc/fb.modes.  
> 
> I neved like the idea of fb.modes. We should be asking the hardware are 
> selves instead.Yes there are cases of really old hardware that lack this. 
> I think the below code will be usefull for these cases.
>  
That's true.  The VBEInfoBlock struct contains a far pointer to a list
of video modes supported, standard VESA DMT modes and OEM-specific
modes.  This is function 0x4F00 of VBE which unfortunately is accessible
only in 16-bit mode.  Maybe the EDID block also contains such
information?

Also, if the user wants to control the refresh rate, or use nonstandard
video modes, there's no choice but to have the timings generated even
for new hardware.  That's where the GTF is useful.

> > So, what's needed is a function that calculates timing parameters which
> > is generic enough to work with the most common monitors.  One solution
> > is to use VESA's GTF (Generalized Timing Formula).  Attached is a patch
> > that implements the formula.
> 
> Great!!!!
> 
> > The timings generated by GTF are different from the standard VESA
> > timings (DMT).  However, it should work for GTF compliant monitors and
> > is also specifically formulated to work with older monitors as well. 
> > Another advantage is that it can calculate the timings for any video
> > mode. It may not work for proprietary displays or TV displays.
> > 
> > One requirement of the GTF is that the monitor specs must be known, ie
> > info->monspecs must be valid.  This can be filled up several ways:
> > 
> > 1. VBE/DDC and EDID parsing (I see the beginnings of it already in
> > fbmon.c)
> 
> Yeap. We can parse the EDID block for data about the limits of your 
> monitor!!! 
> 
> > 2. entered as a boot/module option
> 
> Yuck! But I don't see much of a choose for modular drivers.

We do need to have the monitor's operational limits uploaded whatever
way and as early as possible so the user can boot to a high resolution
immediately.  Using VBE/DDC and parsing the EDID block may not work with
new, but cheap monitors.  I have one such monitor that is supposed to
support DDC2 but spits out a useless EDID block.  So passing it as a
boot option may be useful.  This is similar to XFree86 falling back to
/etc/X11/XF86Config's 'HorizSync' and 'VertRefresh' when the EDID info
is not available.

>  
> > 3. ?ioctl to upload monitor info to fbdev.
> > 
> > (As a side note, should we also add pixclock_min and pixclock_max to
> > info->monspecs?).
> 
> ioctl already exist for this. The only issue is fb_monspec good enough for 
> our needs.
> 
What's the ioctl by the way?

The GTF only requires xres, yres and one of the three:

horizontal scan rate
vertical refresh rate
pixelclock.

in order to generate timings. So adding minimum and maximum pixelclock
fields in info->monspecs will be useful.  Otherwise the GTF may generate
a pixelclock that is outside the graphics card's/monitor's capability. 

Secondly, the GTF function assumes the following:

hsync_len = 8% of htotal
left_margin = 1/2 of inactive frame length
right margin = remainder of htotal

vsync_len = 3
lower_margin = 1
upper margin = remainder of vtotal.

Anyway, the most critical part when computing timings information is the
inactive frame length (htotal - xres, vtotal - yres), which is hblank
and vblank in the fb_get_mode() function.

Finally, some of the fixed numbers I used in the GTF function is
supposedly for a monitor with US specifications:

#define FLYBACK                     550
#define V_FRONTPORCH                1
#define H_OFFSET                    40
#define H_SCALEFACTOR               20
#define H_BLANKSCALE                128
#define H_GRADIENT                  600

I'm not even sure about the meaning of some of them :-). We can add them
in the future if the above assumptions need to be changed.

Tony

PS:  The GTF patch is erroneous.  hfmin and hfmax must be in Hz and the 
boolean logic is incorrect.

diff -Naur linux-2.5.54/drivers/video/modedb.c linux/drivers/video/modedb.c
--- linux-2.5.54/drivers/video/modedb.c	2003-01-06 13:34:50.000000000 +0000
+++ linux/drivers/video/modedb.c	2003-01-07 03:29:59.000000000 +0000
@@ -547,10 +547,10 @@
 	 * If monspecs are invalid, use values that are enough
 	 * for 640x480@60
 	 */
-	if ((!info->monspecs.hfmax && !info->monspecs.vfmax) ||
+	if (!info->monspecs.hfmax || !info->monspecs.vfmax ||
 	    info->monspecs.hfmax < info->monspecs.hfmin ||
 	    info->monspecs.vfmax < info->monspecs.vfmin) {
-		hfmin = 29; hfmax = 30;
+		hfmin = 29000; hfmax = 30000;
 		vfmin = 60; vfmax = 60;
 	} else {
 		hfmin = info->monspecs.hfmin;
@@ -628,10 +628,10 @@
 	 * If monspecs are invalid, use values that are enough
 	 * for 640x480@60
 	 */
-	if ((!info->monspecs.hfmax && !info->monspecs.vfmax) ||
+	if (!info->monspecs.hfmax || !info->monspecs.vfmax ||
 	    info->monspecs.hfmax < info->monspecs.hfmin ||
 	    info->monspecs.vfmax < info->monspecs.vfmin) {
-		hfmin = 29; hfmax = 30;
+		hfmin = 29000; hfmax = 30000;
 		vfmin = 60; vfmax = 60;
 	} else {
 		hfmin = info->monspecs.hfmin;

  reply	other threads:[~2003-01-07  4:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-06 14:54 [RFC][PATCH][FBDEV]: Setting fbcon's windows size Antonino Daplas
2003-01-06 22:27 ` [Linux-fbdev-devel] " James Simmons
2003-01-07  4:23   ` Antonino Daplas [this message]
2003-01-08  5:02 ` Antonino Daplas
2003-01-10 18:18   ` James Simmons
2003-01-11  5:10     ` [Linux-fbdev-devel] " Antonino Daplas
2003-01-10 15:38 ` Antonino Daplas
2003-01-11  0:00   ` James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1041910441.1032.64.camel@localhost.localdomain \
    --to=adaplas@pol.net \
    --cc=jsimmons@infradead.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).