linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tony" <adaplas@hotpop.com>
To: kronos@kronoz.cjb.net, James Simmons <jsimmons@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Jon Smirl <jonsmirl@yahoo.com>,
	Linux Fbdev development list
	<linux-fbdev-devel@lists.sourceforge.net>
Subject: RE: Re: New radeonfb, mostly untested
Date: Mon, 15 Sep 2003 08:56:07 +0800	[thread overview]
Message-ID: <000801c37b24$257b9100$ba17b1cb@bom> (raw)
In-Reply-To: <20030914173137.GA2971@dreamland.darkstar.lan>

> 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();
> }
>

The bug may actually be in the following code:

static int get_std_timing(unsigned char *block, struct fb_videomode
*mode)
{
	int xres, yres = 0, refresh, ratio, i;

	xres = (block[0] + 31) * 8;
	if (xres <= 256)
		return 0;

 	ratio = (block[1] & 0xc0) >> 6;
 	switch (ratio) {
	case 0:
		yres = xres;
 		break;
	case 1:
		yres = (xres * 3)/4;
		break;
 	case 2:
 		yres = (xres * 4)/5;
		break;j
	case 3:
 		yres = (xres * 9)/16;
		break;
	}
	refresh = (block[1] & 0x3f) + 60;

 	for (i = 0; i < VESA_MODEDB_SIZE; i++) {
		if (vesa_modes[i].xres == xres &&
		    vesa_modes[i].yres == yres &&
 		    vesa_modes[i].refresh == refresh) {
 			*mode = vesa_modes[i];
			break;
 		} else {
			calc_mode_timings(xres, yres, refresh, mode);
			break;
 		}
 	}
	return 1;
}
----------------------------------

Maybe you can replace it with this:

static int get_std_timing(unsigned char *block, struct fb_videomode
*mode)
{
	int xres, yres = 0, refresh, ratio, i, j = 0;

	xres = (block[0] + 31) * 8;
	if (xres <= 256)
		return 0;

 	ratio = (block[1] & 0xc0) >> 6;
 	switch (ratio) {
	case 0:
		yres = xres;
 		break;
	case 1:
		yres = (xres * 3)/4;
		break;
 	case 2:
 		yres = (xres * 4)/5;
		break;j
	case 3:
 		yres = (xres * 9)/16;
		break;
	}
	refresh = (block[1] & 0x3f) + 60;

	/* First find standard mode from the table of VESA modes */
 	for (i = 0; i < VESA_MODEDB_SIZE; i++) {
		if (vesa_modes[i].xres == xres &&
		    vesa_modes[i].yres == yres &&
 		    vesa_modes[i].refresh == refresh) {
 			*mode = vesa_modes[i];
			j = 1;
			break;
 		}
	}

	/* If mode is not found in table, calculate using GTF */
	if (!j)
		calc_mode_timings(xres, yres, refresh, mode);

	return 1;
}

Tony




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

  parent reply	other threads:[~2003-09-15  0:46 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-07 16:37 New radeonfb, mostly untested Benjamin Herrenschmidt
2003-09-07 17:48 ` Kronos
2003-09-07 18:23   ` Benjamin Herrenschmidt
2003-09-07 18:43     ` Kronos
2003-09-07 18:49       ` Benjamin Herrenschmidt
2003-09-09 17:18         ` James Simmons
2003-09-09 17:54           ` Kronos
2003-09-09 18:13             ` Benjamin Herrenschmidt
2003-09-09 19:24               ` Kronos
2003-09-09 19:37                 ` Benjamin Herrenschmidt
2003-09-09 20:45                   ` Kronos
2003-09-09 21:07                     ` Benjamin Herrenschmidt
2003-09-09 21:52                       ` Kronos
2003-09-09 22:08                         ` Kronos
2003-09-12 17:44                           ` James Simmons
2003-09-12 17:48                     ` James Simmons
2003-09-12 22:47                       ` Kronos
2003-09-09 20:59                   ` Geert Uytterhoeven
2003-09-12 17:46                     ` James Simmons
2003-09-07 23:03 ` Kronos
2003-09-08  6:06   ` Benjamin Herrenschmidt
2003-09-08 19:05     ` Kronos
2003-09-10 16:41       ` Kronos
2003-09-10 16:48         ` Benjamin Herrenschmidt
2003-09-10 17:46           ` Kronos
2003-09-10 17:50             ` Benjamin Herrenschmidt
2003-09-10 18:41               ` Kronos
2003-09-10 21:27               ` Kronos
2003-09-10 21:32                 ` Benjamin Herrenschmidt
2003-09-12 17:43                   ` James Simmons
2003-09-12 19:36                     ` Kronos
2003-09-12 22:20                       ` James Simmons
2003-09-12 22:45                         ` Kronos
2003-09-14 17:31                         ` Kronos
2003-09-14 17:46                           ` Benjamin Herrenschmidt
2003-09-14 18:59                             ` Kronos
2003-09-15  0:56                           ` Tony [this message]
2003-09-15 16:00                             ` Kronos
2003-09-14 23:59                 ` Tony
2003-09-15 15:55                   ` Kronos
2003-09-11  6:03           ` Geert Uytterhoeven
2003-09-11  6:38             ` Benjamin Herrenschmidt
2003-09-11  6:55               ` Geert Uytterhoeven
2003-09-11  7:05                 ` Benjamin Herrenschmidt
2003-09-12 17:25                   ` 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='000801c37b24$257b9100$ba17b1cb@bom' \
    --to=adaplas@hotpop.com \
    --cc=benh@kernel.crashing.org \
    --cc=jonsmirl@yahoo.com \
    --cc=jsimmons@infradead.org \
    --cc=kronos@kronoz.cjb.net \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /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).