aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/accel.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-04-26 13:31:03 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-10-24 09:04:53 -0400
commitadac8d65f399b02e8a2222fc75c658e4b8d24f65 (patch)
tree3ba0707db2c4afca3a9ac602214b3b5baf0eb4e3 /drivers/video/via/accel.c
parent466bc7fc4246d95cbd37edd169eafb8185e41941 (diff)
viafb: fix hardware acceleration for suspend & resume
This patch splits the acceleration initialization in two parts: The first is only called during probe and is used to allocate resources. The second part is also called on resume to reinitalize the 2D engine. This should fix all acceleration issues after resume most notable an "invisible" cursor and as we do nothing special it is reasonable to assume that it works on all supported IGPs. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw>
Diffstat (limited to 'drivers/video/via/accel.c')
-rw-r--r--drivers/video/via/accel.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index c2f4e6e166f1..bc4905366726 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -315,13 +315,11 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,
315 return 0; 315 return 0;
316} 316}
317 317
318int viafb_init_engine(struct fb_info *info) 318int viafb_setup_engine(struct fb_info *info)
319{ 319{
320 struct viafb_par *viapar = info->par; 320 struct viafb_par *viapar = info->par;
321 void __iomem *engine; 321 void __iomem *engine;
322 int highest_reg, i; 322 u32 chip_name = viapar->shared->chip_info.gfx_chip_name;
323 u32 vq_start_addr, vq_end_addr, vq_start_low, vq_end_low, vq_high,
324 vq_len, chip_name = viapar->shared->chip_info.gfx_chip_name;
325 323
326 engine = viapar->shared->vdev->engine_mmio; 324 engine = viapar->shared->vdev->engine_mmio;
327 if (!engine) { 325 if (!engine) {
@@ -330,18 +328,6 @@ int viafb_init_engine(struct fb_info *info)
330 return -ENOMEM; 328 return -ENOMEM;
331 } 329 }
332 330
333 /* Initialize registers to reset the 2D engine */
334 switch (viapar->shared->chip_info.twod_engine) {
335 case VIA_2D_ENG_M1:
336 highest_reg = 0x5c;
337 break;
338 default:
339 highest_reg = 0x40;
340 break;
341 }
342 for (i = 0; i <= highest_reg; i += 4)
343 writel(0x0, engine + i);
344
345 switch (chip_name) { 331 switch (chip_name) {
346 case UNICHROME_CLE266: 332 case UNICHROME_CLE266:
347 case UNICHROME_K400: 333 case UNICHROME_K400:
@@ -387,6 +373,29 @@ int viafb_init_engine(struct fb_info *info)
387 viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free; 373 viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free;
388#endif 374#endif
389 375
376 viafb_reset_engine(viapar);
377 return 0;
378}
379
380void viafb_reset_engine(struct viafb_par *viapar)
381{
382 void __iomem *engine = viapar->shared->vdev->engine_mmio;
383 int highest_reg, i;
384 u32 vq_start_addr, vq_end_addr, vq_start_low, vq_end_low, vq_high,
385 vq_len, chip_name = viapar->shared->chip_info.gfx_chip_name;
386
387 /* Initialize registers to reset the 2D engine */
388 switch (viapar->shared->chip_info.twod_engine) {
389 case VIA_2D_ENG_M1:
390 highest_reg = 0x5c;
391 break;
392 default:
393 highest_reg = 0x40;
394 break;
395 }
396 for (i = 0; i <= highest_reg; i += 4)
397 writel(0x0, engine + i);
398
390 /* Init AGP and VQ regs */ 399 /* Init AGP and VQ regs */
391 switch (chip_name) { 400 switch (chip_name) {
392 case UNICHROME_K8M890: 401 case UNICHROME_K8M890:
@@ -474,7 +483,7 @@ int viafb_init_engine(struct fb_info *info)
474 writel(0x0, engine + VIA_REG_CURSOR_ORG); 483 writel(0x0, engine + VIA_REG_CURSOR_ORG);
475 writel(0x0, engine + VIA_REG_CURSOR_BG); 484 writel(0x0, engine + VIA_REG_CURSOR_BG);
476 writel(0x0, engine + VIA_REG_CURSOR_FG); 485 writel(0x0, engine + VIA_REG_CURSOR_FG);
477 return 0; 486 return;
478} 487}
479 488
480void viafb_show_hw_cursor(struct fb_info *info, int Status) 489void viafb_show_hw_cursor(struct fb_info *info, int Status)