Bug 428439

Summary: Window minimization animation is glitchy if playing a video on another (rotated) monitor
Product: [Plasma] kwin Reporter: Vlad Zahorodnii <vlad.zahorodnii>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.21
Attachments: on the video, the right part of konsole window is flickering

Description Vlad Zahorodnii 2020-10-29 15:57:23 UTC
Created attachment 132866 [details]
on the video, the right part of konsole window is flickering

STEPS TO REPRODUCE
1. Play a youtube video on a rotated monitor 
2. Minimize Konsole on another monitor

OBSERVED RESULT
Sometimes there is a ghost flickering konsole window.

EXPECTED RESULT
No glitches.
Comment 1 Vlad Zahorodnii 2020-10-29 16:52:22 UTC
Edit: it seems like this bug can be reproduced even if you just try to minimize konsole along with running weston-simple-egl. It doesn't matter if they are on the same screen.
Comment 2 Bug Janitor Service 2020-10-29 19:07:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/401
Comment 3 Vlad Zahorodnii 2020-10-30 07:24:17 UTC
Git commit 74391e250e9d744c9b8a95bc2f3806bb64b51a7e by Vlad Zahorodnii.
Committed on 30/10/2020 at 07:24.
Pushed by vladz into branch 'master'.

Store repaint regions per individual screen

AnimationEffect schedules repaints in postPaintWindow() and performs
cleanup in preScreenPaint(). With the X11-style rendering, this doesn't
have any issues, scheduled repaints will be reset during the next
compositing cycle.

But with per screen rendering, we might hit the following case

    - Paint screen 0
    - Reset scheduled repaints
    - AnimationEffect::prePaintScreen(): update the timeline
    - AnimationEffect::postPaintScreen(): schedule a repaint

    - Paint screen 1
    - Reset scheduled repaints
    - AnimationEffect::prePaintScreen(): destroy the animation
    - AnimationEffect::postPaintScreen(): no repaint is scheduled

    - Return to the event loop

In this scenario, the repaint region scheduled by AnimationEffect will
be lost when compositing is performed on screen 1.

There is no any other way to fix this issue but maintain repaint regions
per each individual screen if per screen rendering is enabled.

M  +5    -5    composite.cpp
M  +0    -5    deleted.cpp
M  +4    -0    plugins/scenes/opengl/scene_opengl.cpp
M  +3    -0    plugins/scenes/qpainter/scene_qpainter.cpp
M  +1    -0    plugins/scenes/xrender/scene_xrender.cpp
M  +84   -6    scene.cpp
M  +14   -0    scene.h
M  +26   -37   toplevel.cpp
M  +1    -9    toplevel.h
M  +1    -1    unmanaged.cpp
M  +1    -1    x11client.cpp
M  +1    -1    xdgshellclient.cpp

https://invent.kde.org/plasma/kwin/commit/74391e250e9d744c9b8a95bc2f3806bb64b51a7e