• Maksim Sisov's avatar
    [ozone/wayland] Add initial display fetch support for Wayland. · b81d0e7f
    Maksim Sisov authored
    This cl adds an initial display fetching support for Ozone/Wayland:
      - First, DesktopScreenOzone adds itself as an observer to a
        NativeDisplayDelegate, which has its own implementation based on
        a platform.
      - Then, DesktopScreenOzone initializes NativeDisplayDelegate and,
        in case of WaylandNativeDisplayDelegate, WaylandNativeDisplayDelegate
        sets itself as an observer to a PrimaryOutput.
      - Once PrimaryOutput creates current display's snapshot and current mode
        , (WaylandNativeDisplayDelegate::)OnOutputReadyForUse is called,
        WaylandNativeDisplayDelegate notifies its observers (DesktopScreenOzone
        in this case) through OnConfigurationChanged method.
      - Then, DesktopScreenOzone calls NativeDisplayDelegate::GetDisplays,
        which returns a vector of display snapshots through a callback, and
        DesktopScreenOzone::OnHostDisplaysReady creates a display::Display
        with parameters it gets from display::DisplaySnapshot.
    
    Preliminary support for mode changes has also been added. If we take a
    normal run-time browser flow, WaylandOutput::OutputHandleMode can be
    called on every display change (it can be a resolution change, a refresh rate
    change and etc). Once |current_mode_| is updated, OnOutputReadyForUse is
    again called and DesktopScreenOzone fetches the newest list of displays,
    which is then used to create a display::Display with the ids provided.
    As a result, ProcessDisplayChanged is called and stored display::Display
    updated by checking its id.
    
    Note: it's impossible to run Wayland without --in-process-gpu flag
    as long as support for gpu process communication with wayland
    connection is not in place yet, but it's under development and
    going to be pushed soon.
    
    To try this, compile with the following gn args
    use_ozone = true
    ozone_platform_wayland = true
    
    TEST=./out/Debug/chrome --ozone-platform=wayland --in-process-gpu
    
    Bug: 578890
    Change-Id: Ia0f61f1af24eeb46433d22cf31f69396325e4c78
    Reviewed-on: https://chromium-review.googlesource.com/1051829Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
    Reviewed-by: default avatarScott Violet <sky@chromium.org>
    Commit-Queue: Maksim Sisov <msisov@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#559446}
    b81d0e7f
desktop_screen_ozone.cc 2.02 KB