Skip to content

plugins/blur: Fix glitches on wayland (effectively, rewrite the effect)

Vlad Zahorodnii requested to merge work/zzag/rewrite-blur into master

Given how the blur effect works, if a pixel changes, the surrounding pixels may have to be repainted as well. Currently, it's achieved by expanding the damage in the BlurEffect::prePaintWindow() function. However, it means that the blur effect should see both surface and buffer damage in the pre paint pass.

Unfortunately, after refactoring surface and buffer damage tracking, kwin no longer provides the buffer damage in the pre paint pass (it does so for good reasons). This broke the blur effect. As an example, you may see visual glitches when moving the software cursor over blurred areas of a window.

In order to fix this issue, the blur effect has to cache background behind every window to avoid blurring already blurred areas.

This change implements a background cache. Unfortunately, since the blur effect's code has become very difficult to change over the years, this change rewrites the relevant parts of the blur effect.

With the proposed design, the blur effect is going to maintain cached background for every window + offscreen render targets. It may have issues with animated windows, however in practice, it seems to behave good enough. However, if it becomes pressing matter, we can move from simplistic design in this patch to somewhat more sophisticated design that involved textures with rounded up size.

BUG: 455526

closes #115 (closed)

Edited by Vlad Zahorodnii

Merge request reports