Bug 509924

Summary: High CPU usage in kwin_wayland while Firefox is open due to KWin::SubSurfaceInterface::parentApplyState()
Product: [Plasma] kwin Reporter: Jure Repinc <jlp>
Component: performanceAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: leo, nate, xaver.hugl
Priority: NOR Keywords: efficiency-and-performance
Version First Reported In: 6.4.5   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: perf data
flamegraph SVG

Description Jure Repinc 2025-09-25 12:30:44 UTC
Created attachment 185247 [details]
perf data

SUMMARY
While I have Firefox web browser open I can see high CPU usage (about 35% of one core of AMD Ryzen 7 7840HS) in kwin_wayland process even when I don't do anything in Firefox (e.g. no video is playing and nothing unusual shows up in about:processes) and it is in the background. I have a lot of tabs open in several windows of Firefox. I tried to close all windows but one and have not yet managed to find out if some specific tab in the last open window is causing this. I have profiled the kwin_wayland process with perf, the profile info is attached.

STEPS TO REPRODUCE
1. Have Firefox wit a lot of tabs/windows open
2. Observe CPU usage of kwin_wayland

OBSERVED RESULT
CPU usage is quite high (about 35 % of single CPU core)

EXPECTED RESULT
CPU usage should be much lower when not doing anything in Firefox.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20250923
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.2
Kernel Version: 6.16.8-1-default (64-bit)
Graphics Platform: Wayland
Wayland version: 1.24.0
Firefox version: 143.0.1
Mesa version: 25.2.2
Processors: 16 × AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
Memory: 32 GiB of RAM (30.7 GiB usable)
Graphics Processor: AMD Radeon 780M
Manufacturer: SLIMBOOK
Product Name: EXCALIBUR-16-AMD7
Comment 1 Zamundaaa 2025-09-25 13:16:35 UTC
Perf data is not portable, you have to look at it yourself. You can use hotspot to generate a flamegraph for it, if there's anything specific, it should immediately stand out in the image.

It is somewhat likely that Firefox is constantly requesting repaints though, we had that issue in the past. Does the CPU usage go away if you minimize the window?
Comment 2 Jure Repinc 2025-09-25 13:46:13 UTC
Created attachment 185258 [details]
flamegraph SVG
Comment 3 Jure Repinc 2025-09-25 13:47:32 UTC
I attached the flamegraph exported as SVG.

And indeed when I minimize all Firefox windows the CPU usage drops to almost 0 %
Comment 4 Nate Graham 2025-09-25 15:46:10 UTC
Looks like it's mostly in KWin::SubSurfaceInterface::parentApplyState()
Comment 5 Zamundaaa 2025-09-26 14:35:42 UTC
Yeah, that means Firefox is doing a huge amount of commits, and more specifically setting the subsurface position every time. Please report this to Mozilla.
Comment 6 leo 2025-12-08 00:44:48 UTC
*** Bug 513066 has been marked as a duplicate of this bug. ***