All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Ben Skeggs <bskeggs@redhat.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH 15/28] drm: Move encoder->save/restore into nouveau
Date: Fri,  4 Dec 2015 09:45:56 +0100	[thread overview]
Message-ID: <1449218769-16577-16-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1449218769-16577-1-git-send-email-daniel.vetter@ffwll.ch>

Nouveau is the only user, and atomic drivers should do state
save/restoring differently. So move it into noveau.

Saves me typing some kerneldoc, too ;-)

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/nouveau/dispnv04/dac.c    |  7 +++----
 drivers/gpu/drm/nouveau/dispnv04/dfp.c    |  7 +++----
 drivers/gpu/drm/nouveau/dispnv04/disp.c   | 34 ++++++++++++-------------------
 drivers/gpu/drm/nouveau/dispnv04/tvnv04.c |  5 +++--
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c |  5 +++--
 drivers/gpu/drm/nouveau/nouveau_encoder.h |  3 +++
 include/drm/drm_modeset_helper_vtables.h  |  4 ----
 7 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/dac.c b/drivers/gpu/drm/nouveau/dispnv04/dac.c
index 78cb033bc015..6c442def403d 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/dac.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/dac.c
@@ -504,8 +504,6 @@ static void nv04_dac_destroy(struct drm_encoder *encoder)
 
 static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = {
 	.dpms = nv04_dac_dpms,
-	.save = nv04_dac_save,
-	.restore = nv04_dac_restore,
 	.mode_fixup = nv04_dac_mode_fixup,
 	.prepare = nv04_dac_prepare,
 	.commit = nv04_dac_commit,
@@ -515,8 +513,6 @@ static const struct drm_encoder_helper_funcs nv04_dac_helper_funcs = {
 
 static const struct drm_encoder_helper_funcs nv17_dac_helper_funcs = {
 	.dpms = nv04_dac_dpms,
-	.save = nv04_dac_save,
-	.restore = nv04_dac_restore,
 	.mode_fixup = nv04_dac_mode_fixup,
 	.prepare = nv04_dac_prepare,
 	.commit = nv04_dac_commit,
@@ -545,6 +541,9 @@ nv04_dac_create(struct drm_connector *connector, struct dcb_output *entry)
 	nv_encoder->dcb = entry;
 	nv_encoder->or = ffs(entry->or) - 1;
 
+	nv_encoder->enc_save = nv04_dac_save;
+	nv_encoder->enc_restore = nv04_dac_restore;
+
 	if (nv_gf4_disp_arch(dev))
 		helper = &nv17_dac_helper_funcs;
 	else
diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouveau/dispnv04/dfp.c
index 429ab5e3025a..4c5fb89d74db 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c
@@ -652,8 +652,6 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder)
 
 static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
 	.dpms = nv04_lvds_dpms,
-	.save = nv04_dfp_save,
-	.restore = nv04_dfp_restore,
 	.mode_fixup = nv04_dfp_mode_fixup,
 	.prepare = nv04_dfp_prepare,
 	.commit = nv04_dfp_commit,
@@ -663,8 +661,6 @@ static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = {
 
 static const struct drm_encoder_helper_funcs nv04_tmds_helper_funcs = {
 	.dpms = nv04_tmds_dpms,
-	.save = nv04_dfp_save,
-	.restore = nv04_dfp_restore,
 	.mode_fixup = nv04_dfp_mode_fixup,
 	.prepare = nv04_dfp_prepare,
 	.commit = nv04_dfp_commit,
@@ -701,6 +697,9 @@ nv04_dfp_create(struct drm_connector *connector, struct dcb_output *entry)
 	if (!nv_encoder)
 		return -ENOMEM;
 
+	nv_encoder->enc_save = nv04_dfp_save;
+	nv_encoder->enc_restore = nv04_dfp_restore;
+
 	encoder = to_drm_encoder(nv_encoder);
 
 	nv_encoder->dcb = entry;
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index ebd9430e0628..449d92a2175e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -39,6 +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 nouveau_encoder *nv_encoder;
 	struct nouveau_crtc *crtc;
 	struct nv04_display *disp;
 	int i, ret;
@@ -108,13 +109,10 @@ nv04_display_create(struct drm_device *dev)
 
 	/* Save previous state */
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
-		crtc->save(crtc);
+		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;
-
-		func->save(encoder);
-	}
+	list_for_each_entry(nv_encoder, &dev->mode_config.encoder_list, base.base.head)
+		nv_encoder->enc_save(&nv_encoder->base.base);
 
 	nouveau_overlay_init(dev);
 
@@ -126,7 +124,7 @@ nv04_display_destroy(struct drm_device *dev)
 {
 	struct nv04_display *disp = nv04_display(dev);
 	struct nouveau_drm *drm = nouveau_drm(dev);
-	struct drm_encoder *encoder;
+	struct nouveau_encoder *encoder;
 	struct drm_crtc *crtc;
 	struct nouveau_crtc *nv_crtc;
 
@@ -140,11 +138,8 @@ nv04_display_destroy(struct drm_device *dev)
 	}
 
 	/* Restore state */
-	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
-		const struct drm_encoder_helper_funcs *func = encoder->helper_private;
-
-		func->restore(encoder);
-	}
+	list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
+		encoder->enc_restore(&encoder->base.base);
 
 	list_for_each_entry(nv_crtc, &dev->mode_config.crtc_list, base.head)
 		nv_crtc->restore(crtc);
@@ -160,8 +155,8 @@ nv04_display_destroy(struct drm_device *dev)
 int
 nv04_display_init(struct drm_device *dev)
 {
-	struct drm_encoder *encoder;
-	struct drm_crtc *crtc;
+	struct nouveau_encoder *encoder;
+	struct nouveau_crtc *crtc;
 
 	/* meh.. modeset apparently doesn't setup all the regs and depends
 	 * on pre-existing state, for now load the state of the card *before*
@@ -171,14 +166,11 @@ nv04_display_init(struct drm_device *dev)
 	 * save/restore "pre-load" state, but more general so we can save
 	 * on suspend too.
 	 */
-	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
-		const struct drm_encoder_helper_funcs *func = encoder->helper_private;
-
-		func->restore(encoder);
-	}
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
+		crtc->save(&crtc->base);
 
-	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
-		crtc->funcs->restore(crtc);
+	list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.base.head)
+		encoder->enc_save(&encoder->base.base);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
index 5345eb5378a8..91d689400d2e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
@@ -192,8 +192,6 @@ static const struct drm_encoder_funcs nv04_tv_funcs = {
 
 static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = {
 	.dpms = nv04_tv_dpms,
-	.save = drm_i2c_encoder_save,
-	.restore = drm_i2c_encoder_restore,
 	.mode_fixup = drm_i2c_encoder_mode_fixup,
 	.prepare = nv04_tv_prepare,
 	.commit = nv04_tv_commit,
@@ -228,6 +226,9 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry)
 	drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC);
 	drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs);
 
+	nv_encoder->enc_save = drm_i2c_encoder_save;
+	nv_encoder->enc_restore = drm_i2c_encoder_restore;
+
 	encoder->possible_crtcs = entry->heads;
 	encoder->possible_clones = 0;
 	nv_encoder->dcb = entry;
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index b734195d80a0..ff8c55866b18 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
@@ -771,8 +771,6 @@ static void nv17_tv_destroy(struct drm_encoder *encoder)
 
 static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = {
 	.dpms = nv17_tv_dpms,
-	.save = nv17_tv_save,
-	.restore = nv17_tv_restore,
 	.mode_fixup = nv17_tv_mode_fixup,
 	.prepare = nv17_tv_prepare,
 	.commit = nv17_tv_commit,
@@ -820,6 +818,9 @@ nv17_tv_create(struct drm_connector *connector, struct dcb_output *entry)
 	drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs);
 	to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs;
 
+	tv_enc->base.enc_save = nv17_tv_save;
+	tv_enc->base.enc_restore = nv17_tv_restore;
+
 	encoder->possible_crtcs = entry->heads;
 	encoder->possible_clones = 0;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/nouveau/nouveau_encoder.h
index b37da95105b0..c38a86408363 100644
--- a/drivers/gpu/drm/nouveau/nouveau_encoder.h
+++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h
@@ -63,6 +63,9 @@ struct nouveau_encoder {
 			u32 datarate;
 		} dp;
 	};
+
+	void (*enc_save)(struct drm_encoder *encoder);
+	void (*enc_restore)(struct drm_encoder *encoder);
 };
 
 struct nouveau_encoder *
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index 35c5a1c4e7ba..bc731754fc70 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -126,8 +126,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
 /**
  * struct drm_encoder_helper_funcs - helper operations for encoders
  * @dpms: set power state
- * @save: save connector state
- * @restore: restore connector state
  * @mode_fixup: try to fixup proposed mode for this connector
  * @prepare: part of the disable sequence, called before the CRTC modeset
  * @commit: called after the CRTC modeset
@@ -149,8 +147,6 @@ static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
  */
 struct drm_encoder_helper_funcs {
 	void (*dpms)(struct drm_encoder *encoder, int mode);
-	void (*save)(struct drm_encoder *encoder);
-	void (*restore)(struct drm_encoder *encoder);
 
 	bool (*mode_fixup)(struct drm_encoder *encoder,
 			   const struct drm_display_mode *mode,
-- 
2.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-12-04  8:45 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04  8:45 [PATCH 00/28] kerneldoc for display vtables Daniel Vetter
2015-12-04  8:45 ` [PATCH 01/28] drm: Polish fbdev helper struct docs Daniel Vetter
2015-12-07 10:45   ` Thierry Reding
2015-12-07 11:50     ` Daniel Vetter
2015-12-07 11:53       ` Thierry Reding
2015-12-04  8:45 ` [PATCH 02/28] drm: Move LEAVE/ENTER_ATOMIC_MODESET to fbdev helpers Daniel Vetter
2015-12-07 11:00   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 03/28] drm: Reorganize helper vtables and their docs Daniel Vetter
2015-12-07 11:00   ` Thierry Reding
2015-12-07 11:59     ` Daniel Vetter
2015-12-07 12:26       ` Thierry Reding
2015-12-04  8:45 ` [PATCH 04/28] drm: Make helper vtable pointers type-safe Daniel Vetter
2015-12-07 11:01   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 05/28] drm: Merge helper docbook into kerneldoc comments Daniel Vetter
2015-12-07 11:15   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 06/28] drm/bridge: Improve kerneldoc Daniel Vetter
2015-12-04 10:43   ` Archit Taneja
2015-12-07 11:31   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 07/28] drm: Update drm_plane_funcs kerneldoc Daniel Vetter
2015-12-07 11:46   ` Thierry Reding
2015-12-07 12:34     ` Daniel Vetter
2015-12-07 12:43       ` Thierry Reding
2015-12-07 13:00         ` Daniel Vetter
2015-12-04  8:45 ` [PATCH 08/28] drm/noveau: Ditch NULL save/restore hook assignments Daniel Vetter
2015-12-07 11:47   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 09/28] drm/qxl: Drop dummy save/restore hooks Daniel Vetter
2015-12-07 11:47   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 10/28] drm/virtio: Drop dummy save/restore functions Daniel Vetter
2015-12-07 11:47   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 11/28] drm/vmwgfx: Drop dummy save/restore hooks Daniel Vetter
2015-12-07 11:48   ` Thierry Reding
2015-12-08 11:55   ` Thomas Hellstrom
2015-12-04  8:45 ` [PATCH 12/28] drm/gma500: Move to private " Daniel Vetter
2015-12-07 11:51   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 13/28] drm/nouveau: Use " Daniel Vetter
2015-12-04 14:31   ` Ilia Mirkin
2015-12-04 16:06     ` Daniel Vetter
2015-12-04 16:13   ` [PATCH] drm/nouveau: Use private save/restore hooks for CRTCs Daniel Vetter
2015-12-07 11:51     ` Thierry Reding
2015-12-04  8:45 ` [PATCH 14/28] drm: Remove crtc/connector->save/restore hooks Daniel Vetter
2015-12-07 11:55   ` Thierry Reding
2015-12-04  8:45 ` Daniel Vetter [this message]
2015-12-04 16:14   ` [PATCH] drm: Move encoder->save/restore into nouveau Daniel Vetter
2015-12-07 11:59     ` Thierry Reding
2015-12-04  8:45 ` [PATCH 16/28] drm: Document drm_atomic_*_get_property Daniel Vetter
2015-12-07 12:01   ` Thierry Reding
2015-12-07 12:51     ` Daniel Vetter
2015-12-04  8:45 ` [PATCH 17/28] drm: Document drm_connector_funcs Daniel Vetter
2015-12-07 12:05   ` Thierry Reding
2015-12-04  8:45 ` [PATCH 18/28] drm: connector->dpms is not optional Daniel Vetter
2015-12-07 12:06   ` Thierry Reding
2015-12-04  8:46 ` [PATCH 19/28] drm: document drm_crtc_funcs Daniel Vetter
2015-12-07 12:25   ` Thierry Reding
2015-12-04  8:46 ` [PATCH 20/28] drm: Add kerneldoc for drm_framebuffer_funcs Daniel Vetter
2015-12-07 12:37   ` Thierry Reding
2015-12-04  8:46 ` [PATCH 21/28] drm: Kerneldoc for drm_mode_config_funcs Daniel Vetter
2015-12-07 13:14   ` Thierry Reding
2015-12-07 13:34     ` Daniel Vetter
2015-12-04  8:46 ` [PATCH 22/28] drm/atomic-helper: Reject attempts at re-stealing encoders Daniel Vetter
2015-12-07 13:26   ` Thierry Reding
2015-12-07 13:40     ` Daniel Vetter
2015-12-04  8:46 ` [PATCH 23/28] drm: Document drm_plane_helper_funcs Daniel Vetter
2015-12-07 14:27   ` Thierry Reding
2015-12-07 14:43     ` Daniel Vetter
2015-12-04  8:46 ` [PATCH 24/28] drm: Document drm_connector_helper_funcs Daniel Vetter
2015-12-07 14:42   ` Thierry Reding
2015-12-07 14:48     ` Daniel Vetter
2015-12-07 15:27       ` Thierry Reding
2015-12-04  8:46 ` [PATCH 25/28] drm/atomic-helper: Mention the new system/resume helpers the docs Daniel Vetter
2015-12-07 14:45   ` Thierry Reding
2015-12-04  8:46 ` [PATCH 26/28] drm: Move drm_display_mode an related docs into kerneldoc Daniel Vetter
2015-12-07 13:39   ` Ville Syrjälä
2015-12-07 15:02   ` Thierry Reding
2015-12-07 15:33     ` Daniel Vetter
2015-12-04  8:46 ` [PATCH 27/28] drm: Document drm_encoder/crtc_helper_funcs Daniel Vetter
2015-12-07 15:21   ` Thierry Reding
2015-12-04  8:46 ` [PATCH 28/28] drm/atomic-helper: Reject legacy flips on a disabled pipe Daniel Vetter
2015-12-07 13:42   ` Ville Syrjälä
2015-12-07 15:25   ` Thierry Reding
2015-12-07 15:33   ` Daniel Stone
2015-12-08  8:23     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449218769-16577-16-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.