From: Antonino Daplas <adaplas@pol.net>
To: Miles Lane <miles.lane@attbi.com>
Cc: James Simmons <jsimmons@infradead.org>,
Linux Fbdev development list
<linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: 2.5.51 -- rivafb is whacky (characters flipped on vertical axis, 640x480 usable area shown inside a higher-res area, etc).
Date: 12 Dec 2002 20:00:45 +0500 [thread overview]
Message-ID: <1039705243.1006.1.camel@localhost.localdomain> (raw)
In-Reply-To: <3DF6894E.3090802@attbi.com>
[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]
On Wed, 2002-12-11 at 05:39, Miles Lane wrote:
> Hi,
>
> I have tried getting rivafb to work in 2.5.51. It is much better
> than before (thanks!). It compiles and sorta works.
>
Can you test the attached patch (rivafb1.diff)? It fixes some things:
1. double ioremap/request_mem_region of the framebuffer memory. Might
cause some initialization weirdness :-)
2. riva_hw.c is outdated (no support for NV_ARCH_20) which will crash
the GeForce3's (I think I read one report of that in the kernel mailing
list).
3. Matched the initialization ordering of rivafb in linux-2.4, except
that RivaGetConfig is executed at rivafb_open().
3. Not sure if the color problem will be fixed. Miles, are you by
offchance using bpp > 8? Because setting the DAC at 8 bpp should be a
very simple matter compared with directcolor which requires some
juggling acts
Also, you mentioned that everything is okay except the characters are
mirrored in the vertical axis, is this correct? Meaning colors are fine
etc. If this is the case, try this patch also:
diff -Naur linux-2.5.51/drivers/video/riva/fbdev.c linux/drivers/video/riva/fbdev.c
--- linux-2.5.51/drivers/video/riva/fbdev.c 2002-12-12 13:59:07.000000000 +0000
+++ linux/drivers/video/riva/fbdev.c 2002-12-12 13:59:30.000000000 +0000
@@ -917,9 +917,11 @@
size = width * h;
dat = cdat;
- for (i = 0; i < size; i++) {
- *dat = byte_rev[*dat];
- dat++;
+ if (par->riva.Architecture == NV_ARCH_03) {
+ for (i = 0; i < size; i++) {
+ *dat = byte_rev[*dat];
+ dat++;
+ }
}
switch (info->var.bits_per_pixel) {
Tony
[-- Attachment #2: rivafb1.diff --]
[-- Type: text/x-patch, Size: 9901 bytes --]
diff -Naur linux-2.5.51/drivers/video/riva/fbdev.c linux/drivers/video/riva/fbdev.c
--- linux-2.5.51/drivers/video/riva/fbdev.c 2002-12-12 13:57:09.000000000 +0000
+++ linux/drivers/video/riva/fbdev.c 2002-12-12 13:58:05.000000000 +0000
@@ -916,6 +916,7 @@
size = width * h;
dat = cdat;
+
for (i = 0; i < size; i++) {
*dat = byte_rev[*dat];
dat++;
@@ -923,17 +924,11 @@
switch (info->var.bits_per_pixel) {
case 8:
- fgx = image->fg_color | ~((1 << 8) - 1);
- bgx = image->bg_color | ~((1 << 8) - 1);
+ fgx = image->fg_color;
+ bgx = image->bg_color;
break;
case 16:
- /* set alpha bit */
- if (info->var.green.length == 5) {
- fgx = 1 << 15;
- bgx = fgx;
- }
- /* Fall through... */
case 32:
fgx |= par->riva_palette[image->fg_color];
bgx |= par->riva_palette[image->bg_color];
@@ -1169,6 +1164,9 @@
save_vga(&par->state);
RivaGetConfig(&par->riva);
+ CRTCout(par, 0x11, 0xFF); /* vgaHWunlock() + riva unlock (0x7F) */
+ par->riva.LockUnlock(&par->riva, 0);
+
riva_save_state(par, &par->initial_state);
}
@@ -1554,13 +1552,14 @@
info->display_fg = NULL;
info->pseudo_palette = pseudo_palette;
- cmap_len = riva_get_cmap_len(&info->var);
- fb_alloc_cmap(&info->cmap, cmap_len, 0);
#ifndef MODULE
if (mode_option)
fb_find_mode(&info->var, info, mode_option,
NULL, 0, NULL, 8);
#endif
+ cmap_len = riva_get_cmap_len(&info->var);
+ fb_alloc_cmap(&info->cmap, cmap_len, 0);
+
return 0;
}
@@ -1713,13 +1712,6 @@
goto err_out_free_base1;
}
- info->screen_base = ioremap(rivafb_fix.smem_start,
- rivafb_fix.smem_len);
- if (!info->screen_base) {
- printk(KERN_ERR PFX "cannot ioremap FB base\n");
- goto err_out_iounmap_ctrl;
- }
-
default_par->riva.EnableIRQ = 0;
default_par->riva.PRAMDAC = (unsigned *)(default_par->ctrl_base +
0x00680000);
@@ -1744,6 +1736,25 @@
default_par->riva.IO = (MISCin(default_par) & 0x01) ? 0x3D0 : 0x3B0;
+ if (default_par->riva.Architecture == NV_ARCH_03) {
+ /*
+ * We have to map the full BASE_1 aperture for Riva128's
+ * because they use the PRAMIN set in "framebuffer" space
+ */
+ if (!request_mem_region(rivafb_fix.smem_start,
+ rivafb_fix.smem_len, "rivafb")) {
+ printk(KERN_ERR PFX "cannot reserve FB region\n");
+ goto err_out_free_base0;
+ }
+
+ info->screen_base = ioremap(rivafb_fix.smem_start,
+ rivafb_fix.smem_len);
+ if (!info->screen_base) {
+ printk(KERN_ERR PFX "cannot ioremap FB base\n");
+ goto err_out_iounmap_ctrl;
+ }
+ }
+
switch (default_par->riva.Architecture) {
case NV_ARCH_03:
default_par->riva.PRAMIN = (unsigned *)(info->screen_base +
@@ -1767,17 +1778,23 @@
info->par = default_par;
- if (!request_mem_region(rivafb_fix.smem_start,
- rivafb_fix.smem_len, "rivafb")) {
- printk(KERN_ERR PFX "cannot reserve FB region\n");
- goto err_out_free_base0;
- }
+ if (default_par->riva.Architecture != NV_ARCH_03) {
+ /*
+ * Now the _normal_ chipsets can just map the amount of
+ * real physical ram instead of the whole aperture
+ */
+ if (!request_mem_region(rivafb_fix.smem_start,
+ rivafb_fix.smem_len, "rivafb")) {
+ printk(KERN_ERR PFX "cannot reserve FB region\n");
+ goto err_out_free_base0;
+ }
- info->screen_base = ioremap(rivafb_fix.smem_start,
- rivafb_fix.smem_len);
- if (!info->screen_base) {
- printk(KERN_ERR PFX "cannot ioremap FB base\n");
- goto err_out_iounmap_ctrl;
+ info->screen_base = ioremap(rivafb_fix.smem_start,
+ rivafb_fix.smem_len);
+ if (!info->screen_base) {
+ printk(KERN_ERR PFX "cannot ioremap FB base\n");
+ goto err_out_iounmap_ctrl;
+ }
}
#ifdef CONFIG_MTRR
diff -Naur linux-2.5.51/drivers/video/riva/riva_hw.c linux/drivers/video/riva/riva_hw.c
--- linux-2.5.51/drivers/video/riva/riva_hw.c 2002-12-12 13:57:09.000000000 +0000
+++ linux/drivers/video/riva/riva_hw.c 2002-12-12 13:17:40.000000000 +0000
@@ -41,7 +41,7 @@
* GPL licensing note -- nVidia is allowing a liberal interpretation of
* the documentation restriction above, to merely say that this nVidia's
* copyright and disclaimer should be included with all code derived
- * from this source. -- Jeff Garzik <jgarzik@pobox.com>, 01/Nov/99
+ * from this source. -- Jeff Garzik <jgarzik@mandrakesoft.com>, 01/Nov/99
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.8 2000/02/08 17:19:11 dawes Exp $ */
@@ -1220,6 +1220,7 @@
state->repaint1 = hDisplaySize < 1280 ? 0x04 : 0x00;
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
nv10UpdateArbitrationSettings(VClk,
pixelDepth * 8,
&(state->arbitration0),
@@ -1285,6 +1286,7 @@
chip->Tri05 = (RivaTexturedTriangle05 *)&(chip->FIFO[0x0000E000/4]);
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
/*
* Initialize state for the RivaTriangle3D05 routines.
*/
@@ -1393,6 +1395,7 @@
chip->PGRAPH[0x0000067C/4] = state->pitch3;
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
LOAD_FIXED_STATE(nv10,PFIFO);
LOAD_FIXED_STATE(nv10,PRAMIN);
LOAD_FIXED_STATE(nv10,PGRAPH);
@@ -1421,15 +1424,31 @@
chip->Tri03 = 0L;
break;
}
- chip->PGRAPH[0x00000640/4] = state->offset0;
- chip->PGRAPH[0x00000644/4] = state->offset1;
- chip->PGRAPH[0x00000648/4] = state->offset2;
- chip->PGRAPH[0x0000064C/4] = state->offset3;
- chip->PGRAPH[0x00000670/4] = state->pitch0;
- chip->PGRAPH[0x00000674/4] = state->pitch1;
- chip->PGRAPH[0x00000678/4] = state->pitch2;
- chip->PGRAPH[0x0000067C/4] = state->pitch3;
- chip->PGRAPH[0x00000680/4] = state->pitch3;
+
+ if (chip->Architecture == NV_ARCH_10) {
+ chip->PGRAPH[0x00000640/4] = state->offset0;
+ chip->PGRAPH[0x00000644/4] = state->offset1;
+ chip->PGRAPH[0x00000648/4] = state->offset2;
+ chip->PGRAPH[0x0000064C/4] = state->offset3;
+ chip->PGRAPH[0x00000670/4] = state->pitch0;
+ chip->PGRAPH[0x00000674/4] = state->pitch1;
+ chip->PGRAPH[0x00000678/4] = state->pitch2;
+ chip->PGRAPH[0x0000067C/4] = state->pitch3;
+ chip->PGRAPH[0x00000680/4] = state->pitch3;
+ } else {
+ chip->PGRAPH[0x00000820/4] = state->offset0;
+ chip->PGRAPH[0x00000824/4] = state->offset1;
+ chip->PGRAPH[0x00000828/4] = state->offset2;
+ chip->PGRAPH[0x0000082C/4] = state->offset3;
+ chip->PGRAPH[0x00000850/4] = state->pitch0;
+ chip->PGRAPH[0x00000854/4] = state->pitch1;
+ chip->PGRAPH[0x00000858/4] = state->pitch2;
+ chip->PGRAPH[0x0000085C/4] = state->pitch3;
+ chip->PGRAPH[0x00000860/4] = state->pitch3;
+ chip->PGRAPH[0x00000864/4] = state->pitch3;
+ chip->PGRAPH[0x000009A4/4] = chip->PFB[0x00000200/4];
+ chip->PGRAPH[0x000009A8/4] = chip->PFB[0x00000204/4];
+ }
chip->PGRAPH[0x00000B00/4] = chip->PFB[0x00000240/4];
chip->PGRAPH[0x00000B04/4] = chip->PFB[0x00000244/4];
chip->PGRAPH[0x00000B08/4] = chip->PFB[0x00000248/4];
@@ -1607,6 +1626,7 @@
state->pitch3 = chip->PGRAPH[0x0000067C/4];
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
state->offset0 = chip->PGRAPH[0x00000640/4];
state->offset1 = chip->PGRAPH[0x00000644/4];
state->offset2 = chip->PGRAPH[0x00000648/4];
@@ -1970,6 +1990,7 @@
nv4GetConfig(chip);
break;
case NV_ARCH_10:
+ case NV_ARCH_20:
nv10GetConfig(chip);
break;
default:
diff -Naur linux-2.5.51/drivers/video/riva/riva_hw.h linux/drivers/video/riva/riva_hw.h
--- linux-2.5.51/drivers/video/riva/riva_hw.h 2002-12-12 13:57:09.000000000 +0000
+++ linux/drivers/video/riva/riva_hw.h 2002-12-12 13:17:42.000000000 +0000
@@ -41,7 +41,7 @@
* GPL licensing note -- nVidia is allowing a liberal interpretation of
* the documentation restriction above, to merely say that this nVidia's
* copyright and disclaimer should be included with all code derived
- * from this source. -- Jeff Garzik <jgarzik@pobox.com>, 01/Nov/99
+ * from this source. -- Jeff Garzik <jgarzik@mandrakesoft.com>, 01/Nov/99
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.6 2000/02/08 17:19:12 dawes Exp $ */
@@ -75,6 +75,7 @@
#define NV_ARCH_04 0x04
#define NV_ARCH_10 0x10
#define NV_ARCH_20 0x20
+
/***************************************************************************\
* *
* FIFO registers. *
diff -Naur linux-2.5.51/drivers/video/riva/riva_tbl.h linux/drivers/video/riva/riva_tbl.h
--- linux-2.5.51/drivers/video/riva/riva_tbl.h 2002-12-12 13:57:09.000000000 +0000
+++ linux/drivers/video/riva/riva_tbl.h 2002-12-12 13:17:42.000000000 +0000
@@ -41,7 +41,7 @@
* GPL licensing note -- nVidia is allowing a liberal interpretation of
* the documentation restriction above, to merely say that this nVidia's
* copyright and disclaimer should be included with all code derived
- * from this source. -- Jeff Garzik <jgarzik@pobox.com>, 01/Nov/99
+ * from this source. -- Jeff Garzik <jgarzik@mandrakesoft.com>, 01/Nov/99
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.5 2000/02/08 17:19:12 dawes Exp $ */
next prev parent reply other threads:[~2002-12-12 12:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-11 0:39 2.5.51 -- rivafb is whacky (characters flipped on vertical axis, 640x480 usable area shown inside a higher-res area, etc) Miles Lane
2002-12-11 5:47 ` James Simmons
2002-12-11 6:10 ` Miles Lane
2002-12-11 15:06 ` James Simmons
2002-12-11 12:49 ` Antonino Daplas
2002-12-11 16:05 ` Miles Lane
2002-12-12 15:00 ` Antonino Daplas [this message]
2002-12-13 5:09 ` James Simmons
2002-12-13 9:34 ` Antonino Daplas
2002-12-13 6:55 ` Miles Lane
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=1039705243.1006.1.camel@localhost.localdomain \
--to=adaplas@pol.net \
--cc=jsimmons@infradead.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=miles.lane@attbi.com \
/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 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.