Skip to content

displayport: process head detach in dpPreModeset while sink is unplugged - #1406

Open
HiroGitea wants to merge 1 commit into
NVIDIA:mainfrom
HiroGitea:fix-dp-detach-while-unplugged
Open

HiroGitea wants to merge 1 commit into
NVIDIA:mainfrom
HiroGitea:fix-dp-detach-while-unplugged

Conversation

@HiroGitea

Copy link
Copy Markdown

Fixes #1405.

ConnectorImpl::dpPreModeset() (new in 615.x) returns early when the sink is unplugged or detection is in progress. That also drops head detaches, which do not need the sink. When a monitor switches to another input, HPD drops and the client shuts the head down, but the DP library never sees the detach and keeps the group marked as head-attached.

On the next attach, trainLinkOptimized() tries to enter flush mode for a head that is no longer active. NVC370_CTRL_CMD_SET_SOR_FLUSH_MODE fails, link training is skipped silently, and DSC is never enabled on the sink. The screen stays black while link-status stays Good.

Change

  • dpPreModeset(): gate only attaches on detection state / HPD; detach heads still go through notifyDetachBegin/notifyDetachEnd (610.57.04 behavior). A skipped attach is logged with DP_PRINTF(DP_WARNING, ...) instead of a DP_ASSERT that is compiled out in release builds.
  • notifyDetachBegin()/notifyDetachEnd() in ConnectorImpl and ConnectorImpl2x: only check connectorActive.

Testing

RTX 5070 Ti, 615.71.09 nvidia-modeset.ko rebuilt from this branch, KWin Wayland, 3840x2160@160 Hz with DSC + FEC. Monitor input switch and monitor power cycle both recover automatically; on the stock module every input switch leaves the screen black until a manual modeset. Logs before/after are in #1405.

dpPreModeset() returns early when the sink is not plugged or detection
is in progress. That also drops head detaches, which do not need the
sink. When a monitor switches to another input, HPD drops, the client
shuts the head down, and the DP library never sees the detach. The
group stays marked as head-attached.

On the next attach after the monitor switches back, trainLinkOptimized()
tries to enter flush mode for a head that is no longer active.
NVC370_CTRL_CMD_SET_SOR_FLUSH_MODE fails, link training is skipped, and
DSC is never enabled on the sink. The source then sends a DSC/FEC
stream the sink cannot decode, which leaves the screen black while
link-status stays Good.

Only gate attaches on detection state and HPD, and let notifyDetachBegin
and notifyDetachEnd run whenever the connector is active, as in
610.57.04. Log when an attach is skipped instead of relying on a
DP_ASSERT that is compiled out in release builds.
@CLAassistant

CLAassistant commented Sep 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@MadoScientist97

Copy link
Copy Markdown

Hi FYI I was having issues with my PC going to sleep too 5070 ti, 9900X, 870 mobo, and I tried using your build but I was still getting into an unrecoverable state if I suspended to s3, granted that my case may be a bit different but your description looks almost exactly same wrt what was happening to me @HiroGitea

@HiroGitea

Copy link
Copy Markdown
Author

@MadoScientist97 thanks for trying it. S3 goes through a different path, so I don't think this PR can fix that. On suspend, nvSuspendDevEvo() → nvRmPauseDP() → nvDPPause() destroys the DP groups and pauses the connector, and resume builds new ones in nvDPResume(). The stale head-attached group this PR is about does not survive a suspend.

The case this PR fixes is the monitor dropping HPD while the system stays up: input switch, monitor power off/on, and possibly DPMS sleep on some monitors. If you can, could you check whether those recover on this build?

For the S3 problem, a separate issue would be easier to track. It would help to know whether it's a black screen with a moving cursor or a full freeze, plus journalctl -k -b -1 | grep -iE 'nvidia|nvrm|xid|blocked for more' from the failed boot. #1378 and #1136 also describe a black screen after resume and may be closer to your case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants