aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2009-09-22 19:47:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:51 -0400
commit81228a36a5d05181fff990c852a9abdf03c75593 (patch)
tree9c741b06e6a6ea7548545906b6bc16c5a45dfe38 /drivers/video/via
parent3915a927aaed8d158cba5ad6466e237ae0d84aab (diff)
viafb: merge viafb_update_viafb_par in viafb_update_fix
Shrink and merge viafb_update_viafb_par. This removes a lot of duplicated data in viafb_par. Use the relevant data of fb_info instead. On the way it removes an inconsistency in handling a second framebuffer which only worked because viafbinfo1->par is modified to point to the same viafb_par as viafbinfo->par. Code cleanup only, no runtime change expected. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Harald Welte <laforge@gnumonks.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/via')
-rw-r--r--drivers/video/via/accel.c13
-rw-r--r--drivers/video/via/viafbdev.c44
-rw-r--r--drivers/video/via/viafbdev.h7
3 files changed, 15 insertions, 49 deletions
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index 45c54bfe99bb..b3e7e8246326 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -34,7 +34,7 @@ void viafb_init_accel(void)
34 34
35void viafb_init_2d_engine(void) 35void viafb_init_2d_engine(void)
36{ 36{
37 u32 dwVQStartAddr, dwVQEndAddr; 37 u32 dwVQStartAddr, dwVQEndAddr, linesize;
38 u32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH; 38 u32 dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
39 39
40 /* init 2D engine regs to reset 2D engine */ 40 /* init 2D engine regs to reset 2D engine */
@@ -191,17 +191,14 @@ void viafb_init_2d_engine(void)
191 } 191 }
192 } 192 }
193 193
194 viafb_set_2d_color_depth(viaparinfo->bpp); 194 viafb_set_2d_color_depth(viafbinfo->var.bits_per_pixel);
195 195
196 writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE); 196 writel(0x0, viaparinfo->io_virt + VIA_REG_SRCBASE);
197 writel(0x0, viaparinfo->io_virt + VIA_REG_DSTBASE); 197 writel(0x0, viaparinfo->io_virt + VIA_REG_DSTBASE);
198 198
199 writel(VIA_PITCH_ENABLE | 199 linesize = viafbinfo->var.xres * viafbinfo->var.bits_per_pixel >> 3;
200 (((viaparinfo->hres * 200 writel(VIA_PITCH_ENABLE | (linesize >> 3) | ((linesize >> 3) << 16),
201 viaparinfo->bpp >> 3) >> 3) | (((viaparinfo->hres * 201 viaparinfo->io_virt + VIA_REG_PITCH);
202 viaparinfo->
203 bpp >> 3) >> 3) << 16)),
204 viaparinfo->io_virt + VIA_REG_PITCH);
205} 202}
206 203
207void viafb_set_2d_color_depth(int bpp) 204void viafb_set_2d_color_depth(int bpp)
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 72833f3334b5..6612ddc2dcd9 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -100,21 +100,17 @@ static const struct viafb_modeinfo viafb_modentry[] = {
100 100
101static struct fb_ops viafb_ops; 101static struct fb_ops viafb_ops;
102 102
103static int viafb_update_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
104{
105 struct viafb_par *ppar;
106 ppar = info->par;
107
108 DEBUG_MSG(KERN_INFO "viafb_update_fix!\n");
109 103
110 fix->visual = 104static void viafb_update_fix(struct fb_info *info)
111 ppar->bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; 105{
112 fix->line_length = ppar->linelength; 106 u32 bpp = info->var.bits_per_pixel;
113 107
114 return 0; 108 info->fix.visual =
109 bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
110 info->fix.line_length =
111 ((info->var.xres_virtual + 7) & ~7) * bpp / 8;
115} 112}
116 113
117
118static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, 114static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
119 struct viafb_par *viaparinfo) 115 struct viafb_par *viaparinfo)
120{ 116{
@@ -147,19 +143,6 @@ static int viafb_release(struct fb_info *info, int user)
147 return 0; 143 return 0;
148} 144}
149 145
150static void viafb_update_viafb_par(struct fb_info *info)
151{
152 struct viafb_par *ppar;
153
154 ppar = info->par;
155 ppar->bpp = info->var.bits_per_pixel;
156 ppar->linelength = ((info->var.xres_virtual + 7) & ~7) * ppar->bpp / 8;
157 ppar->hres = info->var.xres;
158 ppar->vres = info->var.yres;
159 ppar->xoffset = info->var.xoffset;
160 ppar->yoffset = info->var.yoffset;
161}
162
163static int viafb_check_var(struct fb_var_screeninfo *var, 146static int viafb_check_var(struct fb_var_screeninfo *var,
164 struct fb_info *info) 147 struct fb_info *info)
165{ 148{
@@ -255,12 +238,7 @@ static int viafb_set_par(struct fb_info *info)
255 /*We should set memory offset according virtual_x */ 238 /*We should set memory offset according virtual_x */
256 /*Fix me:put this function into viafb_setmode */ 239 /*Fix me:put this function into viafb_setmode */
257 viafb_memory_pitch_patch(info); 240 viafb_memory_pitch_patch(info);
258 241 viafb_update_fix(info);
259 /* Update ***fb_par information */
260 viafb_update_viafb_par(info);
261
262 /* Update other fixed information */
263 viafb_update_fix(&info->fix, info);
264 viafb_bpp = info->var.bits_per_pixel; 242 viafb_bpp = info->var.bits_per_pixel;
265 /* Update viafb_accel, it is necessary to our 2D accelerate */ 243 /* Update viafb_accel, it is necessary to our 2D accelerate */
266 viafb_accel = info->var.accel_flags; 244 viafb_accel = info->var.accel_flags;
@@ -2323,15 +2301,13 @@ static int __devinit via_pci_probe(void)
2323 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1); 2301 viafb_setup_fixinfo(&viafbinfo1->fix, viaparinfo1);
2324 viafb_check_var(&default_var, viafbinfo1); 2302 viafb_check_var(&default_var, viafbinfo1);
2325 viafbinfo1->var = default_var; 2303 viafbinfo1->var = default_var;
2326 viafb_update_viafb_par(viafbinfo); 2304 viafb_update_fix(viafbinfo1);
2327 viafb_update_fix(&viafbinfo1->fix, viafbinfo1);
2328 } 2305 }
2329 2306
2330 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo); 2307 viafb_setup_fixinfo(&viafbinfo->fix, viaparinfo);
2331 viafb_check_var(&default_var, viafbinfo); 2308 viafb_check_var(&default_var, viafbinfo);
2332 viafbinfo->var = default_var; 2309 viafbinfo->var = default_var;
2333 viafb_update_viafb_par(viafbinfo); 2310 viafb_update_fix(viafbinfo);
2334 viafb_update_fix(&viafbinfo->fix, viafbinfo);
2335 default_var.activate = FB_ACTIVATE_NOW; 2311 default_var.activate = FB_ACTIVATE_NOW;
2336 fb_alloc_cmap(&viafbinfo->cmap, 256, 0); 2312 fb_alloc_cmap(&viafbinfo->cmap, 256, 0);
2337 2313
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index 227b000feb38..ea0df4f96842 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -38,13 +38,6 @@
38#define VERSION_MINOR 4 38#define VERSION_MINOR 4
39 39
40struct viafb_par { 40struct viafb_par {
41 int bpp;
42 int hres;
43 int vres;
44 int linelength;
45 u32 xoffset;
46 u32 yoffset;
47
48 void __iomem *fbmem_virt; /*framebuffer virtual memory address */ 41 void __iomem *fbmem_virt; /*framebuffer virtual memory address */
49 void __iomem *io_virt; /*iospace virtual memory address */ 42 void __iomem *io_virt; /*iospace virtual memory address */
50 unsigned int fbmem; /*framebuffer physical memory address */ 43 unsigned int fbmem; /*framebuffer physical memory address */