compositor-drm: rewrite crtc picking for clone mode

Graphics / Wayland / Weston - Pekka Paalanen [] - 2 May 2018 09:08 EDT

To support shared-CRTC clone mode, the chosen CRTC needs to support driving all the attached connectors. Replace the old algorithm with a new one that takes into account all associated connectors.

Ideally it should use possible_clones mask to check which encoders (and therefore connectors) actually can be in a cloned set. However, the DRM documentation says about possible_clones and possible_crtcs masks both: "In reality almost every driver gets this wrong."-

Looking at a target device and its kernel where clone mode is desired, possible_clones is indeed self-conflicting and would not allow cloning at all. Therefore the implemented algorithm replaces the checking of possible_clones with luck. It even goes out of its way to find any CRTC for a configuration, even if not advertised by the kernel as not supported.

Libweston would need infrastructure to allow trial-and-error CRTC allocation: rather than picking one CRTC in advance and do or die, it should try all available CRTCs one by one. Unfortunately that is not yet possible, so this patch implements what it can. It is also the DRM upstream opinion that trial-and-error with ATOMIC_TEST would be the way to go.

Unlike the old algorithm, the new algorithm prefers routings that were in place when Weston started instead of when enabling an output. When you never temporarily disable an output, this makes no difference.

27cc4816 compositor-drm: rewrite crtc picking for clone mode
libweston/compositor-drm.c | 184 ++++++++++++++++++++++++++++++++-------------
1 file changed, 131 insertions(+), 53 deletions(-)


  • Share