Watch
1
0
Fork
You've already forked smithay
0
smithay/smithay-drm-extras
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sven Over e76f1af141 drm_scanner: release CRTC reservations for vanished connectors
`SimpleCrtcMapper` keeps a `connector -> crtc` reservation map and, on each `map()` call, releases the reservation of any connector it is told about that is no longer connected:

```rust
for connector in connectors
    .clone()
    .filter(|conn| conn.state() != connector::State::Connected)
{
    self.crtcs.remove(&connector.handle());
}
```

This only releases connectors that are still present in the resource list and reported as disconnected. A connector whose handle disappears from the resource list entirely is never passed to `map()` again, so its reservation is never released and leaks for the lifetime of the mapper.

This happens routinely with DP-MST: the sink connectors behind an MST hub are dynamically created and destroyed, so unplugging a USB-C/Thunderbolt dock — or suspending and resuming while docked, where the connectors are torn down and recreated under fresh handles while the compositor isn't scanning — makes the old handles vanish rather than transition to `Disconnected`. Each such event leaks one reservation per vanished connector. Because a leaked reservation still counts as "taken", the reservations accumulate across cycles until every CRTC is reserved by a ghost handle. At that point `pick_next_available_for_connector` can no longer find a free CRTC for a genuinely connected connector, so `crtc_for_connector` returns `None` for it and the compositor silently never brings up that output. The only recovery is recreating the `DrmScanner`.

This was observed in niri as external monitors on a dock going missing after a number of suspend/resume cycles, getting progressively more likely over time, and only recoverable by restarting the compositor.

Fix it by releasing the reservation of every connector that is not currently connected, including connectors that are no longer present at all. At the start of `map()`, collect the set of currently connected connector handles and retain only reservations whose handle is in that set. The previously handled case (a connector present but reported as disconnected) is still covered, since such a connector is excluded from the connected set.
2026-07-13 17:04:00 +02:00
..
examples fix compilation errors 2026-07-13 16:03:48 +02:00
src drm_scanner: release CRTC reservations for vanished connectors 2026-07-13 17:04:00 +02:00
Cargo.toml Use 2024 Rust edition 2026-04-09 12:54:11 +02:00
LICENSE DRM Extras license 2024-01-29 22:56:38 +01:00
README.md fix: typos 2026-02-12 12:48:05 +01:00

Smithay DRM Extras

This crate contains some extra abstractions and helpers over DRM

  • display_info module is responsible for extraction of information from DRM connectors (model and manufacturer)
  • drm_scanner module contains helpers for detecting connector connected and disconnected events as well as mapping crtc to them.
    • ConnectorScanner is responsible for tracking connected/disconnected events.
    • CrtcMapper trait and SimpleCrtcMapper are meant for mapping crtc to connector.
    • DrmScanner<CrtcMapper> combines two above into single abstraction. If it does not fit your needs you can always drop down to using ConnectScanner alone.