← Back to Pull requests

nvkms: optional FRL training backoff, FRL caps retention, and lost-link retrain #1505

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Oct 31, 2026 11:09 UTC
Author

Draft: the third commit is being field-tested. See the comment below for the regression it fixes.

Summary

Opt-in fixes for a failure chain on high-capability HDMI FRL displays (e.g. 7680x2160@120 with DSC) around display sleep/wake and sink power cycles. Both module parameters default off, so stock behavior is unchanged with no configuration.

1. frl_train_backoff_ms (uint, default 0): an optional delay in milliseconds between FRL link-training attempts. Some sinks take up to ~2 s after retraining before their SCDC accepts a new training request. The stock six attempts all run within a few milliseconds, so they all fail. With 500, the six attempts span ~2.5 s and training succeeds.
2. frl_caps_retention (bool, default false): when a fresh FRL assessment fails (e.g. during wake) and the EDID is unchanged, keep the last successfully assessed FRL caps. FRL-only modes (e.g. 7680x2160) then stay in the connector mode list instead of being dropped, which would otherwise leave the display stuck on a lower mode.
3. Retrain an active FRL link lost by the sink (only active with frl_caps_retention): with retention keeping the mode list unchanged, a sink that is power-cycled while its head stays active loses its FRL link but gives the client nothing to react to. NVKMS detects this through SCDC and asks nvidia-drm to force a modeset of the head, which retrains the link.

Background

Observed on an Odyssey G95NC (7680x2160@120, DSC) with 615.78.08 (the code paths involved, nvDpyProbeMaxPixelClock(), the nvHdmiFrlSetConfig() retry loop and nvHdmiFrlAssessLink(), are unchanged in 620.70.06):

  • Wake training failure (~2 s window): after display sleep/wake, FRL training attempts 1–3 fail for ~2 s (SCDC not ready), then succeed. The stock retry window (~7 ms total) is far too short.

  • Mode-list regression: the post-wake probe zeroes the FRL caps, and a fresh assessment fails (the SOR can't be assigned while the head is active, or the sink isn't ready), leaving linkMaxFRLRate = NONE. nvHdmiIsFrlPossible() then returns FALSE and the mode-list rebuild drops 7680x2160. The compositor's stored configuration is rejected and the display stays on a low-resolution fallback until the monitor is power-cycled.

  • Sink power cycle with retention (found while testing commit 2): the sink re-asserts HPD every ~7 s. Each re-probe restores the retained caps, the mode list stays identical, the compositor never modesets, and the FRL link is never retrained. The result is no picture indefinitely.
  • Design notes

  • Backoff reuses the existing retry loop (same six attempts, same retries accounting) with an nvkms_usleep between attempts. The sleep is taken while the display lock is held; the parameter description documents this. When training fails with the parameter disabled, the existing "HDMI FRL link training failed" warning is followed by a hint naming the parameter.

  • Retention captures srcCaps/sinkCaps, the pixel-clock ceilings and a raw-EDID snapshot in nvDpyProbeMaxPixelClock() before they are zeroed. It restores them at the three failure sites: probe SOR-assignment failure, probe assessment failure, and nvHdmiFrlAssessLink failure. The restore is conservative:

  • - it only applies when the current caps are already reset;
    - it is gated on the raw EDID bytes being unchanged;
    - it sets reassessFrlLinkCaps, so a real assessment overwrites the fallback.
  • Lost-link retrain:

  • - After a retention restore in the SOR-assignment-failure branch, NVKMS reads SCDC Config_1 (FRL_Rate) and Status_Flags_0 (lane lock) for an active FRL head. It only reads SCDC and never writes or clears it.
    - If the sink reports FRL_Rate 0 or no locked lanes, NVKMS sends a new kernel-client-only event, NVKMS_EVENT_TYPE_DPY_LINK_RETRAIN_REQUIRED. The event is in NVKMS_USER_SPACE_DISALLOWED_EVENTS_MASK, and its payload is no larger than the existing union members, so the user-space ABI is unaffected.
    - nvidia-drm re-commits the connector's active CRTC with mode_changed forced, from a work item, i915-style.
    - DRM link-status = BAD was not used because Mutter does not handle it.
    - A healthy link reads FRL_Rate ≠ 0 with all lanes locked, so normal wakes don't trigger a retrain, and a successful retrain stops further triggers.

    Validation

    The branch is rebased onto main (620.70.06). Field testing ran on 615.78.08, the version my distro ships, using the same three commits applied to the 615 tarball. The 620 rebase needed only mechanical changes; see the rebase comment below.

  • Commits 1+2: 18/18 wake cycles (17 display sleep, 1 S3 suspend/resume) ended at native 7680x2160@119.997 with the FRL mode retained. Without them, the mode is dropped and the monitor has to be power-cycled. A monitor firmware update was tested and didn't help; the ~2 s readiness window is on the sink side.

  • Commit 3, day 1 (Linux 7.2.14): 15 sleep/wake cycles. Each ran the link check and read healthy SCDC values (0x31=0x34, 0x40=0x5f), with no spurious retrains. The sink power-cycle case is not yet verified on hardware.

  • All three commits build cleanly on both 615.78.08 and 620.70.06 (all 5 modules, no new warnings; Linux 7.2.14).
  • Happy to split, reword, or change the option names/defaults if preferred.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: starcraft66 Review duration: 24714m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1505"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%