Skip to content

backend/drm: better hotplug handling

Simon Ser requested to merge github/fork/emersion/drm-hotplug-fixes into master

This commit handles better situations in which the number of connected outputs is greater than the number of available CRTCs. It'll enable as many outputs as possible, and transfer CRTCs to outputs that need one on unplug.

This changes CRTC and plane reallocation to happen after scanning DRM connectors instead of on modeset.

This cleanups CRTCs and planes on unplug to allow them to be re-used for other outputs.

On modeset, if an output doesn't have a CRTC, the desired mode is saved and used later when the output gains a CRTC.

Future work includes giving priority to enabled outputs over disabled ones for CRTC allocation. This requires the compositor to know about all outputs (even outputs without CRTCs) to properly modeset outputs enabled in the compositor config file and disable outputs disabled in the config file.

Known issues/more future work:

  • Falls back to software cursors in some situations Falls back to software cursors when output doesn't have CRTC, but upgrades to hardware cursors when the output gains a CRTC
  • Fails a modeset on shutdown, seems harmless
  • Outputs without CRTCs show up as disabled outputs, we might want to find a better solution

Fixes part of #409 (closed)

Merge request reports