• Michel Dänzer's avatar
    present/wnmd: Execute copies at target_msc-1 already · c3e4c1a0
    Michel Dänzer authored
    It always takes one update cycle for the copy to become visible on the
    host windowing system, so waiting for the target MSC resulted in 1 cycle
    delay.
    
    We re-use the idle list for copies which were executed but need their
    completion event sent.
    
    Fixes black seams when resizing the "Builder" sub-window of
    
     GDK_BACKEND=x11 gtk4-demo
    
    on Xwayland (see
    https://gitlab.gnome.org/GNOME/mutter/-/issues/1290#note_873557).
    
    Unfortunately, this cannot completely fix the seams with apps which
    queue up multiple frames in advance, since there's always at least one
    queued frame corresponding to the old window size. But it should at
    least help a little in that case as well.
    
    v2:
    * Bug fix: Don't update exec_msc in present_wnmd_check_flip_window.
      (Roman Gilg)
    * Use exec_msc = target_msc - 1 instead of exec_msc--, and add a
      comment, for clarity.
    v3:
    * Drop exec_msc = target_msc again in present_wnmd_execute.
    * present_execute_copy should never set vblank->queued in
      present_wnmd_execute now, so replace that branch with an assertion.
      (Roman Gilg)
    Reviewed-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
    Tested-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
    (cherry picked from commit 1cccb486)
    [Since present_wnmd_event_notify hasn't been split up on the 1.20
    branch, it needs to check vblank->flip. Doing the same in
    present_wnmd_free_idle_vblanks to be safe, though I'm not sure it's
    actually possible to hit non-flips there.]
    c3e4c1a0
present_wnmd.c 23.7 KB