compositor-drm: Handle extra flips on recently enabled outputs

With the right timing of events we may hit the following scenario
(extra logging added):

    [atomic] drmModeAtomicCommit [flip_id: 238]
    [CRTC:69] atomic_complete_pending=1

    DRM: head 'DP-8' found, connector 125 is connected
    Output DP-8 (crtc 55) video modes: <SNIP>
    'DP-8' enabled with head(s) DP-8
    DRM: head 'DP-8' updated, connector 125 is connected

    [CRTC:55] atomic_complete_pending processing started [flip_id: 238]
    weston: libweston/compositor-drm.c:3136: atomic_flip_handler: Assertion `output->atomic_complete_pending' failed.

This is easy to hit with monitors that allows daisy-chaining of DP
displays through built-in MST hubs.

While turning the main screen on, outputs are getting connected in very
short succession, so we end up with the second output being enabled
right after atomic commit was requested for the first one but not yet
processed, causing the unexpected flip.

To avoid killing compositor in such scenarios, ignore
atomic_complete_pending on first flip on outputs that are just created.

Signed-off-by: Arkadiusz Hiler <>
1 job for stray_pageflips_resilance in 4 minutes and 39 seconds (queued for 2 seconds)
Status Job ID Name Coverage
passed #31198