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

--- Comment #3 from Fineapple <[email protected]> ---
I can reproduce a closely related (possibly the same) issue on Plasma/KWin
6.7.5,
Wayland, hybrid AMD Phoenix (driving the panel) + NVIDIA RTX 4060, with a
translucent
Aurorae decoration (with a bottom border) and the stock Blur effect.

Symptom: the titlebar of a window with opaque client content (e.g. a QEMU GTK
window)
has a grey tint when on its own, and flickers heavily when the window is placed
over
another blurred window (Konsole), especially while the mouse moves over it
(each new
client frame triggers a repaint). Unloading the blur effect makes it disappear.
KWIN_USE_BUFFER_AGE=0 does not fix it.

Root cause, as far as I can tell from the 6.7.5 sources:
- For windows with a decoration blur region, the blur bounding rect
  (blurRegion(w).boundingRect(), i.e. backgroundRect in BlurEffect::blur) spans
the
  whole window as soon as the decoration has a bottom/side border.
- BlurEffect::blur copies the background from the render target over that whole
  rect (blitFromRenderTarget over dirtyRegion & backgroundRect), and the Kawase
passes
  sample beyond the actual blur shape.
- But the area behind the window's *own* opaque client region is culled by the
  scene's occlusion pass (WorkspaceScene::collectDamage /
preparePaintSimpleScreen).
  The forceTranslucent logic in accumulateRepaints() only subtracts from the
opaque
  regions of windows *above* the BackgroundEffectItem, not the window's own
one.
- So the blur samples stale or undefined pixels from the render target near the
edge of the
  client area. The grey tint comes from stale client content, and the flicker
comes
  from different swapchain buffers holding different stale content.

Fix / workaround: mark windows that have a blur region as translucent in
prePaintWindow, so nothing below them is occlusion-culled. This is what
kwin-effects-glass does (data.setTranslucent() for windows with a blur region),
which is why it fixes the issue:

    void BlurEffect::prePaintWindow(RenderView *view, EffectWindow *w,
WindowPrePaintData &data)
    {
        effects->prePaintWindow(view, w, data);
        if (m_windows.contains(w)) {
            data.setTranslucent();
        }
    }

I built the stock 6.7.5 blur plugin out-of-tree with only this change and it
completely fixes both the grey tint and the flicker for me. A narrower upstream
fix
could restrict this to the area within the blur's expand size around the blur
shape
(e.g. have the scene also subtract forceTranslucent from the window's own
opaque
region), to keep occlusion culling for the rest of the window.

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

Reply via email to