Bug 387313 - Subsurfaces are not clipped
Summary: Subsurfaces are not clipped
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.18.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Vlad Zahorodnii
URL: https://phabricator.kde.org/D29131
Keywords: wayland
: 385678 388837 389053 402241 403311 410729 418455 419797 421655 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-26 11:31 UTC by Rainer Finke
Modified: 2020-08-12 14:03 UTC (History)
29 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.19.0
mgraesslin: Wayland+
mgraesslin: X11-
vlad.zahorodnii: ReviewRequest+


Attachments
plasma 5.14.2, Arch Linux (308.57 KB, video/webm)
2018-10-28 22:12 UTC, Patrick Silva
Details
eye-candy flickering (997.11 KB, image/jpeg)
2019-01-13 14:32 UTC, Vlad Zahorodnii
Details
kmail wayland log (314.29 KB, text/x-log)
2020-08-12 14:03 UTC, Roman Zimmermann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Finke 2017-11-26 11:31:22 UTC
Even after the fix mentioned in this bug report https://bugs.kde.org/show_bug.cgi?id=385924, I still have flickering issues with Kmail on Wayland in the following cases:
1.) Open fullscreen Kmail and move the mouse up and down in the menu e.g. in Files => flickering of the menu window
2.) Open fullscreen Kmail and then afterwards another fullscreen application e.g. Kate. Then either move the mouse e.g. into certain areas of the plasma panel or near the close button (not always the same), or just open in Kate e.g. the Files menu then you will see Kmail instead of Kate. => flickering and wrong application surface

Plasma 5.11.3
KDE Frameworks 5.40
KDE Applications 17.11.80
Qt 5.10 beta 4 (compiled with 5.9.2)
Arch Linux 4.14
Mesa-git on AMD GPU

For reference I opened some time ago the bug https://bugs.kde.org/show_bug.cgi?id=385678, but I didn't get a response.
Comment 1 Martin Flöser 2017-11-26 14:18:37 UTC
Please provide the output of:
qdbus org.kde.KWin /KWin supportInformation

I will probably ask for more information once I have a better idea what could cause this. In all the testing I did on my system I was no longer able to reproduce it. So I need to try figuring out where the difference is.

Just to make sure: with fullscreen you mean maximized, right?
Comment 2 Rainer Finke 2017-11-27 19:32:05 UTC
Please find below the requested information. If you need anything else, let me know! Yes, by fullscreen I meant maximized window, sorry. This triggers the flickering more obvious.

$ qdbus org.kde.KWin /KWin supportInformation
KWin-Unterstützungsinformationen:
Benutzen Sie die folgenden Informationen, wenn Sie nach Unterstützung fragen, z. B. auf http://forum.kde.org.
Sie enthalten Informationen über die momentan laufende Instanz, welche Optionen verwendet werden,
welcher OpenGL-Treiber verwendet wird und welche Effekte laufen.
Bitte geben Sie die unten stehenden Informationen bei einem Pastebin-Dienst wie http://paste.kde.org ein, anstatt sie direkt in die Hilfediskussionen zu schreiben.

==========================

Version
=======
KWin version: 5.11.3
Qt Version: 5.10.0
Qt compile version: 5.10.0
XCB compile version: 1.12

Operation Mode: Xwayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes                                                                                                                                                                                       
KWIN_BUILD_TABBOX: yes                                                                                                                                                                                            
KWIN_BUILD_ACTIVITIES: yes                                                                                                                                                                                        
HAVE_INPUT: yes                                                                                                                                                                                                   
HAVE_DRM: yes                                                                                                                                                                                                     
HAVE_GBM: yes                                                                                                                                                                                                     
HAVE_X11_XCB: yes                                                                                                                                                                                                 
HAVE_EPOXY_GLX: yes                                                                                                                                                                                               
HAVE_WAYLAND_EGL: yes                                                                                                                                                                                             
                                                                                                                                                                                                                  
X11                                                                                                                                                                                                               
===                                                                                                                                                                                                               
Vendor: The X.Org Foundation
Vendor Release: 11905000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Blur: 0
onAllDesktopsAvailable: false
alphaChannelSupported: true
closeOnDoubleClickOnMenu: true
decorationButtonsLeft: 0, 2
decorationButtonsRight: 3, 4, 5
borderSize: 3
gridUnit: 12
font: Noto Sans,10,-1,5,50,0,0,0,0,0,Regular
smallSpacing: 3
largeSpacing: 12

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
glSmoothScale: 2
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: false
glStrictBindingFollowsDriver: true
glCoreProfile: true
glPreferBufferSwap: 101
glPlatformInterface: 2
windowsBlockCompositing: true

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 1
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  no
Number of Screens: 1

Screen 0:
---------
Name: SAM DP-3-U28D590
Geometry: 0,0,3840x2160
Refresh Rate: 59.997


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.23.0 / 4.15.0-rc1-g516fb7f2e73d, LLVM 6.0.0)
OpenGL version string: 4.5 (Core Profile) Mesa 17.4.0-devel (git-b6b4b2c6d8)
OpenGL platform interface: EGL
OpenGL shading language version string: 4.50
Driver: Unknown
GPU class: Unknown
OpenGL version: 4.5
GLSL version: 4.50
Mesa version: 17.4
Linux kernel version: 4.15
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
kwin4_effect_dialogparent
kwin4_effect_fade
kwin4_effect_frozenapp
kwin4_effect_login
kwin4_effect_logout
kwin4_effect_maximize
kwin4_effect_morphingpopups
kwin4_effect_translucency
kwin4_effect_windowaperture
slidingpopups
slide
screenshot
minimizeanimation
desktopgrid
colorpicker
presentwindows
highlightwindow
blur
contrast
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
kwin4_effect_dialogparent:

kwin4_effect_fade:

kwin4_effect_frozenapp:

kwin4_effect_login:

kwin4_effect_logout:

kwin4_effect_maximize:

kwin4_effect_morphingpopups:

kwin4_effect_translucency:

kwin4_effect_windowaperture:

slidingpopups:
fadeInTime: 75
fadeOutTime: 125

slide:

screenshot:

minimizeanimation:

desktopgrid:
zoomDuration: 150
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

colorpicker:

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 75
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

highlightwindow:

blur:
blurRadius: 12
cacheTexture: true

contrast:

startupfeedback:
type: 1

screenedge:

kscreen:




$ kmail
Using Wayland-EGL
Pass a valid window to KWallet::Wallet::openWallet().                                                                                                                                                             
Error loading text-to-speech plug-in "speechd"                                                                                                                                                                    
WebEngine compiled with X11 support, however qpa backend is not xcb. This may fail.                                                                                                                               
[1127/200750.064690:WARNING:stack_trace_posix.cc(648)] Failed to open file: /home/rainer/#613789 (deleted)                                                                                                        
  Error: Datei oder Verzeichnis nicht gefunden                                                                                                                                                                    
Using the 'wl-shell' shell integration
Comment 3 Martin Flöser 2017-11-27 20:07:32 UTC
I see a difference to my system: kmail is using wl_shell, while on my system it is already xdg_shell.
Comment 4 Rainer Finke 2017-11-27 21:26:01 UTC
What do I need for the new xdg_shell support? I did compile kwin and KDE frameworks from git. Is this enough already?
Comment 5 Martin Flöser 2017-11-28 05:39:55 UTC
Yeah, it is in git master
Comment 6 Rainer Finke 2017-11-28 06:36:44 UTC
Oh yes, the new xdg_shell works. I can run libreoffice and Virt-Manager including keyboard input in a VM on Wayland, awesome!!! :-)

Back to the topic, unfortunately kmail is still the application triggering the flickering in a maximized window, if another application is on top, most obvious when scrolling in another application like in Kate in the Files menu.


$ kmail
Using Wayland-EGL
Pass a valid window to KWallet::Wallet::openWallet().
Error loading text-to-speech plug-in "speechd"
WebEngine compiled with X11 support, however qpa backend is not xcb. This may fail.
[1128/072341.092714:WARNING:stack_trace_posix.cc(648)] Failed to open file: /home/rainer/#148529 (deleted)
  Error: Datei oder Verzeichnis nicht gefunden
Using the 'xdg-shell-v6' shell integration


$ qdbus org.kde.KWin /KWin supportInformation
KWin Support Information:
The following information should be used when requesting support on e.g. http://forum.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like http://paste.kde.org instead of pasting into support threads.

==========================

Version
=======
KWin version: 5.11.90
Qt Version: 5.10.0
Qt compile version: 5.10.0
XCB compile version: 1.12

Operation Mode: Xwayland

Build Options
=============                                                                                                                                                                                                     
KWIN_BUILD_DECORATIONS: yes                                                                                                                                                                                       
KWIN_BUILD_TABBOX: yes                                                                                                                                                                                            
KWIN_BUILD_ACTIVITIES: yes                                                                                                                                                                                        
HAVE_INPUT: yes                                                                                                                                                                                                   
HAVE_DRM: yes                                                                                                                                                                                                     
HAVE_GBM: yes                                                                                                                                                                                                     
HAVE_X11_XCB: yes                                                                                                                                                                                                 
HAVE_EPOXY_GLX: yes                                                                                                                                                                                               
HAVE_WAYLAND_EGL: yes                                                                                                                                                                                             
                                                                                                                                                                                                                  
X11                                                                                                                                                                                                               
===
Vendor: The X.Org Foundation
Vendor Release: 11905000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Blur: 0
onAllDesktopsAvailable: false
alphaChannelSupported: true
closeOnDoubleClickOnMenu: true
decorationButtonsLeft: 0, 2
decorationButtonsRight: 3, 4, 5
borderSize: 3
gridUnit: 12
font: Noto Sans,10,-1,5,50,0,0,0,0,0,Regular
smallSpacing: 3
largeSpacing: 12

Platform
==========
Name: DRM
Active: true
Atomic Mode Setting: true

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
glSmoothScale: 2
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: false
glStrictBindingFollowsDriver: true
glCoreProfile: true
glPreferBufferSwap: 101
glPlatformInterface: 2
windowsBlockCompositing: true

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 1
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  no
Number of Screens: 1

Screen 0:
---------
Name: SAM DP-3-U28D590
Geometry: 0,0,3840x2160
Scale: 1
Refresh Rate: 59.997


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.23.0 / 4.15.0-rc1-g516fb7f2e73d, LLVM 6.0.0)
OpenGL version string: 4.5 (Core Profile) Mesa 17.4.0-devel (git-b6b4b2c6d8)
OpenGL platform interface: EGL
OpenGL shading language version string: 4.50
Driver: Unknown
GPU class: Unknown
OpenGL version: 4.5
GLSL version: 4.50
Mesa version: 17.4
Linux kernel version: 4.15
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
kwin4_effect_dialogparent
kwin4_effect_fade
kwin4_effect_frozenapp
kwin4_effect_login
kwin4_effect_logout
kwin4_effect_maximize
kwin4_effect_morphingpopups
kwin4_effect_translucency
kwin4_effect_windowaperture
slidingpopups
slide
screenshot
minimizeanimation
desktopgrid
colorpicker
presentwindows
highlightwindow
blur
contrast
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
kwin4_effect_dialogparent:

kwin4_effect_fade:

kwin4_effect_frozenapp:

kwin4_effect_login:

kwin4_effect_logout:

kwin4_effect_maximize:

kwin4_effect_morphingpopups:

kwin4_effect_translucency:

kwin4_effect_windowaperture:

slidingpopups:
fadeInTime: 75
fadeOutTime: 125

slide:

screenshot:

minimizeanimation:

desktopgrid:
zoomDuration: 150
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

colorpicker:

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 75
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

highlightwindow:

blur:
blurRadius: 12
cacheTexture: true

contrast:

startupfeedback:
type: 1

screenedge:

kscreen:
Comment 7 tromzy 2017-11-28 14:51:52 UTC
I'm affected by this bug too. I can add that Kmail is not the only application that provocks this glitch : Akregator does too.

Plasma 5.11.3
KDE Frameworks 5.40
KDE Applications 17.08
Qt 5.9.3
Arch Linux 4.14
Mesa 17.2.6 on Intel Modesetting (HD4000)
Comment 8 Rainer Finke 2017-12-10 18:53:55 UTC
*** Bug 385678 has been marked as a duplicate of this bug. ***
Comment 9 Rainer Finke 2017-12-18 15:34:52 UTC
I found another application, that is creating the same flickering. 
1.) Open systemsettings as a maximized window
2.) Go to "Display and Screen" and then either to the "Display" or the "Compositor" section
2.) Open e.g. konsole as a maximized window on top of it (do not minimize systemstettings)
3.) Scroll through the "File" menu in konsole
=> Now the screen will flicker and systemsettings draws like it would be the application on top.
Comment 10 Michael D 2018-01-10 02:14:33 UTC
I can reproduce the bug (including as in comment 9) in KDE Neon User Edition (Plasma 5.11.5, Frameworks 5.41.0) on Intel Broadwell hardware and mesa 17.2.4. It's really nasty!
Comment 11 Martin Flöser 2018-01-12 15:30:27 UTC
*** Bug 388837 has been marked as a duplicate of this bug. ***
Comment 12 Martin Flöser 2018-01-15 16:21:36 UTC
I got some findings based on comment #9. Instead of using konsole I tried with kwrite and observed the same flickering if kwrite is started with platform wayland, but no flickering if started with platform xcb.

Through the KWin debug console I investigated the difference of those two kwrites and observed that the Wayland variant uses RGBA (for whatever reason), while the X11 variant uses RGB.

That the flickering is related to use of transparency makes sense in the context of the bug fix I already did.

So overall I'm slightly optimistic to now being able to find the actual issue.
Comment 13 Rainer Finke 2018-01-16 19:25:56 UTC
I did some fast testing with kwin-git on Arch Linux and KDE Frameworks 5.42. First, I didn't compile any other packages, so I might have missed another required change, if yes please let me know.
I still get the flickering. I just have to open Kmail maximized and move the mouse  up and down in the "Files" menu, it either disappears or is flickering. I tested as well with an application on top like Kwrite, but this also didn't really change.
Comment 14 Rainer Finke 2018-01-17 20:46:28 UTC
The update to Plasma 5.12 beta didn't help either, flickering is still there on a Intel and AMD GPU. Do you see the same graphical glitches or do you need any futher information?
Comment 15 Martin Flöser 2018-01-18 05:23:44 UTC
I'm pretty sure I see the same. And I fear I won't have the time to fix it before 5.12 final release. But at least I have a very good idea of what goes wrong.
Comment 16 Patrick Silva 2018-01-18 20:27:40 UTC
I'm affected by this bug on Arch Linux running plasma 5.12 beta.
I have intel hd graphics, modesetting driver.
Comment 17 Rainer Finke 2018-01-19 13:51:54 UTC
As this is just a flickering, for me it is not critical and can wait after the Plasma 5.12 release. And I can work around the flickering by minimizing Kmail when not required or changing the size of the systemsettings window to get the updated content. Thanks
Comment 18 tromzy 2018-01-19 13:56:30 UTC
About minimizing Kmail : https://bugs.kde.org/show_bug.cgi?id=389143

And : https://bugs.kde.org/show_bug.cgi?id=387405
Comment 19 Rainer Finke 2018-01-19 14:53:51 UTC
@tromzy@free.fr: Both bug reports are not related to this one from my point of view. I'm a normal Arch Linux user as well and minimizing Kmail works for me with  Plasma 5.11 and 5.12 beta. I either close Kmail or I mimize to the panel.
Comment 20 Martin Flöser 2018-01-22 18:34:16 UTC
*** Bug 389053 has been marked as a duplicate of this bug. ***
Comment 21 Martin Flöser 2018-01-23 20:57:20 UTC
Adding some investigation results:
 * the observed flickering is "just" buffer age
 * on a multi-screen setup the issue can only be reproduced on the first screen (which has buffer age enabled)
 * the flickering frames are fine. E.g. for moving the cursor over a menu only the changed area is repainted. The flickering comes from the aged buffer
 * which means the root problem is that a buffer is painted with incorrect damage information

Why that is the case I couldn't figure out yet.
Comment 22 Rainer Finke 2018-04-19 21:56:29 UTC
With KDE Applications 18.04 I don't see the flickering in Kmail anymore, at least on my Intel notebook. Will test on my AMD machine and report if it works well.

Linux 4.16, Plasma 5.12.4, KDE Frameworks 5.45
Comment 23 tromzy 2018-04-20 15:20:51 UTC
I'm on Applications 18.04 and I don't seem to be affected by this bug anymore, either.
Comment 24 Rainer Finke 2018-04-21 10:56:55 UTC
My AMD systems don't show the flickering anymore. For me this bug is fixed with KDE Applications 18.04.
Comment 25 Martin Flöser 2018-04-21 15:50:38 UTC
I'm reopening. I don't doubt you that the symptoms are fixed, but this is a KWin bug. No change in KMail can fix it.
Comment 26 Rainer Finke 2018-04-21 16:13:35 UTC
I did my test on 3 systems now, 1 Intel and 2 AMD GPU's. I run Linux 4.16.3, Mesa 18.0.1, Qt 5.10.1, Plasma 5.12.4, KDE Frameworks 5.45 and KDE Applications 18.04.  Looking at the update log, Mesa was updated from 18.0 to 18.0.1 as well at the same time.
Comment 27 Rainer Finke 2018-04-21 16:37:31 UTC
The Mesa downgrade didn't change anything. So yes, somehow the symptoms are gone in the case of Kmail. Don't know if it is related, but in another scenario I can still reproduce a flickering in systemsettings https://bugs.kde.org/show_bug.cgi?id=391615.
Comment 28 Rainer Finke 2018-04-21 18:07:33 UTC
The only change that happened with KDE Applications 18.04 was that Kmail enforces the xcb backend. And by this it tricked me still believing it would run on Wayland as it did before. Sorry to bother you, but I didn't expect this as Plasma 5.12 declared Wayland as stable.
Comment 29 Patrick Silva 2018-09-16 01:58:58 UTC
in plasma 5.14 beta (Arch) I can reproduce the same flickering in window decoration kcm. Click "get new decoration" button, drag the window... enjoy flickering.
Comment 30 kde 2018-09-16 07:11:43 UTC
I also have the same problem with kmail, random flickering and it's nearly always the case when I open a new window inside kmail (file selector, email compositor...).
I'm using an intel integrated gpu. Happy to help if there is anything specific I can try.
Comment 31 tromzy 2018-09-21 07:24:42 UTC
The bug started again on my side, too. When I open a window inside Kmail (mostly "Compose new message"), I get insane flickering and graphics corruption. Setting the windows fullscreen seem to fix it though.
Comment 32 Shmerl 2018-10-15 23:54:09 UTC
I'm affected by this bug as well.

Kmail: 18.08.1
Kwin: 5.13.5
Comment 33 Shmerl 2018-10-28 21:50:11 UTC
(In reply to Patrick Silva from comment #29)
> in plasma 5.14 beta (Arch) I can reproduce the same flickering in window
> decoration kcm. Click "get new decoration" button, drag the window... enjoy
> flickering.

Did anyone test it with 5.14.2? Debian testing is still at 5.13.5. This so far is the biggest annoyance that prevents me from using Wayland Plasma session.
Comment 34 Patrick Silva 2018-10-28 22:12:50 UTC
Created attachment 115956 [details]
plasma 5.14.2, Arch Linux

Screencast showing Arch Linux running plasma 5.14.2, frameworks 5.51.
Comment 35 tromzy 2018-11-21 13:52:52 UTC
For the person who asked, it still occurs on Plasma 5.14.3.
Comment 36 Lemmiwinks 2018-11-23 23:02:51 UTC
I'm also affected. Intel Haswell Graphics

KMAIL 5.9.3 (18.08.3)

Operating System: KDE neon 5.14
KDE Plasma Version: 5.14.3
Qt Version: 5.11.2
KDE Frameworks Version: 5.52.0
Processors: 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz
Memory: 15,1 GiB of RAM
Comment 37 Shmerl 2018-12-05 04:04:51 UTC
Just tested it with Plasma 5.14.3 since it's now available in Debian. The issue is a bit less severe, but still plagues Kmail.
Comment 38 Vlad Zahorodnii 2019-01-11 15:56:16 UTC
One potential way to work around the bug:
* Disable buffer age: KWIN_USE_BUFFER_AGE=0 startplasmacompositor
* Select "Full screen repaints" in System Settings > Display and Monitor > Compositor > Tear prevention ("vsync")
Though it may cause performance issues.

Also, it seems like running KWin/Wayland without buffer age support causes lots of visual artifacts, unless you have full screen repaints.
Comment 39 Vlad Zahorodnii 2019-01-12 13:54:54 UTC
I did some investigation... It looks like this bug is caused by us not properly rendering subsurfaces.
Comment 40 Vlad Zahorodnii 2019-01-12 14:05:25 UTC
> not properly rendering subsurfaces.

In question. It's still not clear why the flickering occurs.
Comment 41 Vlad Zahorodnii 2019-01-13 14:32:10 UTC
Created attachment 117441 [details]
eye-candy flickering

Some further investigation... Apparently, sometimes we don't draw windows atop subsurfaces.
Comment 42 Vlad Zahorodnii 2019-01-15 10:18:53 UTC
Finally! I figured out. The problem is that we don't have quads for subsurfaces, thus https://phabricator.kde.org/source/kwin/browse/master/plugins/scenes/opengl/scene_opengl.cpp$1121-1144 won't be able to clip them when m_hardwareClipping is  false.
Comment 43 Shmerl 2019-01-15 12:13:25 UTC
(In reply to Vlad Zagorodniy from comment #42)
> https://phabricator.kde.org/source/kwin/browse/master/plugins/scenes/opengl/
> scene_opengl.cpp$1121-1144 won't be able to clip them when
> m_hardwareClipping is  false.

Do you have some patch to test a fix for this?
Comment 44 Vlad Zahorodnii 2019-01-15 12:15:22 UTC
(In reply to Shmerl from comment #43)
> Do you have some patch to test a fix for this?
No, the fix isn't that trivial.
Comment 45 Shmerl 2019-01-15 12:16:38 UTC
Good find, anyway! Hopefully this will be fixed soon.
Comment 46 Rainer Finke 2019-01-17 18:39:41 UTC
Is this fix already part of Plasma 5.15 beta?
Comment 47 Vlad Zahorodnii 2019-01-17 18:41:38 UTC
(In reply to Rainer Finke from comment #46)
> Is this fix already part of Plasma 5.15 beta?

I picked wrong verb. There is no currently any fix.
Comment 48 Rainer Finke 2019-01-17 19:08:39 UTC
Thanks for your answer! Ok, this explains than why I got a flickering when kmail is open as a non maximized window and I open kate as well as a non maximized window.
Comment 49 Shmerl 2019-01-17 19:20:04 UTC
(In reply to Rainer Finke from comment #48)
> Thanks for your answer! Ok, this explains than why I got a flickering when
> kmail is open as a non maximized window and I open kate as well as a non
> maximized window.

It happens with Kmail the most, but can happen with a few other programs as well.
Comment 50 Patrick Silva 2019-01-17 20:07:48 UTC
it also happens with gwenview when opengl animations are enabled in gwenview settings.
Comment 51 Patrick Silva 2019-01-23 11:10:44 UTC
*** Bug 402241 has been marked as a duplicate of this bug. ***
Comment 52 Rainer Finke 2019-02-13 22:41:15 UTC
I did upgrade to Plasma 5.15 and I wanted to review the changes in systemsettings, but the flickering and graphical corruptions make it sometimes impossible to use it or to work with other applications (if systemsettings is not fully minimized). With Kmail I have still smilar issues. This bugs lets Plasma on Wayland appear less stable than it actually is.

OS Arch Linux 
KDE-Plasma-Version: 5.15.0
KDE-Frameworks-Version: 5.55.0
Qt-Version: 5.12.1
Kernel-Version: 4.20.7-arch1-1-ARCH
Comment 53 Matej Mrenica 2019-02-16 13:00:15 UTC
*** Bug 403311 has been marked as a duplicate of this bug. ***
Comment 54 Shmerl 2019-02-24 19:38:00 UTC
(In reply to Vlad Zagorodniy from comment #47)
> 
> I picked wrong verb. There is no currently any fix.


Is it clear what needs fixing though or how to fix it, or so far it's not even known?
Comment 55 Martin Flöser 2019-02-25 05:09:25 UTC
See comment #42
Comment 56 Shmerl 2019-02-25 14:54:33 UTC
(In reply to Martin Flöser from comment #55)
> See comment #42

Does it require KWin redesign in some way, or the fix is just not trivial?
Comment 57 Martin Flöser 2019-02-25 16:59:33 UTC
Where does redesign start and non trivial end? Some would say it's a redesign, some would say it's just non trivial.
Comment 58 Shmerl 2019-02-25 17:08:44 UTC
Well, if it requires changing some taken approaches, that's redesign already.
Comment 59 Vlad Zahorodnii 2019-02-25 18:52:53 UTC
Current Scene abstractions are good enough on X11, but not on Wayland. This causes some troubles for us, e.g. KWin will redraw all subsurface tree if any subsurface is damaged, etc.

I think it won't be that hard to come up with new abstractions that would work for non-transformed windows. On the other hand, when effects like Wobbly Windows step in, things become a bit complex... :(

Anyway, Bugzilla isn't the best place to discuss such things.
Comment 60 Rainer Finke 2019-02-26 19:23:37 UTC
Yes, desktop effects like wobbling windows, magic lamp and desktop cube clearly show that the Wayland applications like systemsettings, Kmail and Firefox are not rendered correctly, so the flickering probably is just most obvious to a normal user.
Comment 61 Martin Flöser 2019-02-27 05:29:32 UTC
To add: scene was pretty much the first part of KWin adjusted for Wayland. This part was ported before sub surface protocol was added. Unfortunately sub surfaces change the assumption.

Vlad: an idea for a quick hack: trigger fullscreen repaints whenever there's a subsurface involved.
Comment 62 Vlad Zahorodnii 2019-02-27 09:49:15 UTC
Relevant discussion: https://phabricator.kde.org/T10530
Comment 63 Shmerl 2019-06-02 18:53:01 UTC
Is there any progress beyond the proposed approach?
Comment 64 Patrick Silva 2020-03-04 10:18:21 UTC
*** Bug 418455 has been marked as a duplicate of this bug. ***
Comment 65 Vlad Zahorodnii 2020-05-04 12:54:22 UTC
Git commit f2c8981f7e5fe9cd18a72888a2f199f483e8e983 by Vlad Zahorodnii.
Committed on 04/05/2020 at 12:36.
Pushed by vladz into branch 'master'.

[scene] Generate window quads for sub-surfaces

No window quads are generated for sub-surfaces right now. This leads to
issues with effects that operate on window quads, e.g. magic lamp and
wobbly windows. Furthermore, the OpenGL scene needs window quads to
properly clip windows during the rendering process.

The best way to render sub-surfaces would be with a little help from a
scene graph. Contrary to GNOME, KDE hasn't developed any scene graph
implementation that we could use in kwin. As a short term solution, this
change adjusts the scene to generate window quads.

Window quads are generated as we traverse the current window pixmap tree
in the depth-first search manner. In order to match a list of quads with
a particular WindowPixmap, we assign an id to each quad.
FIXED-IN: 5.19.0

Differential Revision: https://phabricator.kde.org/D29131

M  +159  -151  plugins/scenes/opengl/scene_opengl.cpp
M  +22   -12   plugins/scenes/opengl/scene_opengl.h
M  +99   -28   scene.cpp
M  +34   -0    scene.h

https://commits.kde.org/kwin/f2c8981f7e5fe9cd18a72888a2f199f483e8e983
Comment 66 Patrick Silva 2020-05-05 20:44:51 UTC
*** Bug 410729 has been marked as a duplicate of this bug. ***
Comment 67 Vlad Zahorodnii 2020-05-14 14:04:28 UTC
*** Bug 419797 has been marked as a duplicate of this bug. ***
Comment 68 Méven Car 2020-05-17 05:20:53 UTC
*** Bug 421655 has been marked as a duplicate of this bug. ***
Comment 69 Lemmiwinks 2020-05-22 17:01:01 UTC
Could this be backported to Plasma 5.18.6 ?
It is a very important fix for kde wayland usage which could then be included as an update to Kubuntu 20.04.
Comment 70 Vlad Zahorodnii 2020-05-22 18:13:47 UTC
(In reply to Lemmiwinks from comment #69)
> Could this be backported to Plasma 5.18.6 ?
> It is a very important fix for kde wayland usage which could then be
> included as an update to Kubuntu 20.04.

No, the fix can't be backported to 5.18 branch because it requires some changes in kwayland.
Comment 71 Shmerl 2020-07-26 21:24:47 UTC
I finally managed to run newer Plasma on Debian testing using this:

https://www.preining.info/blog/2020/07/kde-plasma-status-update-2020-07-04/

So now I have 5.19.3, so I tried Plasma session again. Kmail still behaves very badly, so I don't think this issue is fixed or I'm missing something.

Message pane in Kmail doesn't display anything for me and just flickers sometimes.
Comment 72 Shmerl 2020-07-26 21:27:01 UTC
(In reply to Shmerl from comment #71)
> So now I have 5.19.3, so I tried Plasma session again. Kmail still behaves

I meant Wayland session. I'm back to X11 for now, since Kmail was practically unusable.
Comment 73 Vlad Zahorodnii 2020-07-27 06:39:18 UTC
It might be some other subsurface-related issue.
Comment 74 Shmerl 2020-07-27 06:52:41 UTC
(In reply to Vlad Zahorodnii from comment #73)
> It might be some other subsurface-related issue.

Should I open another bug and do you need any data to narrow this down? You can try reproducing it, it happens pretty consistently for me.

Kmail version: 20.04.3.
Comment 75 Matej Mrenica 2020-07-27 06:57:09 UTC
There is also similar issue with Lokalize: https://bugs.kde.org/show_bug.cgi?id=424024
Comment 76 Vlad Zahorodnii 2020-07-27 07:12:12 UTC
(In reply to Shmerl from comment #74)
> Should I open another bug and do you need any data to narrow this down? You
> can try reproducing it, it happens pretty consistently for me.

Yes, please create a new bug report. It would be nice to have some WAYLAND_DEBUG output.
Comment 77 Roman Zimmermann 2020-08-12 14:03:47 UTC
Created attachment 130823 [details]
kmail wayland log

Here is a log from a quick kmail session.

Things I did during that time:
- I was trying to open emails in the message preview area (only flickering there).
- I navigated to a folder with new emails.
- Tried to scroll up to the new messages (more flickering)
- Then selected one of the new emails to view it (at least that’s what I think I did).