drm/nouveau: Use private save/restore hooks for CRTCs
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 4 Dec 2015 16:13:38 +0000 (17:13 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 8 Dec 2015 15:13:49 +0000 (16:13 +0100)
I want to remove the core ones since with atomic drivers system
suspend/resume is solved much differently. And there's only 2 drivers
(gma500 besides nouveau) really using them.

v2: Fixup bugs Ilia spotted.

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449245618-1127-1-git-send-email-daniel.vetter@ffwll.ch
Reviewed-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/nouveau/dispnv04/crtc.c
drivers/gpu/drm/nouveau/dispnv04/disp.c
drivers/gpu/drm/nouveau/nouveau_crtc.h

index 3d96b49fe66209707acaf57bd66f6db1304e5941..6f04397d43a733037471911f7546e6c4cfee88de 100644 (file)
@@ -1081,8 +1081,6 @@ nouveau_crtc_set_config(struct drm_mode_set *set)
 }
 
 static const struct drm_crtc_funcs nv04_crtc_funcs = {
-       .save = nv_crtc_save,
-       .restore = nv_crtc_restore,
        .cursor_set = nv04_crtc_cursor_set,
        .cursor_move = nv04_crtc_cursor_move,
        .gamma_set = nv_crtc_gamma_set,
@@ -1123,6 +1121,9 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
        nv_crtc->index = crtc_num;
        nv_crtc->last_dpms = NV_DPMS_CLEARED;
 
+       nv_crtc->save = nv_crtc_save;
+       nv_crtc->restore = nv_crtc_restore;
+
        drm_crtc_init(dev, &nv_crtc->base, &nv04_crtc_funcs);
        drm_crtc_helper_add(&nv_crtc->base, &nv04_crtc_helper_funcs);
        drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
index 9e650081c3577af3a748b6bc494651fddf92a16b..59242ff767ea7ec978165a7e815f39f34f9c5fce 100644 (file)
@@ -39,7 +39,7 @@ nv04_display_create(struct drm_device *dev)
        struct dcb_table *dcb = &drm->vbios.dcb;
        struct drm_connector *connector, *ct;
        struct drm_encoder *encoder;
-       struct drm_crtc *crtc;
+       struct nouveau_crtc *crtc;
        struct nv04_display *disp;
        int i, ret;
 
@@ -107,8 +107,8 @@ nv04_display_create(struct drm_device *dev)
        }
 
        /* Save previous state */
-       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
-               crtc->funcs->save(crtc);
+       list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
+               crtc->save(&crtc->base);
 
        list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
                const struct drm_encoder_helper_funcs *func = encoder->helper_private;
@@ -128,6 +128,7 @@ nv04_display_destroy(struct drm_device *dev)
        struct nouveau_drm *drm = nouveau_drm(dev);
        struct drm_encoder *encoder;
        struct drm_crtc *crtc;
+       struct nouveau_crtc *nv_crtc;
 
        /* Turn every CRTC off. */
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -145,8 +146,8 @@ nv04_display_destroy(struct drm_device *dev)
                func->restore(encoder);
        }
 
-       list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
-               crtc->funcs->restore(crtc);
+       list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head)
+               nv_crtc->restore(&nv_crtc->base);
 
        nouveau_hw_save_vga_fonts(dev, 0);
 
index f19cb1c5fc5a678e37ec79ba6762708540adb99c..863f10b8d818232f56b7882079ec0459e87ec1a5 100644 (file)
@@ -73,6 +73,9 @@ struct nouveau_crtc {
        int (*set_dither)(struct nouveau_crtc *crtc, bool update);
        int (*set_scale)(struct nouveau_crtc *crtc, bool update);
        int (*set_color_vibrance)(struct nouveau_crtc *crtc, bool update);
+
+       void (*save)(struct drm_crtc *crtc);
+       void (*restore)(struct drm_crtc *crtc);
 };
 
 static inline struct nouveau_crtc *nouveau_crtc(struct drm_crtc *crtc)