[13/28] drm/nouveau: Use private save/restore hooks
diff mbox

Message ID 1449218769-16577-14-git-send-email-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter Dec. 4, 2015, 8:45 a.m. UTC
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.

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c |  5 +++--
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 11 ++++++-----
 drivers/gpu/drm/nouveau/nouveau_crtc.h  |  3 +++
 3 files changed, 12 insertions(+), 7 deletions(-)

Comments

Ilia Mirkin Dec. 4, 2015, 2:31 p.m. UTC | #1
On Fri, Dec 4, 2015 at 3:45 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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.
>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c |  5 +++--
>  drivers/gpu/drm/nouveau/dispnv04/disp.c | 11 ++++++-----
>  drivers/gpu/drm/nouveau/nouveau_crtc.h  |  3 +++
>  3 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> index dab24066fa21..bb9e9cb14b9d 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> @@ -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);
> diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
> index 9e650081c357..ebd9430e0628 100644
> --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
> @@ -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);

Won't this warn about incompatible types? (function wants drm_crtc,
but you're giving it nouveau_crtc)?

>
>         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(crtc);

Why is this OK? Don't you want to use nv_crtc here as the function argument?

>
>         nouveau_hw_save_vga_fonts(dev, 0);
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h
> index f19cb1c5fc5a..863f10b8d818 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h
> @@ -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)
> --
> 2.5.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter Dec. 4, 2015, 4:06 p.m. UTC | #2
On Fri, Dec 04, 2015 at 09:31:01AM -0500, Ilia Mirkin wrote:
> On Fri, Dec 4, 2015 at 3:45 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > 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.
> >
> > Cc: Ben Skeggs <bskeggs@redhat.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/nouveau/dispnv04/crtc.c |  5 +++--
> >  drivers/gpu/drm/nouveau/dispnv04/disp.c | 11 ++++++-----
> >  drivers/gpu/drm/nouveau/nouveau_crtc.h  |  3 +++
> >  3 files changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> > index dab24066fa21..bb9e9cb14b9d 100644
> > --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> > +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
> > @@ -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);
> > diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
> > index 9e650081c357..ebd9430e0628 100644
> > --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
> > +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
> > @@ -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);
> 
> Won't this warn about incompatible types? (function wants drm_crtc,
> but you're giving it nouveau_crtc)?

Because I misapplied a hunk and it's in the next nouveau patch ;-)
> 
> >
> >         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(crtc);
> 
> Why is this OK? Don't you want to use nv_crtc here as the function argument?

Total bullocks and embarrassing. Will resend both.
-Daniel

> 
> >
> >         nouveau_hw_save_vga_fonts(dev, 0);
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h
> > index f19cb1c5fc5a..863f10b8d818 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h
> > +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h
> > @@ -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)
> > --
> > 2.5.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index dab24066fa21..bb9e9cb14b9d 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -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);
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 9e650081c357..ebd9430e0628 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -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);
 
 	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(crtc);
 
 	nouveau_hw_save_vga_fonts(dev, 0);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h
index f19cb1c5fc5a..863f10b8d818 100644
--- a/drivers/gpu/drm/nouveau/nouveau_crtc.h
+++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h
@@ -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)