feat(libSceJxr): allocate prediction rows on the guest heap #16827
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16827"
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 MarrasFederico on 2026-11-07T17:25:11Z.
What
allocatePredInfowas a parameterless placeholder that threw. It now follows pinned jxrlib strPredQuant.c on the caller's LP64CWMImageStrCodec: one guestmallocblock ofcmbWidthx channels x 2 prediction entries (48 bytes each) is split into a current and a previous row per channel, every entry'spiADpoints at its owniAD, andpPredInfoMemorykeeps the block. A failed allocation returnsICERR_ERROR(-1) and leaves the codec unchanged; success returnsICERR_OK(0).The block comes from the guest heap (
malloc_nid_postfix), likeallocateQuantizer, so the guest's ownfreeorfreePredInfocan release it. A null codec, more than 16 channels (jxrlib would write pastPredInfo[16]) or a size that overflowssize_tthrowsstd::invalid_argument. Channels pastcNumChannelskeep their row pointers, as in jxrlib.The test builds codecs with 1, 6, 11 and 16 channels and widths 1, 5 and 9, runs this export and jxrlib's own
allocatePredInfoon copies, and checks that both produce the same row layout andpiADlinks and leave the unused channels alone; it also checks the null-codec and 17-channel errors.allocatePredInfo - not measured on a PS5: prototype and layout are inferred from the export name; the debt entry is in
docs/dev/debt/libSceJxr.md.Tested
Ubuntu 26.04.1 LTS x86-64, GCC 15.2.0, Release,
BUILD_TESTING=ON, base12dafe416092f4ff2faca0a54891413fb2d0f7c1. No PS5 hardware or title was tested; Windows and macOS were not tested.core/libs/prx/libSceJxr/allserially withnice -n 19 cmake --build build --parallel 2 --target core/libs/prx/libSceJxr/all.ctest --test-dir build -R 'guest_jxr' --output-on-failurepasses (100% tests passed out of 15).mainthe export is a parameterless placeholder that throws throughNotImplemented_nid_no_patch, so the new assertions cannot pass there.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpass.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 gabichuuuuu on 2026-11-08T18:18:47Z.
Review: COMMENTED
Windows run of head
0788d07102, merged alone ontomainf35f1e5eca(clean merge). Setup: Windows 11, WinLibs GCC 15.2 (x86_64-ucrt-posix-seh), Release,BUILD_TESTING=ON.guest_jxr*tests with--repeat until-fail:5: every run passes.main'slibSceJxr/Export.cppand this PR's header, the build stops withconflicting declaration of C function, because the test calls exports whose signatures only exist with this PR.Merge order: every open libSceJxr PR from this series edits the same "remaining stubs" line in
docs/dev/debt/libSceJxr.md, so each merge will conflict with the next one there.Pull request closed