All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/admgpu: check HDMI HPD status after ddc probe
@ 2020-05-09  5:48 Binbin Zhou
  2020-05-09 13:35 ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Binbin Zhou @ 2020-05-09  5:48 UTC (permalink / raw)
  To: alexander.deucher, hristian.koenig; +Cc: zhoubinbin, Binbin Zhou, amd-gfx

Now, we check the presence of the EDID to determine if there is a monitor
present.

DVI-I connectors have both analog and digital encoders and the HPD pin
is only reliable on the digital part.

But when I pull out the Radeon HD8570's HDMI connector, the HDMI status
in system is still perform connected.

asd@asd-PC:~$ cat /sys/class/drm/card0-HDMI-A-1/status 
connected

At this moment, if I want to read the EDID by /dev/i2c-X with I2C
driver, there is no EDID can be read.

Dmesg witha drm.debug=0x6, we can find the following message:

[drm:drm_helper_hpd_irq_event] [CONNECTOR:41:HDMI-A-1] status
updated from connected to connected

Based on the appearance, I thought to check the HPD status again, because
the HPD status is perform disconnected, after amdgpu_display_ddc_probe().
If the amdgpu_display_hpd_sense() return false, I think the HDMI connector
status is undefined, and just return disconnected simply.

I'm not sure if it happened to other AMD cards.

Signed-off-by: Binbin Zhou <zhoubb.aaron@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index f355d9a752d2..ee657db9a228 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -973,7 +973,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
 	const struct drm_encoder_helper_funcs *encoder_funcs;
 	int r;
 	enum drm_connector_status ret = connector_status_disconnected;
-	bool dret = false, broken_edid = false;
+	bool dret = false, broken_edid = false, undefined_flag = false;
 
 	if (!drm_kms_helper_is_poll_worker()) {
 		r = pm_runtime_get_sync(connector->dev->dev);
@@ -988,7 +988,12 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
 
 	if (amdgpu_connector->ddc_bus)
 		dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
-	if (dret) {
+
+	/* Check the HDMI HPD pin status again */
+	if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd))
+		undefined_flag = true;
+
+	if (dret && !undefined_flag) {
 		amdgpu_connector->detected_by_load = false;
 		amdgpu_connector_free_edid(connector);
 		amdgpu_connector_get_edid(connector);
-- 
2.17.1

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/admgpu: check HDMI HPD status after ddc probe
  2020-05-09  5:48 [PATCH] drm/admgpu: check HDMI HPD status after ddc probe Binbin Zhou
@ 2020-05-09 13:35 ` Alex Deucher
  2020-05-11  1:45   ` Aaron Chou
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2020-05-09 13:35 UTC (permalink / raw)
  To: Binbin Zhou; +Cc: Deucher, Alexander, zhoubinbin, amd-gfx list, hristian.koenig

On Sat, May 9, 2020 at 1:48 AM Binbin Zhou <zhoubb.aaron@gmail.com> wrote:
>
> Now, we check the presence of the EDID to determine if there is a monitor
> present.
>
> DVI-I connectors have both analog and digital encoders and the HPD pin
> is only reliable on the digital part.
>
> But when I pull out the Radeon HD8570's HDMI connector, the HDMI status
> in system is still perform connected.
>
> asd@asd-PC:~$ cat /sys/class/drm/card0-HDMI-A-1/status
> connected
>
> At this moment, if I want to read the EDID by /dev/i2c-X with I2C
> driver, there is no EDID can be read.
>
> Dmesg witha drm.debug=0x6, we can find the following message:
>
> [drm:drm_helper_hpd_irq_event] [CONNECTOR:41:HDMI-A-1] status
> updated from connected to connected
>
> Based on the appearance, I thought to check the HPD status again, because
> the HPD status is perform disconnected, after amdgpu_display_ddc_probe().
> If the amdgpu_display_hpd_sense() return false, I think the HDMI connector
> status is undefined, and just return disconnected simply.
>
> I'm not sure if it happened to other AMD cards.

This is the part I don't understand.  The logic already checks the HPD
status in amdgpu_connector_check_hpd_status_unchanged().  Does it
still report connected at that point?  After that it tires to read the
EDID in amdgpu_display_ddc_probe().  If the monitor is disconnected,
there should be no EDID so dret should be false.  We should try and
figure out why the first HPD check reports connected and the EDID
probe returns true.

Alex

>
> Signed-off-by: Binbin Zhou <zhoubb.aaron@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index f355d9a752d2..ee657db9a228 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -973,7 +973,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
>         const struct drm_encoder_helper_funcs *encoder_funcs;
>         int r;
>         enum drm_connector_status ret = connector_status_disconnected;
> -       bool dret = false, broken_edid = false;
> +       bool dret = false, broken_edid = false, undefined_flag = false;
>
>         if (!drm_kms_helper_is_poll_worker()) {
>                 r = pm_runtime_get_sync(connector->dev->dev);
> @@ -988,7 +988,12 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
>
>         if (amdgpu_connector->ddc_bus)
>                 dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
> -       if (dret) {
> +
> +       /* Check the HDMI HPD pin status again */
> +       if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd))
> +               undefined_flag = true;
> +
> +       if (dret && !undefined_flag) {
>                 amdgpu_connector->detected_by_load = false;
>                 amdgpu_connector_free_edid(connector);
>                 amdgpu_connector_get_edid(connector);
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/admgpu: check HDMI HPD status after ddc probe
  2020-05-09 13:35 ` Alex Deucher
@ 2020-05-11  1:45   ` Aaron Chou
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Chou @ 2020-05-11  1:45 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Deucher, Alexander, zhoubinbin, amd-gfx list, hristian.koenig

On Sat, May 9, 2020 at 9:35 PM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Sat, May 9, 2020 at 1:48 AM Binbin Zhou <zhoubb.aaron@gmail.com> wrote:
> >
> > Now, we check the presence of the EDID to determine if there is a monitor
> > present.
> >
> > DVI-I connectors have both analog and digital encoders and the HPD pin
> > is only reliable on the digital part.
> >
> > But when I pull out the Radeon HD8570's HDMI connector, the HDMI status
> > in system is still perform connected.
> >
> > asd@asd-PC:~$ cat /sys/class/drm/card0-HDMI-A-1/status
> > connected
> >
> > At this moment, if I want to read the EDID by /dev/i2c-X with I2C
> > driver, there is no EDID can be read.
> >
> > Dmesg witha drm.debug=0x6, we can find the following message:
> >
> > [drm:drm_helper_hpd_irq_event] [CONNECTOR:41:HDMI-A-1] status
> > updated from connected to connected
> >
> > Based on the appearance, I thought to check the HPD status again, because
> > the HPD status is perform disconnected, after amdgpu_display_ddc_probe().
> > If the amdgpu_display_hpd_sense() return false, I think the HDMI connector
> > status is undefined, and just return disconnected simply.
> >
> > I'm not sure if it happened to other AMD cards.
>
> This is the part I don't understand.  The logic already checks the HPD
> status in amdgpu_connector_check_hpd_status_unchanged().  Does it
> still report connected at that point?  After that it tires to read the
> EDID in amdgpu_display_ddc_probe().  If the monitor is disconnected,
> there should be no EDID so dret should be false.  We should try and
> figure out why the first HPD check reports connected and the EDID
> probe returns true.
>
> Alex

Emm.....
I have tried with Radeon driver, it is the same.
And In the Mint system, I find if I pick out the HDMI connector, I can
see the status is still connected,
At the moment, If I do the xrandr command or open the Setting->Display
application, the HDMI status will refresh to disconnected.
The operation means to detect the display again.

Does the phenomenon meet the expectation?

Regards.
Aaron.
>
> >
> > Signed-off-by: Binbin Zhou <zhoubb.aaron@gmail.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> > index f355d9a752d2..ee657db9a228 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> > @@ -973,7 +973,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
> >         const struct drm_encoder_helper_funcs *encoder_funcs;
> >         int r;
> >         enum drm_connector_status ret = connector_status_disconnected;
> > -       bool dret = false, broken_edid = false;
> > +       bool dret = false, broken_edid = false, undefined_flag = false;
> >
> >         if (!drm_kms_helper_is_poll_worker()) {
> >                 r = pm_runtime_get_sync(connector->dev->dev);
> > @@ -988,7 +988,12 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
> >
> >         if (amdgpu_connector->ddc_bus)
> >                 dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
> > -       if (dret) {
> > +
> > +       /* Check the HDMI HPD pin status again */
> > +       if (!amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd))
> > +               undefined_flag = true;
> > +
> > +       if (dret && !undefined_flag) {
> >                 amdgpu_connector->detected_by_load = false;
> >                 amdgpu_connector_free_edid(connector);
> >                 amdgpu_connector_get_edid(connector);
> > --
> > 2.17.1
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-11  1:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09  5:48 [PATCH] drm/admgpu: check HDMI HPD status after ddc probe Binbin Zhou
2020-05-09 13:35 ` Alex Deucher
2020-05-11  1:45   ` Aaron Chou

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.