Skip to content

revert: libSceFreeTypeOt forwarded outline bitmap rendering (#19411) - #19762

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:revert/19411
Nov 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:revert/19411

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

What

Exact inverse revert of #19411 (merge 5891d14). Since it merged, guest_freetype_ot_patched times out (20 s) on Linux; it passed in 0.00 s before. Main alone fails it in the Linux batch pb-20261113T1903Z (base d261fa6); the last Linux batch without #19411 passed it. The change can come back once the test passes on Linux.

Tested

guest_freetype_ot_patched must pass on Linux on this PR.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

…ar#19411)

This reverts boykopovar#19411 (merge 5891d14). Since it merged, guest_freetype_ot_patched times out (20 s) on Linux; it passed in 0.00 s before
(Linux batch pb-20261113T1903Z, main alone).

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 0fb2017ec1:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_freetype_ot_tests failed to build.
    ftbase.c:(.text+0x1bb7): undefined reference to `FT_Stream_Open'
    ftbase.c:(.text+0x24c7): undefined reference to `FT_Stream_Open'
    ftbase.c:(.text+0x73c8): undefined reference to `FT_Stream_Open'
    ftbase.c:(.text+0x74c8): undefined reference to `FT_Stream_Open'
    ftbase.c:(.text+0x75c8): undefined reference to `FT_Stream_Open'
    /usr/bin/ld: 3rdparty/freetype/libfreetype.a(ftbase.c.o):ftbase.c:(.text+0xe495): more undefined references to `FT_Stream_Open' follow
    ftinit.c:(.text+0x1fc): undefined reference to `FT_New_Memory'
    /usr/bin/ld: ftinit.c:(.text+0x23c): undefined reference to `FT_Done_Memory'
    ftinit.c:(.text+0x276): undefined reference to `FT_Done_Memory'
    collect2: error: ld returned 1 exit status
    
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

@github-actions

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 19410 core/libs/prx/libSceFreeTypeOt/Export.cpp L196-198
core/libs/tests/GuestFreeTypeOt.cpp L449-451
PR 19415 core/libs/prx/libSceFreeTypeOt/Export.cpp L196-198
core/libs/tests/GuestFreeTypeOt.cpp L39, L448-451

Some 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.

Pull request Shared files not compared
PR 10897 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 16122 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 16823 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 17715 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 17776 core/libs/prx/libSceFreeTypeOt/Export.cpp
core/libs/tests/GuestFreeTypeOt.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 19587 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md

@JJenkx

JJenkx commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 0fb2017ec1, merged onto main 88513c79d4 (2fe97c0da0, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_freetype_ot, guest_freetype_ot_patched pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions

Copy link
Copy Markdown

Progress report (752c0f7 → 0fb2017)

📉 System libraries: 40.09% (-0.0025%, -1 reverted functions)

⚠️ 1 went back to stubs
Library Name
libSceFreeTypeOt sceFreeTypeOtOutlineGetBitmap_nid_no_patch

Changed libraries (implemented exports)

Library Before After Change
libSceFreeTypeOt 142/199 (71.36%) 141/199 (70.85%) -0.50%

@RiverWhy

Copy link
Copy Markdown
Contributor

Root cause, from running the test under gdb on Linux: sceFreeTypeOtOutlineGetBitmap_nid_no_patch is exported as 4RRjK-Wd1lU, which is compute_nid("FT_Outline_Get_Bitmap"). In the relinked libSceFreeTypeOt.prx, its call to FT_Outline_Get_Bitmap_nid_postfix becomes an import of that same NID, and the import resolves to the library's own export. The function tail-jumps to itself (jmp 4RRjK-Wd1lU@plt), so it spins without growing the stack until the 20 s timeout. That's why only the patched variant hangs.

The other exports that share a NID with libSceFreeType avoid this. Their forwarders live in ForwardExports.cpp, which is only compiled on Windows; on Linux and macOS the NID falls through to libSceFreeType through the link dependency. The FT_Realloc/FT_QRealloc forward (8088438) used that pattern.

I tried that shape for this function on main (f6d5bc30d6), Linux, GCC 13.3:

  • removed the Export.cpp entry
  • added a Windows-only FT_Outline_Get_BitmapForward_nid_no_patch exported as 4RRjK-Wd1lU to ForwardExports.cpp
  • in GuestFreeTypeOt.cpp, resolved the raw variant by FT_Outline_Get_Bitmap_nid_postfix, like the other forwarded exports

With that, guest_freetype_ot and guest_freetype_ot_patched both pass (0.01 s), including the outline bitmap pixel comparison, and all 96 tests matching freetype pass. I couldn't build the Windows forwarder here. @THEMANnt, this may be the way to bring the feature back after the revert.

AI-assisted: yes (Claude Code).

@THEMANnt

Copy link
Copy Markdown
Contributor

@RiverWhy Thanks for tracing the patched Linux hang and testing the Windows-only forwarder approach on Linux.

@oneandonlydean Would you be open to a standalone fix for the outline-bitmap hang in place of this revert? The fix in #19415 keeps 4RRjK-Wd1lU exported by libSceFreeTypeOt and calls a uniquely named libSceFreeType adapter to avoid the recursive lookup. I verified the export with nm -D, and the raw and patched tests each passed three consecutive runs on Linux and Windows.

If that approach works for you, I can pull the bitmap fix into its own PR and rebase #19410 and #19415 once it lands.

@kaiffeetasse

Copy link
Copy Markdown
Contributor

Root cause reproduced here on a non-ASan build-libs at main 2cebbe43ee, and it is not specific to this export: the relinked module ends up exporting and importing the same NID, and the Linux dynamic linker binds that import to the module itself.

Measurements:

  • guest_freetype_ot_patched times out on the unmodified main build too, not only under ASan: ***Timeout 20.03 sec, user 20.26 s of a 20.35 s wall time, i.e. it spins on the CPU rather than waiting. So this is not the ASan arena placement of Sanitizers nightly: the five load-sensitive failures and the stable ngs2_filter abort (11-03 to 11-07 runs) #16813.
  • nm -D build-libs/core/libs/libs/libSceFreeTypeOt.prx lists U 4RRjK-Wd1lU next to T 4RRjK-Wd1lU, and LD_DEBUG=bindings on a dlopen of that module prints binding file .../libSceFreeTypeOt.prx [0] to .../libSceFreeTypeOt.prx [0]: normal symbol '4RRjK-Wd1lU'. The export is nine bytes, endbr64; jmp 4RRjK-Wd1lU@plt, so it jumps into the GOT slot that resolves to itself.
  • Scanning all 406 patched modules on that commit for a NID that is both exported and imported finds 5 modules / 9 NIDs: libSceAmpr sZLrjx-yEx4; libSceFreeTypeOt 2rcvKZfm5rI, 4RRjK-Wd1lU; libSceLibcInternal s2eGsgUF9vk, v09ZcAhZzSc; libScePosixForWebKit J0kng1yac3M, XepdqehVYe4, ay3uROQAc5A, lybyyKtP54c; libkernel_sys C2kJ-byS5rM. Not all of them are trampolines, but at least the libScePosixForWebKit pair is: readdir_nid_disambig1_nid_postfix is endbr64; jmp lybyyKtP54c@plt and readdir_r_nid_disambig1_nid_postfix is endbr64; jmp J0kng1yac3M@plt, both to their own NID, and LD_DEBUG=bindings binds each to the module itself. Those two are only untested, not safe: the libc readdir/readdir_r imports bind to those same exports, so a guest module calling them through libc would spin the same way.

So #19411 is a new instance of the class #13730 already carries (fix(prx): keep forwarding exports from binding to themselves on Linux, with its patched_self_imports suite) — 4RRjK-Wd1lU is simply not in that table yet. The revert restores the patched test now; once #13730 lands, the forward can come back unchanged instead of needing the adapter of #19415.

I am not opening a competing PR: the revert here, #19410/#19415 and #13730 already cover the topic.

AI-assisted.

@oneandonlydean
oneandonlydean merged commit 4bd8689 into boykopovar:main Nov 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants