Repository navigation
Make the Xenoblade Chronicles: Definitive Edition profile work on Android (3/3): fps_limit 30, core_preempt lock - #642
Open
tapionallanaire wants to merge 2 commits into
Open
tapionallanaire wants to merge 2 commits into
tapionallanaire wants to merge 2 commits into
Conversation
On Horizon two threads of one core never run at the same moment: a running thread gives its core up only where it blocks, sleeps or yields, or when a higher-priority thread of the core preempts it. The host runs every guest thread on its own pthread, so threads of one core run side by side. Xenoblade Chronicles: Definitive Edition corrupts its heap at boot when they do: about one boot in four crashed 1-4 s into nnMain at changing sites (a memset of a size read from a resource block's footer, null and wild pointers in the heap's free-list walk), with or without a save. Not changed by core_preempt on, a barrier after file reads, DM_SPIN=0, DM_AUDIO=0 or DM_VK_WORKER=0; the whole process on one CPU with taskset made it worse (6 of 12), so it is the interleaving, not parallelism. core_preempt lock (profile) / DM_CORE_LOCK (switch): a guest thread whose affinity is one core holds that core's lock, a first-come ticket lock, while it runs guest code, and gives it up at each SVC and native HLE wait. A waiter of higher priority preempts the holder in guest code (SIGURG; in host code it is not stopped and the waiter signals again). Threads that may run on several cores, and host-owned guest threads, run free. It applies for the first DM_CORE_LOCK_SECS seconds (default 20; 0 = for good): held for good it cost Xenoblade 2-3 hitches of 70-100 ms in five minutes of play (a thread running 100 ms in guest code while the main thread waited for core 0). DM_CORE_SLICE_US adds a time slice for waiters of equal priority (default off; 4000 gave more hitches, not fewer). 0 of 60 boots crashed with it, on an AYN Thor (Snapdragon 8 Gen 2).
…re_preempt lock The game times its own 30 fps (33.23 ms a frame) and presents at interval 1, which beat against a 117.84 Hz panel: about one frame in seven stayed five refreshes. fps_limit 30 ticks in whole panel refreshes: 10,809 of 10,809 frames at exactly four refreshes over six minutes of Colony 9 (AYN Thor, SurfaceFlinger present times). About one boot in four crashed on a corrupt heap; core_preempt lock (previous commit) keeps two threads of one core from running at the same moment for the first 20 s: 0 of 60 boots crashed. README: the Android run (prologue to Colony 9), the Colony 9 road fix in the Vulkan replay, the pacing and the boot crash; save thumbnails black (open).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Xenoblade Chronicles: Definitive Edition 1.1.2 profile on Android:
fps_limit 30;core_preempt lock;Depends on #641 (
core_preempt lock): this branch includes that commit, so please merge #641 first. The README also describes the Colony 9 road fix in #640.Why
fps_limit 30makes the host's limiter tick in whole panel refreshes.Tested
AYN Thor (Adreno 740, Turnip v27.0.0-R1). The route was New Game → Sword Valley prologue (the Mechon M82 boss) → Colony 9: Shulk's first fights, the arrival event, the Commercial District from day to night, and save / load.
core_preempt lock.Open: save thumbnails are black (the README says why).
Proof (AYN Thor)
Present times of 5 min of Colony 9:
xcde-surfaceflinger-presents.tsv(9,026 of 9,026 frames at four refreshes).