* [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
@ 2018-09-17 17:43 Lyude Paul
2018-09-17 17:55 ` Ville Syrjälä
0 siblings, 1 reply; 7+ messages in thread
From: Lyude Paul @ 2018-09-17 17:43 UTC (permalink / raw)
To: dri-devel
Cc: Gustavo Padovan, Maarten Lankhorst, Sean Paul, David Airlie,
linux-kernel
Userspace asked them to be forced off, so why would we care about what a
probe tells us?
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
drivers/gpu/drm/drm_probe_helper.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index a1bb157bfdfa..56d2b5dd1f58 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -269,7 +269,9 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
retry:
ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx);
if (!ret) {
- if (funcs->detect_ctx)
+ if (connector->force == DRM_FORCE_OFF)
+ ret = connector_status_disconnected;
+ else if (funcs->detect_ctx)
ret = funcs->detect_ctx(connector, &ctx, force);
else if (connector->funcs->detect)
ret = connector->funcs->detect(connector, force);
@@ -317,6 +319,9 @@ drm_helper_probe_detect(struct drm_connector *connector,
if (ret)
return ret;
+ if (connector->force == DRM_FORCE_OFF)
+ return connector_status_disconnected;
+
if (funcs->detect_ctx)
return funcs->detect_ctx(connector, ctx, force);
else if (connector->funcs->detect)
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
2018-09-17 17:43 [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off Lyude Paul
@ 2018-09-17 17:55 ` Ville Syrjälä
2018-09-17 17:58 ` Lyude Paul
2018-09-17 18:10 ` Lyude Paul
0 siblings, 2 replies; 7+ messages in thread
From: Ville Syrjälä @ 2018-09-17 17:55 UTC (permalink / raw)
To: Lyude Paul; +Cc: dri-devel, Sean Paul, David Airlie, linux-kernel
On Mon, Sep 17, 2018 at 01:43:44PM -0400, Lyude Paul wrote:
> Userspace asked them to be forced off, so why would we care about what a
> probe tells us?
I believe there should be force checks in the callers already.
Or are we missing some?
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> ---
> drivers/gpu/drm/drm_probe_helper.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index a1bb157bfdfa..56d2b5dd1f58 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -269,7 +269,9 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
> retry:
> ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx);
> if (!ret) {
> - if (funcs->detect_ctx)
> + if (connector->force == DRM_FORCE_OFF)
> + ret = connector_status_disconnected;
connector->force is protected by mode_config.mutex IIRC.
> + else if (funcs->detect_ctx)
> ret = funcs->detect_ctx(connector, &ctx, force);
> else if (connector->funcs->detect)
> ret = connector->funcs->detect(connector, force);
> @@ -317,6 +319,9 @@ drm_helper_probe_detect(struct drm_connector *connector,
> if (ret)
> return ret;
>
> + if (connector->force == DRM_FORCE_OFF)
> + return connector_status_disconnected;
> +
> if (funcs->detect_ctx)
> return funcs->detect_ctx(connector, ctx, force);
> else if (connector->funcs->detect)
> --
> 2.17.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
2018-09-17 17:55 ` Ville Syrjälä
@ 2018-09-17 17:58 ` Lyude Paul
2018-09-17 18:10 ` Lyude Paul
1 sibling, 0 replies; 7+ messages in thread
From: Lyude Paul @ 2018-09-17 17:58 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: dri-devel, Sean Paul, David Airlie, linux-kernel
On Mon, 2018-09-17 at 20:55 +0300, Ville Syrjälä wrote:
> On Mon, Sep 17, 2018 at 01:43:44PM -0400, Lyude Paul wrote:
> > Userspace asked them to be forced off, so why would we care about what a
> > probe tells us?
>
> I believe there should be force checks in the callers already.
> Or are we missing some?
JFYI, this is to fix "DDC responded but no EDID" errors from nouveau, which
presumably come from the fact that having a connector forced off disables
reading it's EDID. It's possible we are missing something in
nouveau_connector_detect(), but I'm confused as to why we would want to call
->probe() at all in the first place
>
> >
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > ---
> > drivers/gpu/drm/drm_probe_helper.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c
> > b/drivers/gpu/drm/drm_probe_helper.c
> > index a1bb157bfdfa..56d2b5dd1f58 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -269,7 +269,9 @@ drm_helper_probe_detect_ctx(struct drm_connector
> > *connector, bool force)
> > retry:
> > ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex,
> > &ctx);
> > if (!ret) {
> > - if (funcs->detect_ctx)
> > + if (connector->force == DRM_FORCE_OFF)
> > + ret = connector_status_disconnected;
>
> connector->force is protected by mode_config.mutex IIRC.
>
> > + else if (funcs->detect_ctx)
> > ret = funcs->detect_ctx(connector, &ctx, force);
> > else if (connector->funcs->detect)
> > ret = connector->funcs->detect(connector, force);
> > @@ -317,6 +319,9 @@ drm_helper_probe_detect(struct drm_connector *connector,
> > if (ret)
> > return ret;
> >
> > + if (connector->force == DRM_FORCE_OFF)
> > + return connector_status_disconnected;
> > +
> > if (funcs->detect_ctx)
> > return funcs->detect_ctx(connector, ctx, force);
> > else if (connector->funcs->detect)
> > --
> > 2.17.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
2018-09-17 17:55 ` Ville Syrjälä
2018-09-17 17:58 ` Lyude Paul
@ 2018-09-17 18:10 ` Lyude Paul
2018-09-17 18:16 ` Ville Syrjälä
1 sibling, 1 reply; 7+ messages in thread
From: Lyude Paul @ 2018-09-17 18:10 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: dri-devel, Sean Paul, David Airlie, linux-kernel
On Mon, 2018-09-17 at 20:55 +0300, Ville Syrjälä wrote:
> On Mon, Sep 17, 2018 at 01:43:44PM -0400, Lyude Paul wrote:
> > Userspace asked them to be forced off, so why would we care about what a
> > probe tells us?
>
> I believe there should be force checks in the callers already.
> Or are we missing some?
JFYI, what triggered me to send this patch are these error messages that come
from nouveau when a hotplug happens on a port that we've forced off:
[ 1903.918104] nouveau 0000:01:00.0: DRM: DDC responded, but no EDID for DP-2
[ 1903.918123] [drm:drm_helper_hpd_irq_event [drm_kms_helper]] [CONNECTOR:61:DP-2] status updated from disconnected to disconnected
That being said; I'm sure there are probably some checks missing, but I don't
really see the purpose in calling the driver's probe functions at all if they're
just supposed to return the status we forced.
>
> >
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > ---
> > drivers/gpu/drm/drm_probe_helper.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c
> > b/drivers/gpu/drm/drm_probe_helper.c
> > index a1bb157bfdfa..56d2b5dd1f58 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -269,7 +269,9 @@ drm_helper_probe_detect_ctx(struct drm_connector
> > *connector, bool force)
> > retry:
> > ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex,
> > &ctx);
> > if (!ret) {
> > - if (funcs->detect_ctx)
> > + if (connector->force == DRM_FORCE_OFF)
> > + ret = connector_status_disconnected;
>
> connector->force is protected by mode_config.mutex IIRC.
>
> > + else if (funcs->detect_ctx)
> > ret = funcs->detect_ctx(connector, &ctx, force);
> > else if (connector->funcs->detect)
> > ret = connector->funcs->detect(connector, force);
> > @@ -317,6 +319,9 @@ drm_helper_probe_detect(struct drm_connector *connector,
> > if (ret)
> > return ret;
> >
> > + if (connector->force == DRM_FORCE_OFF)
> > + return connector_status_disconnected;
> > +
> > if (funcs->detect_ctx)
> > return funcs->detect_ctx(connector, ctx, force);
> > else if (connector->funcs->detect)
> > --
> > 2.17.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
2018-09-17 18:10 ` Lyude Paul
@ 2018-09-17 18:16 ` Ville Syrjälä
2018-09-17 21:12 ` Lyude Paul
0 siblings, 1 reply; 7+ messages in thread
From: Ville Syrjälä @ 2018-09-17 18:16 UTC (permalink / raw)
To: Lyude Paul; +Cc: dri-devel, Sean Paul, David Airlie, linux-kernel
On Mon, Sep 17, 2018 at 02:10:02PM -0400, Lyude Paul wrote:
> On Mon, 2018-09-17 at 20:55 +0300, Ville Syrjälä wrote:
> > On Mon, Sep 17, 2018 at 01:43:44PM -0400, Lyude Paul wrote:
> > > Userspace asked them to be forced off, so why would we care about what a
> > > probe tells us?
> >
> > I believe there should be force checks in the callers already.
> > Or are we missing some?
>
> JFYI, what triggered me to send this patch are these error messages that come
> from nouveau when a hotplug happens on a port that we've forced off:
>
> [ 1903.918104] nouveau 0000:01:00.0: DRM: DDC responded, but no EDID for DP-2
> [ 1903.918123] [drm:drm_helper_hpd_irq_event [drm_kms_helper]] [CONNECTOR:61:DP-2] status updated from disconnected to disconnected
>
> That being said; I'm sure there are probably some checks missing, but I don't
> really see the purpose in calling the driver's probe functions at all if they're
> just supposed to return the status we forced.
Digging through my cobweb ridden local git repository I found this:
commit bbd17813a7c7d0210c619365707044d0fb29e3f0
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date: Mon Jun 10 15:28:55 2013 +0300
drm: Ignore forced connectors in drm_helper_hpd_irq_event()
drm_helper_hpd_irq_event() calls the connector's .detect() function
even for forced connectors. If the returned status doesn't match the
forced status, we will send the hotplug event, causing userspace to
re-probe all the connectors. Eventually we should end up back where
we started when drm_helper_probe_single_connector_modes() overwrites
the connector status with the forced status.
We can avoid all that pointles work if we just skip forced connectors
in drm_helper_hpd_irq_event().
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index ed1334e27c33..4fc2ad76c107 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -1086,6 +1086,10 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
mutex_lock(&dev->mode_config.mutex);
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+ /* Ignore forced connectors. */
+ if (connector->force)
+ continue;
+
/* Only handle HPD capable connectors. */
if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
continue;
I guess I never sent it out.
--
Ville Syrjälä
Intel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
2018-09-17 18:16 ` Ville Syrjälä
@ 2018-09-17 21:12 ` Lyude Paul
2018-09-21 8:59 ` Daniel Vetter
0 siblings, 1 reply; 7+ messages in thread
From: Lyude Paul @ 2018-09-17 21:12 UTC (permalink / raw)
To: Ville Syrjälä; +Cc: dri-devel, Sean Paul, David Airlie, linux-kernel
On Mon, 2018-09-17 at 21:16 +0300, Ville Syrjälä wrote:
> On Mon, Sep 17, 2018 at 02:10:02PM -0400, Lyude Paul wrote:
> > On Mon, 2018-09-17 at 20:55 +0300, Ville Syrjälä wrote:
> > > On Mon, Sep 17, 2018 at 01:43:44PM -0400, Lyude Paul wrote:
> > > > Userspace asked them to be forced off, so why would we care about what a
> > > > probe tells us?
> > >
> > > I believe there should be force checks in the callers already.
> > > Or are we missing some?
> >
> > JFYI, what triggered me to send this patch are these error messages that
> > come
> > from nouveau when a hotplug happens on a port that we've forced off:
> >
> > [ 1903.918104] nouveau 0000:01:00.0: DRM: DDC responded, but no EDID for DP-
> > 2
> > [ 1903.918123] [drm:drm_helper_hpd_irq_event [drm_kms_helper]]
> > [CONNECTOR:61:DP-2] status updated from disconnected to disconnected
> >
> > That being said; I'm sure there are probably some checks missing, but I
> > don't
> > really see the purpose in calling the driver's probe functions at all if
> > they're
> > just supposed to return the status we forced.
>
> Digging through my cobweb ridden local git repository I found this:
>
> commit bbd17813a7c7d0210c619365707044d0fb29e3f0
> Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Date: Mon Jun 10 15:28:55 2013 +0300
>
> drm: Ignore forced connectors in drm_helper_hpd_irq_event()
>
> drm_helper_hpd_irq_event() calls the connector's .detect() function
> even for forced connectors. If the returned status doesn't match the
> forced status, we will send the hotplug event, causing userspace to
> re-probe all the connectors. Eventually we should end up back where
> we started when drm_helper_probe_single_connector_modes() overwrites
> the connector status with the forced status.
>
> We can avoid all that pointles work if we just skip forced connectors
> in drm_helper_hpd_irq_event().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> b/drivers/gpu/drm/drm_crtc_helper.c
> index ed1334e27c33..4fc2ad76c107 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -1086,6 +1086,10 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
> mutex_lock(&dev->mode_config.mutex);
> list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
>
> + /* Ignore forced connectors. */
> + if (connector->force)
> + continue;
> +
> /* Only handle HPD capable connectors. */
> if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
> continue;
>
>
> I guess I never sent it out.
Ahhh, to be honest though this patch isn't really enough.
drm_helper_hpd_irq_event() isn't going to be used by all drivers (I may remove
some usage of it in nouveau in the near future, even) so I still think it would
be a better idea to just add this into drm_helper_probe_detect() and
drm_helper_probe_detect_ctx() so everything gets covered
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off
2018-09-17 21:12 ` Lyude Paul
@ 2018-09-21 8:59 ` Daniel Vetter
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2018-09-21 8:59 UTC (permalink / raw)
To: Lyude Paul
Cc: Ville Syrjälä,
David Airlie, Sean Paul, linux-kernel, dri-devel
On Mon, Sep 17, 2018 at 05:12:04PM -0400, Lyude Paul wrote:
> On Mon, 2018-09-17 at 21:16 +0300, Ville Syrjälä wrote:
> > On Mon, Sep 17, 2018 at 02:10:02PM -0400, Lyude Paul wrote:
> > > On Mon, 2018-09-17 at 20:55 +0300, Ville Syrjälä wrote:
> > > > On Mon, Sep 17, 2018 at 01:43:44PM -0400, Lyude Paul wrote:
> > > > > Userspace asked them to be forced off, so why would we care about what a
> > > > > probe tells us?
> > > >
> > > > I believe there should be force checks in the callers already.
> > > > Or are we missing some?
> > >
> > > JFYI, what triggered me to send this patch are these error messages that
> > > come
> > > from nouveau when a hotplug happens on a port that we've forced off:
> > >
> > > [ 1903.918104] nouveau 0000:01:00.0: DRM: DDC responded, but no EDID for DP-
> > > 2
> > > [ 1903.918123] [drm:drm_helper_hpd_irq_event [drm_kms_helper]]
> > > [CONNECTOR:61:DP-2] status updated from disconnected to disconnected
> > >
> > > That being said; I'm sure there are probably some checks missing, but I
> > > don't
> > > really see the purpose in calling the driver's probe functions at all if
> > > they're
> > > just supposed to return the status we forced.
> >
> > Digging through my cobweb ridden local git repository I found this:
> >
> > commit bbd17813a7c7d0210c619365707044d0fb29e3f0
> > Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Date: Mon Jun 10 15:28:55 2013 +0300
> >
> > drm: Ignore forced connectors in drm_helper_hpd_irq_event()
> >
> > drm_helper_hpd_irq_event() calls the connector's .detect() function
> > even for forced connectors. If the returned status doesn't match the
> > forced status, we will send the hotplug event, causing userspace to
> > re-probe all the connectors. Eventually we should end up back where
> > we started when drm_helper_probe_single_connector_modes() overwrites
> > the connector status with the forced status.
> >
> > We can avoid all that pointles work if we just skip forced connectors
> > in drm_helper_hpd_irq_event().
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> > b/drivers/gpu/drm/drm_crtc_helper.c
> > index ed1334e27c33..4fc2ad76c107 100644
> > --- a/drivers/gpu/drm/drm_crtc_helper.c
> > +++ b/drivers/gpu/drm/drm_crtc_helper.c
> > @@ -1086,6 +1086,10 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
> > mutex_lock(&dev->mode_config.mutex);
> > list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
> >
> > + /* Ignore forced connectors. */
> > + if (connector->force)
> > + continue;
> > +
> > /* Only handle HPD capable connectors. */
> > if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
> > continue;
> >
> >
> > I guess I never sent it out.
>
> Ahhh, to be honest though this patch isn't really enough.
> drm_helper_hpd_irq_event() isn't going to be used by all drivers (I may remove
> some usage of it in nouveau in the near future, even) so I still think it would
> be a better idea to just add this into drm_helper_probe_detect() and
> drm_helper_probe_detect_ctx() so everything gets covered
Atm all connector->force handling is outside of drm_helper_probe_detect. I
guess we could try to push (some) of it into this helper, if that's
useful. There seems to be some duplication already. But adding a redundant
check like you do here feels a bit funky. Maybe makes more sense in
context of the nouveau stuff you're working on?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-09-21 9:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 17:43 [PATCH] drm/probe_helper: Don't bother probing when connectors are forced off Lyude Paul
2018-09-17 17:55 ` Ville Syrjälä
2018-09-17 17:58 ` Lyude Paul
2018-09-17 18:10 ` Lyude Paul
2018-09-17 18:16 ` Ville Syrjälä
2018-09-17 21:12 ` Lyude Paul
2018-09-21 8:59 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).