Repository navigation
fix(fontft): preserve format query lock backoff on Windows - #14225
oneandonlydean merged 2 commits into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
At head 1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e, the production change restores a real 30 μs lock backoff using the shared precise-wait helper, and the added test covers contention, result, lock restoration, and cleanup.
What I ran
Reviewed head 1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e against base cae3edaf11db8c6c1694c2d772d07c079755a71f (main); the current-base preview merged cleanly. Environment: Linux x86_64, glibc 2.36, Python 3.11.2, GCC 12.2.0.
git diff --check cae3edaf11db8c6c1694c2d772d07c079755a71f...1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e
python3 tools/check_conventions.py --base cae3edaf11db8c6c1694c2d772d07c079755a71f --head 1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e --title 'fix(fontft): preserve format query lock backoff on Windows' --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14225-1bbd927c4bbc/pr-body.md
python3 tools/pr_stack_check.py 14225 --repo boykopovar/AnyPS5
mkdir -p /tmp/anyps5-pr14225-quality/core/libs/prx/libSceFontFt /tmp/anyps5-pr14225-quality/core/libs/tests
git show 1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e:core/libs/prx/libSceFontFt/CMakeLists.txt > /tmp/anyps5-pr14225-quality/core/libs/prx/libSceFontFt/CMakeLists.txt
git show 1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e:core/libs/tests/GuestFontFtBackoff.cpp > /tmp/anyps5-pr14225-quality/core/libs/tests/GuestFontFtBackoff.cpp
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr14225-quality core/libs/tests/GuestFontFtBackoff.cpp
gh pr checks 14225 -R boykopovar/AnyPS5The test-quality heuristic flagged a likely registration issue because the CMake source path uses ${LIBS_INCLUDE_DIR}; I inspected the exact CMake file and confirmed that it adds the test executable and registers guest_font_ft_backoff. I did not build locally.
Results
| Check | Result |
|---|---|
| Diff check | Passed; no whitespace errors. |
| Conventions and PR template | Passed. |
| Current-base merge preview | Clean; no declared dependencies. |
| CMake test registration | Confirmed by source inspection; the CTest is registered as guest_font_ft_backoff. |
| Test-quality heuristic | One false-positive registration warning due to the variable-expanded CMake path; no assertion-quality warning. |
| Hosted CI | Eligibility and intake passed. Windows, conventions, labels, library-portability, and report were pending; Linux, register-context, relinker, relinker-asan, and write-watch were skipped at the final refresh. |
| Windows test matrix | Author reports 9/9 focused CTests on WinLibs GCC 15.2.0 and MSYS2 UCRT64 GCC 16.2.0; the new test passes on both. Not run locally. |
Unedited output for local checks
Diff check produced no output and exited successfully.
All conventions checks passed.
core/libs/tests/GuestFontFtBackoff.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.
Hosted checks:
linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124708461897
register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124708461655
relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124708461329
relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124708461730
write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124708462332
windows pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124708460486
eligibility pass 6s https://github.com/boykopovar/AnyPS5/actions/runs/41258750930/job/124707437656
intake pass 20s https://github.com/boykopovar/AnyPS5/actions/runs/41258750895/job/124707438502
conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750893/job/124707438438
labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258751013/job/124707438785
library-portability pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750947/job/124707437459
report pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41258750956/job/124707437547
Negative control
| Assertion | Change to code under test | Result |
|---|---|---|
| The new regression test distinguishes the WinLibs busy-spin behavior | Author reports running the test against baseline with only the test and registration added; production change absent. | WinLibs failed the CPU-budget assertion at 101.6%; MSYS2 passed. Author-reported, not independently rerun. |
Findings
Blocking
None found in the reviewed diff.
Non-blocking
The Windows builds, focused tests, and negative control are author-reported; I did not independently run them or test on a Windows host. The source change is small and calls the existing helper, which uses a Windows high-resolution waitable timer when available and falls back to std::this_thread::sleep_for if timer waiting fails.
Sources
- Reviewed implementation and test at head
1bbd927c4bbc678415fe8b7bebd0d8af2cacea2e. PreciseSleepUsimplementation at basecae3edaf11db8c6c1694c2d772d07c079755a71f.
Not verified
- No local build or C++ tests; the initial review workflow excludes builds.
- Windows behavior was supported by the author's reported runs but not independently reproduced here.
- Linux/macOS title behavior was not tested; the PR reports those environments were not run.
- Hosted CI had not completed at the final refresh.
|
The Windows part looks right: The change also applies off Windows, though, and there it goes the other way. In Could you use |
|
@oneandonlydean Addressed in d9a0fdfde7. Both the helper include and The regression test now uses Full |
|
A Windows run with GCC 16: Windows 11 Pro 10.0.22631, i9-9900K, MSYS2 UCRT64 GCC 16.1.0, Release, this PR (
Looks good on Windows 👍 AI-assisted: yes (Claude Code) |
d9a0fdf to
c8855b8
Compare
What
Restore the Windows backoff in
FontFt::SupportFormatsusing the existingPreciseSleepUs(30)helper under#ifdef _WIN32. WinLibs' sub-millisecondstd::this_thread::sleep_forreturns immediately, so a format query spins while another thread holds the font-library lock. The helper include is also Windows-only; Linux/macOS retain the originalstd::this_thread::sleep_for(30us), avoiding the precise helper's POSIX spin tail and Linux timer-slack changes. Refs #1471.Add
guest_font_ft_backoff: hold the library lock while a realsceFontFtSupportTrueTypequery runs on another thread, verify it remains blocked, release it, then check the result, lock restoration and library cleanup. Enforce the existing timed-wait tests' 40% calling-thread CPU budget on Windows and POSIX, usingGetThreadTimesor hostclock_gettime(CLOCK_THREAD_CPUTIME_ID)respectively. The timing test runs serially on every platform.Tested
Rebased 2026-11-05: head
c8855b8027, independently based on main1be4c77a8d.git range-diffconfirms the topic commits are unchanged by the rebase.Windows 11
10.0.26300, AMD Ryzen 7 9800X3D, Release,BUILD_TESTING=ON.The focused set covers
guest_font_ft_backoff,guest_font,guest_font_scissor,guest_font_renderer_lifecycle,guest_system_font,guest_font_metrics,guest_font_style_information,guest_font_outline_profileandguest_font_rebind_renderer.Original negative control: on main
cc26ab4438with only the new test and registration added, WinLibs fails the CPU-budget assertion (101.6% reported over the held-lock interval). MSYS2 passes that control. With the production fix, the same test passes on both toolchains and reports 0.0% calling-thread CPU on both toolchains in the final runs. These are synthetic lock-wait checks, with no title or frame-rate measurement.Additional POSIX validation on Ubuntu 24.04 WSL2 / GCC 13.3.0: the updated
GuestFontFtBackoff.cpppasses-fsyntax-only. An isolated harness reusing that file's actualThreadCpuNanosandRequireCpuBudgetfunctions passes a sleeping control (6.6% CPU) and rejects a busy-spin negative control (100.0%). This validates the new CPU counter and assertion; the full Linux font CTest was not run. The WSL full-build prerequisites lack XRandR development headers.tools/check_conventions.py --base origin/main,git diff --checkand the public-header declaration audit pass. The original 2026-10-31 scan,tools/pr_overlap.py --branch codex/fix-fontft-windows-backoff, found no overlap across 1,695 open PRs. Both fixes are based independently on main; this PR does not require the separate ksem fix.MSYS2 uses the existing local
CMAKE_SKIP_INSTALL_RULES=ONworkaround for #12994; installation was not tested. macOS runtime and titles were not run; Linux validation is limited to the compile check and CPU-counter controls above.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)