• Nick Diego Yamane's avatar
    ozone/wayland: Fix a startup crash in multi-monitor scenario · 248fa84a
    Nick Diego Yamane authored
    WaylandConnection initialization is considered done once at least one of
    the wl_outputs advertised gets its "done" event (ie: all its metadata
    was already received, ie: size, origin, mode, etc), which has been
    working well so far, at least with the Wayland compositors tested until
    now.
    
    It turns out that such initialization is broken for multi-screen
    scenarios, where the compositor sends events in the following order:
    
    ...
    wl_registry::global for wl_output object 1
    wl_registry::global for wl_output object 2
    wl_output::geometry for wl_output 1
    wl_output::mode for wl_output 1        <-- output 1 ready
    wl_output::geometry for wl_output 2
    wl_output::mode for wl_output 2        <-- output 2 ready
    ...
    
    This is how Exo compositor sends the events, which leads Ozone/Wayland
    to crash at startup. To fix it, this patch modifies code that deals with
    wl_output and WaylandScreen so that it only creates display::Display
    objects for wl_outputs once they are "ready" (ie: all required metadata
    already received from the server). In addition, some cleanup and minor
    fixes are made.
    
    R=tonikitoo@igalia.com
    
    Bug: 1111905
    Test: Covered by unit tests.
    Change-Id: I25d23c5a76d0b2ab900bab4460344cf908db07e9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2332844
    Commit-Queue: Nick Yamane <nickdiego@igalia.com>
    Reviewed-by: default avatarMaksim Sisov (GMT+3) <msisov@igalia.com>
    Reviewed-by: default avatarAntonio Gomes (GMT-4) <tonikitoo@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#794255}
    248fa84a
test_output.cc 1.93 KB