Bug 107125 - [i915] HDMI connector status is connected after disconnection
Summary: [i915] HDMI connector status is connected after disconnection
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: high normal
Assignee: Intel GFX Bugs mailing list
QA Contact: Intel GFX Bugs mailing list
Whiteboard: Triaged, ReadyForDev
: 110835 (view as bug list)
Depends on:
Reported: 2018-07-05 13:10 UTC by Chris Chiu
Modified: 2019-08-12 06:29 UTC (History)
6 users (show)

See Also:
i915 platform: CFL
i915 features: display/HDMI

Full dmesg log with drm.debug=0xe (191.40 KB, text/plain)
2018-07-05 13:10 UTC, Chris Chiu
no flags Details
'xrandr --verbose' before unplugging HDMI (16.86 KB, text/plain)
2018-07-05 13:11 UTC, Chris Chiu
no flags Details
output of 'xrandr --current --verbose' after unplugging HDMI (16.86 KB, text/plain)
2018-07-05 13:12 UTC, Chris Chiu
no flags Details
patch to recheck connector state after 2s (3.14 KB, patch)
2018-08-03 08:03 UTC, Alexander Boettcher
no flags Details | Splinter Review
HDMI connection removed slowly (186.15 KB, text/plain)
2019-03-29 21:10 UTC, Chintan Patel
no flags Details

Description Chris Chiu 2018-07-05 13:10:12 UTC
Created attachment 140473 [details]
Full dmesg log with drm.debug=0xe

    We have few ASUS laptops X705FD (The new WiskyLake), X560UD (intel
i5-8250U), X530UN (intel i7-8550U) share the same problem, which is
the HDMI connector status stays connected even the HDMI cable has been
unplugged. Look into the "/sys/class/drm/card0-HDMI-A-1/status" for
checking the status while plug/unplug the HDMI, it shows
"disconnected" before plug in HDMI cable, then switch to "connected"
after plugin, and still stay "connected" after unplug. This would
cause the audio output path cannot correctly switch from HDMI to
internal speaker after unplugging the HDMI.

I then try to verify with the latest kernel 4.18.0-rc3+, the bug still
present. The full "dmesg" attached.

The HDMI cable is plugged in at ~26th second.
"[ 26.214371] [drm:drm_detect_monitor_audio [drm]] Monitor has basic
audio support"
then unplug the HDMI at ~73th second.
"[ 73.328361] [drm:drm_detect_monitor_audio [drm]] Monitor has basic
audio support"

Please advise what I can do to fix this. Thanks
Comment 1 Chris Chiu 2018-07-05 13:11:25 UTC
Created attachment 140474 [details]
'xrandr --verbose' before unplugging HDMI
Comment 2 Chris Chiu 2018-07-05 13:12:26 UTC
Created attachment 140475 [details]
output of 'xrandr --current --verbose' after unplugging HDMI
Comment 3 Jani Nikula 2018-07-06 07:17:41 UTC

On Fri, 06 Jul 2018, Chris Chiu <chiu@endlessm.com> wrote:
> On Thu, Jul 5, 2018 at 10:40 PM, Ville Syrjälä
> <ville.syrjala@linux.intel.com> wrote:
>> On Thu, Jul 05, 2018 at 03:58:36PM +0800, Chris Chiu wrote:
>>> Please advise what I can do to fix this. Thanks
>> Pull the cable out faster?
>> I presume this is the same old case of hpd disconnecting slightly
>> before ddc and we still manage to read the EDID when processing
>> the hpd irq. We kinda tried to fix that with the live status
>> check but that thing failed spectacularly.
> Thanks for the suggestion. I tried pulling the cable out faster, the status
> shows correctly. I also tried branch drm-tip of
> https://cgit.freedesktop.org/drm/drm-tip
> but the symptom persists.
> Anything I can help here? Or any old commit/patch I can try to do some
> experiments?
Comment 4 Chris Wilson 2018-07-06 07:20:27 UTC
Presumably we just want to kick off a delayed work (2s?) from a hotplug event if the status remains unchanged (and it's not a long pulse etc etc).
Comment 5 Daniel Drake 2018-07-17 12:34:09 UTC
Yes, without looking at the code, doing some kind of debounce delay before handling the hotplug interrupt sounds like a clear solution here. We're ready to test any patches...
Comment 6 Maxim Malkov 2018-07-28 20:14:52 UTC
I also encountered this bug on ThinkPad T440. In fact, I think this's a regression: I never seen this bug on 4.14. It only appeared when I upgraded to 4.16, and it didn't go away after I upgraded to 4.17.

The most prominent side effect is that systemd-logind fails to suspend on lid close, believing that there's external screen attached.

Interestingly, although `grep . /sys/class/drm/*/status` will say that monitor is connected, on my machine, simply running `xrandr` will unstuck the status (and the grep command will now correctly report "disconnected" as well).
Comment 7 Maxim Malkov 2018-07-31 17:49:01 UTC
Another thing that I noticed is that `xrandr --output HDMI-1 --off` no longer turns the monitor off, but merely turns it black. I'm absolutely sure that the command used to actually turn the screen off. Not sure if it's related to this bug, though.
Comment 8 Alexander Boettcher 2018-08-03 08:03:18 UTC
Created attachment 140946 [details] [review]
patch to recheck connector state after 2s

I added a patch which solves the issue for the driver used on Genode. Please feel free to test and adjust to your needs on vanilla Linux. The patch is against 4.16.3

Some background: we encountered the issue on our port of the Intel graphic driver to Genode and believed long it is due to some porting issues. Then I stumbled over this bug report and the hint about the 2s delay work. So, implemented a patch and we could resolve the issue with the HDMI disconnect reliable for us - thanks.
Comment 9 Chris Chiu 2018-08-08 07:42:46 UTC
Thanks. I verified the attached patch on the problematic X705FD/X560UD. It works fine on both.
Comment 10 Lakshmi 2018-09-11 07:32:38 UTC
(In reply to Alexander Boettcher from comment #8)
> Created attachment 140946 [details] [review] [review]
> patch to recheck connector state after 2s
Is this patch is in upstream?
Comment 12 Chris Chiu 2019-01-22 01:01:09 UTC
Hi Jani,
    Will your patch go upstream? Or is there any patch that is a good upstream candidate for approval?
Comment 13 Chris Chiu 2019-02-11 09:58:18 UTC
Gentle ping. Any better idea for the next step?
Comment 14 Chintan Patel 2019-03-29 21:10:54 UTC
Created attachment 143814 [details]
HDMI connection removed slowly

I see similar issue on Chromebook with native HDMI port. When HDMI connection gets removed slowly (wiggling) issue is easily reproducible. (Issue happens with drm-tip also).

Attaching the logs for the same.

Any update on when upstream fix will be available?
Comment 15 Lakshmi 2019-04-01 09:30:04 UTC
(In reply to Chris Chiu from comment #12)
> Hi Jani,
>     Will your patch go upstream? Or is there any patch that is a good
> upstream candidate for approval?

Chris, Any feedback from comment 11? Do you still have the issue after applying the patch?
Comment 16 Chris Chiu 2019-04-01 10:19:55 UTC
(In reply to Lakshmi from comment #15)
> (In reply to Chris Chiu from comment #12)
> > Hi Jani,
> >     Will your patch go upstream? Or is there any patch that is a good
> > upstream candidate for approval?
> Chris, Any feedback from comment 11? Do you still have the issue after
> applying the patch?

No problem with Jani's patch. It's working fine unless a very tricky pull out of HDMI cable (pull out the HDMI cable gentle and slow, with each move of a few millimeters).
Comment 17 Chintan Patel 2019-04-01 16:02:16 UTC
 (In reply to Jani Nikula from comment #11)
> Please try
> http://patchwork.freedesktop.org/patch/msgid/20180925071836.24711-1-jani.
> nikula@intel.com

Issue is not reproducible with this patch.
Comment 18 Lakshmi 2019-04-02 07:03:33 UTC
@Jani, How to proceed further?
Comment 19 Jani Nikula 2019-06-14 08:42:48 UTC
*** Bug 110835 has been marked as a duplicate of this bug. ***
Comment 20 Jani Nikula 2019-06-14 08:47:58 UTC
We need to get this fixed. It's a real issue, and it's been open for too long.

The starting points of the relevant patch/mail threads are:



Comment 21 Jani Nikula 2019-06-14 09:01:39 UTC
Copy-pasting what I've written before, and was pasted to bug 110835 too:

We get a hotplug interrupt before the plug is completely out, while ddc communication still works with the display, and we conclude we are still connected. Moreover, the live status bits on the hotplug state have been notoriously unreliable in the past, we've tried using them like three times in the past, leading to regressions and reverts every time.

You can come up with all sorts of pathological slow plug/unplug/wiggle cases. If you have a concrete requirement how slow needs to be okay, or better yet write a test case for igt and chamelium, we can work with that. We've proposed fixes in the past but they stalled because some undisclosed unquantified test case still failed.

Presumably we're getting the issues because we've improved our hotplug and/or ddc code to not have too much inherent delays.

The actual user reported bugs apparently get fixed by all of the proposed solutions.

The failures in undisclosed tests only get fixed by Guang Bai's patches, but IMO that's a moot point as long as we don't have access to the tests and can't verify the tests make sense.

Finally, any solution resorting to using hotplug live status (including Guang Bai's patches) *absolutely* *must* dig through the sad history of it, commit by commit in git logs, and explain in excruciating detail why it failed several times before, and why it would be different this time. I'm not accepting anything with roundabout "it should just work" statements.
Comment 22 Daniel Drake 2019-08-12 06:29:22 UTC
We expect that this is fixed by new commits:

   drm/i915: Add support for retrying hotplug
   drm/i915: Enable hotplug retry

However we no longer have any affected harware to confirm. I'm closing the bug accordingly.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.