Commit b8c49ef6aeef662e7920435012be8c2ecc41c30d
Committed by
Linus Torvalds
1 parent
7f8c54d20b
Exists in
master
and in
7 other branches
[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>
Showing 1 changed file with 20 additions and 4 deletions Side-by-side Diff
drivers/video/nvidia/nvidia.c
... | ... | @@ -411,6 +411,7 @@ |
411 | 411 | |
412 | 412 | /* command line data, set in nvidiafb_setup() */ |
413 | 413 | static int flatpanel __devinitdata = -1; /* Autodetect later */ |
414 | +static int fpdither __devinitdata = -1; | |
414 | 415 | static int forceCRTC __devinitdata = -1; |
415 | 416 | static int hwcur __devinitdata = 0; |
416 | 417 | static int noaccel __devinitdata = 0; |
417 | 418 | |
... | ... | @@ -1026,10 +1027,19 @@ |
1026 | 1027 | NVTRACE_ENTER(); |
1027 | 1028 | |
1028 | 1029 | NVLockUnlock(par, 1); |
1029 | - if (!par->FlatPanel || (info->var.bits_per_pixel != 24) || | |
1030 | - !par->twoHeads) | |
1030 | + if (!par->FlatPanel || !par->twoHeads) | |
1031 | 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 | 1043 | info->fix.visual = (info->var.bits_per_pixel == 8) ? |
1034 | 1044 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; |
1035 | 1045 | |
1036 | 1046 | |
... | ... | @@ -1548,9 +1558,9 @@ |
1548 | 1558 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); |
1549 | 1559 | |
1550 | 1560 | par->FlatPanel = flatpanel; |
1551 | - | |
1552 | 1561 | if (flatpanel == 1) |
1553 | 1562 | printk(KERN_INFO PFX "flatpanel support enabled\n"); |
1563 | + par->FPDither = fpdither; | |
1554 | 1564 | |
1555 | 1565 | par->CRTCnumber = forceCRTC; |
1556 | 1566 | par->FpScale = (!noscale); |
... | ... | @@ -1729,6 +1739,8 @@ |
1729 | 1739 | } else if (!strncmp(this_opt, "nomtrr", 6)) { |
1730 | 1740 | nomtrr = 1; |
1731 | 1741 | #endif |
1742 | + } else if (!strncmp(this_opt, "fpdither:", 9)) { | |
1743 | + fpdither = simple_strtol(this_opt+9, NULL, 0); | |
1732 | 1744 | } else |
1733 | 1745 | mode_option = this_opt; |
1734 | 1746 | } |
... | ... | @@ -1775,7 +1787,11 @@ |
1775 | 1787 | module_param(flatpanel, int, 0); |
1776 | 1788 | MODULE_PARM_DESC(flatpanel, |
1777 | 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 | 1795 | module_param(hwcur, int, 0); |
1780 | 1796 | MODULE_PARM_DESC(hwcur, |
1781 | 1797 | "Enables hardware cursor implementation. (0 or 1=enabled) " |