Skip to content

fix(render): preserve 120 fps pacing headroom - #64

Merged
qiin2333 merged 1 commit into
masterfrom
codex/bound-host-paced-latency
Jul 20, 2026
Merged

fix(render): preserve 120 fps pacing headroom#64
qiin2333 merged 1 commit into
masterfrom
codex/bound-host-paced-latency

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 把定时呈现的绝对提交余量固定为 2 ms,给 120 Hz 的 RenderService latch 留出稳定空间
  • future lead 从半帧放宽到一帧,并加入 1 us PTS 量化容差
  • 新增 120 FPS 双帧 burst 测试,保证两帧继续按 PTS 间隔送显;真正超过预算时才 catch-up

为啥要改

PR63 的半帧预算在 120 FPS 下只有约 5.21 ms。解码器只要同批吐出两帧,第二帧就会被这个小杂鱼阈值重新锚定到同一个 VSync,Surface 随后丢掉其中一帧,实际显示帧率因此跑不满。

修复后稳态 lead 是 2 ms,相比 PR63 只增加约 0.96 ms;一帧 future lead 只吸收瞬时 decoder burst,不恢复旧版固定一整帧排队。

验证

  • c++ -std=c++17 -Wall -Wextra -Werror nativelib/src/main/cpp/presentation_scheduler.cpp nativelib/src/test/cpp/presentation_scheduler_test.cpp -I nativelib/src/main/cpp -o /tmp/moonlight_presentation_scheduler_test && /tmp/moonlight_presentation_scheduler_test
  • npm run check
  • node hvigorw.js assembleApp --mode project -p product=default -p buildMode=debug --no-daemon(DevEco SDK 6.1 / JBR 21,BUILD SUCCESSFUL)

Summary by CodeRabbit

  • 改进

    • 优化高刷新率场景下的画面呈现调度,提升连续帧的时间一致性。
    • 改善成对帧突发到达时的处理,减少不必要的帧合并或跳过。
    • 调整未来帧调度窗口,使不同帧率和小数帧率下的延迟控制更加稳定。
  • 测试

    • 新增并更新高刷新率及突发帧场景验证,确保追帧行为符合预期。

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b815ed7a-391c-478a-b9c2-1fbc5ba5687e

📥 Commits

Reviewing files that changed from the base of the PR and between 7bd8695 and 486be08.

📒 Files selected for processing (3)
  • nativelib/src/main/cpp/presentation_scheduler.cpp
  • nativelib/src/main/cpp/presentation_scheduler.h
  • nativelib/src/test/cpp/presentation_scheduler_test.cpp

📝 Walkthrough

Walkthrough

调度器改用固定 2ms 提交前置时间,并将未来前置上限调整为初始前置时间加一帧间隔及量化余量。测试同步覆盖 120fps 突发帧事件序列和新的延迟预算边界。

Changes

演示调度器阈值调整

Layer / File(s) Summary
调度阈值配置
nativelib/src/main/cpp/presentation_scheduler.cpp, nativelib/src/main/cpp/presentation_scheduler.h
使用固定 2ms 的提交与初始前置时间,并将最大未来前置时间改为初始前置时间加一帧间隔及 1µs 量化余量。
突发帧与延迟预算测试
nativelib/src/test/cpp/presentation_scheduler_test.cpp
新增 120fps 成对突发帧测试,验证 NONECATCH_UP 事件,并更新最大未来前置时间断言及测试入口。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题简洁且准确概括了核心变更:修复渲染调度以保留 120 FPS 的节奏余量。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/bound-host-paced-latency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qiin2333
qiin2333 merged commit 78afe56 into master Jul 20, 2026
2 checks passed
@qiin2333
qiin2333 deleted the codex/bound-host-paced-latency branch July 20, 2026 11:21
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