nvidia-drm: trigger connector detect on hotplug events#1127
Open
kekiefer wants to merge 1 commit intoNVIDIA:mainfrom
Open
nvidia-drm: trigger connector detect on hotplug events#1127kekiefer wants to merge 1 commit intoNVIDIA:mainfrom
kekiefer wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
When a DisplayPort sink is hotplugged after boot, the connector status reported in /sys/class/drm/card0-DP-1/status remains "disconnected" even though the kernel observes the HPD edge and emits a HOTPLUG=1 uevent. Userspace must run `echo detect > status` to refresh the connector before a modeset succeeds. The hotplug work handler nv_drm_handle_hotplug_event() was calling drm_kms_helper_hotplug_event(), which only sends a uevent and invokes the output_poll_changed callback. It never calls connector->detect(). Because the connector status is therefore never refreshed, DRM core keeps reporting the cached "disconnected" state. Call drm_helper_hpd_irq_event() instead. That helper iterates all DRM_CONNECTOR_POLL_HPD-flagged connectors, runs connector->detect() on each, updates the recorded status, and only sends the uevent if the status actually changed. This is the correct entry point for an HPD-edge notification and produces a fresh status read for userspace without requiring a manual detect. Signed-off-by: Kurt Kiefer <kekiefer@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note that this fix was developed and validated against a Jetson Orin AGX 64GB running the r36.5 fork of these kernel modules (https://gitlab.com/nvidia/nv-tegra/tegra/kernel-src/nv-kernel-display-driver/-/tree/l4t/l4t-r36.5) where there is no meaningful commit history, so submission there did not seem appropriate.
As such, this change was rebased to upstream here, but could not be revalidated.
Also, if this repository is not the appropriate upstream target, please let me know and I can redirect this patch.
When a DisplayPort sink is hotplugged after boot, the connector status reported in /sys/class/drm/card0-DP-1/status remains "disconnected" even though the kernel observes the HPD edge and emits a HOTPLUG=1 uevent. Userspace must run
echo detect > statusto refresh the connector before a modeset succeeds.The hotplug work handler nv_drm_handle_hotplug_event() was calling drm_kms_helper_hotplug_event(), which only sends a uevent and invokes the output_poll_changed callback. It never calls connector->detect(). Because the connector status is therefore never refreshed, DRM core keeps reporting the cached "disconnected" state.
Call drm_helper_hpd_irq_event() instead. That helper iterates all DRM_CONNECTOR_POLL_HPD-flagged connectors, runs connector->detect() on each, updates the recorded status, and only sends the uevent if the status actually changed. This is the correct entry point for an HPD-edge notification and produces a fresh status read for userspace without requiring a manual detect.