Bug 319563

Summary: OverrideRedirect windows blink when resized
Product: [Plasma] kwin Reporter: Aurelien Gateau <agateau>
Component: compositingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.11
Sentry Crash Report:

Description Aurelien Gateau 2013-05-09 09:02:48 UTC
When compositing is enabled, OverrideRedirect windows blink when they are resized.

This can be reproduced with Colibri. Build kde:colibri from master, then run tests/append.sh.

Reproducible: Always
Comment 1 Martin Flöser 2013-05-09 09:20:07 UTC
When the failing resize happens I can see the following debug output for KWin:

kwin(6595) KWin::Toplevel::createWindowPixmap: Creating window pixmap failed:  
'ID: 25166855 '
Comment 2 Martin Flöser 2013-05-09 10:45:36 UTC
Short analysis of what's going on:

1. Window gets resized
2. KWin discards the existing pixmap and schedules a repaint
3. during next repaint a new pixmap is created for the window
4. between creating pixmap and checking the size of the window, the window got 
resized again (due to ongoing animation)
5. KWin discards the created pixmap
6. Frame gets rendered but there is no pixmap -> flicker

Way to fix it: keep the old pixmap around till a new one is created. Wanted to 
do something like that anyway to have proper cross-fading in the maximize 
window effect.
Comment 3 Martin Flöser 2013-06-05 06:21:12 UTC
Git commit 4824527bcc467f98f7abd8f7eb9ea46b5f3cbf1a by Martin Gräßlin.
Committed on 10/05/2013 at 12:07.
Pushed by graesslin into branch 'master'.

New class to encapsulate a Window's Pixmap

The behavior for creating a pixmap for a window is moved from Toplevel
into a dedicated class WindowPixmap. Scene::Window holds a reference to
this class and creates a new WindowPixmap whenever the pixmap needs to be
discarded. In addition it also keeps the old WindowPixmap around for the
case that creating the new pixmap fails. The compositor can in that case
use the previous pixmap which reduces possible flickering. Also this
referencing can be used to improve transition effects like the maximize
windows effect which would benefit from starting with the old pixmap.

For XRender and OpenGL a dedicated sub-class of the WindowPixmap is
created which provides the additional mapping to an XRender picture and
OpenGL texture respectively.
FIXED-IN: 4.11
REVIEW: 110577

M  +0    -35   kwin/composite.cpp
M  +79   -0    kwin/scene.cpp
M  +151  -1    kwin/scene.h
M  +59   -64   kwin/scene_opengl.cpp
M  +19   -5    kwin/scene_opengl.h
M  +42   -31   kwin/scene_xrender.cpp
M  +20   -3    kwin/scene_xrender.h
M  +0    -6    kwin/toplevel.cpp
M  +0    -10   kwin/toplevel.h

http://commits.kde.org/kde-workspace/4824527bcc467f98f7abd8f7eb9ea46b5f3cbf1a