feat(libSceHmd2): return the console's display and mirroring buffer sizes #7690
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7690"
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 T3cm0 on 2026-10-18T23:57:18Z.
What
Implements four libSceHmd2 size queries that threw:
sceHmd2ReprojectionQueryDisplayBufferSizeAlign,sceHmd2ReprojectionQuerySeeThroughBufferSizeAlign,sceHmd2ReprojectionGetMirroringDisplayBufferSizeAlignandsceHmd2ReprojectionGetMirroringWorkMemorySizeAlign. Each returns a{size, alignment}pair in RAX:RDX (Hmd2::SizeAlign), and the console returns fixed values: 0x6000000 and 0x10000, 0x1106000 and 0x100, 0x5FA0000 and 0x10000, 0x4000 and 0x100. PPSA05666 (Horizon Call of the Mountain) reaches the reprojection set-up right after its PS VR2 tracker set-up, allocates the sizes these queries return and passes the mirroring buffer size (0x5FA0000) tosceHmd2ReprojectionEnableMirroring.sceHmd2ReprojectionQueryBufferSizeAlignis left to #7658, which implements it; the debt file records the value the console returns for it (0x100828 and 0x100), measured the same way. The values were measured on the console; the debt file says what is assumed.Hmd2::SizeAlignhas the same layout and member names as the one #7658 adds, so whichever lands second only drops its copy.Tested
Windows 11 (MinGW GCC 15.2) and Ubuntu 26.04 on WSL2 (GCC 15.2), Release builds:
ctestfor guest_hmd2 passes on both, and patched_libraries on Windows; the built exports set RAX and RDX as the console's do. The values come from a homebrew payload on a PS5 (firmware 13.60) with no PS VR2 headset that loadedlibSceHmd2.sprxwithout initializing it and called each query with small arguments, always with the same result. The arguments PPSA05666 passes were captured under AnyPS5. Not tested further with a title.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T23:57:59Z.
Progress report (
98db779→f264452)📈 System libraries: 66.69% (+0.07%, +4 implemented functions)
✅ 4 implemented
sceHmd2ReprojectionGetMirroringDisplayBufferSizeAlignsceHmd2ReprojectionGetMirroringWorkMemorySizeAlignsceHmd2ReprojectionQueryDisplayBufferSizeAlignsceHmd2ReprojectionQuerySeeThroughBufferSizeAlignImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T00:11:20Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceHmd2/Hmd2.hppL51, L63Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/debt/libSceVideoOut.mdcore/libs/tests/GuestHmd2.cppdocs/dev/debt/libSceVideoOut.mdImported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-19T02:16:42Z.
Datapoint from Gran Turismo 7 (PPSA01317, 01.000.001 base package): the title calls
sceHmd2ReprojectionQueryDisplayBufferSizeAlignright aftersceHmd2ReprojectionQueryBufferSizeAlign, and this PR's answer is what lets it leavelibSceHmd2. Onmain324e0e48e+ #7658 alone, 3 of 3 runs abort onsceHmd2ReprojectionQueryDisplayBufferSizeAlign not implemented(libSceHmd2.prx+0x1c90underapp.exe+0x952f47, 0x48 bytes after theQueryBufferSizeAligncall site that stopped it on plainmain); with this PR added (heade191a132a, which brings #7463), 3 of 3 pass all four size queries and stop onsceVrTracker2Initialize not implemented(libSceVrTracker2.prx+0x1650underapp.exe+0x95310a, same function, same module-load thread), 9.5 s (cold shader cache), 4.9 s and 4.9 s after launch, still before the first frame.main324e0e48e+ #7658sceHmd2ReprojectionQueryDisplayBufferSizeAlign not implementedlibSceHmd2.prx+0x1c90underapp.exe+0x952f47main324e0e48e+ #7658 + this PRsceVrTracker2Initialize not implementedlibSceVrTracker2.prx+0x1650underapp.exe+0x95310aHorizon Call of the Mountain (PPSA05666, v01.004.011) on the second tree: 3 of 3 stop on
sceVrTracker2Initialize not implemented(108 s cold cache, 10 s, 11 s), the same addresses as with #7463 alone (app.exe+0x4b8d89b, with thelibSceHmd2.prx+0x1920device-information return address and the VR set-up framesapp.exe+0x10f8eee/+0x10fadeeup the stack). NosceHmd2Reprojection*export is reached before that abort, which matches the PR text: the reprojection set-up comes after the tracker set-up, and on the emulator the tracker set-up throws first. So Horizon cannot confirm the four values yet; GT7 confirms thatQueryDisplayBufferSizeAlignis the first of them a title asks for.Merge notes: against #7658 the only conflict is the duplicate
Hmd2::SizeAligninHmd2.hppand the debt bullet, as both PRs predict (I kept #7658's struct block and both sets of declarations;Export.cppandGuestHmd2.cppmerged by themselves). #7658 itself conflicts with currentmaininlibSceJson2(#6126);main's files were kept there.stderr, GT7 run 3 with this PR (abort block)
stderr, Horizon run 2 with this PR (abort block)
Tested. Windows 11 (26200), RTX 4090 (NVIDIA 616.92), WinLibs GCC 15.2.0 r7 (UCRT), Release
libstarget, ccache, one worktree for both trees; GT7'sapp.exeis the relink frommain31cbb55d7, Horizon's the 10/14 relink, onlylibs/swapped. Desktop session, no input, 600 s cap,APS5_PLAYGO_UNLISTED_CHUNKS=absentfor Horizon, box otherwise idle. Not a review of the console measurements.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T09:02:00Z.
Rebase handoff, with one design decision flagged for review — rebased onto current
main(both commits, authorship unchanged).The decision:
main'sb378541e7("report the PS VR2 runtime as unavailable again") landed after your merge-base and revertedsceHmd2InitializetoUnsupportedFeature— your branch was built on the initialization-succeeds model. I keptmain's architecture (Initialize fails,TestWithoutHeadsetstays) and layered your feature on it: the four size queries return the console-measured values ungated, and VrTracker2 applied verbatim. If your intent is to re-land the succeeds-model (#7323 behavior), the Initialize restoration plus your fullTestInitializedsuite is the part to redo — I did not guess that direction.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; the Hmd2 tests pass (2/2); conventions pass; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766, #7784), none from this PR.To pick it up:
Head is
38ce5ba3d.Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-19T09:21:18Z.
Console values for this PR's Hmd2 answers, measured inside Gran Turismo 7 (PPSA01317, 01.690.000) on a retail PS5 (firmware 13.40) with a PS VR2 headset connected and on, by calling the exports from the running game process (ptrace from an elfldr payload):
QueryDisplayBufferSizeAlign0x6000000 / 0x10000,QuerySeeThroughBufferSizeAlign0x1106000 / 0x100,GetMirroringDisplayBufferSizeAlign0x5FA0000 / 0x10000,GetMirroringWorkMemorySizeAlign0x4000 / 0x100. MLB The Show 25 (no headset, Hmd2 not initialized) gets the same four pairs.sceHmd2GetFieldOfViewWithoutHandlereturns 0 with 1.84177089, 0.947190642, 1.32898104, 1.32898104, bit-identical toDefaultFieldOfView.sceHmd2GetDeviceInformationwith the headset present returns 0 and 28 bytes: status 0, userId 0, panel 4000 × 2040, latency90Hz 5555, latency120Hz 4160, hmuMount 0, lensSeparationDistance 66 (0x42), reserved 0, virtualImageDistance 2.0f. Apart from status (0 here, 2 = NotDetected in this PR) and lensSeparationDistance (66 here, 0 in this PR), every field matches. I did not measure the no-headset answer inside an initialized title, so this does not say the PR's NotDetected values are wrong, only what a title sees with a headset.sceHmd2GetDeviceInformationevery frame from its main loop (seen by recording the title's own calls).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T19:13:56Z.
Rebase handoff — rebased onto current
main(585075cb7, both commits, authorship unchanged).The resolution, same direction as my earlier flag on this PR:
main'sb378541e7deliberately restored the Initialize-fails model (sceHmd2Initialize →UNSUPPORTED_FEATURE), so your first commit's succeeds-model debt text is superseded — I keptmain's entry and applied your VrTracker2 before-init answers and the measured size queries on top of it. One consequence I fixed in the docs:main's entry still said the display and see-through size queries "stay unimplemented and throw pending console measurements of their sizes and alignments" — stale once your top commit lands, so that clause now covers onlysceHmd2ReprojectionQueryBufferSizeAlign(the one you left unimplemented, its measurement documented in your new entry). Your new entry for the five measurements is untouched.Worth noting for reviewers: @frankea's console measurements from inside GT7 this morning (PS VR2 connected) match your four implemented values exactly — independent corroboration on top of your payload measurements.
Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds;guest_hmd2andguest_vr_tracker2pass; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766, #7784), none from this PR; conventions pass with two[debt-length]findings (one ismain's pre-existing Hmd2 entry, shortened by the clause fix; one is this PR's new VrTracker2 entry — warnings only).To pick it up:
Head is
7a5d02a79.