nvidiafb: Add flat panel dither support
PATCH 1/1 nvidiafb: Add flat panel dither support
nvidiafb didn't fully hook-up the code it borrowed from X for doing flat panel dithering (this is useful for 6 bits panels). This adds a driver option to force it, and by default "reads" the current value from the chip to get the firmware setting. It significantly improves the quality of images on the iMac G5 I have here (though the X driver doesn't yet "read" the current value and defaults to 0, so you have to add Option "FBDither" "true" to your X config file to get that, I'll try to fix X.org to "read" the default unless specified asap).
drivers/video/nvidia/nvidia.c +20 -4
@@ -403,6 +403,7 @@/* command line data, set in nvidiafb_setup() */ static int flatpanel__devinitdata =-1 ;/* Autodetect later */ +static int fpdither__devinitdata =-1 ;static int forceCRTC__devinitdata =-1 ;static int hwcur__devinitdata =0 ;static int noaccel__devinitdata =0 ;
@@ -1018,10 +1019,19 @@NVTRACE_ENTER ();NVLockUnlock (par,1 ); -if (!par->FlatPanel || (info->var.bits_per_pixel !=24 ) || - !par->twoHeads) +if (!par->FlatPanel || !par->twoHeads) par->FPDither =0 ; +if (par->FPDither <0 ) { +if ((par->Chipset &0x0ff0 ) ==0x0110 ) + par->FPDither = !!(NV_RD32 (par->PRAMDAC,0x0528 ) + &0x00010000 ); +else + par->FPDither = !!(NV_RD32 (par->PRAMDAC,0x083C ) &1 ); + printk(KERN_INFO PFX "Flat panel dithering %s\n", + par->FPDither ? "enabled" : "disabled"); + } + info->fix.visual = (info->var.bits_per_pixel ==8 ) ?FB_VISUAL_PSEUDOCOLOR :FB_VISUAL_DIRECTCOLOR ;
@@ -1540,9 +1550,9 @@sprintf (nvidiafb_fix.id,"NV%x" , (pd->device &0x0ff0 ) >>4 ); par->FlatPanel = flatpanel; -if (flatpanel ==1 ) printk(KERN_INFO PFX "flatpanel support enabled\n"); + par->FPDither = fpdither; par->CRTCnumber = forceCRTC; par->FpScale = (!noscale);
@@ -1721,6 +1731,8 @@ } else if (!strncmp(this_opt, "nomtrr", 6)) { nomtrr =1 ;#endif + }else if (!strncmp (this_opt,"fpdither:" ,9 )) { + fpdither =simple_strtol (this_opt+9 ,NULL ,0 ); }else mode_option = this_opt; }
@@ -1767,7 +1779,11 @@module_param (flatpanel, int,0 );MODULE_PARM_DESC (flatpanel,"Enables experimental flat panel support for some chipsets. " -"(0 or 1=enabled) (default=0)" ); +"(0=disabled, 1=enabled, -1=autodetect) (default=-1)" ); +module_param (fpdither, int,0 ); +MODULE_PARM_DESC (fpdither, +"Enables dithering of flat panel for 6 bits panels. " +"(0=disabled, 1=enabled, -1=autodetect) (default=-1)" );module_param (hwcur, int,0 );MODULE_PARM_DESC (hwcur, "Enables hardware cursor implementation. (0 or 1=enabled) "
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl