USE_COVERAGE instruments the build with clang's -fprofile-instr-generate
-fcoverage-mapping, exposed as the clang-coverage preset (build-coverage/,
inheriting clang-devel so the dev asserts stay on, Qt off since nothing in
the test path needs it).
The instrumentation is tree-wide rather than scoped to pcsx2/arm64: much of
the JIT is inline code living in headers that get pulled into core and common
translation units, so narrowing at build time would drop counters for exactly
the code we care about. tools/coverage.sh narrows at report time instead,
where the filter is exact.
The script builds the five gtest binaries, runs them with per-process profile
files, merges, and reports scoped to pcsx2/arm64/ (--scope all widens to the
other ARM64-only sources). Two hazards it defends against:
- cmake --preset takes the source dir from the working directory and ignores
-S, so running this through the /home/bmd/ARMSX2 symlink bakes the
symlinked path into every coverage mapping. It cds first.
- llvm-cov does not error when --sources matches nothing; it reports every
file it has data for, which reads as a plausible whole-tree number. The
filter prefix is read back from CMAKE_HOME_DIRECTORY so it always matches
what the compiler recorded, and a row-count tripwire fails the run if the
report escapes its scope anyway.
Baseline for pcsx2/arm64/: 74.65% lines, 79.94% functions, 77.70% regions.
Add ENABLE_MOBILE_GAMEDB_OVERLAY, defaulting ON for ARM64 Linux (UNIX AND NOT
APPLE) and OFF everywhere else, and have pcsx2_copy_runtime_resources copy
bin/resources-overlay/armsx2_overrides.yaml next to the executable when it is
set. The overlay lives outside the GLOB'd bin/resources/ tree, so desktop GPUs
never pick it up; it lands flat as resources/armsx2_overrides.yaml where the
GameDatabase override loader already looks for it on every platform (and no-ops
when absent, so x86/Windows/macOS builds are unaffected).
The gate is architecture+OS, not frontend: ARM64 Linux ships both the Qt and
the SDL frontend to handhelds (Rocknix/Batocera Qualcomm/Mali devices, Raspberry
Pi), all tilers that want the same mobile GS tuning, so a frontend-based gate
would miss the Qt handhelds. Packagers and the dev box can force it either way.
Verified on ARM64 Linux: option defaults ON, and a built frontend gets the full
338-entry overlay in its resources/ dir.
Pulls GV-6b (divide per vertex at accumulate time — the fused FindMinMax
covers varying Q), the ROV-heuristic/SW-sync-log warning cleanup, and
GV-CLOSE (GS_VERTEX_CROSSCHECK campaign scaffolding removed, including
the orphaned CMake option this tree carried).
The warning-cleanup hunks in GSRendererHW resolved to this tree's newer
upstream ROV shape, where the dead locals it removed (two_pass_alpha and
friends) never existed and full_barrier must stay mutable.
Merges yaps2/main (github.com/yaps2/yaps2, c16b88cb7) into ARMSX2,
replacing the arm64 recompiler family with the yaps2 JITs and importing
the yaps2 testing, perf, and libretro infrastructure. Common ancestor is
upstream PCSX2 342db5152 (2026-06-19); git auto-merged all but 38 files.
Replaced (deleted in this merge, recoverable from history):
- arm64/aR5900*, aR3000A*, aVU* -> arm64/iR5900*/iR3000A*/microVU*-arm64:
EE static-pin register file with lazy dirty tracking, dual-residence
allocator, IOP block linking, native COP2 macro ops, inline unaligned
fastmem, persisted VU program cache, call-ret shadow ring, VU0 spin
fast-forward.
- MVU_DIFF shadow-run hooks in shared VU interpreter TUs (superseded by
the offline vurunner JIT-vs-interp oracle).
Imported from yaps2:
- tests/ctest/core/recompilers: ~80 gtest suites (EE/IOP/VU differential
harnesses, fuzzers, ABI digest tripwire, capture format pins) plus the
gs_vertex_tests kernel oracle.
- pcsx2-vurunner / pcsx2-eerunner headless capture-replay runners.
- tools/perf counter-based A/B rigs, perf jitdump productionization,
PmuCounters, clang-perf/clang-handheld presets.
- pcsx2-libretro core (ENABLE_LIBRETRO, default OFF; rename pending).
- GS vertex-kick fast path (GV series): TBL-based packed parse,
register-resident kick, scalar-outcode cull, fused draw-rect/FindMinMax.
- Null renderer, VK_KHR_display direct WSI, swapchain PresentStats.
- SPU2 NEON mixer vectorization, EE timer read clamp (NFL 2K5 hang),
IOP ioman signed-compare fix, assorted UB fixes.
Kept from ARMSX2 in the both-touched files:
- iOS dual-map W^X and fastmem-unavailable resilience (Memory, HostSys,
vtlb). The split data/code area model is retained; both areas now take
fixed VA hints so cached VU JIT code stays deterministic on Linux.
- Android thread-affinity model, VMState shutdown early-outs, all
platform frontends, branding, CI, RetroAchievements identity/policy.
- GSDeviceVK: ARMSX2's push-descriptor decision logic (Mali crash gate,
proprietary-vs-turnip Adreno split) merged with yaps2's descriptor-pool
exhaustion recovery (flush + render-pass restart instead of dropped
binds). Vendor feature policy is the union: Mali fbfetch policy with
MediaTek/G57/Xclipse gates from ARMSX2; Adreno stencil/ROV/
test-and-sample-depth hang avoidance and no_ps2_z_quantization from
yaps2.
Build-system notes:
- The Qt debugger is now gated behind ENABLE_QT_DEBUGGER (default off on
arm64) so handheld builds drop the KDDockWidgets dependency.
- GSDeviceNone and remaining yaps2 GS code were ported to the newer
upstream GSTexture Usage-flags API.
The replaced backend's interpreter-fallback glue (intExecuteOneInst,
AndroidEEOpHist) and the EEDiffVerify runtime differ are retained for
now; dead pieces will be removed in a follow-up commit.
Extract the fused packed-vertex parse (STQRGBAXYZF2/STQRGBAXYZ2) and the
per-prim accept/cull decision out of GSState.cpp into pure free functions
(GS/GSVertexKick.h, namespace GSVertexKernels). No behavior change: gsrunner
frame hashes over all 15 local dumps are bit-identical on both the software
and Vulkan renderers.
New gtest target gs_vertex_tests pins the kernels against independent scalar
models of the GIF/GS semantics (plain integer C, no GSVector) over directed
edges (Q==+0.0 vs -0.0, 16-subtexel boundaries, duplicate vertices) plus
3.5M-case randomized sweeps per prim class. Optimized kernel implementations
in the GV campaign must pass the same suite bit-for-bit.
Also adds the GS_VERTEX_CROSSCHECK CMake option (default OFF) that later GV
items use to run legacy+new kernels side by side during dump replays.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adding pcsx2-libretro EXCLUDE_FROM_ALL when the core is disabled kept it
out of the default `all`, but the subdirectory still emitted an
unconditional install(TARGETS pcsx2-libretro) rule. That put yaps2_libretro.so
into the `install` target and left the target buildable, so install-driven
builds (ninja/make install, packaging) and "build all targets" flows (IDEs)
compiled the libretro core even when someone only wanted yaps2-sdl.
Gate the add_subdirectory on ENABLE_LIBRETRO so that when it's off (the
default) neither the target nor its install rule exists. Build the core
with -DENABLE_LIBRETRO=ON (as the nightly's libretro job already does).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ENABLE_LIBRETRO was only ever referenced (CMakeLists.txt gating the
pcsx2-libretro subdirectory), never declared with option(), so it was an
invisible undeclared variable — off by default but absent from cmake -LH,
ccmake, and the GUI. Declare it alongside the sibling frontend toggles so
the default is explicit and discoverable. The nightly's -DENABLE_LIBRETRO=ON
still overrides it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Libretro: Scaffold yaps2_libretro core (M1: builds + dlopens)
New pcsx2-libretro/ target producing yaps2_libretro.so (ENABLE_LIBRETRO=ON,
or built on demand). Milestone 1 of the libretro port:
- Full libretro v1 entry-point surface, version-script-restricted to
retro_* exports (PCSX2 internals must not collide with the frontend).
- Host:: implementations adapted from pcsx2-sdl: same CPU-thread state
machine (VMManager::Execute on a dedicated thread, RunOnCPUThread queue),
no windowing/clipboard/file-picker.
- retro_load_game boots the VM headlessly: GS renderer forced to Null,
Surfaceless WindowInfo, null audio; config+data self-contained under
<system dir>/pcsx2 (yaps2-libretro.ini).
- retro_run presents a placeholder XRGB8888 frame; no pacing yet.
- POSITION_INDEPENDENT_CODE forced ON (the pcsx2-sdl ET_EXEC persisted-JIT
trick cannot apply to a shared core).
Verified: builds in org.kde.Sdk 6.10 (gcc), dlopen + retro_api_version +
retro_get_system_info OK.
Next: M2 Vulkan negotiation interface (wrap vkCreateInstance/Device so
GSDeviceVK inits against the frontend-shared device, set_image handoff),
M3 frame pacing + libretro input/audio, M4 savestates/disk control.
* Libretro: M2 Vulkan context sharing + frame handoff (first light)
The lrps2-libretro pattern ported to the modern GSDeviceVK:
- VKLibretro.{h,cpp}: the loader's global vkGetInstanceProcAddr is swapped
for a wrapper that intercepts vkCreateDevice (merges the frontend's
required extensions/layers/features into GS's create info and captures
the shared VkDevice) and vkQueueSubmit (serialises against the frontend
through the HW-render interface queue lock).
- GSDeviceVK: adopts the negotiation-provided VkInstance/VkPhysicalDevice
instead of creating its own (and never destroys the frontend's instance);
the surfaceless BeginPresent branch publishes the merged display texture
(ShaderReadOnly + ExecuteCommandBuffer) into a mutex-guarded slot.
- Main.cpp: RETRO_HW_CONTEXT_VULKAN + context negotiation interface
(create_device opens MTGS from the frontend thread, so GSDeviceVK is
fully constructed before the context reply); the VM boot parks until
context_reset delivers the retro_hw_render_interface_vulkan; retro_run
consumes at most one published frame per call and forwards it via
set_image + video_cb(RETRO_HW_FRAME_BUFFER_VALID), dupe otherwise.
First light verified on Turnip Adreno 618 (and llvmpipe): GT3 boots
(VMManager::Initialize StartupSuccess), frames arrive hw_valid with a
non-black 640x448 readback.
Known gaps for M3: no frame pacing (VM free-runs; YAPS2_RUN_SLEEP=1 paces
headless runs), no libretro input/audio, m_current is sampled by the
frontend while GS may already be rendering the next frame (single
buffered), no OSD.
* Libretro: M3 frame pacing, joypad input, audio
- Pacing: PublishFrame now blocks the GS thread until retro_run consumes
the frame (one presented frame per retro_run; the frontend's cadence is
the emulation's vsync). Enabled at context_reset, aborted before any
path that could otherwise leave the GS thread parked (context_destroy,
retro_unload_game, VKLibretro::Shutdown). Static screens still dupe
thanks to yaps2's SkipDuplicateFrames -- the VM keeps 100% speed and the
frontend gets video_cb(NULL) for unchanged frames.
- Input: retro_run forwards the libretro joypad + both analogs straight
into the DualShock2 bind slots (Pad::GetPad(0)->Set), bypassing
InputManager; SDL input source stays disabled.
- Audio: AudioStream grows a public PullFrames() (frontend-driven pull
from the ring), SPU2 exposes GetOutputStream(), the config pins the
Null backend (mix into the ring, no device thread), and retro_run
drains the ring into audio_batch_cb with float->s16 conversion.
- Config: EmuFolders::Settings is now set explicitly (the libretro path
bypasses SetDataDirectory, so the INI used to land in the cwd).
Verified on Adreno 618 with GT3: internal fps 59.9, speed 100%, frames
publish on change, INI persists under <system>/pcsx2/inis.
* Libretro: Stable backbuffer ring + dynamic PAL av_info
Fixes the RetroArch heap-corruption crash ~2 minutes in (GT3 FMV -> demo
race transition): the published frame was the pooled m_current texture,
which GSDeviceVK recycles while the frontend still samples the view for
cached-frame replays. Frames are now copied into a dedicated ring of
three backbuffer textures owned outside the pool; on a resolution change
the displaced buffer is retired (kept alive until device teardown)
instead of destroyed, because the frontend can replay the old image
indefinitely (e.g. while its menu is open). Verified: headless harness
clean over 4+ minutes at ~100% speed, RetroArch session stable past the
previous crash point.
Also: when the booted VM reports a vertical frequency different from the
NTSC default (PAL 50Hz, progressive), retro_run pushes an updated
retro_system_av_info to the frontend.
* Libretro: M4 save states (retro_serialize/retro_unserialize)
SaveState grows in-memory zip variants sharing the existing disk code:
SaveState_ZipToBuffer writes the ArchiveEntryList into a libzip
buffer source (zip_source_keep + read-back after close), and
SaveState_UnzipFromBuffer opens one over the incoming blob; the whole
entry/version/screenshot pipeline is reused via a shared
SaveState_UnzipFromZip body, so the on-disk and in-memory formats are
identical (a retro state is a valid .p2s payload).
retro_serialize runs SaveState_DownloadState + ZipToBuffer as a blocking
RunOnCPUThread job with frame pacing temporarily disabled -- while the
frontend is inside retro_serialize it is not calling retro_run, so a
parked PublishFrame would deadlock the GS freeze. The fixed
retro_serialize_size bound is 68 MiB (DownloadState's 64 MiB working
buffer + slack); the actual zip length travels as a leading u64 inside
the block.
Verified on GT3 (Adreno 618): serialize 587 ms, unserialize 131 ms,
emulation continues cleanly after the in-place load.
* Libretro: M4 core options + disk control (m3u multi-disc)
Core options (RETRO_ENVIRONMENT_SET_VARIABLES): GS renderer
(Vulkan/Software; the software renderer still presents through the
shared Vulkan context, so the negotiation path is unchanged), internal
resolution 1x-4x (EmuCore/GS upscale_multiplier, live), fast boot and
widescreen patches. Startup values apply before LoadStartupSettings;
later changes re-apply via VMManager::ApplySettings on the CPU thread.
Disk control (SET_DISK_CONTROL_EXT_INTERFACE): .m3u playlists parse
into a disc list (relative entries resolved against the playlist dir),
single-disc content registers as a one-entry list, and closing the tray
swaps via VMManager::ChangeDisc on the CPU thread. m3u added to
valid_extensions.
Regression-tested on GT3: boot, savestate roundtrip and rendering
unchanged.
* Libretro: OSD via real present path into the backbuffer
The surfaceless BeginPresent no longer copies m_current and skips the
frame -- with the libretro context active it begins an actual present
render pass targeting the dedicated backbuffer (clear + viewport/scissor,
same sequence as the swapchain path) and returns PresentResult::OK. The
whole standard presentation pipeline now runs unchanged: PresentRect
draws the display aspect-corrected with TV shaders/linear filtering,
FullscreenUI::Render and ImGuiManager::RenderOSD draw the overlay, and
EndPresent (libretro branch) finishes the backbuffer, submits without
swapchain semantics and publishes the image to the frontend. The old
copy-based publish is gone.
New core option: yaps2_show_fps (EmuCore/GS OsdShowFPS).
Verified on GT3/Adreno 618: readback shows the ImGui FPS counter drawn
over the aspect-corrected frame; boot/savestate regression clean.
* Libretro: Fix retro_serialize bounds check to include the u64 length header
The check compared buffer.size() against the caller's buffer size, but the
write is sizeof(u64) + buffer.size() — a state within 8 bytes of the
reported serialize size would overflow the frontend's buffer.
* Libretro: Size the output canvas to the internal resolution
The present backbuffer was sized from the fixed 640x448 window info, so
the upscale option rendered internally at 2x-4x and then got scaled back
down before the frontend ever saw the frame.
The present path now tracks the merged frame: expand it to the target
aspect ratio (the internal-resolution screenshot rule), clamp it to the
advertised max geometry (2732x2048, 4x PAL at 4:3), and resize the
surfaceless "window" before the draw rect is computed so the whole
frame stays consistent. ResizeWindow learns to adopt a new size with no
swap chain, and retro_run reports geometry changes with SET_GEOMETRY so
the frontend keeps scaling correctly. Resizes are rare in practice (boot,
FMV/interlace switches, option changes) and reuse the existing
retire-don't-destroy backbuffer ring.
* Libretro: Core options v2 + video/performance options
Registers options through SET_CORE_OPTIONS_V2 with Video/Performance/
System categories and per-option help text (legacy SET_VARIABLES kept as
the fallback), and adds:
- Aspect ratio (Auto 4:3/3:2, 4:3, 16:9, Stretch) — the canvas sizing
follows it, and 16:9 pairs with the widescreen patches option
- Deinterlacing mode (Automatic/Off/Weave/Bob/Blend/Adaptive)
- No-interlacing patches (progressive output for supported games)
- Blending accuracy (Minimum-Maximum)
- EE cycle rate (50%-300%) and EE cycle skip speed hacks
* Libretro: Don't double-load the Vulkan library in EnumerateGPUs
The frontend preloads libvulkan for the context negotiation, and
EnumerateGPUs asserted (and would have unloaded the host's library) when
called with no device open — which is exactly the Software renderer
path, via D3D::GetPreferredRenderer. Use the already-loaded library and
leave it loaded.
* Libretro: Second wave of core options
Video: texture filtering, anisotropic filtering, software renderer
threads. Performance: hardware download mode (readbacks are expensive
on tile-based mobile GPUs), MTVU and Instant VU1 toggles. System: BIOS
selection (scanned from <system>/pcsx2/bios at option registration,
auto = first valid image) and cheats (.pnach loading).
* Libretro: Fix crash on content close
Two shutdown bugs, both hit on every quit-from-menu:
- GSDeviceVK::Destroy destroyed the negotiated VkDevice, but that device
belongs to the frontend (it made the vkCreateDevice call) and the
frontend tears it down after context_destroy — RetroArch was left
waiting on and destroying a dead device (freeze, then segfault).
Guard it like the adopted VkInstance already was.
- The frontend replays the last set_image indefinitely (menu background,
duped frames), so retro_unload_game now retracts the image and waits
for the GPU before VM teardown destroys the textures it points at.
Verified: 6/6 clean RetroArch exits after a full Vulkan content run
(was a reliable SIGSEGV on close before).
* Libretro: Reclaim retired presentation backbuffers
A resolution change retires the displaced backbuffer instead of freeing
it, because the frontend may still be replaying its image for a few
cached/duped frames. But the retired list was only cleared at device
teardown, so every interlace<->progressive switch (frequent in FMV-heavy
games) leaked a full-resolution render target for the rest of the
session.
Each retired backbuffer is now tagged with a monotonic present count and
reclaimed once kLibretroRetireFrames (6) presents have gone by --
comfortably beyond any libretro frontend's swapchain depth (2-3), and
GSTextureVK destruction is itself fence-deferred, so the underlying
Vulkan objects aren't freed until the GPU is done with them either.
Verified: GT3 boots/renders through its 640x448<->640x480 interlace
switches with no crash (harness + real RetroArch, clean exit).
* Libretro: Move libretro headers to 3rdparty/libretro
The libretro Vulkan HW-render interface header was pulled in by adding
pcsx2-libretro/ to PCSX2_FLAGS's INTERFACE include path, which leaked
onto every target that consumes PCSX2_FLAGS (and had the GS backend
reaching into the frontend's source dir).
Move libretro.h + libretro_vulkan.h into 3rdparty/libretro/ behind a
header-only INTERFACE library (libretro-headers), and link it PRIVATE
to the two targets that actually need it: PCSX2 (for VKLibretro.cpp) and
the pcsx2-libretro frontend. No other target sees the headers now.
The iOS job's CMake configure failed at cmake/Pcsx2Utils.cmake:20 with
'Unsupported platform.' — the platform dispatch had branches for Windows,
macOS (APPLE AND NOT IOS), Linux and BSD but none for iOS, so an iOS
configure fell through to FATAL_ERROR. Add an 'APPLE AND IOS' branch ahead
of the macOS one. Desktop builds are unaffected (IOS is false there).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Strip the legacy Android, React Native, Java, Gradle, and res/ directories from platforms/ios that were inherited from the original port. Configure the CMake build for the iOS target with local module discovery, PCAP and CURL guards, rapidyaml source path fixes, Vulkan disabled, lz4 build flags scoped, libjpeg-turbo skipped on iOS, and the Qt UI and test runners turned off. Set CMAKE_SYSTEM_PROCESSOR to arm64 for cross-compilation. Add a self-contained GitHub Actions workflow that builds an unsigned IPA for real devices using the iphoneos SDK, named with the commit SHA. Merge upstream master to stay current.
The unconditional add_compile_options("-march=armv8.1-a") lands after
CMAKE_CXX_FLAGS on the compile line, so the documented override recipe
(-march=armv8-a in the flags, as build-sdl uses) silently lost and every
Linux arm64 binary required LSE. First real ARMv8.0 hardware (RG43H Pro,
RK3562, 4x Cortex-A53) faulted on a casal in MTVU WaitForWork() at boot.
Gate the v8.1 default on the user not having chosen an -march.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Upstream 0beb18c9e ("Deps: Update rapidyaml to v0.11.1", 2026-03-29) deleted the
vendored 3rdparty/rapidyaml and switched to find_package(ryml REQUIRED), making
ryml a system/external dependency. That breaks self-contained and cross builds
(e.g. the rocknix handheld toolchain) which have no system ryml available.
Restore the in-tree copy (v0.10.0, from 0beb18c9e^) and point the build back at
it: add_subdirectory(3rdparty/rapidyaml) instead of find_package, and link
rapidyaml::rapidyaml. The C++ side needs no changes: common/YAML.cpp is already
version-guarded (0804b68fc "Common: Fix build with older ryml",
RYML_VERSION_MINOR >= 11) so it compiles against v0.10 unchanged. Also drop
ryml.dll from the Windows dep-copy list since it's now statically linked.
This is a deliberate fork-local divergence from upstream's un-bundling, kept so
downstream builders don't have to provision ryml themselves.
Configures without a system ryml and builds end-to-end (common + pcsx2-qt) using
the in-tree library.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Qt debugger and its KDDockWidgets dependency are gated behind a new
ENABLE_QT_DEBUGGER option (default ON, OFF on ARM64 handheld targets). When off,
the Debugger/* sources, the KDDockWidgets find_package/link/DLL-copy, and the
debugger entry points in MainWindow / QtHost / DebugSettingsWidget all compile
out, dropping the dependency entirely on builds that don't ship the debugger.
Co-Authored-By: Ryan Walklin <ryan@testtoast.com>
Co-Authored-By: Brian Degenhardt <bmd@bmdhacks.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CMake/preset wiring for the ARM64 target, the vixl C++20 enum-conversion warning
suppression, PmuCounters (cycle/instret PMU reads), and the Perf jitdump dir/enable
controls (EmuConfig.Profiler.EnablePerfDump, redirected out of /tmp into the cache
dir). Plus small platform/build fixes (ALSA thread naming, SmallString, X11 guards,
ARM MIDR CPU-name fallback, gcc lambda decay). The ARCH_ARM64 status banner now
reflects that EE/IOP/VU recompilers are all implemented.
Co-Authored-By: Ryan Walklin <ryan@testtoast.com>
Co-Authored-By: Brian Degenhardt <bmd@bmdhacks.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>