Bug 511010

Summary: Video playback causes graphical corruption on panel applets
Product: [Plasma] kwin Reporter: Jakub Veselý <jakub.vesely2>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: nate, niccolo.venerandi, serdarthtux, xaver.hugl
Priority: NOR    
Version First Reported In: 6.4.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Example of graphical corruption on the panel

Description Jakub Veselý 2025-10-24 10:41:51 UTC
SUMMARY
While playing back a video (reproduced both in Firefox on YouTube and in mpv playing local 1080p BD rip), graphical corruption (flickering squares of whatever is behind the panel) can be observed on at least task manager applet and system tray applet. The video being played has to be visible on the screen. 

STEPS TO REPRODUCE
1. Open Firefox
2. Navigate to YouTube
3. Play any video
4. Optionally either move cursor over the task bar or scroll in the Firefox window to more reliably trigger the corruption. However I have observed it even when not doing this.

OBSERVED RESULT
Corrupted graphics flickering over task manager applet

EXPECTED RESULT
No graphical corruption

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.5.0
KDE Frameworks Version: 6.19.0
Qt Version: 6.10.0
Kernel Version: 6.17.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Graphics Processor: NVIDIA GeForce RTX 4080 SUPER
Driver version: 580.95.5


ADDITIONAL INFORMATION
Most reliable reproduction is with Firefox. While playing a video in MPV the effect can occur, however the effect seemed to be much less pronounced and appeared less frequently. Issue occured at different scaling settings (including no scaling), different video HW acceleration settings and both with VRR enabled and disabled. The graphical corruption is not visible in screenshots or OBS screen recordings. The issue occurs even with KWin compositing set to QPainter. When using QPainter, the corrupted area seems to respond to another window approaching the panel and resizes based on the distance of the second window and its size. In this case the corrupted area is always rectangular and seems to only appear in the second half of the panel. Regardless of the compositing used, if another HW accelerated surface is under the panel (e.g. a Konsole window), the corruption seems to also spread to this surface. I could not reproduce this by overlaying other windows, only with the panel. Putting Dolphin under the panel did not cause any corruption to the Dolphin window. Issue is not new in 6.5, I can also reproduced it in 6.4.5.
Comment 1 Zamundaaa 2025-11-10 22:04:02 UTC
Please attach a video or image of the glitches. Also, does it go away if you disable damage tracking / buffer age? https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_use_buffer_age
Comment 2 Jakub Veselý 2025-11-10 22:25:49 UTC
With KWIN_USE_BUFFER_AGE=0 the glitching is much worse. It still only happens on YouTube, however it now also happens even with the video paused, just moving cursor around is enough. By much worse it effectively makes half of the panel flicker and disappear. The tray icons and time sometimes get rendered behind the panel texture, but most of the time, it is just the panel texture not being rendered at all and the wallpaper shows through the "holes". I will try to take a video tomorrow, it is not so easy to capture since the corruption does not show up on screenshots or OBS recordings.
Comment 3 Zamundaaa 2025-11-10 23:48:27 UTC
Git commit 5ca05f8fd822b35012ad92f425dd8556f56ad809 by Xaver Hugl.
Committed on 10/11/2025 at 23:09.
Pushed by zamundaaa into branch 'master'.

backends/drm: add environment variables to debug potential synchronization issues

Specifically, KWIN_DRM_FORCE_GL_FINISH_MGPU_COPY, to force glFinish before doing
multi GPU copies, and KWIN_DRM_FORCE_GL_FINISH_PRESENT to force glFinish before
presenting a buffer to the screen.
Related: bug 511728

M  +7    -4    src/backends/drm/drm_egl_layer_surface.cpp

https://invent.kde.org/plasma/kwin/-/commit/5ca05f8fd822b35012ad92f425dd8556f56ad809
Comment 4 Bug Janitor Service 2025-11-11 01:29:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8406
Comment 5 Zamundaaa 2025-11-11 01:54:54 UTC
Git commit b3725f628d6daca2d1853a0a0b74753321af358c by Xaver Hugl.
Committed on 11/11/2025 at 01:29.
Pushed by zamundaaa into branch 'Plasma/6.5'.

backends/drm: add environment variables to debug potential synchronization issues

Specifically, KWIN_DRM_FORCE_GL_FINISH_MGPU_COPY, to force glFinish before doing
multi GPU copies, and KWIN_DRM_FORCE_GL_FINISH_PRESENT to force glFinish before
presenting a buffer to the screen.
Related: bug 511728


(cherry picked from commit 5ca05f8fd822b35012ad92f425dd8556f56ad809)

Co-authored-by: Xaver Hugl <xaver.hugl@kde.org>

M  +7    -4    src/backends/drm/drm_egl_layer_surface.cpp

https://invent.kde.org/plasma/kwin/-/commit/b3725f628d6daca2d1853a0a0b74753321af358c
Comment 6 Jakub Veselý 2025-11-11 17:22:36 UTC
Created attachment 186706 [details]
Example of graphical corruption on the panel

See the provided picture for an example of the graphical corruption. This specific example is with the damage tracking disabled. I have a video file which shows more of the behaviour, but it is too large to upload.
Comment 7 Jakub Veselý 2025-11-15 18:06:41 UTC
(In reply to Zamundaaa from comment #5)
> Git commit b3725f628d6daca2d1853a0a0b74753321af358c by Xaver Hugl.
> Committed on 11/11/2025 at 01:29.
> Pushed by zamundaaa into branch 'Plasma/6.5'.
> 
> backends/drm: add environment variables to debug potential synchronization
> issues
> 
> Specifically, KWIN_DRM_FORCE_GL_FINISH_MGPU_COPY, to force glFinish before
> doing
> multi GPU copies, and KWIN_DRM_FORCE_GL_FINISH_PRESENT to force glFinish
> before
> presenting a buffer to the screen.
> Related: bug 511728
> 
> 
> (cherry picked from commit 5ca05f8fd822b35012ad92f425dd8556f56ad809)
> 
> Co-authored-by: Xaver Hugl <xaver.hugl@kde.org>
> 
> M  +7    -4    src/backends/drm/drm_egl_layer_surface.cpp
> 
> https://invent.kde.org/plasma/kwin/-/commit/
> b3725f628d6daca2d1853a0a0b74753321af358c

I've tried building Plasma from the master branch and setting the mentioned environment variables. The corruption still occurs.
Comment 8 Jakub Veselý 2025-11-22 17:06:56 UTC
I've managed to prevent the glitching from appearing. It seems that it only occurs when the refresh rate of the monitor is set to its native 240Hz. Lowering to 120Hz is enough to prevent it from appearing. Adaptive sync still setting still has no impact.