Allow DisplayPort detach bookkeeping when the sink is unplugged - #1359
martinstark wants to merge 2 commits into
Conversation
The HPD check in dpPreModeset() rejects detach-only requests after unplug. This skips DP library cleanup while NVKMS advances its head bookkeeping, leaving stale attached groups that can block subsequent link training. Allow detach-only requests when HPD is low. Reject requests with an attachment target on any selected head, preserving the connector/discovery guards and forced-connected and dynamic-mux exceptions.
|
This patch fixes the issue for this Samsung too; where the 120 Hz mode doesn't require DSC and so does not exhibit the issue while 240 Hz does:
|
|
Fixes the issue on my machine ested PR #1359 successfully on Fedora 44. Setup: GPU: RTX 5090 Behavior: Stock 610.57.04: works normally I rebuilt the RPM Fusion akmod with PR #1359 applied and verified the patched 615.71.09 kernel module was actually loaded. I’m continuing to test repeated power cycles, GNOME DPMS, suspend/resume, reboot, and 240 Hz behavior. So far this patch fixes the regression on my setup as well. |
|
Tested Stock 615.71.09 detected the monitor but produced no signal. Replugging, changing ports and 1080p/60 did not recover it; reboot did. The 1080p capture had DSC/FEC off and logged With this PR's two commits and no diagnostic source patches, native build, DKMS installation and reboot passed. Loaded module build IDs were verified. Graphical unlock, reconnect in both USB-C orientations, HDMI→DP input switching with KVM USB, and 10-second DPMS off/on all worked without another reboot. I separately confirmed full 6144×2560/120 Hz output. The original flush failures did not recur. AUX/disconnect and DRM topology warnings remain. Reconnect/input-switch captures were at 3072×2560/~60 Hz; DPMS was at 3840×2160/~60 Hz. Full-resolution reconnect endurance and system suspend/resume remain untested; the original failure trigger was not isolated. Thanks for the fix. |
|
Another reproduction of the DP monitor power-cycle issue (I have not tested this patch):
|
Power-cycling a Dell U2725QE on 615.71.09 can leave DPLib tracking detached heads, breaking subsequent setup using DSC (4k120hz) . This patch restores detach cleanup and same-connector recovery in the tested setup.
Cause and fix
All four
previousPluggedmodeset guards were introduced in 615.71.09 (dpPreModeset()guard); 610.57.04 has none.dpPreModeset()rejects unplugged detach, leavingdpPostModeset()nothing to complete. NVKMS detaches hardware, clears its head bit and removes group devices; DPLib retains its per-head pointer and an empty, attachedactiveGroupsentry.With stale groups present,
ConnectorImpl2x::enableFlush()proceeds past its early-return checks and attempts flush phase 1. Phase 1 returns0x40(NV_ERR_INVALID_STATE), abortingtrainLinkOptimized()before hardware training or sink DSC enable. The firmware-side rejection reason is unavailable.Every selected head is checked before mutation: allow HPD-low detach-only requests; reject any request containing an attachment target. Connector/discovery guards, forced-connected/DDS exceptions and DSC/flush/training policy remain unchanged. Existing detach callbacks and unplug discovery completion already permit cleanup around the hardware update.
Reproduction
RTX 5090, direct DisplayPort, Arch Linux, Sway/Wayland, kernel
7.2.4-arch1-2, NVIDIA modules/userspace615.71.09. Both modes use 3840×2160/four lanes: 60 Hz at 5.4 Gbit/s without DSC/FEC; 120 Hz at 8.1 Gbit/s with DSC/FEC.Power-cycling from working 120 Hz also fails on stock 615.71.09. Expected: same-connector recovery.
Evidence and limits
Pinned evidence: sanitized timestamped logs, diagnostic patches, control-flow harness and build/reproduction instructions. Instrumentation is excluded from this PR.
0x800, SOR 10x40; attach-training result is false.0x200, SOR 0headMask=0x8) completes; group/transition lists are empty at rediscovery. Head 3 reattaches at 120 Hz; first training attempt, FEC and sink DSC enable succeed.Captures use separate boots/connector assignments. The fixed capture covers one instrumented 120 Hz cycle on the same connector: no phase-1 failure or
0x40, but AUX errors persist during power-off/rediscovery. Thenv-modeset-kernel.obuild and control-flow checks passed. Not tested on hardware: diagnostic-free build, MST, UHBR, eDP/DDS, multi-head/head reassignment, other GPUs and repeated-cycle reliability.Potentially related: NVIDIA bug 6760883, RTX 5090/Samsung G95NC wake regression (tracking acknowledgement).
AI tools assisted with investigation, patch development and this write-up. I performed the hardware tests.