Skip to content

perf(animation): cut 8-bit spring tails and seed focus dim from vblank - #971

Open
ZhangDM-520 wants to merge 1 commit into
noctalia-dev:mainfrom
ZhangDM-520:perf/alpha-spring-and-setter-guards
Open

ZhangDM-520 wants to merge 1 commit into
noctalia-dev:mainfrom
ZhangDM-520:perf/alpha-spring-and-setter-guards

Conversation

@ZhangDM-520

@ZhangDM-520 ZhangDM-520 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Split out from #965 per review feedback so the non-pool animation optimizations can be reviewed independently:

  • 8-bit spring tail cut: Add AnimatedValue::finishQuantizedSpringTail(255.0) to stop overdamped alpha springs (m_focusDim, m_ruleOpacity, m_modalShadeAlpha, LayerSurface::m_fade) once remaining displacement stays strictly within the target's 8-bit rounding cell (roundingMargin = 0.5 - |targetSteps - round(targetSteps)|, matching finishSpringTail). Skips the cut when an animation effect preset is bound (AnimationEvent::Layers / AnimationEvent::DimUnfocused) so umbriel_progress is unaffected.
  • Vblank-seeded focus dim: Add Output::latestVblankMsec() (reused by Output::handleFrame() to avoid duplicating time sampling) and AnimatedValue::seedStartMsec() so m_focusDim advances on the first frame instead of stalling at elapsed = 0.

Motivation

Overdamped alpha springs (such as dim_unfocused) currently keep ticking and damaging the output for dozens of frames after the 8-bit quantized alpha has already converged within the target's rounding cell, triggering unnecessary compositing and blur passes. Seeding focus-dim from the latest vblank also eliminates the 1-frame initial stall.

Type of Change

  • Refactoring

Testing

  • clang-format --dry-run -Werror on all 8 modified files: PASS
  • ninja -C build-debug umbriel tests/animation-test: PASS (0 warnings)
  • meson test -C build-debug animation: PASS (1/1)
  • just check animation/focus_rules: PASS (3.41s)

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • This change fits SCOPE.md, or its scope was agreed in an issue or on Discord first.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format, or this PR has no C++, shader, or Markdown changes.
  • I ran the relevant build, test, lint, or verification commands, or explained why they were not run.
  • I functionally verified compositor behavior where automated checks are insufficient.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I updated docs/ and examples/config.toml, or this PR does not change user-facing configuration or behavior.
  • I used canonical names for config keys, IPC actions, paths, and identifiers.

Additional Notes

@github-actions
github-actions Bot marked this pull request as draft December 2, 2026 05:27
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

The description now contains the required template structure.

@ZhangDM-520
ZhangDM-520 marked this pull request as ready for review December 2, 2026 05:37
@ZhangDM-520
ZhangDM-520 marked this pull request as draft December 2, 2026 05:47
@ZhangDM-520
ZhangDM-520 force-pushed the perf/alpha-spring-and-setter-guards branch from c06b627 to eff98b1 Compare December 2, 2026 06:07
@ZhangDM-520 ZhangDM-520 changed the title perf(animation): cut 8-bit spring tails, seed focus dim from vblank, and guard scene setters perf(animation): cut 8-bit spring tails and seed focus dim from vblank Dec 2, 2026
Split out from noctalia-dev#965 as requested in review:

- Add AnimatedValue::finishQuantizedSpringTail(255.0) to stop springs (e.g. overdamped alpha springs) once remaining displacement stays strictly within the target's 8-bit rounding cell, skipping the cut when an animation effect preset is bound (Layers / DimUnfocused).
- Add Output::latestVblankMsec() (reused by Output::handleFrame()) and AnimatedValue::seedStartMsec() to seed focus-dim transitions from the latest vblank so the first tick advances immediately.

Assisted-by: LLM (human-reviewed)
Signed-off-by: ZhangDM-520 <jixianqiang1540@gmail.com>
@ZhangDM-520
ZhangDM-520 force-pushed the perf/alpha-spring-and-setter-guards branch from eff98b1 to a877d43 Compare December 2, 2026 06:22
@ZhangDM-520
ZhangDM-520 marked this pull request as ready for review December 2, 2026 07:20

@talia-ci talia-ci Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Talia preliminary review

Check Result
Merge score 🟢 4/5 — No issues found; likely ready after CI and human review
Findings None found
Review depth 3/5 — how thoroughly the changed code could be checked by reading it
Coverage 8 of 8 changed files reviewed

What Talia checked: Inspected all eight changed hunks plus AnimatedValue tick/retarget/snap and spring-bound helpers, effect preset binding/gating, Output vblank sampling and View/Output consumers. No concrete introduced bug is supported; remaining uncertainty is runtime vblank-seeded first-frame timing and the 8-bit precision assumption, neither of which was executed.

Run details
  • Commit reviewed: a877d43
  • Source lookups: 36 file reads, 31 searches
  • Prompt version: 859b7490ca3d

Preliminary automated review: Talia read the changed code and related source; nothing was built, run or tested, and AI can make mistakes. It is not a scope acceptance or a promise to merge; a human reviewer makes the final call. See our ethos.

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.

1 participant