Skip to content

drm-extras: report late CRTC mappings - #2125

Open
johnrichardrinehart wants to merge 1 commit into
Smithay:masterfrom
johnrichardrinehart:fix/drm-scanner-newly-mapped-events
Open

drm-extras: report late CRTC mappings#2125
johnrichardrinehart wants to merge 1 commit into
Smithay:masterfrom
johnrichardrinehart:fix/drm-scanner-newly-mapped-events

Conversation

@johnrichardrinehart

Copy link
Copy Markdown

Description

DrmScanner can report a connected connector with crtc: None when every compatible CRTC is occupied. If another connector later disconnects, CrtcMapper::map() can assign the released CRTC without a connector state or mode change. The scan then reports only the disconnection, so consumers do not learn that the previously unusable connector is now mapped.

This change snapshots mappings before CrtcMapper::map() and reports Connected again for a connected connector whose mapping changes from None to Some. It suppresses the extra event when ConnectorScanner already reported the connector as newly connected in the same scan.

This differs from #1923: that change reports mode-list updates through Changed; this change reports CRTC availability when the connector metadata did not change. Keeping the existing Connected variant avoids an API-breaking enum addition and works with consumers that register outputs from Connected { crtc: Some(_) }.

A focused unit test covers the transition and verifies that existing mappings, same-scan connection events, and connectors that remain unmapped are not reported.

Related: #2075 and #2076.

This contribution was developed with assistance from OpenAI Codex, as disclosed in the commit message.

Verification

  • cargo fmt --all -- --check
  • cargo clippy --manifest-path smithay-drm-extras/Cargo.toml --no-deps -- -D warnings
  • cargo test --manifest-path smithay-drm-extras/Cargo.toml

Checklist

DrmScanner can report a connected connector without a CRTC when every
compatible CRTC is occupied. If another connector disconnects later,
the mapper assigns the released CRTC, but ConnectorScanner has no state
transition to report. Consumers can then miss the mapping and leave the
output inactive.

Record mappings before CrtcMapper::map() and report a Connected event
when a connected connector changes from unmapped to mapped. Avoid a
duplicate event for connectors that became connected in the same scan.
Add a focused mapping-transition test and document the event semantics.

This contribution was developed with assistance from OpenAI Codex.

Signed-off-by: John Rinehart <johnrichardrinehart@gmail.com>
johnrichardrinehart added a commit to johnrichardrinehart/nixosModules that referenced this pull request Aug 8, 2026
Niri's Smithay revision predates the fix that releases CRTC
reservations for vanished DP-MST connectors. Smithay also fails to
report when an already-connected connector receives a CRTC on a later
scan, which can leave Niri unaware of the usable mapping.

Pin only smithay-drm-extras to the commit behind Smithay PR #2125. The
commit includes the merged stale-reservation fix and the tested
late-mapping event fix while leaving Niri's core Smithay dependency
unchanged. Regenerate the Cargo vendor tree and document why the pin is
required.

Link: Smithay/smithay#2125
Link: Smithay/smithay#2076
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.

1 participant