aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via
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
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')
-rw-r--r--drivers/video/via/accel.c43
-rw-r--r--drivers/video/via/accel.h3
-rw-r--r--drivers/video/via/viafbdev.c4
3 files changed, 31 insertions, 19 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)
diff --git a/drivers/video/via/accel.h b/drivers/video/via/accel.h
index 2c122d292365..79d5e10cc835 100644
--- a/drivers/video/via/accel.h
+++ b/drivers/video/via/accel.h
@@ -203,7 +203,8 @@
203#define VIA_BITBLT_MONO 2 203#define VIA_BITBLT_MONO 2
204#define VIA_BITBLT_FILL 3 204#define VIA_BITBLT_FILL 3
205 205
206int viafb_init_engine(struct fb_info *info); 206int viafb_setup_engine(struct fb_info *info);
207void viafb_reset_engine(struct viafb_par *viapar);
207void viafb_show_hw_cursor(struct fb_info *info, int Status); 208void viafb_show_hw_cursor(struct fb_info *info, int Status);
208void viafb_wait_engine_idle(struct fb_info *info); 209void viafb_wait_engine_idle(struct fb_info *info);
209 210
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 4e9e105a6c78..6c651e401dc6 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1695,6 +1695,8 @@ int viafb_resume(struct pci_dev *pdev)
1695 if (pci_enable_device(pdev)) 1695 if (pci_enable_device(pdev))
1696 goto fail; 1696 goto fail;
1697 pci_set_master(pdev); 1697 pci_set_master(pdev);
1698 if (viaparinfo->shared->vdev->engine_mmio)
1699 viafb_reset_engine(viaparinfo);
1698 viafb_set_par(viafbinfo); 1700 viafb_set_par(viafbinfo);
1699 if (viafb_dual_fb) 1701 if (viafb_dual_fb)
1700 viafb_set_par(viafbinfo1); 1702 viafb_set_par(viafbinfo1);
@@ -1766,7 +1768,7 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
1766 viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; 1768 viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
1767 1769
1768 viafbinfo->pseudo_palette = pseudo_pal; 1770 viafbinfo->pseudo_palette = pseudo_pal;
1769 if (viafb_accel && !viafb_init_engine(viafbinfo)) { 1771 if (viafb_accel && !viafb_setup_engine(viafbinfo)) {
1770 viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA | 1772 viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA |
1771 FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT; 1773 FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT;
1772 default_var.accel_flags = FB_ACCELF_TEXT; 1774 default_var.accel_flags = FB_ACCELF_TEXT;