All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>
To: Intel Graphics Development
	<intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "David (ChunMing) Zhou"
	<David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Andrey Grodzovsky"
	<andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>,
	"Sam Bobroff" <sbobroff-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>,
	"Daniel Vetter" <daniel.vetter-/w4YWyX8dFk@public.gmane.org>,
	"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
	"Maarten Lankhorst"
	<maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	"DRI Development"
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"Monk Liu" <Monk.Liu-5C7GfCeVMHo@public.gmane.org>,
	"Maxime Ripard"
	<maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	"Huang Rui" <ray.huang-5C7GfCeVMHo@public.gmane.org>,
	"Ben Skeggs" <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Alex Deucher" <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	"Daniel Vetter"
	<daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Sean Paul" <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>,
	"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	"Rex Zhu" <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>,
	"Shaoyun Liu" <Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 4/7] drm: Move the legacy kms disable_all helper to crtc helpers
Date: Mon, 10 Dec 2018 11:03:56 +0100	[thread overview]
Message-ID: <20181210100359.22507-5-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20181210100359.22507-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>

It's not a core function, and the matching atomic functions are also
not in the core. Plus the suspend/resume helper is also already there.

Needs a tiny bit of open-coding, but less midlayer beats that I think.

Cc: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Cc: Rex Zhu <Rex.Zhu@amd.com>
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Shaoyun Liu <Shaoyun.Liu@amd.com>
Cc: Monk Liu <Monk.Liu@amd.com>
Cc: nouveau@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  2 +-
 drivers/gpu/drm/drm_crtc.c                 | 31 -------------------
 drivers/gpu/drm/drm_crtc_helper.c          | 35 ++++++++++++++++++++++
 drivers/gpu/drm/nouveau/nouveau_display.c  |  2 +-
 drivers/gpu/drm/radeon/radeon_display.c    |  2 +-
 include/drm/drm_crtc.h                     |  2 --
 include/drm/drm_crtc_helper.h              |  1 +
 7 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index c75badfa5c4c..e669297ffefb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2689,7 +2689,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 	amdgpu_irq_disable_all(adev);
 	if (adev->mode_info.mode_config_initialized){
 		if (!amdgpu_device_has_dc_support(adev))
-			drm_crtc_force_disable_all(adev->ddev);
+			drm_helper_force_disable_all(adev->ddev);
 		else
 			drm_atomic_helper_shutdown(adev->ddev);
 	}
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f660819d406e..7dabbaf033a1 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -104,37 +104,6 @@ int drm_crtc_force_disable(struct drm_crtc *crtc)
 	return drm_mode_set_config_internal(&set);
 }
 
-/**
- * drm_crtc_force_disable_all - Forcibly turn off all enabled CRTCs
- * @dev: DRM device whose CRTCs to turn off
- *
- * Drivers may want to call this on unload to ensure that all displays are
- * unlit and the GPU is in a consistent, low power state. Takes modeset locks.
- *
- * Note: This should only be used by non-atomic legacy drivers. For an atomic
- * version look at drm_atomic_helper_shutdown().
- *
- * Returns:
- * Zero on success, error code on failure.
- */
-int drm_crtc_force_disable_all(struct drm_device *dev)
-{
-	struct drm_crtc *crtc;
-	int ret = 0;
-
-	drm_modeset_lock_all(dev);
-	drm_for_each_crtc(crtc, dev)
-		if (crtc->enabled) {
-			ret = drm_crtc_force_disable(crtc);
-			if (ret)
-				goto out;
-		}
-out:
-	drm_modeset_unlock_all(dev);
-	return ret;
-}
-EXPORT_SYMBOL(drm_crtc_force_disable_all);
-
 static unsigned int drm_num_crtcs(struct drm_device *dev)
 {
 	unsigned int num = 0;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index a3c81850e755..23159eb494f1 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -984,3 +984,38 @@ void drm_helper_resume_force_mode(struct drm_device *dev)
 	drm_modeset_unlock_all(dev);
 }
 EXPORT_SYMBOL(drm_helper_resume_force_mode);
+
+/**
+ * drm_helper_force_disable_all - Forcibly turn off all enabled CRTCs
+ * @dev: DRM device whose CRTCs to turn off
+ *
+ * Drivers may want to call this on unload to ensure that all displays are
+ * unlit and the GPU is in a consistent, low power state. Takes modeset locks.
+ *
+ * Note: This should only be used by non-atomic legacy drivers. For an atomic
+ * version look at drm_atomic_helper_shutdown().
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_helper_force_disable_all(struct drm_device *dev)
+{
+	struct drm_crtc *crtc;
+	int ret = 0;
+
+	drm_modeset_lock_all(dev);
+	drm_for_each_crtc(crtc, dev)
+		if (crtc->enabled) {
+			struct drm_mode_set set = {
+				.crtc = crtc,
+			};
+
+			ret = drm_mode_set_config_internal(&set);
+			if (ret)
+				goto out;
+		}
+out:
+	drm_modeset_unlock_all(dev);
+	return ret;
+}
+EXPORT_SYMBOL(drm_helper_force_disable_all);
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index f326ffd86766..5d273a655479 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -453,7 +453,7 @@ nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime)
 		if (drm_drv_uses_atomic_modeset(dev))
 			drm_atomic_helper_shutdown(dev);
 		else
-			drm_crtc_force_disable_all(dev);
+			drm_helper_force_disable_all(dev);
 	}
 
 	/* disable flip completion events */
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index e6912eb99b42..92332226e5cf 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1643,7 +1643,7 @@ void radeon_modeset_fini(struct radeon_device *rdev)
 	if (rdev->mode_info.mode_config_initialized) {
 		drm_kms_helper_poll_fini(rdev->ddev);
 		radeon_hpd_fini(rdev);
-		drm_crtc_force_disable_all(rdev->ddev);
+		drm_helper_force_disable_all(rdev->ddev);
 		radeon_fbdev_fini(rdev);
 		radeon_afmt_fini(rdev);
 		drm_mode_config_cleanup(rdev->ddev);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b45bec0b7a9c..85abd3fe9e83 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1149,8 +1149,6 @@ static inline uint32_t drm_crtc_mask(const struct drm_crtc *crtc)
 	return 1 << drm_crtc_index(crtc);
 }
 
-int drm_crtc_force_disable_all(struct drm_device *dev);
-
 int drm_mode_set_config_internal(struct drm_mode_set *set);
 struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);
 
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index d65f034843ce..0ee9a96b70da 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -56,6 +56,7 @@ bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
 int drm_helper_connector_dpms(struct drm_connector *connector, int mode);
 
 void drm_helper_resume_force_mode(struct drm_device *dev);
+int drm_helper_force_disable_all(struct drm_device *dev);
 
 /* drm_probe_helper.c */
 int drm_helper_probe_single_connector_modes(struct drm_connector
-- 
2.20.0.rc1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-12-10 10:03 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 10:03 [PATCH 0/7] legacy helper cleanup Daniel Vetter
2018-12-10 10:03 ` [PATCH 1/7] drm/ch7006: Stop using drm_crtc_force_disable Daniel Vetter
2018-12-10 16:20   ` Ville Syrjälä
2018-12-12 10:54     ` [Intel-gfx] " Daniel Vetter
2018-12-10 10:03 ` [PATCH 2/7] drm/nouveau: " Daniel Vetter
2018-12-10 10:03 ` [PATCH 3/7] drm: Unexport drm_crtc_force_disable Daniel Vetter
     [not found] ` <20181210100359.22507-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2018-12-10 10:03   ` Daniel Vetter [this message]
2018-12-10 15:58     ` [PATCH 4/7] drm: Move the legacy kms disable_all helper to crtc helpers Alex Deucher
2018-12-11 15:53       ` Sean Paul
2018-12-11 15:55         ` Alex Deucher
2018-12-10 10:03 ` [PATCH 5/7] drm/qxl: Don't set the dpms hook Daniel Vetter
2018-12-10 13:08   ` Gerd Hoffmann
2018-12-10 13:08   ` Gerd Hoffmann
2018-12-10 10:03 ` [PATCH 6/7] drm/xen: " Daniel Vetter
2018-12-10 10:12   ` Oleksandr Andrushchenko
2018-12-10 10:12   ` Oleksandr Andrushchenko
2018-12-12 10:56     ` Daniel Vetter
2018-12-12 10:56     ` Daniel Vetter
2018-12-10 10:03 ` Daniel Vetter
2018-12-10 10:11 ` [PATCH 7/7] drm: Split out drm_probe_helper.h Daniel Vetter
2018-12-10 10:11 ` Daniel Vetter
2018-12-10 10:11   ` Daniel Vetter
2018-12-10 10:24   ` Thierry Reding
2018-12-10 10:24   ` Thierry Reding
     [not found]   ` <20181210101133.5364-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2018-12-10 10:24     ` Thierry Reding
2018-12-10 10:24       ` Thierry Reding
2018-12-10 10:24       ` Thierry Reding
2018-12-10 10:24       ` Thierry Reding
2018-12-10 11:10       ` Benjamin Gaignard
2018-12-10 11:10       ` Benjamin Gaignard
2018-12-10 11:10         ` Benjamin Gaignard
2018-12-10 11:10         ` Benjamin Gaignard
2018-12-10 11:10         ` Benjamin Gaignard
     [not found]         ` <CA+M3ks5MgpCqMDp6DrtyB_Cj_YMryysTmbAaUjzN7sWde5dX6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-10 13:40           ` Benjamin Gaignard
2018-12-10 13:40             ` Benjamin Gaignard
2018-12-10 13:40             ` Benjamin Gaignard
2018-12-10 13:40             ` Benjamin Gaignard
     [not found]             ` <CA+M3ks7ODkgZe_otsens1H4PoKOdnfHVxUgi84NPyri6Xhh1dg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-12 10:53               ` Daniel Vetter
2018-12-12 10:53                 ` Daniel Vetter
2018-12-12 10:53                 ` Daniel Vetter
2018-12-12 10:53                 ` Daniel Vetter
2018-12-12 10:53             ` Daniel Vetter
2018-12-12 10:53             ` Daniel Vetter
2018-12-10 13:40         ` Benjamin Gaignard
2018-12-10 12:30   ` Neil Armstrong
2018-12-10 12:30     ` Neil Armstrong
2018-12-10 12:30     ` Neil Armstrong
2018-12-10 12:30     ` Neil Armstrong
2018-12-10 12:30   ` Neil Armstrong
2018-12-10 12:30   ` Neil Armstrong
2018-12-29 22:56   ` Liviu Dudau
2018-12-29 22:56   ` Liviu Dudau
2018-12-29 22:56     ` Liviu Dudau
2019-01-07  9:45     ` Daniel Vetter
2019-01-07  9:45     ` Daniel Vetter
2019-01-07  9:45       ` Daniel Vetter
     [not found]       ` <20190107094522.GU21184-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-01-07 10:08         ` Liviu Dudau
2019-01-07 10:08           ` Liviu Dudau
2019-01-07 10:24           ` Daniel Vetter
2019-01-07 10:24           ` Daniel Vetter
     [not found]           ` <20190107100841.GH20342-hOhETlTuV5niMG9XS5x8Mg@public.gmane.org>
2019-01-07 10:24             ` Daniel Vetter
2019-01-07 10:24               ` Daniel Vetter
2019-01-07 10:08       ` Liviu Dudau
2018-12-10 11:39 ` ✗ Fi.CI.CHECKPATCH: warning for legacy helper cleanup Patchwork
2018-12-10 12:09 ` ✓ Fi.CI.BAT: success " Patchwork
2018-12-10 14:57 ` ✓ Fi.CI.IGT: " Patchwork
2018-12-10 21:33 ` [PATCH 0/7] " Alex Deucher
2018-12-17 19:42 [PATCH 1/7] drm/ch7006: Stop using drm_crtc_force_disable Daniel Vetter
     [not found] ` <20181217194303.14397-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2018-12-17 19:43   ` [PATCH 4/7] drm: Move the legacy kms disable_all helper to crtc helpers 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=20181210100359.22507-5-daniel.vetter@ffwll.ch \
    --to=daniel.vetter-/w4ywyx8dfk@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=Monk.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=Rex.Zhu-5C7GfCeVMHo@public.gmane.org \
    --cc=Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=daniel.vetter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ray.huang-5C7GfCeVMHo@public.gmane.org \
    --cc=sbobroff-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.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.