feat(libSceNKWebKit): implement HistoricalVelocityData::velocityForNewData and the VelocityData dump #19302
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19302"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MatteoSid on 2026-11-13T02:43:48Z.
What
Implements two
VelocityDataexports, following pinned WebKitVelocityData.cppatc55364d53f97, the revision the libSceNKWebKit debt entries pin:WebCore::HistoricalVelocityData::velocityForNewData(FloatPoint, double, MonotonicTime)(_ZN7WebCore22HistoricalVelocityData18velocityForNewDataENS_10FloatPointEdN3WTF13MonotonicTimeE, NIDTJbM4gtL7mU), lines 33-70;WebCore::operator<<(WTF::TextStream&, const VelocityData&)(_ZN7WebCorelsERN3WTF10TextStreamERKNS_12VelocityDataE, NIDBTXZgU0oot8), lines 72-83.VelocityData.hdeclares both withWEBCORE_EXPORT, with the parameter types the export names demangle to. The file is the same in the PS5 11.x tree the other libSceNKWebKit entries pin, and the header differs only by one#include <wtf/Optional.h>.velocityForNewDatakeeps a ring of three{timestamp, position, scale}samples. When there is history and the new timestamp is more than 1/60 s after the oldest sample, it returns(position delta / time delta, scale delta / time delta, timestamp); otherwise it returns a zeroVelocityData. A sample more than 1/60 s after the last append is appended (the index advances first, so the first sample lands in slot 1), and an earlier one overwrites the latest slot. The dump writes the timestamp, then each non-zero rate, asdumpPropertygroups.Layouts in
WebCoreTypes.hpp, checked withstatic_assert:VelocityDatais 24 bytes (three floats,MonotonicTimeat 16) and is returned through the hidden result pointer;HistoricalVelocityDatais 88 bytes (m_historySize,m_latestDataIndex,m_lastAppendTimestampat 8, three 24-byte samples from 16). The code is in the newsrc/WebCoreVelocityData.cpp, which carries the upstream notice verbatim. It uses the existingTextStreamexportsstartGroup,endGroupandoperator<<forconst char*,floatanddouble. Upstream's inlinedumpPropertybuilds a temporaryWTF::Stringfor each name. The dump writes the name as a C string instead, which appends the same characters. Both stubs leaveExport.cppandInventoryExports.hpp, and the declarations go intoWebCoreExports.hppandWebCoreDumpExports.hpp.Reachability:
HistoricalVelocityData()is= defaultwith inline member initializers,VelocityDatahas an inline constructor, andTextStreamhas an inline constructor. A title builds all three inline and passes plain values (a point, a scale and a time), so both functions run on objects no unimplemented export has to create.New debt entry: not compared with a console module; the layouts come from the pinned header; the property names are written as C strings.
Tested
After merging
main: headb77e99252ais a real merge (no rebase) ofmaincda5c28fa0, which includes #19993. Since #19603, the inventory line indocs/dev/debt/libSceNKWebKit.mdhas no count. Againstmain, the debt file differs only by this PR's VelocityData entry and the two inventory rows it removes (TJbM4gtL7mU,BTXZgU0oot8); there are no duplicate lines, and #19993's entry is kept. Linux (Ubuntu 24.04 container, GCC 13.3), Release,-DBUILD_TESTING=ON: all 81 libSceNKWebKit test targets and the patchedlibSceNKWebKit.prxbuild withninja -k 0and no errors.nkwebkit_webcorevelocitydatapasses, andctest -R 'nkwebkit|^public_headers$'passes 82 of 82 (the 81 libSceNKWebKit tests andpublic_headers).nm -Don the patched.prxstill listsTJbM4gtL7mUandBTXZgU0oot8.tools/check_conventions.py --base origin/main --head HEADandgit diff --checkpass. The earlier merges ofmain(heads159a789996and7943f67670) passed the same checks. The approval, the mutation check, the overlap check and the Windows run below were on77928b987d.Before the merge, on
77928b987d: Linux (Ubuntu 24.04 container, GCC 13.3), Release,-DBUILD_TESTING=ON, on head77928b987dbased onmain7a6183485f. I built all 75 libSceNKWebKit test targets and the patchedlibSceNKWebKit.prxwithninja -k 0, with no errors.ctest -R '^(guest_)?nkwebkit_|public_headers'passes 140 of 140: the 75 libSceNKWebKit tests and the 65public_headerstests.Windows: JJenkx ran
nkwebkit_webcorevelocitydataon head77928b987dmerged ontomain(Windows 11, WinLibs GCC 15.2 UCRT, Release); it passes in 3 of 3 runs (comment).The new
nkwebkit_webcorevelocitydatatest checks exact values. Expected rates were worked out by hand, or rounded tofloatin Python where the division is not exact.m_historySize,m_latestDataIndex,m_lastAppendTimestampand the stored samples.1.0 / 60) gives no velocity and no append. This checks that both comparisons are strict.NumberRespectingIntegers. It checks which rates are omitted when zero, and that the stream and its indent come back unchanged.Mutation check, one change at a time: 19 of 20 make the test fail. The killed ones change the ring modulo, the size cap, the last-append update, the history test, the oldest-index branch and wrap formula, both strict comparisons, the overwrite inside the window, the horizontal, scale and time components, the 1/60 threshold, each of the three dump conditions, the scale value written, the property name, the separator and the group end. The survivor writes the
floatrates through thedoublewriter. It is equivalent: the conversion is exact and both writers format with two fixed digits.nm -Don the patchedlibSceNKWebKit.prxlistsTJbM4gtL7mUandBTXZgU0oot8, andtools/nid_names.py'scompute_nidgives those NIDs for the two names.tools/check_conventions.py --base origin/main --head HEADpasses.tools/pr_overlap.py --branchfinds no overlap with the 91 open PRs it could merge. It could not compare 44 PRs that share files but conflict withmain. I checked their diffs by hand: none adds or removes these two exports or edits the lines next to them. #16510 (filter operations) removesoperator<<(TextStream&, const FilterOperation&)fromInventoryExports.hpptwo lines below theVelocityDatadeclaration, with one unchanged line between, and shows that declaration only as context. Searches forVelocityDataandHistoricalVelocityDatafind no other open PR. #15517 listed theVelocityDatadump as not implemented for lack of source; the pinned revision has it. No title tested.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-13T03:03:37Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional. The ring-buffer arithmetic, the struct layouts and the
TextStreamcalls match the code I read, and every symbol the new file calls is declared.What I ran
77928b987db0f8b38fdad343fbde4f4a9dc9cbed, basemain. The merged-preview check was not run.Results
WtfExports.hppsrc/*.cppandtests/*.cppctestFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/WebCoreVelocityData.cpp:64: theappendlambda's parametersnewPosition,scaleandtimestampshadow the function's parameters of the same names. This is legal C++. Renaming them, for examplepos,sandt, would make the copy from upstream easier to compare.Not verified
ctest(140 of 140), and the 19 of 20 mutation check: author-reported, not run here.tools/check_conventions.pyandtools/pr_overlap.py: author-reported, not run.Export.cppandInventoryExports.hpp: not checked.Export.cpp,InventoryExports.hppanddocs/dev/debt/libSceNKWebKit.md: too large for the review folder. I read only their hunks in the diff.To get this to a good state
Nothing is required.
Optional: the parameter rename in the non-blocking point above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T12:43:46Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
77928b987d:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcorevelocitydata_testsbuilt cleanly.nkwebkit_webcorevelocitydata):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreDumpExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me