Bug 49906 - hotplug probing unconditionally checks all connectors
Summary: hotplug probing unconditionally checks all connectors
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Daniel Vetter
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
: 26845 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-14 06:07 UTC by Tvrtko Ursulin
Modified: 2017-07-24 23:01 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Skip periodic probes if we have a hotplug-driven system (2.21 KB, patch)
2012-05-14 06:10 UTC, Chris Wilson
no flags Details | Splinter Review
fixup polling for hotplug pins (3.89 KB, patch)
2012-05-23 06:02 UTC, Daniel Vetter
no flags Details | Splinter Review

Description Tvrtko Ursulin 2012-05-14 06:07:01 UTC
In a mode where connector probing runs, monitor detection runs indiscriminately on all connectors, re-fetching full EDID on the ones which have remained connected, and often spending a lot of time on the ones which have nothing on them. With many connectors this time can accumulate and cause dropped frames every ten seconds.

For example with 3.4.0-rc7+ on Intel DH61AG motherboard with the latest BIOS (39) this loop take approx. 330ms which causes a lot of dropped frames. See the annotated log:

[  438.262675] [drm:intel_ironlake_crt_detect_hotplug], ironlake hotplug adpa=0xf40000, result 0
[  438.262681] [drm:intel_crt_detect], CRT not detected via hotplug
[  438.262685] [drm:output_poll_execute], [CONNECTOR:7:VGA-1] status updated from 2 to 2
[  438.263060] [drm:drm_do_probe_ddc_edid], drm: skipping non-existent adapter i915 gmbus dpb
[  438.263064] [drm:output_poll_execute], [CONNECTOR:10:HDMI-A-1] status updated from 2 to 2
[  438.265621] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.267368] [drm:intel_update_fbc], 
[  438.270188] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.274180] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.275621] [drm:intel_dp_detect], DPCD: 0000000000000000
[  438.275626] [drm:output_poll_execute], [CONNECTOR:13:DP-1] status updated from 2 to 2
[  438.351685] [drm:drm_detect_monitor_audio], Monitor has basic audio support
[  438.351690] [drm:output_poll_execute], [CONNECTOR:16:HDMI-A-2] status updated from 1 to 1

80ms to probe HDMI-A-2 which remained connected.

[  438.359616] [drm:drm_do_probe_ddc_edid], drm: skipping non-existent adapter i915 gmbus dpd
[  438.359620] [drm:output_poll_execute], [CONNECTOR:18:HDMI-A-3] status updated from 2 to 2
[  438.362177] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.366148] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.370146] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.371596] [drm:intel_dp_detect], DPCD: 0000000000000000
[  438.371600] [drm:output_poll_execute], [CONNECTOR:19:DP-2] status updated from 2 to 2

20ms to probe DP-2 which remained disconnected and is not phisically exposed on the board?

[  438.371916] [drm:intel_dp_detect], DPCD: 110a824100000180
[  438.372229] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.372439] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.372441] [drm:i2c_algo_dp_aux_xfer], dp_aux_xfer return -121
[  438.372753] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.372963] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.372965] [drm:i2c_algo_dp_aux_xfer], dp_aux_xfer return -121
[  438.373277] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.373486] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.373488] [drm:i2c_algo_dp_aux_xfer], dp_aux_xfer return -121
[  438.373800] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.374010] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.374012] [drm:i2c_algo_dp_aux_xfer], dp_aux_xfer return -121
[  438.374323] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.374533] [drm:intel_dp_i2c_aux_ch], aux_i2c nack
[  438.374535] [drm:i2c_algo_dp_aux_xfer], dp_aux_xfer return -121
[  438.374537] [drm:output_poll_execute], [CONNECTOR:21:DP-3] status updated from 2 to 1

3ms to probe DP-3 which went to connected but what it is and how? Only HDMI-2 is connected in reality.

Is this the on-board eDP? Is the vbios still describing it incorrectly?

[  438.375448] [drm:drm_mode_addfb], [FB:27]
[  438.378082] [drm:drm_mode_getconnector], [CONNECTOR:7:?]
[  438.378087] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:7:VGA-1]
[  438.378093] [drm:intel_ironlake_crt_detect_hotplug], ironlake hotplug adpa=0xf40000, result 0
[  438.378095] [drm:intel_crt_detect], CRT not detected via hotplug
[  438.378100] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:7:VGA-1] disconnected
[  438.378105] [drm:drm_mode_getconnector], [CONNECTOR:7:?]
[  438.378107] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:7:VGA-1]
[  438.378111] [drm:intel_ironlake_crt_detect_hotplug], ironlake hotplug adpa=0xf40000, result 0
[  438.378113] [drm:intel_crt_detect], CRT not detected via hotplug
[  438.378115] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:7:VGA-1] disconnected
[  438.378123] [drm:drm_mode_getconnector], [CONNECTOR:10:?]
[  438.378125] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:10:HDMI-A-1]
[  438.378496] [drm:drm_do_probe_ddc_edid], drm: skipping non-existent adapter i915 gmbus dpb
[  438.378499] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:10:HDMI-A-1] disconnected
[  438.378503] [drm:drm_mode_getconnector], [CONNECTOR:10:?]
[  438.378505] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:10:HDMI-A-1]
[  438.378886] [drm:drm_do_probe_ddc_edid], drm: skipping non-existent adapter i915 gmbus dpb
[  438.378890] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:10:HDMI-A-1] disconnected
[  438.378900] [drm:drm_mode_getconnector], [CONNECTOR:13:?]
[  438.378905] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1]
[  438.381462] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.384008] [drm:intel_update_fbc], 
[  438.385155] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.389150] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.390601] [drm:intel_dp_detect], DPCD: 0000000000000000
[  438.390608] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1] disconnected
[  438.390616] [drm:drm_mode_getconnector], [CONNECTOR:13:?]
[  438.390620] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1]
[  438.393177] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.397146] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.401149] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.402595] [drm:intel_dp_detect], DPCD: 0000000000000000
[  438.402602] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1] disconnected

22ms to do something on DP-1 to which nothing is connected and it is unknown what it represents.

[  438.402623] [drm:drm_mode_getconnector], [CONNECTOR:16:?]
[  438.402627] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:16:HDMI-A-2]
[  438.478728] [drm:drm_detect_monitor_audio], Monitor has basic audio support
[  438.554892] [drm:drm_edid_to_eld], ELD monitor DELL U2711
[  438.554897] HDMI: DVI dual 0, max TMDS clock 225, latency present 1 0, video latency 15 0, audio latency 0 227
[  438.554900] [drm:drm_edid_to_eld], ELD size 9, SAD count 1
[  438.554938] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:16:HDMI-A-2] probed modes :
[  438.554942] [drm:drm_mode_debug_printmodeline], Modeline 28:"1920x1080" 60 148500 1920 2008 2052 2200 1080 1082 1087 1125 0x48 0x5
[  438.554948] [drm:drm_mode_debug_printmodeline], Modeline 59:"1920x1080" 50 148500 1920 2448 2492 2640 1080 1084 1089 1125 0x40 0x5
[  438.554953] [drm:drm_mode_debug_printmodeline], Modeline 45:"1920x1080" 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x40 0x5
[  438.554958] [drm:drm_mode_debug_printmodeline], Modeline 60:"1920x1080" 24 74250 1920 2558 2602 2750 1080 1084 1089 1125 0x40 0x5
[  438.554963] [drm:drm_mode_debug_printmodeline], Modeline 58:"1920x1080" 50 74250 1920 2448 2492 2640 1080 1084 1094 1125 0x40 0x15
[  438.554968] [drm:drm_mode_debug_printmodeline], Modeline 46:"1920x1080" 60 74250 1920 2008 2052 2200 1080 1084 1094 1125 0x40 0x15
[  438.554973] [drm:drm_mode_debug_printmodeline], Modeline 35:"1600x1200" 60 162000 1600 1664 1856 2160 1200 1201 1204 1250 0x40 0x5
[  438.554979] [drm:drm_mode_debug_printmodeline], Modeline 33:"1680x1050" 60 146250 1680 1784 1960 2240 1050 1053 1059 1089 0x40 0x6
[  438.554984] [drm:drm_mode_debug_printmodeline], Modeline 41:"1280x1024" 75 135000 1280 1296 1440 1688 1024 1025 1028 1066 0x40 0x5
[  438.554989] [drm:drm_mode_debug_printmodeline], Modeline 36:"1280x1024" 60 108000 1280 1328 1440 1688 1024 1025 1028 1066 0x40 0x5
[  438.554994] [drm:drm_mode_debug_printmodeline], Modeline 32:"1280x800" 60 83500 1280 1352 1480 1680 800 803 809 831 0x40 0x9
[  438.554999] [drm:drm_mode_debug_printmodeline], Modeline 34:"1152x864" 75 108000 1152 1216 1344 1600 864 865 868 900 0x40 0x5
[  438.555005] [drm:drm_mode_debug_printmodeline], Modeline 57:"1280x720" 50 74250 1280 1720 1760 1980 720 725 730 750 0x40 0x5
[  438.555010] [drm:drm_mode_debug_printmodeline], Modeline 47:"1280x720" 60 74250 1280 1390 1430 1650 720 725 730 750 0x40 0x5
[  438.555015] [drm:drm_mode_debug_printmodeline], Modeline 56:"1440x576" 50 27000 1440 1464 1590 1728 576 580 586 625 0x40 0x1a
[  438.555020] [drm:drm_mode_debug_printmodeline], Modeline 42:"1024x768" 75 78800 1024 1040 1136 1312 768 769 772 800 0x40 0x5
[  438.555025] [drm:drm_mode_debug_printmodeline], Modeline 43:"1024x768" 60 65000 1024 1048 1184 1344 768 771 777 806 0x40 0xa
[  438.555030] [drm:drm_mode_debug_printmodeline], Modeline 53:"1440x480" 60 27000 1440 1478 1602 1716 480 488 494 525 0x40 0x1a
[  438.555035] [drm:drm_mode_debug_printmodeline], Modeline 44:"800x600" 75 49500 800 816 896 1056 600 601 604 625 0x40 0x5
[  438.555040] [drm:drm_mode_debug_printmodeline], Modeline 37:"800x600" 60 40000 800 840 968 1056 600 601 605 628 0x40 0x5
[  438.555045] [drm:drm_mode_debug_printmodeline], Modeline 55:"720x576" 50 27000 720 732 796 864 576 581 586 625 0x40 0xa
[  438.555050] [drm:drm_mode_debug_printmodeline], Modeline 49:"720x480" 60 27000 720 736 798 858 480 489 495 525 0x40 0xa
[  438.555055] [drm:drm_mode_debug_printmodeline], Modeline 38:"640x480" 75 31500 640 656 720 840 480 481 484 500 0x40 0xa
[  438.555060] [drm:drm_mode_debug_printmodeline], Modeline 39:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[  438.555065] [drm:drm_mode_debug_printmodeline], Modeline 52:"640x480" 60 25175 640 656 752 800 480 490 492 525 0x40 0xa
[  438.555071] [drm:drm_mode_debug_printmodeline], Modeline 40:"720x400" 70 28320 720 738 846 900 400 412 414 449 0x40 0x6
[  438.555083] [drm:drm_mode_getconnector], [CONNECTOR:16:?]

153ms to re-fetch modes on connected HDMI-A-2.

[  438.555864] [drm:drm_mode_getconnector], [CONNECTOR:18:?]
[  438.555869] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:18:HDMI-A-3]
[  438.563573] [drm:drm_do_probe_ddc_edid], drm: skipping non-existent adapter i915 gmbus dpd
[  438.563578] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:18:HDMI-A-3] disconnected
[  438.563584] [drm:drm_mode_getconnector], [CONNECTOR:18:?]
[  438.563587] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:18:HDMI-A-3]
[  438.571571] [drm:drm_do_probe_ddc_edid], drm: skipping non-existent adapter i915 gmbus dpd
[  438.571575] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:18:HDMI-A-3] disconnected

16ms to attempt fetching EDID on unknown HDMI-A-3.

[  438.571587] [drm:drm_mode_getconnector], [CONNECTOR:19:?]
[  438.571590] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:19:DP-2]
[  438.574147] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.578119] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.582104] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.583554] [drm:intel_dp_detect], DPCD: 0000000000000000
[  438.583559] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:19:DP-2] disconnected
[  438.583566] [drm:drm_mode_getconnector], [CONNECTOR:19:?]
[  438.583569] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:19:DP-2]
[  438.586133] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.590107] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.594108] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003f
[  438.595553] [drm:intel_dp_detect], DPCD: 0000000000000000
[  438.595560] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:19:DP-2] disconnected

20ms for unknown DP-2.

[  438.595575] [drm:drm_mode_getconnector], [CONNECTOR:21:?]
[  438.595579] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:21:DP-3]
[  438.595583] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:21:DP-3] disconnected
[  438.595587] [drm:drm_mode_getconnector], [CONNECTOR:21:?]
[  438.595590] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:21:DP-3]
[  438.595593] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:21:DP-3] disconnected

Looks fine for unknown DP-3 here.
Comment 1 Chris Wilson 2012-05-14 06:10:00 UTC
Created attachment 61612 [details] [review]
Skip periodic probes if we have a hotplug-driven system

Step 1 is to reduce the frequency of the polling.
Comment 2 Tvrtko Ursulin 2012-05-14 06:19:21 UTC
(In reply to comment #1)
> Created attachment 61612 [details] [review] [review]
> Skip periodic probes if we have a hotplug-driven system

This won't work well in the field where VGA over DVI-I is used with cheap adapters which do not wire the HPD pin.
 
> Step 1 is to reduce the frequency of the polling.

Reduce as in eliminate or I am misreading it? :)
Comment 3 Chris Wilson 2012-05-14 06:26:47 UTC
If we don't specify that the connector is polled for CONNECTION/DISCONNECTION, then any current probing performed by the periodic helper is a bug. So from that pov, we aren't actually modifying existing behaviour (except for papering over a bug in the core) and just disabling the unused timer.

However, I think the helper is buggy and so we are seeing unwanted polling of HPD connectors.
Comment 4 Tvrtko Ursulin 2012-05-15 08:45:28 UTC
Would you like me to test this patch, or it is to trivial?

On a related note, what is the other thing which runs every ten seconds after output_poll_execute finishes? I have a situation on a different hardware where only that part runs every ten seconds, identical to lines from 438.402623 and below. X seems to be triggering that. But end result it it re-fetches EDID on the connected outputs which again results in glitching.
Comment 5 Tvrtko Ursulin 2012-05-16 06:24:58 UTC
(In reply to comment #4)
> On a related note, what is the other thing which runs every ten seconds after
> output_poll_execute finishes? I have a situation on a different hardware where
> only that part runs every ten seconds, identical to lines from 438.402623 and
> below. X seems to be triggering that. But end result it it re-fetches EDID on
> the connected outputs which again results in glitching.

Please disregards, it was an unrelated process doing this probing which I failed to identify and stop while doing the testing in a stripped down environment.
Comment 6 Chris Wilson 2012-05-21 02:59:45 UTC
(In reply to comment #4)
> Would you like me to test this patch, or it is to trivial?

If you can verify that it does what it says on the tin, that will be most helpful, thanks.
Comment 7 Tvrtko Ursulin 2012-05-23 05:29:49 UTC
Works as designed.
Comment 8 Tvrtko Ursulin 2012-05-23 05:54:12 UTC
But it also regresses when you switch video connectors - I just switched HDMI to VGA and it did not initialise it. Strange, I am pretty sure I was getting HPD events on this board. I have to inject some debug to be sure...
Comment 9 Daniel Vetter 2012-05-23 06:02:13 UTC
Created attachment 62017 [details] [review]
fixup polling for hotplug pins

Chris' patch will break hotplug detection, so here's a new try. Please test (and if you can, please also check whether hotplug (and unplug) detection still works, i.e. whether the xrandr gui configuration tool of your desktop still pops up).
Comment 10 Tvrtko Ursulin 2012-05-23 06:02:53 UTC
Hmm.. the code is a bit confusing. I think the culprit is in this snippet:

void drm_helper_hpd_irq_event(struct drm_device *dev)
{
	if (!dev->mode_config.poll_enabled)
		return;

dev->mode_config.poll_enabled is not set to true unless you call drm_kms_helper_poll_init and HPD events of course do not work. It feels strange to have this check in drm_helper_hpd_irq_event since it is not about polling.

Perhaps the check should be removed?
Comment 11 Tvrtko Ursulin 2012-05-23 06:13:29 UTC
(In reply to comment #9)
> Created attachment 62017 [details] [review] [review]
> fixup polling for hotplug pins
> 
> Chris' patch will break hotplug detection, so here's a new try. Please test
> (and if you can, please also check whether hotplug (and unplug) detection still
> works, i.e. whether the xrandr gui configuration tool of your desktop still
> pops up).

Who will now call connector->funcs->detect for HPD capable connectors, is that not necessary or I am missing something?
Comment 12 Daniel Vetter 2012-05-23 06:14:10 UTC
Ok, I don't understand at all why that hotplug loop even gets run for your system every 10s. Can you please attach xrandr --verbose and full dmesg with drm.debug=0xe added to your kernel cmdline?
Comment 13 Daniel Vetter 2012-05-23 06:15:17 UTC
Yeah, Dave Airlie arleady pointed out that not calling ->detect will break fbcon a bit. Userspace should be calling detect on all connectors already when getting a hotplug uevent, so that should work. Hence test this patch anyway, please.
Comment 14 Tvrtko Ursulin 2012-05-23 06:18:11 UTC
Loop doesn't run right now, it used to when we had "video=DP-3:d" passed to the kernel (see bug 49907). I think it was more a trigger on the wider topic on why all connectors are re-probed on a HPD event.
Comment 15 Tvrtko Ursulin 2012-05-23 06:19:21 UTC
(In reply to comment #13)
> Yeah, Dave Airlie arleady pointed out that not calling ->detect will break
> fbcon a bit. Userspace should be calling detect on all connectors already when
> getting a hotplug uevent, so that should work. Hence test this patch anyway,
> please.

What if there is no userspace, and with that I mean no X? I don't think code should regress in that case.
Comment 16 Daniel Vetter 2012-05-23 06:25:55 UTC
Ok, so the 10s loop was just due to broken userspace, and the issue here is that we run ->detect on all hotplug pins. Adjusting bug summary accordingly.
Comment 17 Chris Wilson 2012-05-24 08:59:27 UTC
*** Bug 26845 has been marked as a duplicate of this bug. ***
Comment 18 Daniel Vetter 2012-05-24 09:07:43 UTC
Self-correction: The 10s loop is due to bug #49907
Comment 19 Daniel Vetter 2012-12-10 20:41:51 UTC
Spurious polling should be fixed in 3.8 (you can grab the patches from the drm-next git tree). Specifically for this case here:

905bc9ff6575f78aab24c0261e8785425b5a0397 drm: don't start the poll engine in probe_single_connector
69787f7da6b2adc4054357a661aaa1701a9ca76f drm: run the hpd irq event code directly
816da85a0990c2b52cfffa77637d1c770d6790e9 drm: handle HPD and polled connectors separately


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.