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

--- Comment #17 from Matt Meier <[email protected]> ---
I tracked this down on my machine, and I believe the cause is KWin's Sliding
popups effect, not Mesa or Qt.

Setup: Kubuntu 26.04, Plasma/KWin 6.6.6, Qt 6.10.2, Mesa 26.0.8, libwayland
1.24. Laptop with the desktop on the Intel iGPU, eDP-1 plus a DisplayPort
monitor. Lock screen on, screens power off after locking.

What happens, from a WAYLAND_DEBUG=client trace of plasmashell and the 6.6.6
source:

1. Each time the screens power off or back on while locked, the wl_output
globals are removed and re-added. plasmashell unmaps the panel (attach(nil) +
commit on its "dock" layer surface) and creates a new zwlr_layer_surface_v1 for
the same wl_surface on the new output.

2. KWin destroys the old LayerShellV1Window. The panel has org_kde_kwin_slide
set (location bottom), so SlidingPopupsEffect::slotWindowClosed() calls
slideOut(), which takes an EffectWindowDeletedRef and a visible ref on the
closed window. That keeps the closed window's item alive, and with it the
panel's last wl_buffer.

3. The slide-out timeline only advances in
SlidingPopupsEffect::prePaintWindow(). While the screen is locked,
WindowItem::computeVisibility() returns false for everything except the lock
screen and input method (the isScreenLocked() branch in scene/windowitem.cpp),
so the closed panel is never pre-painted, the timeline never moves, and the
animation never finishes.

4. So every output change while locked leaks one panel buffer. Mesa's EGL
Wayland surface has 4 color buffers. In my trace the panel surface held 4
attached, never-released buffers when the loop started (committed at
plasmashell startup and at the 3 output changes since), with zero
wl_buffer.release events for that surface. The next swap lands in
wait_for_free_buffer(), which calls wl_display_roundtrip_queue() until a buffer
comes back. That is the plasmashell ~100% / kwin_wayland ~55% here, and the
same stack as the cores in comment 13.

5. On unlock, screenLockingChanged triggers
SlidingPopupsEffect::stopAnimations(), which clears the animations and drops
the refs. That is why it stops as soon as the password is entered (also noted
in bug 513424 comment 7).

It also explains a pattern I saw every time: after a fresh plasmashell start,
the first lock + screens-off never spins and the second one always does (the
startup buffer plus 3 more makes 4).

A/B test, session locked, screens forced on for 15 s then off, CPU measured 35
s later:
- Default effects: 4 spins in 7 cycles (plasmashell restarted after each spin,
so every second cycle)
- Fading popups unloaded: no change, 3 spins in 7
- Sliding popups unloaded: 0 spins in 8 consecutive cycles, no restarts

Workaround: turn off "Sliding popups" in System Settings > Window Management >
Desktop Effects (or kwriteconfig6 --file kwinrc --group Plugins --key
slidingpopupsEnabled false, then reconfigure KWin).

Possible fixes, not built or tested: don't start slide-in/slide-out while
effects->isScreenLocked() (the effect already drops everything on
screenLockingChanged), or advance the timelines from prePaintScreen() so a
hidden window's animation still finishes. Other effects that hold a deleted ref
and only advance in prePaintWindow() may have the same problem while locked.

Bug 525746 and bug 513424 look like the same issue. Attached are the
per-surface buffer accounting at the start of the loop and the relevant trace
lines.

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

Reply via email to