Skip to content

nvidia-drm: expose opt-in per-connector MST DDC adapters - #1400

Open
sbmf21 wants to merge 2 commits into
NVIDIA:mainfrom
sbmf21:fix/mst-ddc-upstream
Open

sbmf21 wants to merge 2 commits into
NVIDIA:mainfrom
sbmf21:fix/mst-ddc-upstream

Conversation

@sbmf21

@sbmf21 sbmf21 commented Sep 26, 2026 •

Copy link
Copy Markdown

An MST chain can expose the physical connector's legacy I2C path without exposing per-display I2C adapters for downstream sinks. DDC/CI clients such as ddcutil and KDE PowerDevil then cannot address each monitor independently.

This series adds opt-in per-connector MST DDC adapters, enabled with nvidia_drm.mst_ddc=1. Transfers are routed through NVKMS to the existing DisplayPort remote I2C sideband implementation. Supported requests are a single read, a single write, or a combined write/read preserving the repeated START. Unsupported message shapes, flags and lengths are rejected; transport failures and short replies return an error.

MST messages are posted asynchronously. KAPI waits outside the global NVKMS and PM locks, with separate start, poll and cancel operations. Requests are owned by the DP device and identified by unique tokens; callbacks detach messages on completion/failure, and timeout/error paths cancel outstanding requests. This prevents monitor reply delays from blocking compositor display updates.

Adapters use the established DPMST name and are associated with their DRM connectors. This lets existing ddcutil phantom detection exclude a duplicate legacy path. The adapter's display handle is refreshed when a connector is reused, and adapter registration is unwound on failure/destruction. The separate DisplayPort prerequisite commit bounds the reported remote I2C reply length before copying into the fixed 128-byte buffer.

Validation

  • Built all five modules for Arch Linux 7.2.6-arch2-1, using NVIDIA 615.71.09 as the source base.
  • Local extracted-source ASan/UBSan tests cover request validation, reply bounds, asynchronous completion, cancellation, token mismatch, message-manager teardown, and KAPI wait/error/timeout paths. Encoder output matches Linux MST wire-format vectors for read, write, combined and EDID requests. These tests use modeled transports; they do not establish real kernel concurrency safety.
  • Hardware: RTX 4070 → Dell U2724DE → U2717D → U2717D. With the asynchronous revision, all three monitors pass brightness reads and detection, and the user confirms all three Plasma sliders work smoothly without desktop freezes.
  • A traced brightness query previously spent about 129 ms and 103 ms in the two synchronous transfers, with KWin threads blocked in NVKMS. With asynchronous requests, individual NVKMS calls took at most 3.94 ms in the corresponding trace, with no blocked KWin thread samples. The tested login/detection session recorded no pageflip timeout warnings. Overall monitor response time remains about the same.
  • U2724DE firmware M3T104, MST enabled and Multi-Monitor Sync disabled. With Multi-Monitor Sync enabled, downstream sinks returned valid DDC/CI null replies; changing only that setting restored communication.
  • Three DPMST adapters and, with a separate ddcutil numbering fix, three active displays numbered 1–3.

Remaining validation and hotplug limitation

Suspend/resume passed on the earlier synchronous revision; it has not yet been repeated with the asynchronous implementation.

On that earlier revision, disconnecting/reconnecting the GPU-to-root-monitor cable left video blank across the chain. All three connectors remained connected/enabled and all nine brightness queries succeeded (three monitors, each tested with 40/200/1000 ms delays). KWin logged pageflip timeouts and NVIDIA logged nvHandleCpEventDeferredWork: displayId ... invalid. Issue #1380 reports a similar error pattern on 615.71.09, but a shared cause or independence from this change has not been established. Cable hotplug has not yet been repeated with the asynchronous revision.

Review is particularly welcome on NVKMS locking, connector reuse, request cancellation and adapter lifetime under concurrent hotplug/I2C activity. Other GPUs, MST hubs and older kernels remain untested, and the feature defaults to disabled.

Runtime testing used the feature code in this series plus a local KAPI version-string guard to prevent accidentally mixing stock and patched modules with the same release number. That packaging-only guard is excluded from this contribution.

Check the reported byte count before copying into the fixed-size reply buffer. MST remote I2C replies can advertise up to 255 bytes, while the buffer holds 128.
@CLAassistant

CLAassistant commented Sep 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sbmf21
sbmf21 marked this pull request as ready for review September 26, 2026 11:45
Route supported I2C transfers through NVKMS to DisplayPort remote I2C
sideband requests. Register DPMST adapters per connector and refresh display
handles on connector reuse. Reject unsupported requests and short replies.

Post transfers asynchronously and wait outside the global NVKMS and PM
locks so DDC response delays do not stall compositor updates. Use request
tokens and explicit cancellation to handle completion, errors and teardown.
Keep the feature opt-in with mst_ddc=1 pending broader hardware testing.
@sbmf21
sbmf21 force-pushed the fix/mst-ddc-upstream branch from c037880 to 5b0ad91 Compare September 27, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants