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 , 01/Nov/99 + * from this source. -- Jeff Garzik , 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 , 01/Nov/99 + * from this source. -- Jeff Garzik , 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 , 01/Nov/99 + * from this source. -- Jeff Garzik , 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 $ */