rivafb: rix crashes on ppc
PATCH 1/1 rivafb: rix crashes on ppc
Hi,
the attached patch against 2.6.9 for rivafb:
- fixes crashes when changing video modes/switching away from X on ppc
- fixes random crashes when scrolling in e.g. vi
- improves on the NV30 support
- reintroduces noaccel (not perfect but helps a lot for debugging)
- converts MODULE_PARM to module_param
- cleans up some printks, FB_ACCELF_TEXT cruft
Most of this is taken from either XFree86 4.3 or BenH's 2.4 ppc tree. Please apply,
-- Guido
drivers/video/riva/fbdev.c +28 -20
@@ -205,6 +207,7 @@/* command line data, set in rivafb_setup() */ static int flatpanel__initdata =-1 ;/* Autodetect later */ static int forceCRTC__initdata =-1 ; +static int noaccel__initdata =0 ;#ifdef CONFIG_MTRR static int nomtrr__initdata =0 ;#endif
@@ -231,7 +234,6 @@ .activate = FB_ACTIVATE_NOW, .height = -1, .width = -1, - .accel_flags = FB_ACCELF_TEXT, .pixclock = 39721, .left_margin = 40, .right_margin = 24,
@@ -1162,9 +1166,9 @@/* vgaHWunlock() + riva unlock (0x7F) */ CRTCout (par,0x11 ,0xFF ); par->riva.LockUnlock (&par->riva,0 ); -riva_load_video_mode (info); -riva_setup_accel (info); +if (info->flags &FBINFO_HWACCEL_DISABLED ) +riva_setup_accel (info);memset_io (par->riva.CURSOR,0 ,MAX_CURS *MAX_CURS *2 ); info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >>3 ));
@@ -1670,6 +1674,13 @@ | FBINFO_HWACCEL_FILLRECT |FBINFO_HWACCEL_IMAGEBLIT |FBINFO_MISC_MODESWITCHLATE ; + +/* Accel seems to not work properly on NV30 yet...*/ +if (par->riva.Architecture ==NV_ARCH_30 || noaccel) { + printk(KERN_DEBUG PFX "disabling acceleration.\n"); + info->flags =FBINFO_HWACCEL_DISABLED ; + } + info->var = rivafb_default_var; info->fix.visual = (info->var.bits_per_pixel ==8 ) ?FB_VISUAL_PSEUDOCOLOR :FB_VISUAL_DIRECTCOLOR ;
@@ -1711,13 +1722,14 @@ pedid = (unsigned char *)get_property (dp, propnames[i],NULL );if (pedid !=NULL ) { - par->EDID = pedid; -return 1 ; + par->EDID = pedid; +NVTRACE ("LCD found.\n" ); +return 1 ; } } }NVTRACE_LEAVE (); -return 0 ; +return 0 ; }#endif /* CONFIG_PPC_OF */
@@ -1732,7 +1744,7 @@for (i = par->bus; i >=1 ; i--) {riva_probe_i2c_connector (par, i, &par->EDID);if (par->EDID) { -printk ("rivafb: Found EDID Block from BUS %i\n" , i); +printk (PFX "Found EDID Block from BUS %i\n" , i);break ; } }
@@ -1771,7 +1783,6 @@ var->bits_per_pixel =8 ;riva_update_var (var, &modedb); } - var->accel_flags |=FB_ACCELF_TEXT ;NVTRACE_LEAVE (); }
@@ -1781,10 +1792,10 @@NVTRACE_ENTER ();#ifdef CONFIG_PPC_OF if (!riva_get_EDID_OF (info, pdev)) -printk ("rivafb: could not retrieve EDID from OF\n" ); +printk (PFX "could not retrieve EDID from OF\n" );#elif CONFIG_FB_RIVA_I2C if (!riva_get_EDID_i2c (info)) -printk ("rivafb: could not retrieve EDID from DDC/I2C\n" ); +printk (PFX "could not retrieve EDID from DDC/I2C\n" );#endif NVTRACE_LEAVE (); }
@@ -1946,7 +1957,6 @@ printk(KERN_ERR PFX "cannot ioremap PRAMIN region\n"); goto err_out_free_nv3_pramin; } - rivafb_fix.accel =FB_ACCEL_NV3 ;break ;case NV_ARCH_04 :case NV_ARCH_10 :
@@ -1954,14 +1964,13 @@case NV_ARCH_30 : default_par->riva.PCRTC0 = (unsigned *)(default_par->ctrl_base +0x00600000 ); default_par->riva.PRAMIN = (unsigned *)(default_par->ctrl_base +0x00710000 ); - rivafb_fix.accel =FB_ACCEL_NV4 ;break ; } -riva_common_setup (default_par);if (default_par->riva.Architecture ==NV_ARCH_03 ) { - default_par->riva.PCRTC = default_par->riva.PCRTC0 = default_par->riva.PGRAPH; + default_par->riva.PCRTC = default_par->riva.PCRTC0 + = default_par->riva.PGRAPH; } rivafb_fix.smem_len =riva_get_memlen (default_par) *1024 ;
@@ -2115,6 +2125,8 @@#endif }else if (!strncmp (this_opt,"strictmode" ,10 )) { strictmode =1 ; + }else if (!strncmp (this_opt,"noaccel" ,7 )) { + noaccel =1 ; }else mode_option = this_opt; }
@@ -2163,19 +2175,20 @@ }module_exit (rivafb_exit); +#endif /* MODULE */ -MODULE_PARM (flatpanel,"i" ); +module_param (noaccel, bool,0 ); +MODULE_PARM_DESC (noaccel,"bool: disable acceleration" ); +module_param (flatpanel, int,-1 );MODULE_PARM_DESC (flatpanel,"Enables experimental flat panel support for some chipsets. (0 or 1=enabled) (default=0)" ); -MODULE_PARM (forceCRTC,"i" ); +module_param (forceCRTC, int,-1 );MODULE_PARM_DESC (forceCRTC,"Forces usage of a particular CRTC in case autodetection fails. (0 or 1) (default=autodetect)" ); -#ifdef CONFIG_MTRR -MODULE_PARM (nomtrr,"i" ); +module_param (nomtrr, bool,0 );MODULE_PARM_DESC (nomtrr,"Disables MTRR support (0 or 1=disabled) (default=0)" );#endif -MODULE_PARM (strictmode,"i" ); +module_param (strictmode, bool,0 );MODULE_PARM_DESC (strictmode,"Only use video modes from EDID" ); -#endif /* MODULE */ MODULE_AUTHOR ("Ani Joshi, maintainer" );MODULE_DESCRIPTION ("Framebuffer driver for nVidia Riva 128, TNT, TNT2, and the GeForce series" );
drivers/video/riva/nv_driver.c +61 -13
97 lines not on this page · raw message
drivers/video/riva/riva_hw.c +18 -7
@@ -1536,13 +1538,13 @@ chip->PMC[0x00001588 /4 ] =0 ; chip->PFB[0x00000240 /4 ] =0 ; - chip->PFB[0x00000244 /4 ] =0 ; - chip->PFB[0x00000248 /4 ] =0 ; - chip->PFB[0x0000024C /4 ] =0 ; chip->PFB[0x00000250 /4 ] =0 ; - chip->PFB[0x00000254 /4 ] =0 ; - chip->PFB[0x00000258 /4 ] =0 ; - chip->PFB[0x0000025C /4 ] =0 ; + chip->PFB[0x00000260 /4 ] =0 ; + chip->PFB[0x00000270 /4 ] =0 ; + chip->PFB[0x00000280 /4 ] =0 ; + chip->PFB[0x00000290 /4 ] =0 ; + chip->PFB[0x000002A0 /4 ] =0 ; + chip->PFB[0x000002B0 /4 ] =0 ; chip->PGRAPH[0x00000B00 /4 ] = chip->PFB[0x00000240 /4 ]; chip->PGRAPH[0x00000B04 /4 ] = chip->PFB[0x00000244 /4 ];
@@ -2067,7 +2069,8 @@#ifdef __BIG_ENDIAN/* turn on big endian register access */ - chip->PMC[0x00000004 /4 ] =0x01000001 ; +if (!(chip->PMC[0x00000004 /4 ] &0x01000001 )) + chip->PMC[0x00000004 /4 ] =0x01000001 ;#endif /*
@@ -2128,6 +2131,11 @@case 0x01F0 :case 0x0250 :case 0x0280 : +case 0x0300 : +case 0x0310 : +case 0x0320 : +case 0x0330 : +case 0x0340 :if (chip->PEXTDEV[0x0000 /4 ] & (1 <<22 )) chip->CrystalFreqKHz =27000 ;break ;
@@ -2159,6 +2167,11 @@case 0x01F0 :case 0x0250 :case 0x0280 : +case 0x0300 : +case 0x0310 : +case 0x0320 : +case 0x0330 : +case 0x0340 : chip->twoHeads = TRUE;break ;default :
drivers/video/riva/riva_hw.h +3 -1
@@ -541,8 +541,10 @@#define RIVA_FIFO_FREE (hwinst,hwptr,cnt) \ { \ - while ((hwinst).FifoFreeCount < (cnt)) \ + while ((hwinst).FifoFreeCount < (cnt)) { \ + mb();mb(); \ (hwinst).FifoFreeCount = (hwinst).hwptr->FifoFree >> 2; \ + } \ (hwinst).FifoFreeCount -= (cnt); \ }#endif /* __RIVA_HW_H__ */
Quoted 10 lines · Guido Guenther
Hi,
the attached patch against 2.6.9 for rivafb:
- fixes crashes when changing video modes/switching away from X on ppc
- fixes random crashes when scrolling in e.g. vi
- improves on the NV30 support
- reintroduces noaccel (not perfect but helps a lot for debugging)
- convertsMODULE_PARMtomodule_param
- cleans up some printks,FB_ACCELF_TEXTcruft
Most of this is taken from either XFree86 4.3 or BenH's 2.4 ppc tree. Please apply,
I shouldn't be sending out patches late, the HWACCEL_DISABLED logic was reversed, fixed here.
-- Guido
drivers/video/riva/fbdev.c +28 -24
@@ -205,6 +207,7 @@/* command line data, set in rivafb_setup() */ static int flatpanel__initdata =-1 ;/* Autodetect later */ static int forceCRTC__initdata =-1 ; +static int noaccel__initdata =0 ;#ifdef CONFIG_MTRR static int nomtrr__initdata =0 ;#endif
@@ -231,7 +234,6 @@ .activate = FB_ACTIVATE_NOW, .height = -1, .width = -1, - .accel_flags = FB_ACCELF_TEXT, .pixclock = 39721, .left_margin = 40, .right_margin = 24,
@@ -1008,8 +1010,6 @@ par->state.flags |=VGA_SAVE_CMAP ;save_vga (&par->state);#endif -riva_common_setup (par); -RivaGetConfig (&par->riva, par->Chipset);/* vgaHWunlock() + riva unlock (0x7F) */ CRTCout (par,0x11 ,0xFF ); par->riva.LockUnlock (&par->riva,0 );
@@ -1157,14 +1157,12 @@struct riva_par *par = (struct riva_par *) info->par;NVTRACE_ENTER (); -riva_common_setup (par); -RivaGetConfig (&par->riva, par->Chipset);/* vgaHWunlock() + riva unlock (0x7F) */ CRTCout (par,0x11 ,0xFF ); par->riva.LockUnlock (&par->riva,0 ); -riva_load_video_mode (info); -riva_setup_accel (info); +if (!(info->flags &FBINFO_HWACCEL_DISABLED )) +riva_setup_accel (info);memset_io (par->riva.CURSOR,0 ,MAX_CURS *MAX_CURS *2 ); info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >>3 ));
@@ -1670,6 +1668,13 @@ | FBINFO_HWACCEL_FILLRECT |FBINFO_HWACCEL_IMAGEBLIT |FBINFO_MISC_MODESWITCHLATE ; + +/* Accel seems to not work properly on NV30 yet...*/ +if ((par->riva.Architecture ==NV_ARCH_30 ) || noaccel) { + printk(KERN_DEBUG PFX "disabling acceleration\n"); + info->flags |=FBINFO_HWACCEL_DISABLED ; + } + info->var = rivafb_default_var; info->fix.visual = (info->var.bits_per_pixel ==8 ) ?FB_VISUAL_PSEUDOCOLOR :FB_VISUAL_DIRECTCOLOR ;
@@ -1711,13 +1716,14 @@ pedid = (unsigned char *)get_property (dp, propnames[i],NULL );if (pedid !=NULL ) { - par->EDID = pedid; -return 1 ; + par->EDID = pedid; +NVTRACE ("LCD found.\n" ); +return 1 ; } } }NVTRACE_LEAVE (); -return 0 ; +return 0 ; }#endif /* CONFIG_PPC_OF */
@@ -1732,7 +1738,7 @@for (i = par->bus; i >=1 ; i--) {riva_probe_i2c_connector (par, i, &par->EDID);if (par->EDID) { -printk ("rivafb: Found EDID Block from BUS %i\n" , i); +printk (PFX "Found EDID Block from BUS %i\n" , i);break ; } }
@@ -1771,7 +1777,6 @@ var->bits_per_pixel =8 ;riva_update_var (var, &modedb); } - var->accel_flags |=FB_ACCELF_TEXT ;NVTRACE_LEAVE (); }
@@ -1781,10 +1786,10 @@NVTRACE_ENTER ();#ifdef CONFIG_PPC_OF if (!riva_get_EDID_OF (info, pdev)) -printk ("rivafb: could not retrieve EDID from OF\n" ); +printk (PFX "could not retrieve EDID from OF\n" );#elif CONFIG_FB_RIVA_I2C if (!riva_get_EDID_i2c (info)) -printk ("rivafb: could not retrieve EDID from DDC/I2C\n" ); +printk (PFX "could not retrieve EDID from DDC/I2C\n" );#endif NVTRACE_LEAVE (); }
@@ -1946,7 +1951,6 @@ printk(KERN_ERR PFX "cannot ioremap PRAMIN region\n"); goto err_out_free_nv3_pramin; } - rivafb_fix.accel =FB_ACCEL_NV3 ;break ;case NV_ARCH_04 :case NV_ARCH_10 :
@@ -1954,14 +1958,13 @@case NV_ARCH_30 : default_par->riva.PCRTC0 = (unsigned *)(default_par->ctrl_base +0x00600000 ); default_par->riva.PRAMIN = (unsigned *)(default_par->ctrl_base +0x00710000 ); - rivafb_fix.accel =FB_ACCEL_NV4 ;break ; } -riva_common_setup (default_par);if (default_par->riva.Architecture ==NV_ARCH_03 ) { - default_par->riva.PCRTC = default_par->riva.PCRTC0 = default_par->riva.PGRAPH; + default_par->riva.PCRTC = default_par->riva.PCRTC0 + = default_par->riva.PGRAPH; } rivafb_fix.smem_len =riva_get_memlen (default_par) *1024 ;
@@ -2115,6 +2119,8 @@#endif }else if (!strncmp (this_opt,"strictmode" ,10 )) { strictmode =1 ; + }else if (!strncmp (this_opt,"noaccel" ,7 )) { + noaccel =1 ; }else mode_option = this_opt; }
@@ -2163,19 +2169,20 @@ }module_exit (rivafb_exit); +#endif /* MODULE */ -MODULE_PARM (flatpanel,"i" ); +module_param (noaccel, bool,0 ); +MODULE_PARM_DESC (noaccel,"bool: disable acceleration" ); +module_param (flatpanel, int,-1 );MODULE_PARM_DESC (flatpanel,"Enables experimental flat panel support for some chipsets. (0 or 1=enabled) (default=0)" ); -MODULE_PARM (forceCRTC,"i" ); +module_param (forceCRTC, int,-1 );MODULE_PARM_DESC (forceCRTC,"Forces usage of a particular CRTC in case autodetection fails. (0 or 1) (default=autodetect)" ); -#ifdef CONFIG_MTRR -MODULE_PARM (nomtrr,"i" ); +module_param (nomtrr, bool,0 );MODULE_PARM_DESC (nomtrr,"Disables MTRR support (0 or 1=disabled) (default=0)" );#endif -MODULE_PARM (strictmode,"i" ); +module_param (strictmode, bool,0 );MODULE_PARM_DESC (strictmode,"Only use video modes from EDID" ); -#endif /* MODULE */ MODULE_AUTHOR ("Ani Joshi, maintainer" );MODULE_DESCRIPTION ("Framebuffer driver for nVidia Riva 128, TNT, TNT2, and the GeForce series" );
drivers/video/riva/nv_driver.c +61 -13
97 lines not on this page · raw message
drivers/video/riva/riva_hw.c +18 -7
@@ -1536,13 +1536,13 @@ chip->PMC[0x00001588 /4 ] =0 ; chip->PFB[0x00000240 /4 ] =0 ; - chip->PFB[0x00000244 /4 ] =0 ; - chip->PFB[0x00000248 /4 ] =0 ; - chip->PFB[0x0000024C /4 ] =0 ; chip->PFB[0x00000250 /4 ] =0 ; - chip->PFB[0x00000254 /4 ] =0 ; - chip->PFB[0x00000258 /4 ] =0 ; - chip->PFB[0x0000025C /4 ] =0 ; + chip->PFB[0x00000260 /4 ] =0 ; + chip->PFB[0x00000270 /4 ] =0 ; + chip->PFB[0x00000280 /4 ] =0 ; + chip->PFB[0x00000290 /4 ] =0 ; + chip->PFB[0x000002A0 /4 ] =0 ; + chip->PFB[0x000002B0 /4 ] =0 ; chip->PGRAPH[0x00000B00 /4 ] = chip->PFB[0x00000240 /4 ]; chip->PGRAPH[0x00000B04 /4 ] = chip->PFB[0x00000244 /4 ];
@@ -2067,7 +2067,8 @@#ifdef __BIG_ENDIAN/* turn on big endian register access */ - chip->PMC[0x00000004 /4 ] =0x01000001 ; +if (!(chip->PMC[0x00000004 /4 ] &0x01000001 )) + chip->PMC[0x00000004 /4 ] =0x01000001 ;#endif /*
@@ -2128,6 +2129,11 @@case 0x01F0 :case 0x0250 :case 0x0280 : +case 0x0300 : +case 0x0310 : +case 0x0320 : +case 0x0330 : +case 0x0340 :if (chip->PEXTDEV[0x0000 /4 ] & (1 <<22 )) chip->CrystalFreqKHz =27000 ;break ;
@@ -2159,6 +2165,11 @@case 0x01F0 :case 0x0250 :case 0x0280 : +case 0x0300 : +case 0x0310 : +case 0x0320 : +case 0x0330 : +case 0x0340 : chip->twoHeads = TRUE;break ;default :
drivers/video/riva/riva_hw.h +3 -1
@@ -541,8 +541,10 @@#define RIVA_FIFO_FREE (hwinst,hwptr,cnt) \ { \ - while ((hwinst).FifoFreeCount < (cnt)) \ + while ((hwinst).FifoFreeCount < (cnt)) { \ + mb();mb(); \ (hwinst).FifoFreeCount = (hwinst).hwptr->FifoFree >> 2; \ + } \ (hwinst).FifoFreeCount -= (cnt); \ }#endif /* __RIVA_HW_H__ */
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click