Commit b8c49ef6 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] 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).
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Antonino A. Daplas" <adaplas@hotpop.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7f8c54d2
...@@ -411,6 +411,7 @@ MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl); ...@@ -411,6 +411,7 @@ MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl);
/* command line data, set in nvidiafb_setup() */ /* command line data, set in nvidiafb_setup() */
static int flatpanel __devinitdata = -1; /* Autodetect later */ static int flatpanel __devinitdata = -1; /* Autodetect later */
static int fpdither __devinitdata = -1;
static int forceCRTC __devinitdata = -1; static int forceCRTC __devinitdata = -1;
static int hwcur __devinitdata = 0; static int hwcur __devinitdata = 0;
static int noaccel __devinitdata = 0; static int noaccel __devinitdata = 0;
...@@ -1026,10 +1027,19 @@ static int nvidiafb_set_par(struct fb_info *info) ...@@ -1026,10 +1027,19 @@ static int nvidiafb_set_par(struct fb_info *info)
NVTRACE_ENTER(); NVTRACE_ENTER();
NVLockUnlock(par, 1); NVLockUnlock(par, 1);
if (!par->FlatPanel || (info->var.bits_per_pixel != 24) || if (!par->FlatPanel || !par->twoHeads)
!par->twoHeads)
par->FPDither = 0; 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) ? info->fix.visual = (info->var.bits_per_pixel == 8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
...@@ -1548,9 +1558,9 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, ...@@ -1548,9 +1558,9 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
par->FlatPanel = flatpanel; par->FlatPanel = flatpanel;
if (flatpanel == 1) if (flatpanel == 1)
printk(KERN_INFO PFX "flatpanel support enabled\n"); printk(KERN_INFO PFX "flatpanel support enabled\n");
par->FPDither = fpdither;
par->CRTCnumber = forceCRTC; par->CRTCnumber = forceCRTC;
par->FpScale = (!noscale); par->FpScale = (!noscale);
...@@ -1729,6 +1739,8 @@ static int __devinit nvidiafb_setup(char *options) ...@@ -1729,6 +1739,8 @@ static int __devinit nvidiafb_setup(char *options)
} else if (!strncmp(this_opt, "nomtrr", 6)) { } else if (!strncmp(this_opt, "nomtrr", 6)) {
nomtrr = 1; nomtrr = 1;
#endif #endif
} else if (!strncmp(this_opt, "fpdither:", 9)) {
fpdither = simple_strtol(this_opt+9, NULL, 0);
} else } else
mode_option = this_opt; mode_option = this_opt;
} }
...@@ -1775,7 +1787,11 @@ module_exit(nvidiafb_exit); ...@@ -1775,7 +1787,11 @@ module_exit(nvidiafb_exit);
module_param(flatpanel, int, 0); module_param(flatpanel, int, 0);
MODULE_PARM_DESC(flatpanel, MODULE_PARM_DESC(flatpanel,
"Enables experimental flat panel support for some chipsets. " "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_param(hwcur, int, 0);
MODULE_PARM_DESC(hwcur, MODULE_PARM_DESC(hwcur,
"Enables hardware cursor implementation. (0 or 1=enabled) " "Enables hardware cursor implementation. (0 or 1=enabled) "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment