Re: Re: New radeonfb, mostly untested

From
Kronos <hidden>
Date
2003-09-14 17:33:10
Reply to
James Simmons, 2003-09-12
Il Fri, Sep 12, 2003 at 11:20:13PM +0100, James Simmons ha scritto: 
quoted
Also, modes  from fb_get_mode  are different from  XFree modes  so every
time I switch from console to X I have to re-center the screen.

This happens only when modedb is created from edid, not when using the
standard modedb.

Currently create_modedb is unused (the new radeon driver is the first
user of edid stuff) so we may be hitting a real bug.
Sounds like bugs in the code. The code was never tested before.
Look at this:

bc 1.05
Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation,
Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
xres=1280
yres=1024
refresh=60
hactive=xres
vactive=yres
vfreq=refresh
divisor = (1000000 - (vfreq * 550))/1000
hfreq = (yres + 1) * vfreq  * 1000;
hfreq=hfreq/divisor
c_val = (((40-20) * 128)/256 + 20)*1000
m_val = (128 * 600)/256
m_val = (m_val * 1000000)/hfreq;
duty_cycle = c_val - m_val;
hblank = (xres * duty_cycle)/(100000 - duty_cycle);
htotal = hactive+hblank
hsync_len = (htotal * 8)/100
hsync_len
137
hblank
433
duty_cycle
25283

hsync_len should be 112, so:

htotal = (112 * 100)/8
htotal
1400
hblank = htotal - hactive
hblank
120
duty_cycle = (hblank*100000 - xres)/(hblank + 1)
duty_cycle
99162

duty_cycle calculated by from fb_get_hblank_by_hfreq) is 25283
duty_cycle reversed from EDID detailed timing is 99162

I just downloaded GTF_V1R1.xls from vesa.org, now I'm downloading
gnumeric...

Until we find the bug we can change calc_mode_timings in this way:

void calc_mode_timings(int xres, int yres, int refresh, struct fb_videomode *mode)
{
        int dbsize = sizeof(modedb)/sizeof(modedb[0]);
        struct fb_videomode *cur;
        int i;

        for (i = 0; i < dbsize; i++) {
                cur = &modedb[i];

                if (cur->xres == xres && cur->yres == yres &&
                                     cur->refreh == refresh) {
                        /* Yeah */
                        mode->xres = xres;
                        mode->yres = yres;
                        mode->pixclock = cur->pixclock;
                        mode->refresh = refresh;
                        mode->left_margin = cur->left_margin;
                        mode->right_margin = cur->right_margin;
                        mode->upper_margin = cur->upper_margin;
                        mode->lower_margin = cur->lower_margin;
                        mode->hsync_len = cur->hsync_len;
                        mode->vsync_len = cur->vsync_len;
                        mode->vmode = cur->vmode;
                        mode->sync = cur->sync;

                        return;
                }
        }

        BUG();
}

Luca
-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
Not an editor command: Wq


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Thread (45 messages) 45 messages, 5 authors, 2003-09-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help