Repository navigation
fix: blur a region with one clipped node instead of one per rectangle - #7
Merged
mirkobrombin merged 2 commits intoNov 13, 2026
Conversation
jp-vernooy
force-pushed
the
fix/blur-clip-region
branch
from
November 10, 2026 20:29
462b3f0 to
6ffa964
Compare
SceneFX runs the whole multi-pass blur once per wlr_scene_blur node, over the node's visible area expanded by the blur size. A compositor that wants to blur an arbitrary region therefore has to create one node per rectangle of that region, and a rounded region is stored as one rectangle per scanline of its corners. Carry a patch that adds wlr_scene_blur_set_clip_region(). The clip is intersected into the node's visible region, so rendering, damage tracking and the blur's damage expansion all stay inside it, and one node can blur any shape. Without a clip the node behaves as before. Assisted-by: Claude Code:claude-opus-5-5 AI-Scope: Wrote the SceneFX clip-region patch from a prompt to cut per-rectangle blur cost.
Rounded blur regions from clients arrive as one pixman rectangle per scanline of each corner. Creating one SceneFX blur node per rectangle ran the full blur pipeline dozens of times per surface: a single Files window needed 15 nodes, and a desktop with blurred panels dropped to about 12 fps on Apple M4 (hundreds of GPU jobs per frame). Blur the region's extents with a single node clipped to the region. The result is pixel-identical to the per-rectangle nodes, needs no shape detection, and also covers clients that send no corner radius. Liquid blur keeps its per-shape nodes. Assisted-by: Claude Code:claude-opus-5-5 AI-Scope: Wrote the background-effect.c change and its benchmark from the same prompt.
jp-vernooy
force-pushed
the
fix/blur-clip-region
branch
from
November 10, 2026 20:35
6ffa964 to
f5532c4
Compare
jp-vernooy
marked this pull request as ready for review
November 10, 2026 20:38
Member
|
Thanks a lot! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Been testing Singularity Desktop on my M4 Pro MacBook with Aurora Silicon and found a performance issue when turning on blur or glass effects.
Blur regions from clients are rounded, and pixman stores a rounded region as one rectangle per scanline of each corner.
background-effect.ccreated one SceneFX blur node per rectangle, and SceneFX runs the full multi-pass blur once per node. A surface with four rounded panels (radius 16) becomes 76 rectangles, so 76 complete blur passes per frame. On the above-mentioned system, the desktop with blurred panels and dock dropped to about 12 fps while moving a window, with about 250 GPU jobs per frame.This PR blurs each region with one node clipped to the region:
feat: add a clip region to SceneFX blur nodessubprojects/packagefiles/scenefx-blur-clip-region.patch, which addswlr_scene_blur_set_clip_region().fix: blur a region with one clipped node instead of one per rectangleThe result matches the per-rectangle nodes, needs no shape detection, and works for any client:
zsingularity_blur_v1with a corner radius, or plainext-background-effect-v1regions.Related: singularityos-lab/singularity-desktop#271 ("blur bounds", "reported lag").
How has it been tested?
All on the M4 Pro, Aurora kernel 7.3.0-26, Mesa 26.3.0.
1. Standalone blur client in a nested labwc
A small Wayland client with no toolkit (
blurbench, about 300 lines of C, shm only):wlr-layer-shellbackground surface redraws a moving colour pattern on every frame callback, so the blur is re-rendered every frame;xdg_toplevelabove it draws N rounded panels and requests blur behind them;zsingularity_blur_v1(mode blur/glass/liquid, strength 100, corner radius) or overext-background-effect-v1(region only).Setup: labwc runs nested (
WLR_BACKENDS=wayland, 1280×720,-d), withblurbenchas its only client. 8 s per run, 2 rounds, builds alternating.Metrics:
wlr_scene_output_build_state;drm-engine-*);/proc/PID/stat;singularity@ 5aa79d4ext-background-effect, no radius (76)The nested output is paced by the host at 120 Hz.
Rendering: with the backdrop frozen, screenshots of both builds were compared pixel by pixel.
ext: differ by at most 19/255, only inside the area that was re-rendered between the two captures. That fits the blur's per-render noise dither.2. As the session compositor
The same change was applied to the labwc tree in use on this machine and run as the session compositor (120 Hz panel). The test: Super+drag of a translucent window in circles, counting
dcp:iomfb_swap_submit(displayed frames) andasahi_g17_doorbell(GPU jobs) system-wide.Window corners are clean: the blur follows the rounded edge with no square spill.
3. Build
meson setupapplies the three SceneFX patches in order.scripts/checkpatch.pl --strictreports nothing new forsrc/background-effect.c.Not yet done: testing on non-Apple GPUs (don't currently have access to x86 hosts running Singularity)
Generative AI assistance
AI assistance: disclosed
Both commits carry
Assisted-byandAI-Scopetrailers (see AGENTS.md).