diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2010-03-10 18:21:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:34 -0500 |
commit | e17cea3cece6d3ec47a5b358821505943abe6541 (patch) | |
tree | cf474d56ab2a700577dc0c3cc4bb6f33d1e56154 /drivers/video | |
parent | 415559fbf2353f4271a4cd6e11259b8bbc97cc33 (diff) |
viafb: support color depth 15 and 30
Add support for the color depth 15 on IGA1 and 30 on IGA1 and IGA2. To
allow the usage of those the driver now refuses color depth that are
totally off and otherwise the selection in viafb_check_var is used.
Therefore the first call to this for the first framebuffer was delayed a
bit. It only enables the new formats if they are requested exactly
(viafb_bpp=15|30).
As this is a new feature, no regressions are expected. The color depth 15
was successfully tested. Didn't get anything usable for 30 but that might
be the programs fault. I would like to get some feedback whether it works
as expected or not if somebody knows a program/configuration where it
should.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Scott Fang <ScottFang@viatech.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/via/hw.c | 9 | ||||
-rw-r--r-- | drivers/video/via/viafbdev.c | 43 |
2 files changed, 34 insertions, 18 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 1823253a6f40..f2583b1b527f 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c | |||
@@ -694,12 +694,18 @@ void viafb_set_primary_color_depth(u8 depth) | |||
694 | case 8: | 694 | case 8: |
695 | value = 0x00; | 695 | value = 0x00; |
696 | break; | 696 | break; |
697 | case 15: | ||
698 | value = 0x04; | ||
699 | break; | ||
697 | case 16: | 700 | case 16: |
698 | value = 0x14; | 701 | value = 0x14; |
699 | break; | 702 | break; |
700 | case 24: | 703 | case 24: |
701 | value = 0x0C; | 704 | value = 0x0C; |
702 | break; | 705 | break; |
706 | case 30: | ||
707 | value = 0x08; | ||
708 | break; | ||
703 | default: | 709 | default: |
704 | printk(KERN_WARNING "viafb_set_primary_color_depth: " | 710 | printk(KERN_WARNING "viafb_set_primary_color_depth: " |
705 | "Unsupported depth: %d\n", depth); | 711 | "Unsupported depth: %d\n", depth); |
@@ -724,6 +730,9 @@ void viafb_set_secondary_color_depth(u8 depth) | |||
724 | case 24: | 730 | case 24: |
725 | value = 0xC0; | 731 | value = 0xC0; |
726 | break; | 732 | break; |
733 | case 30: | ||
734 | value = 0x80; | ||
735 | break; | ||
727 | default: | 736 | default: |
728 | printk(KERN_WARNING "viafb_set_secondary_color_depth: " | 737 | printk(KERN_WARNING "viafb_set_secondary_color_depth: " |
729 | "Unsupported depth: %d\n", depth); | 738 | "Unsupported depth: %d\n", depth); |
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 410de33f5778..ce7783b63f6a 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -80,6 +80,15 @@ static void viafb_fill_var_color_info(struct fb_var_screeninfo *var, u8 depth) | |||
80 | var->green.length = 8; | 80 | var->green.length = 8; |
81 | var->blue.length = 8; | 81 | var->blue.length = 8; |
82 | break; | 82 | break; |
83 | case 15: | ||
84 | var->bits_per_pixel = 16; | ||
85 | var->red.offset = 10; | ||
86 | var->green.offset = 5; | ||
87 | var->blue.offset = 0; | ||
88 | var->red.length = 5; | ||
89 | var->green.length = 5; | ||
90 | var->blue.length = 5; | ||
91 | break; | ||
83 | case 16: | 92 | case 16: |
84 | var->bits_per_pixel = 16; | 93 | var->bits_per_pixel = 16; |
85 | var->red.offset = 11; | 94 | var->red.offset = 11; |
@@ -98,6 +107,15 @@ static void viafb_fill_var_color_info(struct fb_var_screeninfo *var, u8 depth) | |||
98 | var->green.length = 8; | 107 | var->green.length = 8; |
99 | var->blue.length = 8; | 108 | var->blue.length = 8; |
100 | break; | 109 | break; |
110 | case 30: | ||
111 | var->bits_per_pixel = 32; | ||
112 | var->red.offset = 20; | ||
113 | var->green.offset = 10; | ||
114 | var->blue.offset = 0; | ||
115 | var->red.length = 10; | ||
116 | var->green.length = 10; | ||
117 | var->blue.length = 10; | ||
118 | break; | ||
101 | } | 119 | } |
102 | } | 120 | } |
103 | 121 | ||
@@ -171,6 +189,10 @@ static int viafb_check_var(struct fb_var_screeninfo *var, | |||
171 | return -EINVAL; | 189 | return -EINVAL; |
172 | else if (!depth) | 190 | else if (!depth) |
173 | depth = 24; | 191 | depth = 24; |
192 | else if (depth == 15 && viafb_dual_fb && ppar->iga_path == IGA1) | ||
193 | depth = 15; | ||
194 | else if (depth == 30) | ||
195 | depth = 30; | ||
174 | else if (depth <= 8) | 196 | else if (depth <= 8) |
175 | depth = 8; | 197 | depth = 8; |
176 | else if (depth <= 16) | 198 | else if (depth <= 16) |
@@ -1811,19 +1833,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, | |||
1811 | viafb_second_virtual_yres = viafb_second_yres; | 1833 | viafb_second_virtual_yres = viafb_second_yres; |
1812 | } | 1834 | } |
1813 | 1835 | ||
1814 | switch (viafb_bpp) { | ||
1815 | case 0 ... 8: | ||
1816 | viafb_bpp = 8; | ||
1817 | break; | ||
1818 | case 9 ... 16: | ||
1819 | viafb_bpp = 16; | ||
1820 | break; | ||
1821 | case 17 ... 32: | ||
1822 | viafb_bpp = 32; | ||
1823 | break; | ||
1824 | default: | ||
1825 | viafb_bpp = 8; | ||
1826 | } | ||
1827 | default_var.xres = default_xres; | 1836 | default_var.xres = default_xres; |
1828 | default_var.yres = default_yres; | 1837 | default_var.yres = default_yres; |
1829 | switch (default_xres) { | 1838 | switch (default_xres) { |
@@ -1836,8 +1845,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, | |||
1836 | } | 1845 | } |
1837 | default_var.yres_virtual = default_yres; | 1846 | default_var.yres_virtual = default_yres; |
1838 | default_var.bits_per_pixel = viafb_bpp; | 1847 | default_var.bits_per_pixel = viafb_bpp; |
1839 | if (default_var.bits_per_pixel == 15) | ||
1840 | default_var.bits_per_pixel = 16; | ||
1841 | default_var.pixclock = | 1848 | default_var.pixclock = |
1842 | viafb_get_pixclock(default_xres, default_yres, viafb_refresh); | 1849 | viafb_get_pixclock(default_xres, default_yres, viafb_refresh); |
1843 | default_var.left_margin = (default_xres >> 3) & 0xf8; | 1850 | default_var.left_margin = (default_xres >> 3) & 0xf8; |
@@ -1847,7 +1854,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, | |||
1847 | default_var.hsync_len = default_var.left_margin; | 1854 | default_var.hsync_len = default_var.left_margin; |
1848 | default_var.vsync_len = 4; | 1855 | default_var.vsync_len = 4; |
1849 | viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); | 1856 | viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); |
1850 | viafb_check_var(&default_var, viafbinfo); | ||
1851 | viafbinfo->var = default_var; | 1857 | viafbinfo->var = default_var; |
1852 | 1858 | ||
1853 | if (viafb_dual_fb) { | 1859 | if (viafb_dual_fb) { |
@@ -1883,8 +1889,6 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, | |||
1883 | default_var.yres = viafb_second_yres; | 1889 | default_var.yres = viafb_second_yres; |
1884 | default_var.xres_virtual = viafb_second_virtual_xres; | 1890 | default_var.xres_virtual = viafb_second_virtual_xres; |
1885 | default_var.yres_virtual = viafb_second_virtual_yres; | 1891 | default_var.yres_virtual = viafb_second_virtual_yres; |
1886 | if (viafb_bpp1 != viafb_bpp) | ||
1887 | viafb_bpp1 = viafb_bpp; | ||
1888 | default_var.bits_per_pixel = viafb_bpp1; | 1892 | default_var.bits_per_pixel = viafb_bpp1; |
1889 | default_var.pixclock = | 1893 | default_var.pixclock = |
1890 | viafb_get_pixclock(viafb_second_xres, viafb_second_yres, | 1894 | viafb_get_pixclock(viafb_second_xres, viafb_second_yres, |
@@ -1904,6 +1908,7 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, | |||
1904 | &viafbinfo1->fix); | 1908 | &viafbinfo1->fix); |
1905 | } | 1909 | } |
1906 | 1910 | ||
1911 | viafb_check_var(&viafbinfo->var, viafbinfo); | ||
1907 | viafb_update_fix(viafbinfo); | 1912 | viafb_update_fix(viafbinfo); |
1908 | viaparinfo->depth = fb_get_color_depth(&viafbinfo->var, | 1913 | viaparinfo->depth = fb_get_color_depth(&viafbinfo->var, |
1909 | &viafbinfo->fix); | 1914 | &viafbinfo->fix); |
@@ -2070,6 +2075,8 @@ static int __init viafb_init(void) | |||
2070 | #endif | 2075 | #endif |
2071 | if (parse_mode(viafb_mode, &dummy, &dummy) | 2076 | if (parse_mode(viafb_mode, &dummy, &dummy) |
2072 | || parse_mode(viafb_mode1, &dummy, &dummy) | 2077 | || parse_mode(viafb_mode1, &dummy, &dummy) |
2078 | || viafb_bpp < 0 || viafb_bpp > 32 | ||
2079 | || viafb_bpp1 < 0 || viafb_bpp1 > 32 | ||
2073 | || parse_active_dev()) | 2080 | || parse_active_dev()) |
2074 | return -EINVAL; | 2081 | return -EINVAL; |
2075 | 2082 | ||