From: Sean Paul <sean@poorly.run>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Chunming Zhou <David1.Zhou@amd.com>,
sbobroff@linux.ibm.com, Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
Rex Zhu <Rex.Zhu@amd.com>, Dave Airlie <airlied@linux.ie>,
Huang Rui <ray.huang@amd.com>,
Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
nouveau <nouveau@lists.freedesktop.org>,
"Deucher, Alexander" <alexander.deucher@amd.com>,
Daniel Vetter <daniel.vetter@intel.com>,
Shaoyun Liu <Shaoyun.Liu@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
"monk.liu" <Monk.Liu@amd.com>, Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [PATCH 4/7] drm: Move the legacy kms disable_all helper to crtc helpers
Date: Tue, 11 Dec 2018 10:53:30 -0500 [thread overview]
Message-ID: <20181211155330.GD154160@art_vandelay> (raw)
In-Reply-To: <CADnq5_ODEwoeY0uomUYcokYyqP0+e34-hN6i2RJNjPEV1Fs=2w@mail.gmail.com>
On Mon, Dec 10, 2018 at 10:58:20AM -0500, Alex Deucher wrote:
> On Mon, Dec 10, 2018 at 5:04 AM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> >
> > 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(-)
> >
/snip
> > 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)
>
> Maybe put crtc somewhere in the function name so it's clear what we
> are disabling.
FWIW, I think it's more clear this way. set_config_internal will turn off
everything attached to the crtc, so _everything_ will be disabled in this case.
Either way,
Reviewed-by: Sean Paul <sean@poorly.run>
Sean
> With that fixed:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
> > +{
> > + 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
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-12-11 15:53 UTC|newest]
Thread overview: 29+ 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 ` [PATCH 4/7] drm: Move the legacy kms disable_all helper to crtc helpers Daniel Vetter
2018-12-10 15:58 ` Alex Deucher
2018-12-11 15:53 ` Sean Paul [this message]
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 10:03 ` [PATCH 6/7] drm/xen: " Daniel Vetter
2018-12-10 10:12 ` Oleksandr Andrushchenko
2018-12-12 10:56 ` Daniel Vetter
2018-12-10 10:11 ` [PATCH 7/7] drm: Split out drm_probe_helper.h Daniel Vetter
[not found] ` <20181210101133.5364-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2018-12-10 10:24 ` Thierry Reding
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
[not found] ` <CA+M3ks7ODkgZe_otsens1H4PoKOdnfHVxUgi84NPyri6Xhh1dg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-12-12 10:53 ` Daniel Vetter
2018-12-10 12:30 ` Neil Armstrong
2018-12-29 22:56 ` Liviu Dudau
2019-01-07 9:45 ` Daniel Vetter
[not found] ` <20190107094522.GU21184-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-01-07 10:08 ` Liviu Dudau
[not found] ` <20190107100841.GH20342-hOhETlTuV5niMG9XS5x8Mg@public.gmane.org>
2019-01-07 10:24 ` Daniel Vetter
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
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=20181211155330.GD154160@art_vandelay \
--to=sean@poorly.run \
--cc=David1.Zhou@amd.com \
--cc=Monk.Liu@amd.com \
--cc=Rex.Zhu@amd.com \
--cc=Shaoyun.Liu@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrey.grodzovsky@amd.com \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maxime.ripard@bootlin.com \
--cc=nouveau@lists.freedesktop.org \
--cc=ray.huang@amd.com \
--cc=sbobroff@linux.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox