diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-11-07 04:00:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:49 -0500 |
commit | b8c49ef6aeef662e7920435012be8c2ecc41c30d (patch) | |
tree | 4a79124a75fbb9132bb911a5a5cb31b0efa15687 /drivers/video/nvidia/nvidia.c | |
parent | 7f8c54d20b258acf291dd4490b0e22fa10b2a17f (diff) |
[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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Antonino A. Daplas" <adaplas@hotpop.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/nvidia/nvidia.c')
-rw-r--r-- | drivers/video/nvidia/nvidia.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index 96d51144094a..691151e2bce3 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -411,6 +411,7 @@ MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl); | |||
411 | 411 | ||
412 | /* command line data, set in nvidiafb_setup() */ | 412 | /* command line data, set in nvidiafb_setup() */ |
413 | static int flatpanel __devinitdata = -1; /* Autodetect later */ | 413 | static int flatpanel __devinitdata = -1; /* Autodetect later */ |
414 | static int fpdither __devinitdata = -1; | ||
414 | static int forceCRTC __devinitdata = -1; | 415 | static int forceCRTC __devinitdata = -1; |
415 | static int hwcur __devinitdata = 0; | 416 | static int hwcur __devinitdata = 0; |
416 | static int noaccel __devinitdata = 0; | 417 | static int noaccel __devinitdata = 0; |
@@ -1026,10 +1027,19 @@ static int nvidiafb_set_par(struct fb_info *info) | |||
1026 | NVTRACE_ENTER(); | 1027 | NVTRACE_ENTER(); |
1027 | 1028 | ||
1028 | NVLockUnlock(par, 1); | 1029 | NVLockUnlock(par, 1); |
1029 | if (!par->FlatPanel || (info->var.bits_per_pixel != 24) || | 1030 | if (!par->FlatPanel || !par->twoHeads) |
1030 | !par->twoHeads) | ||
1031 | par->FPDither = 0; | 1031 | par->FPDither = 0; |
1032 | 1032 | ||
1033 | if (par->FPDither < 0) { | ||
1034 | if ((par->Chipset & 0x0ff0) == 0x0110) | ||
1035 | par->FPDither = !!(NV_RD32(par->PRAMDAC, 0x0528) | ||
1036 | & 0x00010000); | ||
1037 | else | ||
1038 | par->FPDither = !!(NV_RD32(par->PRAMDAC, 0x083C) & 1); | ||
1039 | printk(KERN_INFO PFX "Flat panel dithering %s\n", | ||
1040 | par->FPDither ? "enabled" : "disabled"); | ||
1041 | } | ||
1042 | |||
1033 | info->fix.visual = (info->var.bits_per_pixel == 8) ? | 1043 | info->fix.visual = (info->var.bits_per_pixel == 8) ? |
1034 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; | 1044 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; |
1035 | 1045 | ||
@@ -1548,9 +1558,9 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1548 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); | 1558 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); |
1549 | 1559 | ||
1550 | par->FlatPanel = flatpanel; | 1560 | par->FlatPanel = flatpanel; |
1551 | |||
1552 | if (flatpanel == 1) | 1561 | if (flatpanel == 1) |
1553 | printk(KERN_INFO PFX "flatpanel support enabled\n"); | 1562 | printk(KERN_INFO PFX "flatpanel support enabled\n"); |
1563 | par->FPDither = fpdither; | ||
1554 | 1564 | ||
1555 | par->CRTCnumber = forceCRTC; | 1565 | par->CRTCnumber = forceCRTC; |
1556 | par->FpScale = (!noscale); | 1566 | par->FpScale = (!noscale); |
@@ -1729,6 +1739,8 @@ static int __devinit nvidiafb_setup(char *options) | |||
1729 | } else if (!strncmp(this_opt, "nomtrr", 6)) { | 1739 | } else if (!strncmp(this_opt, "nomtrr", 6)) { |
1730 | nomtrr = 1; | 1740 | nomtrr = 1; |
1731 | #endif | 1741 | #endif |
1742 | } else if (!strncmp(this_opt, "fpdither:", 9)) { | ||
1743 | fpdither = simple_strtol(this_opt+9, NULL, 0); | ||
1732 | } else | 1744 | } else |
1733 | mode_option = this_opt; | 1745 | mode_option = this_opt; |
1734 | } | 1746 | } |
@@ -1775,7 +1787,11 @@ module_exit(nvidiafb_exit); | |||
1775 | module_param(flatpanel, int, 0); | 1787 | module_param(flatpanel, int, 0); |
1776 | MODULE_PARM_DESC(flatpanel, | 1788 | MODULE_PARM_DESC(flatpanel, |
1777 | "Enables experimental flat panel support for some chipsets. " | 1789 | "Enables experimental flat panel support for some chipsets. " |
1778 | "(0 or 1=enabled) (default=0)"); | 1790 | "(0=disabled, 1=enabled, -1=autodetect) (default=-1)"); |
1791 | module_param(fpdither, int, 0); | ||
1792 | MODULE_PARM_DESC(fpdither, | ||
1793 | "Enables dithering of flat panel for 6 bits panels. " | ||
1794 | "(0=disabled, 1=enabled, -1=autodetect) (default=-1)"); | ||
1779 | module_param(hwcur, int, 0); | 1795 | module_param(hwcur, int, 0); |
1780 | MODULE_PARM_DESC(hwcur, | 1796 | MODULE_PARM_DESC(hwcur, |
1781 | "Enables hardware cursor implementation. (0 or 1=enabled) " | 1797 | "Enables hardware cursor implementation. (0 or 1=enabled) " |