From: Lukas Wunner <lukas@wunner.de>
To: Lyude Paul <lyude@redhat.com>
Cc: nouveau@lists.freedesktop.org,
"Gustavo Padovan" <gustavo@padovan.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Sean Paul" <seanpaul@chromium.org>,
"David Airlie" <airlied@linux.ie>,
"Ben Skeggs" <bskeggs@redhat.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/probe_helper: Add drm_helper_probe_single_connector_modes_with_rpm()
Date: Thu, 19 Jul 2018 10:08:12 +0200 [thread overview]
Message-ID: <20180719080812.GA14235@wunner.de> (raw)
In-Reply-To: <20180718205645.25924-3-lyude@redhat.com>
On Wed, Jul 18, 2018 at 04:56:40PM -0400, Lyude Paul wrote:
> For nouveau, while the GPU is guaranteed to be on when a hotplug has
> been received, the same assertion does not hold true if a connector
> probe has been started by userspace without having had received a sysfs
> event.
>
> So ensure that any connector probing keeps the GPU alive for the
> duration of the probe by introducing
> drm_helper_probe_single_connector_modes_with_rpm(). It's the same as
> drm_helper_probe_single_connector_modes, but it handles holding a power
> reference to the device for the duration of the connector probe.
Hm, a runtime PM ref is already acquired in nouveau_connector_detect().
I'm wondering why that's not sufficient?
Thanks,
Lukas
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Reviewed-by: Karol Herbst <karolherbst@gmail.com>
> Cc: Lukas Wunner <lukas@wunner.de>
> Cc: stable@vger.kernel.org
> ---
> Changes since v1:
> - Add a generic helper to DRM to handle this
>
> drivers/gpu/drm/drm_probe_helper.c | 31 +++++++++++++++++++++
> drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_connector.c | 4 +--
> include/drm/drm_crtc_helper.h | 7 +++--
> 4 files changed, 38 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 527743394150..0a9d6748b854 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -31,6 +31,7 @@
>
> #include <linux/export.h>
> #include <linux/moduleparam.h>
> +#include <linux/pm_runtime.h>
>
> #include <drm/drmP.h>
> #include <drm/drm_crtc.h>
> @@ -541,6 +542,36 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> }
> EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
>
> +/**
> + * drm_helper_probe_single_connector_modes_with_rpm - get complete set of
> + * display modes
> + * @connector: connector to probe
> + * @maxX: max width for modes
> + * @maxY: max height for modes
> + *
> + * Same as drm_helper_probe_single_connector_modes, except that it makes sure
> + * that the device is active by synchronously grabbing a runtime power
> + * reference while probing.
> + *
> + * Returns:
> + * The number of modes found on @connector.
> + */
> +int drm_helper_probe_single_connector_modes_with_rpm(struct drm_connector *connector,
> + uint32_t maxX, uint32_t maxY)
> +{
> + int ret;
> +
> + ret = pm_runtime_get_sync(connector->dev->dev);
> + if (ret < 0 && ret != -EACCES)
> + return ret;
> +
> + ret = drm_helper_probe_single_connector_modes(connector, maxX, maxY);
> +
> + pm_runtime_put(connector->dev->dev);
> + return ret;
> +}
> +EXPORT_SYMBOL(drm_helper_probe_single_connector_modes_with_rpm);
> +
> /**
> * drm_kms_helper_hotplug_event - fire off KMS hotplug events
> * @dev: drm_device whose connector state changed
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index fa3ab618a0f9..c54767b50fd8 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -858,7 +858,7 @@ static const struct drm_connector_funcs
> nv50_mstc = {
> .reset = nouveau_conn_reset,
> .detect = nv50_mstc_detect,
> - .fill_modes = drm_helper_probe_single_connector_modes,
> + .fill_modes = drm_helper_probe_single_connector_modes_with_rpm,
> .destroy = nv50_mstc_destroy,
> .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
> .atomic_destroy_state = nouveau_conn_atomic_destroy_state,
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 2a45b4c2ceb0..8d9070779261 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -1088,7 +1088,7 @@ nouveau_connector_funcs = {
> .reset = nouveau_conn_reset,
> .detect = nouveau_connector_detect,
> .force = nouveau_connector_force,
> - .fill_modes = drm_helper_probe_single_connector_modes,
> + .fill_modes = drm_helper_probe_single_connector_modes_with_rpm,
> .set_property = nouveau_connector_set_property,
> .destroy = nouveau_connector_destroy,
> .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
> @@ -1103,7 +1103,7 @@ nouveau_connector_funcs_lvds = {
> .reset = nouveau_conn_reset,
> .detect = nouveau_connector_detect_lvds,
> .force = nouveau_connector_force,
> - .fill_modes = drm_helper_probe_single_connector_modes,
> + .fill_modes = drm_helper_probe_single_connector_modes_with_rpm,
> .set_property = nouveau_connector_set_property,
> .destroy = nouveau_connector_destroy,
> .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state,
> diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
> index 6914633037a5..8f3f6d6fcc8c 100644
> --- a/include/drm/drm_crtc_helper.h
> +++ b/include/drm/drm_crtc_helper.h
> @@ -64,9 +64,10 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> struct drm_framebuffer *old_fb);
>
> /* drm_probe_helper.c */
> -int drm_helper_probe_single_connector_modes(struct drm_connector
> - *connector, uint32_t maxX,
> - uint32_t maxY);
> +int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> + uint32_t maxX, uint32_t maxY);
> +int drm_helper_probe_single_connector_modes_with_rpm(struct drm_connector *connector,
> + uint32_t maxX, uint32_t maxY);
> int drm_helper_probe_detect(struct drm_connector *connector,
> struct drm_modeset_acquire_ctx *ctx,
> bool force);
> --
> 2.17.1
>
next prev parent reply other threads:[~2018-07-19 8:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 20:56 [PATCH 0/2] Fix connector probing deadlocks from RPM bugs Lyude Paul
2018-07-18 20:56 ` Lyude Paul
[not found] ` <20180718205645.25924-1-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-07-18 20:56 ` [PATCH 1/2] drm/fb_helper: Add drm_fb_helper_output_poll_changed_with_rpm() Lyude Paul
2018-07-18 20:56 ` Lyude Paul
[not found] ` <20180718205645.25924-2-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-07-19 7:49 ` Lukas Wunner
2018-07-19 7:49 ` Lukas Wunner
2018-07-20 0:08 ` Lyude Paul
2018-07-20 0:08 ` Lyude Paul
[not found] ` <be93e682cd5a583e9b4cb6c4fcd7a476d597bb6b.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-07-20 0:17 ` Lyude Paul
2018-07-20 0:17 ` Lyude Paul
2018-07-21 9:39 ` Lukas Wunner
2018-07-21 9:39 ` Lukas Wunner
2018-07-23 17:50 ` Lyude Paul
2018-07-23 17:50 ` Lyude Paul
2018-07-18 20:56 ` [PATCH 2/2] drm/probe_helper: Add drm_helper_probe_single_connector_modes_with_rpm() Lyude Paul
2018-07-18 20:56 ` Lyude Paul
2018-07-19 8:08 ` Lukas Wunner [this message]
2018-08-06 8:31 ` [PATCH 0/2] Fix connector probing deadlocks from RPM bugs Daniel Vetter
2018-08-06 8:31 ` 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=20180719080812.GA14235@wunner.de \
--to=lukas@wunner.de \
--cc=airlied@linux.ie \
--cc=bskeggs@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@padovan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=nouveau@lists.freedesktop.org \
--cc=seanpaul@chromium.org \
--cc=ville.syrjala@linux.intel.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 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.