]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/nouveau/kms/nv04-nv4x: move suspend code to dispnv04 fini hook
authorBen Skeggs <bskeggs@redhat.com>
Tue, 12 Feb 2019 12:28:13 +0000 (22:28 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 19 Feb 2019 22:59:59 +0000 (08:59 +1000)
It has no relevance to the atomic path used by newer GPUs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/dispnv04/disp.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nouveau_display.h

index bda02f6603046ae703737f87fae3cfdfd70c503e..451e38a82fe76aded3c7f2ec720c0ddd88bac4b8 100644 (file)
 #include "hw.h"
 #include "nouveau_encoder.h"
 #include "nouveau_connector.h"
+#include "nouveau_bo.h"
 
 #include <nvif/if0004.h>
 
 static void
-nv04_display_fini(struct drm_device *dev)
+nv04_display_fini(struct drm_device *dev, bool suspend)
 {
        struct nv04_display *disp = nv04_display(dev);
+       struct drm_crtc *crtc;
 
        /* Disable flip completion events. */
        nvif_notify_put(&disp->flip);
@@ -45,6 +47,29 @@ nv04_display_fini(struct drm_device *dev)
        NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0);
        if (nv_two_heads(dev))
                NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
+
+       if (!suspend)
+               return;
+
+       /* Un-pin FB and cursors so they'll be evicted to system memory. */
+       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+               struct nouveau_framebuffer *nouveau_fb;
+
+               nouveau_fb = nouveau_framebuffer(crtc->primary->fb);
+               if (!nouveau_fb || !nouveau_fb->nvbo)
+                       continue;
+
+               nouveau_bo_unpin(nouveau_fb->nvbo);
+       }
+
+       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+               struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
+               if (nv_crtc->cursor.nvbo) {
+                       if (nv_crtc->cursor.set_offset)
+                               nouveau_bo_unmap(nv_crtc->cursor.nvbo);
+                       nouveau_bo_unpin(nv_crtc->cursor.nvbo);
+               }
+       }
 }
 
 static int
index 07aee824b364ca0877f559565301b7bbe10e9b52..b8a04f178a67359d3f62d442910b431a98c831e2 100644 (file)
@@ -2222,7 +2222,7 @@ nv50_disp_func = {
  *****************************************************************************/
 
 static void
-nv50_display_fini(struct drm_device *dev)
+nv50_display_fini(struct drm_device *dev, bool suspend)
 {
        struct nouveau_encoder *nv_encoder;
        struct drm_encoder *encoder;
index 1acf035db02e2d6212264f2be6afbce34d49eb0c..2e717224d1a37bedda0e2edf32467f238b42b4a6 100644 (file)
@@ -461,7 +461,7 @@ nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime)
                cancel_work_sync(&drm->hpd_work);
 
        drm_kms_helper_poll_disable(dev);
-       disp->fini(dev);
+       disp->fini(dev, suspend);
 }
 
 static void
@@ -614,7 +614,6 @@ int
 nouveau_display_suspend(struct drm_device *dev, bool runtime)
 {
        struct nouveau_display *disp = nouveau_display(dev);
-       struct drm_crtc *crtc;
 
        if (drm_drv_uses_atomic_modeset(dev)) {
                if (!runtime) {
@@ -625,32 +624,9 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)
                                return ret;
                        }
                }
-
-               nouveau_display_fini(dev, true, runtime);
-               return 0;
        }
 
        nouveau_display_fini(dev, true, runtime);
-
-       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-               struct nouveau_framebuffer *nouveau_fb;
-
-               nouveau_fb = nouveau_framebuffer(crtc->primary->fb);
-               if (!nouveau_fb || !nouveau_fb->nvbo)
-                       continue;
-
-               nouveau_bo_unpin(nouveau_fb->nvbo);
-       }
-
-       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-               struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
-               if (nv_crtc->cursor.nvbo) {
-                       if (nv_crtc->cursor.set_offset)
-                               nouveau_bo_unmap(nv_crtc->cursor.nvbo);
-                       nouveau_bo_unpin(nv_crtc->cursor.nvbo);
-               }
-       }
-
        return 0;
 }
 
index 2676876a82c7ca9f22b93c5f419ad5ff4761a697..33ed788f585555639c6357aaaf43f5060b951a85 100644 (file)
@@ -29,7 +29,7 @@ struct nouveau_display {
        void *priv;
        void (*dtor)(struct drm_device *);
        int  (*init)(struct drm_device *);
-       void (*fini)(struct drm_device *);
+       void (*fini)(struct drm_device *, bool suspend);
 
        struct nvif_disp disp;