diff options
Diffstat (limited to 'drivers/video/via/viafbdev.c')
-rw-r--r-- | drivers/video/via/viafbdev.c | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index e9c9f0ec842a..8e43759a0b8d 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -33,6 +33,8 @@ static u32 pseudo_pal[17]; | |||
33 | static char *viafb_mode = "640x480"; | 33 | static char *viafb_mode = "640x480"; |
34 | static char *viafb_mode1 = "640x480"; | 34 | static char *viafb_mode1 = "640x480"; |
35 | 35 | ||
36 | static int viafb_accel = 1; | ||
37 | |||
36 | /* Added for specifying active devices.*/ | 38 | /* Added for specifying active devices.*/ |
37 | char *viafb_active_dev = ""; | 39 | char *viafb_active_dev = ""; |
38 | 40 | ||
@@ -140,6 +142,9 @@ static int viafb_check_var(struct fb_var_screeninfo *var, | |||
140 | 142 | ||
141 | /* Adjust var according to our driver's own table */ | 143 | /* Adjust var according to our driver's own table */ |
142 | viafb_fill_var_timing_info(var, viafb_refresh, vmode_index); | 144 | viafb_fill_var_timing_info(var, viafb_refresh, vmode_index); |
145 | if (info->var.accel_flags & FB_ACCELF_TEXT && | ||
146 | !ppar->shared->engine_mmio) | ||
147 | info->var.accel_flags = 0; | ||
143 | 148 | ||
144 | return 0; | 149 | return 0; |
145 | } | 150 | } |
@@ -177,8 +182,10 @@ static int viafb_set_par(struct fb_info *info) | |||
177 | 182 | ||
178 | viafb_update_fix(info); | 183 | viafb_update_fix(info); |
179 | viafb_bpp = info->var.bits_per_pixel; | 184 | viafb_bpp = info->var.bits_per_pixel; |
180 | /* Update viafb_accel, it is necessary to our 2D accelerate */ | 185 | if (info->var.accel_flags & FB_ACCELF_TEXT) |
181 | viafb_accel = info->var.accel_flags; | 186 | info->flags &= ~FBINFO_HWACCEL_DISABLED; |
187 | else | ||
188 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
182 | } | 189 | } |
183 | 190 | ||
184 | return 0; | 191 | return 0; |
@@ -764,10 +771,11 @@ static void viafb_fillrect(struct fb_info *info, | |||
764 | const struct fb_fillrect *rect) | 771 | const struct fb_fillrect *rect) |
765 | { | 772 | { |
766 | struct viafb_par *viapar = info->par; | 773 | struct viafb_par *viapar = info->par; |
774 | struct viafb_shared *shared = viapar->shared; | ||
767 | u32 fg_color; | 775 | u32 fg_color; |
768 | u8 rop; | 776 | u8 rop; |
769 | 777 | ||
770 | if (!viapar->shared->hw_bitblt) { | 778 | if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt) { |
771 | cfb_fillrect(info, rect); | 779 | cfb_fillrect(info, rect); |
772 | return; | 780 | return; |
773 | } | 781 | } |
@@ -786,7 +794,7 @@ static void viafb_fillrect(struct fb_info *info, | |||
786 | rop = 0xF0; | 794 | rop = 0xF0; |
787 | 795 | ||
788 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: fillrect\n"); | 796 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: fillrect\n"); |
789 | if (viapar->shared->hw_bitblt(viapar->io_virt, VIA_BITBLT_FILL, | 797 | if (shared->hw_bitblt(shared->engine_mmio, VIA_BITBLT_FILL, |
790 | rect->width, rect->height, info->var.bits_per_pixel, | 798 | rect->width, rect->height, info->var.bits_per_pixel, |
791 | viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy, | 799 | viapar->vram_addr, info->fix.line_length, rect->dx, rect->dy, |
792 | NULL, 0, 0, 0, 0, fg_color, 0, rop)) | 800 | NULL, 0, 0, 0, 0, fg_color, 0, rop)) |
@@ -797,8 +805,9 @@ static void viafb_copyarea(struct fb_info *info, | |||
797 | const struct fb_copyarea *area) | 805 | const struct fb_copyarea *area) |
798 | { | 806 | { |
799 | struct viafb_par *viapar = info->par; | 807 | struct viafb_par *viapar = info->par; |
808 | struct viafb_shared *shared = viapar->shared; | ||
800 | 809 | ||
801 | if (!viapar->shared->hw_bitblt) { | 810 | if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt) { |
802 | cfb_copyarea(info, area); | 811 | cfb_copyarea(info, area); |
803 | return; | 812 | return; |
804 | } | 813 | } |
@@ -807,7 +816,7 @@ static void viafb_copyarea(struct fb_info *info, | |||
807 | return; | 816 | return; |
808 | 817 | ||
809 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: copyarea\n"); | 818 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: copyarea\n"); |
810 | if (viapar->shared->hw_bitblt(viapar->io_virt, VIA_BITBLT_COLOR, | 819 | if (shared->hw_bitblt(shared->engine_mmio, VIA_BITBLT_COLOR, |
811 | area->width, area->height, info->var.bits_per_pixel, | 820 | area->width, area->height, info->var.bits_per_pixel, |
812 | viapar->vram_addr, info->fix.line_length, area->dx, area->dy, | 821 | viapar->vram_addr, info->fix.line_length, area->dx, area->dy, |
813 | NULL, viapar->vram_addr, info->fix.line_length, | 822 | NULL, viapar->vram_addr, info->fix.line_length, |
@@ -819,10 +828,11 @@ static void viafb_imageblit(struct fb_info *info, | |||
819 | const struct fb_image *image) | 828 | const struct fb_image *image) |
820 | { | 829 | { |
821 | struct viafb_par *viapar = info->par; | 830 | struct viafb_par *viapar = info->par; |
831 | struct viafb_shared *shared = viapar->shared; | ||
822 | u32 fg_color = 0, bg_color = 0; | 832 | u32 fg_color = 0, bg_color = 0; |
823 | u8 op; | 833 | u8 op; |
824 | 834 | ||
825 | if (!viapar->shared->hw_bitblt || | 835 | if (info->flags & FBINFO_HWACCEL_DISABLED || !shared->hw_bitblt || |
826 | (image->depth != 1 && image->depth != viapar->depth)) { | 836 | (image->depth != 1 && image->depth != viapar->depth)) { |
827 | cfb_imageblit(info, image); | 837 | cfb_imageblit(info, image); |
828 | return; | 838 | return; |
@@ -843,7 +853,7 @@ static void viafb_imageblit(struct fb_info *info, | |||
843 | op = VIA_BITBLT_COLOR; | 853 | op = VIA_BITBLT_COLOR; |
844 | 854 | ||
845 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: imageblit\n"); | 855 | DEBUG_MSG(KERN_DEBUG "viafb 2D engine: imageblit\n"); |
846 | if (viapar->shared->hw_bitblt(viapar->io_virt, op, | 856 | if (shared->hw_bitblt(shared->engine_mmio, op, |
847 | image->width, image->height, info->var.bits_per_pixel, | 857 | image->width, image->height, info->var.bits_per_pixel, |
848 | viapar->vram_addr, info->fix.line_length, image->dx, image->dy, | 858 | viapar->vram_addr, info->fix.line_length, image->dx, image->dy, |
849 | (u32 *)image->data, 0, 0, 0, 0, fg_color, bg_color, 0)) | 859 | (u32 *)image->data, 0, 0, 0, 0, fg_color, bg_color, 0)) |
@@ -853,6 +863,7 @@ static void viafb_imageblit(struct fb_info *info, | |||
853 | static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 863 | static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
854 | { | 864 | { |
855 | struct viafb_par *viapar = info->par; | 865 | struct viafb_par *viapar = info->par; |
866 | void __iomem *engine = viapar->shared->engine_mmio; | ||
856 | u32 temp, xx, yy, bg_color = 0, fg_color = 0, | 867 | u32 temp, xx, yy, bg_color = 0, fg_color = 0, |
857 | chip_name = viapar->shared->chip_info.gfx_chip_name; | 868 | chip_name = viapar->shared->chip_info.gfx_chip_name; |
858 | int i, j = 0, cur_size = 64; | 869 | int i, j = 0, cur_size = 64; |
@@ -867,7 +878,7 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
867 | 878 | ||
868 | if (cursor->set & FB_CUR_SETHOT) { | 879 | if (cursor->set & FB_CUR_SETHOT) { |
869 | temp = (cursor->hot.x << 16) + cursor->hot.y; | 880 | temp = (cursor->hot.x << 16) + cursor->hot.y; |
870 | writel(temp, viapar->io_virt + VIA_REG_CURSOR_ORG); | 881 | writel(temp, engine + VIA_REG_CURSOR_ORG); |
871 | } | 882 | } |
872 | 883 | ||
873 | if (cursor->set & FB_CUR_SETPOS) { | 884 | if (cursor->set & FB_CUR_SETPOS) { |
@@ -875,7 +886,7 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
875 | xx = cursor->image.dx - info->var.xoffset; | 886 | xx = cursor->image.dx - info->var.xoffset; |
876 | temp = yy & 0xFFFF; | 887 | temp = yy & 0xFFFF; |
877 | temp |= (xx << 16); | 888 | temp |= (xx << 16); |
878 | writel(temp, viapar->io_virt + VIA_REG_CURSOR_POS); | 889 | writel(temp, engine + VIA_REG_CURSOR_POS); |
879 | } | 890 | } |
880 | 891 | ||
881 | if (cursor->image.width <= 32 && cursor->image.height <= 32) | 892 | if (cursor->image.width <= 32 && cursor->image.height <= 32) |
@@ -889,13 +900,13 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
889 | } | 900 | } |
890 | 901 | ||
891 | if (cursor->set & FB_CUR_SETSIZE) { | 902 | if (cursor->set & FB_CUR_SETSIZE) { |
892 | temp = readl(viapar->io_virt + VIA_REG_CURSOR_MODE); | 903 | temp = readl(engine + VIA_REG_CURSOR_MODE); |
893 | if (cur_size == 32) | 904 | if (cur_size == 32) |
894 | temp |= 0x2; | 905 | temp |= 0x2; |
895 | else | 906 | else |
896 | temp &= ~0x2; | 907 | temp &= ~0x2; |
897 | 908 | ||
898 | writel(temp, viapar->io_virt + VIA_REG_CURSOR_MODE); | 909 | writel(temp, engine + VIA_REG_CURSOR_MODE); |
899 | } | 910 | } |
900 | 911 | ||
901 | if (cursor->set & FB_CUR_SETCMAP) { | 912 | if (cursor->set & FB_CUR_SETCMAP) { |
@@ -922,8 +933,8 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
922 | ((info->cmap.blue[bg_color] & 0xFF00) >> 8); | 933 | ((info->cmap.blue[bg_color] & 0xFF00) >> 8); |
923 | } | 934 | } |
924 | 935 | ||
925 | writel(bg_color, viapar->io_virt + VIA_REG_CURSOR_BG); | 936 | writel(bg_color, engine + VIA_REG_CURSOR_BG); |
926 | writel(fg_color, viapar->io_virt + VIA_REG_CURSOR_FG); | 937 | writel(fg_color, engine + VIA_REG_CURSOR_FG); |
927 | } | 938 | } |
928 | 939 | ||
929 | if (cursor->set & FB_CUR_SETSHAPE) { | 940 | if (cursor->set & FB_CUR_SETSHAPE) { |
@@ -996,8 +1007,8 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
996 | 1007 | ||
997 | static int viafb_sync(struct fb_info *info) | 1008 | static int viafb_sync(struct fb_info *info) |
998 | { | 1009 | { |
999 | if (viafb_accel) | 1010 | if (!(info->flags & FBINFO_HWACCEL_DISABLED)) |
1000 | viafb_wait_engine_idle(); | 1011 | viafb_wait_engine_idle(info); |
1001 | return 0; | 1012 | return 0; |
1002 | } | 1013 | } |
1003 | 1014 | ||
@@ -1867,22 +1878,18 @@ static int __devinit via_pci_probe(void) | |||
1867 | 1878 | ||
1868 | viafb_get_mmio_info(&viafbinfo->fix.mmio_start, | 1879 | viafb_get_mmio_info(&viafbinfo->fix.mmio_start, |
1869 | &viafbinfo->fix.mmio_len); | 1880 | &viafbinfo->fix.mmio_len); |
1870 | viaparinfo->io_virt = ioremap_nocache(viafbinfo->fix.mmio_start, | ||
1871 | viafbinfo->fix.mmio_len); | ||
1872 | if (!viaparinfo->io_virt) { | ||
1873 | printk(KERN_WARNING "ioremap failed: hardware acceleration disabled\n"); | ||
1874 | viafb_accel = 0; | ||
1875 | } | ||
1876 | |||
1877 | viafbinfo->node = 0; | 1881 | viafbinfo->node = 0; |
1878 | viafbinfo->fbops = &viafb_ops; | 1882 | viafbinfo->fbops = &viafb_ops; |
1879 | viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 1883 | viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
1880 | 1884 | ||
1881 | viafbinfo->pseudo_palette = pseudo_pal; | 1885 | viafbinfo->pseudo_palette = pseudo_pal; |
1882 | if (viafb_accel) { | 1886 | if (viafb_accel && !viafb_init_engine(viafbinfo)) { |
1883 | viafb_init_accel(viaparinfo->shared); | 1887 | viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA | |
1884 | viafb_init_2d_engine(); | 1888 | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT; |
1885 | viafb_hw_cursor_init(); | 1889 | default_var.accel_flags = FB_ACCELF_TEXT; |
1890 | } else { | ||
1891 | viafbinfo->flags |= FBINFO_HWACCEL_DISABLED; | ||
1892 | default_var.accel_flags = 0; | ||
1886 | } | 1893 | } |
1887 | 1894 | ||
1888 | if (viafb_second_size && (viafb_second_size < 8)) { | 1895 | if (viafb_second_size && (viafb_second_size < 8)) { |
@@ -1963,15 +1970,6 @@ static int __devinit via_pci_probe(void) | |||
1963 | default_var.lower_margin = 4; | 1970 | default_var.lower_margin = 4; |
1964 | default_var.hsync_len = default_var.left_margin; | 1971 | default_var.hsync_len = default_var.left_margin; |
1965 | default_var.vsync_len = 4; | 1972 | default_var.vsync_len = 4; |
1966 | default_var.accel_flags = 0; | ||
1967 | |||
1968 | if (viafb_accel) { | ||
1969 | viafbinfo->flags |= | ||
1970 | (FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | | ||
1971 | FBINFO_HWACCEL_IMAGEBLIT); | ||
1972 | default_var.accel_flags |= FB_ACCELF_TEXT; | ||
1973 | } else | ||
1974 | viafbinfo->flags |= FBINFO_HWACCEL_DISABLED; | ||
1975 | 1973 | ||
1976 | if (viafb_dual_fb) { | 1974 | if (viafb_dual_fb) { |
1977 | viafbinfo1 = framebuffer_alloc(viafb_par_length, NULL); | 1975 | viafbinfo1 = framebuffer_alloc(viafb_par_length, NULL); |
@@ -1994,12 +1992,6 @@ static int __devinit via_pci_probe(void) | |||
1994 | viaparinfo1->fbmem_used; | 1992 | viaparinfo1->fbmem_used; |
1995 | viaparinfo->fbmem_free = viaparinfo->memsize; | 1993 | viaparinfo->fbmem_free = viaparinfo->memsize; |
1996 | viaparinfo->fbmem_used = 0; | 1994 | viaparinfo->fbmem_used = 0; |
1997 | if (viafb_accel) { | ||
1998 | viaparinfo1->VQ_start = viaparinfo->VQ_start - | ||
1999 | viafb_second_offset; | ||
2000 | viaparinfo1->VQ_end = viaparinfo->VQ_end - | ||
2001 | viafb_second_offset; | ||
2002 | } | ||
2003 | 1995 | ||
2004 | viaparinfo->iga_path = IGA1; | 1996 | viaparinfo->iga_path = IGA1; |
2005 | viaparinfo1->iga_path = IGA2; | 1997 | viaparinfo1->iga_path = IGA2; |
@@ -2073,7 +2065,7 @@ static void __devexit via_pci_remove(void) | |||
2073 | if (viafb_dual_fb) | 2065 | if (viafb_dual_fb) |
2074 | unregister_framebuffer(viafbinfo1); | 2066 | unregister_framebuffer(viafbinfo1); |
2075 | iounmap((void *)viafbinfo->screen_base); | 2067 | iounmap((void *)viafbinfo->screen_base); |
2076 | iounmap(viaparinfo->io_virt); | 2068 | iounmap(viaparinfo->shared->engine_mmio); |
2077 | 2069 | ||
2078 | viafb_delete_i2c_buss(viaparinfo); | 2070 | viafb_delete_i2c_buss(viaparinfo); |
2079 | 2071 | ||
@@ -2235,7 +2227,7 @@ MODULE_PARM_DESC(viafb_SAMM_ON, | |||
2235 | 2227 | ||
2236 | module_param(viafb_accel, int, 0); | 2228 | module_param(viafb_accel, int, 0); |
2237 | MODULE_PARM_DESC(viafb_accel, | 2229 | MODULE_PARM_DESC(viafb_accel, |
2238 | "Set 2D Hardware Acceleration.(Default = OFF)"); | 2230 | "Set 2D Hardware Acceleration: 0 = OFF, 1 = ON (default)"); |
2239 | 2231 | ||
2240 | module_param(viafb_active_dev, charp, 0); | 2232 | module_param(viafb_active_dev, charp, 0); |
2241 | MODULE_PARM_DESC(viafb_active_dev, "Specify active devices."); | 2233 | MODULE_PARM_DESC(viafb_active_dev, "Specify active devices."); |