https://bugs.kde.org/show_bug.cgi?id=528903

            Bug ID: 528903
           Summary: Stutter that builds up over session: KWin spends heavy
                    CPU time recreating EglSwapchains in
                    Compositor::setupLayers (amdgpu, multi-monitor)
    Classification: Plasma
           Product: kwin
      Version First unspecified
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: performance
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 198515
  --> https://bugs.kde.org/attachment.cgi?id=198515&action=edit
supportInformation

SUMMARY
Since upgrading to KWin 6.8, the desktop develops stutter that gets worse
over the course of a session. A few hours after login, moving the cursor
between monitors or hovering task manager icons (with window previews)
causes visible stutter. While it stutters, kwin_wayland's CPU usage goes up
sharply while CPU usage of applications and GPU (GFX) usage drop, so KWin
appears to be stalling on CPU work rather than the GPU being overloaded.

Logging out and back in makes it go away until it builds up again.
A reboot is not needed.

STEPS TO REPRODUCE
1. Log in to a Plasma Wayland session with two monitors (details below).
2. Use the desktop normally for a few hours (browser, Discord, etc.).
3. Move the cursor back and forth between monitors, or hover task manager
   icons so window previews appear.

OBSERVED RESULT
Stutter of the cursor and the whole desktop. kwin_wayland CPU usage spikes,
GPU usage drops (e.g. from ~55% to ~5-10% while a game is running).

EXPECTED RESULT
Smooth cursor movement and popups, like right after login.

PROFILING
perf record -g on kwin_wayland while triggering the stutter. The largest
single cost (~10% of KWin's samples) is:

  KWin::Compositor::composite
  -> KWin::Compositor::setupLayers
  -> KWin::EglSwapchain::create
  -> dri2_destroy_image
  -> pipe_resource_destroy
  -> amdgpu_va_range_free

So KWin seems to be (re)creating swapchains for output layers during
compositing, and freeing the old buffers is expensive. Full flat profile
attached (kwin-perf-flat.txt).

WHAT I TESTED (none fixed it)
- Matching refresh rates (DP-1 lowered to 143.97 Hz) - stutter still builds up.
  (Similar to bug 527668, but matching refresh rates does not help here.)
- KWIN_FORCE_SW_CURSOR=1 - no lasting improvement.
- Disabling "Allow tearing in fullscreen windows" - no change.
- Disabling the iGPU in BIOS - no change.
- Kernel 7.2.11 / 7.2.14 / 7.2.15 - no difference.
- Removing KWIN_WAYLAND_SUPPORT_XX_SESSION_MANAGER - no change.
- No third-party KWin effects or scripts installed.
- VRAM is not filling up; no suspend/resume needed to trigger it.
- KWIN_DRM_NO_AMS=1 causes graphical glitches, so could not be tested.

Disabling task manager window previews stops the stutter on taskbar hover,
but moving the cursor between monitors still triggers it.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.8.2
KDE Frameworks Version: 6.31.0
Qt Version: 6.12.0
Kernel Version: 7.3.4-arch1-2 (64-bit)
Graphics Platform: Wayland

HARDWARE
- GPU: AMD Radeon RX 7600 (navi33), both monitors connected to it
- CPU: Ryzen 7 7700 (iGPU enabled, no monitors attached)
- Intel Arc A380 installed, driver not loaded
- DP-1: 2560x1440 @ 300 Hz, adaptive sync off
- DP-2: 1080x1920 (portrait) @ 144 Hz, adaptive sync incapable
- Scale 1 on both

ADDITIONAL INFORMATION
supportInformation attached (kwin-support.txt).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to