[pr-fix][audio] audio: split XMA voice and ring locks with round-robin block pumping #714
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!714
Loading…
Reference in a new issue
No description provided.
Delete branch "ggwp/Darner:fix/audio-xma-locks"
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?
Contributor role (optional)
What it changes
Port of the XMA locking/pumping update from newer upstream CNF (
larp-hle/src/modules/audio.rs):The problem on
post-merge: Each XMA context guarded both its decoding state and its output ring behind a singleMutex<Option<Voice>>. The title sends ACP commands from its time-critical mixer thread, while the XMA decoder runs at ordinary thread priority — if the decoder thread is preempted while holding the voice lock, the time-critical mixer thread blocks waiting for decoding (priority inversion), causing audio stalls/dropouts and frame-pacing hiccups.Fix:
Slotwith two narrow locks:ring: Mutex<Taken>(held only over the shared ring read/write pointers, taken briefly once per decoded block so read commands never wait on decoding) andvoice: Mutex<Option<Voice>>(held for at most one decoded block at a time).Xma::pump), so when many rings empty simultaneously (e.g. after a load), every active voice receives its first block before any receives its second.How it was tested
e6f1156(based onpost-merge28a9b42; also run in-game in a combined build on AMD Radeon 8060S and RX 9070 XT)cargo test --offline -p darner-hle --lib audio— passedcargo clippy --offline -p darner-hle --tests— passedcargo build --offline --release -p darner— succeeded (combined build)e6f1156:cargo test,cargo clippy(passed).Checklist
post-merge.Checked for overlap
dsp.rsonly; this PR touchesaudio.rsonly, no overlap).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.