Skip to content

perf: throttle shadow-driven blur repaints - #963

Open
Dank-del wants to merge 4 commits into
aunetx:masterfrom
Dank-del:battery-repaint-throttle
Open

perf: throttle shadow-driven blur repaints#963
Dank-del wants to merge 4 commits into
aunetx:masterfrom
Dank-del:battery-repaint-throttle

Conversation

@Dank-del

Copy link
Copy Markdown
Contributor

Replaces frame-count-based blur invalidation with a monotonic 100 ms throttle. This keeps shadow-driven blur refreshes responsive while preventing continuously painting actors from requeuing costly blur work every few frames. Built successfully with the project Makefile.

Comment thread src/conveniences/paint_signals.js
Comment thread src/conveniences/paint_signals.js
Comment thread src/conveniences/paint_signals.js Outdated
Comment on lines +35 to +39
// queue_repaint() invalidates the effect itself, which results in
// a paint without ACTOR_DIRTY. Do not turn that repaint into a
// new trailing timeout.
if (!(paint_flags & Clutter.PaintFlag.ACTOR_DIRTY))
return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the wrong Clutter enum. The vfunc_paint() argument is Clutter.EffectPaintFlags, while Clutter.PaintFlag is a separate stage-paint enum and has no ACTOR_DIRTY member. Consequently, undefined is coerced to zero here and every paint returns early, disabling blur invalidation entirely. Please use Clutter.EffectPaintFlags.ACTOR_DIRTY. Clutter documents the callback flag as ClutterEffectPaintFlags

Comment on lines +34 to +36
paint_effect.set_callback(paint_flags => {
if (!(paint_flags & Clutter.EffectPaintFlags.ACTOR_DIRTY))
return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it looks like I made a mistake in my previous suggestion 🫣. ACTOR_DIRTY cannot distinguish the repaint triggered by blur_effect.queue_repaint() here. Clutter clears this flag only for the effect passed to queue_repaint; effects layered above it still receive ACTOR_DIRTY. Since PaintCallbackEffect is added after the blur effect, each timeout-triggered repaint reaches this callback and schedules another timeout, preserving the permanent 10 Hz repaint loop. This needs an explicit one-shot guard for the requested repaint instead of relying on paint flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants