perf: throttle shadow-driven blur repaints - #963
Conversation
| // 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; |
There was a problem hiding this comment.
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
| paint_effect.set_callback(paint_flags => { | ||
| if (!(paint_flags & Clutter.EffectPaintFlags.ACTOR_DIRTY)) | ||
| return; |
There was a problem hiding this comment.
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.
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.