aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-24 00:30:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:35 -0400
commitd9cad04bcde00411976402eda726199ac13b29ca (patch)
tree13a8f3fc7791972d843d449eb6718165659e4ec9 /drivers/video
parente0759a5fbba12e0f2c9149d85bea1ec7df0178fd (diff)
tridentfb: move global acceleration hooks into structure
This patch moves acceleration hooks into the tridentfb_par structure and removes global hooks. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: "Antonino A. Daplas" <adaplas@pol.net> 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/tridentfb.c63
1 files changed, 24 insertions, 39 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index e87f77093ec1..d6796448c5ac 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -31,6 +31,12 @@ struct tridentfb_par {
31 u32 pseudo_pal[16]; 31 u32 pseudo_pal[16];
32 int chip_id; 32 int chip_id;
33 int flatpanel; 33 int flatpanel;
34 void (*init_accel) (struct tridentfb_par *, int, int);
35 void (*wait_engine) (struct tridentfb_par *);
36 void (*fill_rect)
37 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32);
38 void (*copy_rect)
39 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32);
34}; 40};
35 41
36static unsigned char eng_oper; /* engine operation... */ 42static unsigned char eng_oper; /* engine operation... */
@@ -155,15 +161,6 @@ static inline u8 t_inb(struct tridentfb_par *p, u16 reg)
155 return fb_readb(p->io_virt + reg); 161 return fb_readb(p->io_virt + reg);
156} 162}
157 163
158static struct accel_switch {
159 void (*init_accel) (struct tridentfb_par *, int, int);
160 void (*wait_engine) (struct tridentfb_par *);
161 void (*fill_rect)
162 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32);
163 void (*copy_rect)
164 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32);
165} *acc;
166
167static inline void writemmr(struct tridentfb_par *par, u16 r, u32 v) 164static inline void writemmr(struct tridentfb_par *par, u16 r, u32 v)
168{ 165{
169 fb_writel(v, par->io_virt + r); 166 fb_writel(v, par->io_virt + r);
@@ -259,13 +256,6 @@ static void blade_copy_rect(struct tridentfb_par *par,
259 writemmr(par, DR2, direction ? d1 : d2); 256 writemmr(par, DR2, direction ? d1 : d2);
260} 257}
261 258
262static struct accel_switch accel_blade = {
263 blade_init_accel,
264 blade_wait_engine,
265 blade_fill_rect,
266 blade_copy_rect,
267};
268
269/* 259/*
270 * BladeXP specific acceleration functions 260 * BladeXP specific acceleration functions
271 */ 261 */
@@ -405,13 +395,6 @@ static void xp_copy_rect(struct tridentfb_par *par,
405 t_outb(par, 0x01, 0x2124); 395 t_outb(par, 0x01, 0x2124);
406} 396}
407 397
408static struct accel_switch accel_xp = {
409 xp_init_accel,
410 xp_wait_engine,
411 xp_fill_rect,
412 xp_copy_rect,
413};
414
415/* 398/*
416 * Image specific acceleration functions 399 * Image specific acceleration functions
417 */ 400 */
@@ -491,13 +474,6 @@ static void image_copy_rect(struct tridentfb_par *par,
491 0x80000000 | 1 << 22 | 1 << 10 | 1 << 7 | direction); 474 0x80000000 | 1 << 22 | 1 << 10 | 1 << 7 | direction);
492} 475}
493 476
494static struct accel_switch accel_image = {
495 image_init_accel,
496 image_wait_engine,
497 image_fill_rect,
498 image_copy_rect,
499};
500
501/* 477/*
502 * Accel functions called by the upper layers 478 * Accel functions called by the upper layers
503 */ 479 */
@@ -524,18 +500,18 @@ static void tridentfb_fillrect(struct fb_info *info,
524 break; 500 break;
525 } 501 }
526 502
527 acc->fill_rect(par, fr->dx, fr->dy, fr->width, 503 par->fill_rect(par, fr->dx, fr->dy, fr->width,
528 fr->height, col, fr->rop); 504 fr->height, col, fr->rop);
529 acc->wait_engine(par); 505 par->wait_engine(par);
530} 506}
531static void tridentfb_copyarea(struct fb_info *info, 507static void tridentfb_copyarea(struct fb_info *info,
532 const struct fb_copyarea *ca) 508 const struct fb_copyarea *ca)
533{ 509{
534 struct tridentfb_par *par = info->par; 510 struct tridentfb_par *par = info->par;
535 511
536 acc->copy_rect(par, ca->sx, ca->sy, ca->dx, ca->dy, 512 par->copy_rect(par, ca->sx, ca->sy, ca->dx, ca->dy,
537 ca->width, ca->height); 513 ca->width, ca->height);
538 acc->wait_engine(par); 514 par->wait_engine(par);
539} 515}
540#else /* !CONFIG_FB_TRIDENT_ACCEL */ 516#else /* !CONFIG_FB_TRIDENT_ACCEL */
541#define tridentfb_fillrect cfb_fillrect 517#define tridentfb_fillrect cfb_fillrect
@@ -1029,7 +1005,7 @@ static int tridentfb_set_par(struct fb_info *info)
1029 write3X4(par, GraphEngReg, 0x80); 1005 write3X4(par, GraphEngReg, 0x80);
1030 1006
1031#ifdef CONFIG_FB_TRIDENT_ACCEL 1007#ifdef CONFIG_FB_TRIDENT_ACCEL
1032 acc->init_accel(par, info->var.xres, bpp); 1008 par->init_accel(par, info->var.xres, bpp);
1033#endif 1009#endif
1034 1010
1035 switch (bpp) { 1011 switch (bpp) {
@@ -1290,11 +1266,20 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1290 chip3D = is3Dchip(chip_id); 1266 chip3D = is3Dchip(chip_id);
1291 1267
1292 if (is_xp(chip_id)) { 1268 if (is_xp(chip_id)) {
1293 acc = &accel_xp; 1269 default_par->init_accel = xp_init_accel;
1270 default_par->wait_engine = xp_wait_engine;
1271 default_par->fill_rect = xp_fill_rect;
1272 default_par->copy_rect = xp_copy_rect;
1294 } else if (is_blade(chip_id)) { 1273 } else if (is_blade(chip_id)) {
1295 acc = &accel_blade; 1274 default_par->init_accel = blade_init_accel;
1275 default_par->wait_engine = blade_wait_engine;
1276 default_par->fill_rect = blade_fill_rect;
1277 default_par->copy_rect = blade_copy_rect;
1296 } else { 1278 } else {
1297 acc = &accel_image; 1279 default_par->init_accel = image_init_accel;
1280 default_par->wait_engine = image_wait_engine;
1281 default_par->fill_rect = image_fill_rect;
1282 default_par->copy_rect = image_copy_rect;
1298 } 1283 }
1299 1284
1300 default_par->chip_id = chip_id; 1285 default_par->chip_id = chip_id;
@@ -1365,7 +1350,7 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1365 if (err < 0) 1350 if (err < 0)
1366 goto out_unmap2; 1351 goto out_unmap2;
1367 1352
1368 if (defaultaccel && acc) 1353 if (defaultaccel && default_par->init_accel)
1369 info->var.accel_flags |= FB_ACCELF_TEXT; 1354 info->var.accel_flags |= FB_ACCELF_TEXT;
1370 else 1355 else
1371 info->var.accel_flags &= ~FB_ACCELF_TEXT; 1356 info->var.accel_flags &= ~FB_ACCELF_TEXT;