Bug 431954

Summary: KWin OpenGL acceleration causes flickering and stale content
Product: [Plasma] kwin Reporter: CarlosE <carana2099>
Component: compositingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate, s.kde
Priority: NOR    
Version First Reported In: 5.20.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description CarlosE 2021-01-22 19:49:30 UTC
SUMMARY
Using OpenGL hardware accelaration with vsync on KWin causes programs to flicker and render stale content.

STEPS TO REPRODUCE
1. Choose OpenGL as render infrastructure
2. Set Tearing Prevention to something other than none.
3. Enable compositing.
3. Open programs that have large sections that need constant repainting (such as fast scrolling (sideways and vertically) in Okular, tabbing in a terminal, or blinking carets.

OBSERVED RESULT
KWin will render stale content (flicker between the current frame and a stale frame from a few miliseconds prior) and cause vertical screen tearing. This is especially noticeable in Okular (when scrolling fast), LibreOffice and Konsole (when the caret blinks).

It is absent when compositing is disabled, in screen recordings via Xcomposite, and when vsync is forced via _GL_SYNC_TO_VBLANK (when Tearing Prevention is set to Never).

EXPECTED RESULT
KWin should the current window content without the need to disable compositing or using Mesa environment variables.

SOFTWARE/OS VERSIONS 
Operating System: Arch Linux
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.7-111-tkg-pds
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-8565U CPU @ 1.80GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Comment 1 CarlosE 2021-01-27 22:39:51 UTC
After more testing, the bug seems to be absent after when using xf86-video-intel.

In fact, there is now tearing in the Xorg modesetting driver (when compositing is disabled) that didn't use to be there. I don't know how to debug this issue, but I'm starting to suspect the modesetting driver, rather than KWin, is the culprit.
Comment 2 CarlosE 2021-03-20 00:01:54 UTC
Seems to be fixed in Plasma 5.21.