]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
viafb: fix hardware acceleration for suspend & resume
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Mon, 26 Apr 2010 17:31:03 +0000 (17:31 +0000)
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Sun, 24 Oct 2010 13:04:53 +0000 (13:04 +0000)
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>
drivers/video/via/accel.c
drivers/video/via/accel.h
drivers/video/via/viafbdev.c

index c2f4e6e166f11508b61a46236a68fa61f66ada4f..bc4905366726479966511df637991d3e5daca781 100644 (file)
@@ -315,13 +315,11 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,
        return 0;
 }
 
        return 0;
 }
 
-int viafb_init_engine(struct fb_info *info)
+int viafb_setup_engine(struct fb_info *info)
 {
        struct viafb_par *viapar = info->par;
        void __iomem *engine;
 {
        struct viafb_par *viapar = info->par;
        void __iomem *engine;
-       int highest_reg, i;
-       u32 vq_start_addr, vq_end_addr, vq_start_low, vq_end_low, vq_high,
-               vq_len, chip_name = viapar->shared->chip_info.gfx_chip_name;
+       u32 chip_name = viapar->shared->chip_info.gfx_chip_name;
 
        engine = viapar->shared->vdev->engine_mmio;
        if (!engine) {
 
        engine = viapar->shared->vdev->engine_mmio;
        if (!engine) {
@@ -330,18 +328,6 @@ int viafb_init_engine(struct fb_info *info)
                return -ENOMEM;
        }
 
                return -ENOMEM;
        }
 
-       /* Initialize registers to reset the 2D engine */
-       switch (viapar->shared->chip_info.twod_engine) {
-       case VIA_2D_ENG_M1:
-               highest_reg = 0x5c;
-               break;
-       default:
-               highest_reg = 0x40;
-               break;
-       }
-       for (i = 0; i <= highest_reg; i += 4)
-               writel(0x0, engine + i);
-
        switch (chip_name) {
        case UNICHROME_CLE266:
        case UNICHROME_K400:
        switch (chip_name) {
        case UNICHROME_CLE266:
        case UNICHROME_K400:
@@ -387,6 +373,29 @@ int viafb_init_engine(struct fb_info *info)
        viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free;
 #endif
 
        viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free;
 #endif
 
+       viafb_reset_engine(viapar);
+       return 0;
+}
+
+void viafb_reset_engine(struct viafb_par *viapar)
+{
+       void __iomem *engine = viapar->shared->vdev->engine_mmio;
+       int highest_reg, i;
+       u32 vq_start_addr, vq_end_addr, vq_start_low, vq_end_low, vq_high,
+               vq_len, chip_name = viapar->shared->chip_info.gfx_chip_name;
+
+       /* Initialize registers to reset the 2D engine */
+       switch (viapar->shared->chip_info.twod_engine) {
+       case VIA_2D_ENG_M1:
+               highest_reg = 0x5c;
+               break;
+       default:
+               highest_reg = 0x40;
+               break;
+       }
+       for (i = 0; i <= highest_reg; i += 4)
+               writel(0x0, engine + i);
+
        /* Init AGP and VQ regs */
        switch (chip_name) {
        case UNICHROME_K8M890:
        /* Init AGP and VQ regs */
        switch (chip_name) {
        case UNICHROME_K8M890:
@@ -474,7 +483,7 @@ int viafb_init_engine(struct fb_info *info)
        writel(0x0, engine + VIA_REG_CURSOR_ORG);
        writel(0x0, engine + VIA_REG_CURSOR_BG);
        writel(0x0, engine + VIA_REG_CURSOR_FG);
        writel(0x0, engine + VIA_REG_CURSOR_ORG);
        writel(0x0, engine + VIA_REG_CURSOR_BG);
        writel(0x0, engine + VIA_REG_CURSOR_FG);
-       return 0;
+       return;
 }
 
 void viafb_show_hw_cursor(struct fb_info *info, int Status)
 }
 
 void viafb_show_hw_cursor(struct fb_info *info, int Status)
index 2c122d2923654a1874177699cc703a782782dd4a..79d5e10cc83575fba00d0b8adb2ec2e290d3cdc8 100644 (file)
 #define VIA_BITBLT_MONO                2
 #define VIA_BITBLT_FILL                3
 
 #define VIA_BITBLT_MONO                2
 #define VIA_BITBLT_FILL                3
 
-int viafb_init_engine(struct fb_info *info);
+int viafb_setup_engine(struct fb_info *info);
+void viafb_reset_engine(struct viafb_par *viapar);
 void viafb_show_hw_cursor(struct fb_info *info, int Status);
 void viafb_wait_engine_idle(struct fb_info *info);
 
 void viafb_show_hw_cursor(struct fb_info *info, int Status);
 void viafb_wait_engine_idle(struct fb_info *info);
 
index 4e9e105a6c78524b5e84fc9e797e6efb28c04ef1..6c651e401dc6f54c279234f3cf635ab3e5068622 100644 (file)
@@ -1695,6 +1695,8 @@ int viafb_resume(struct pci_dev *pdev)
        if (pci_enable_device(pdev))
                goto fail;
        pci_set_master(pdev);
        if (pci_enable_device(pdev))
                goto fail;
        pci_set_master(pdev);
+       if (viaparinfo->shared->vdev->engine_mmio)
+               viafb_reset_engine(viaparinfo);
        viafb_set_par(viafbinfo);
        if (viafb_dual_fb)
                viafb_set_par(viafbinfo1);
        viafb_set_par(viafbinfo);
        if (viafb_dual_fb)
                viafb_set_par(viafbinfo1);
@@ -1766,7 +1768,7 @@ int __devinit via_fb_pci_probe(struct viafb_dev *vdev)
        viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
 
        viafbinfo->pseudo_palette = pseudo_pal;
        viafbinfo->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
 
        viafbinfo->pseudo_palette = pseudo_pal;
-       if (viafb_accel && !viafb_init_engine(viafbinfo)) {
+       if (viafb_accel && !viafb_setup_engine(viafbinfo)) {
                viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA |
                        FBINFO_HWACCEL_FILLRECT |  FBINFO_HWACCEL_IMAGEBLIT;
                default_var.accel_flags = FB_ACCELF_TEXT;
                viafbinfo->flags |= FBINFO_HWACCEL_COPYAREA |
                        FBINFO_HWACCEL_FILLRECT |  FBINFO_HWACCEL_IMAGEBLIT;
                default_var.accel_flags = FB_ACCELF_TEXT;