acphal: allocate all SHAPE contexts and stop faking the ACP channel #511
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/511"
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 brcly/TuxBox. Originally posted by csj0oe on 2026-11-29T18:08:53Z.
What
AcpHalCreatereturned a 32-slot vtable whose every method returnedS_OK, soConnectandSubmitCommandsucceeded while audio commands vanished.AcpHalAllocateShapeContextshandled only XMA and returnedE_NOTIMPLfor any PCM/SRC/EQ/DMA counts.SHAPE_CONTEXTSis declared inruntime/acphal/abi.hand pinned bystatic_asserts: six context arrays allocated, validated and released.IAcpHalis a real six-slot implementation. A second allocation returnsACP_E_ALREADY_ALLOCATEDinstead ofS_OK.Connect,SubmitCommandandDisconnectkeep theS_OKresults earlier builds reported, so the title's audio path behaves as before; each writes one warning naming the call and its arguments that the ACP command queue is not implemented.PopMessagestill returns false andGetNumMessageszero.acphal-control.exeproves invalid shapes fail, XMA and all-six shapes pass, and heap bytes match the declared sizes. It is wired as atuxbox.py verify --only acphalgate.Verification
hr == ACP_E_ALREADY_ALLOCATED (hr=0x00000000).acphal PASS shapes=xma,all-six,invalid,max-xma channel=honest.cargo check --target x86_64-pc-windows-msvc -p tuxbox-acphal --testspasses.PASS acphalunder Proton GE;python tuxbox.py check --no-gpu10/10.The analysis this came from also had the ACP error values wrong; the declaration pins
0x8AC80001,0x8AC80002and0x8AC8000A.Not covered
AcpHalReleaseShapeContextscall sites andACP_E_NOT_ALLOCATEDon a second release were not traced in a Frosty teardown.ApuCreateHeapandApuAllocare unchanged and outside this change.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T20:37:58Z.
Thanks. Allocating every SHAPE context properly and returning
ACP_E_ALREADY_ALLOCATEDfor a second allocation both look right.The part that holds it:
Connectnow returnsE_NOTIMPL, which by your own description makes a title's audio init fail where it used to succeed silently. ProjectScarlett has working audio onmaintoday, so before we merge this we need a game run showing it still starts and still has sound with this change. If it does callConnect, I'd keep the current behaviour (or log loudly instead of failing) until the ACP queue is implemented, and land the context allocation on its own.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T21:11:45Z.
Thanks, this addresses what I raised. It conflicts with
mainnow (after tonight's merges); could you rebase it? Then we'll run it through the check and merge.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T22:03:02Z.
Heads-up: we rewrote
main's history tonight (one commit per merged PR, to drop files that came in with intermediate commits), and this branch is still based on the oldmain(on the old #512 merge,39463ea5). That's why GitHub now shows it with dozens of commits that aren't yours. Your own commits are the ones after39463ea5; this replays only those onto the newmain:Sorry for the extra step.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:26Z.
Heads-up: main just landed a large cleanup (up to
e5d2e913), so this PR needs a rebase.rustfmt.toml).unwrap(), lossyascasts and undocumentedunsafeoutside tests.cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.The least painful way is to format your branch first, so the rebase only shows real changes:
Then run
python tuxbox.py check --no-gpu, which now includes the format step.If clippy flags something new:
Fromfor widening,TryFromfor narrowing, and a mask for bit fields.unwrap(): use?, orexpectwith the reason it can't fail.unsafeblock: it needs a// SAFETY:comment.CONTRIBUTING's "Code checks" section lists the commands. Thanks!
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:52:23Z.
Thanks for the rebase. The behaviour is now what we discussed. One thing blocks the merge, though, and one is still outstanding.
1.
abi.hhas to be in our own words. The new header's type, field and constant names, its error-code names, the order of its declarations, and its reference to "the two heaps apu.h describes" all match the GDK's own headers name for name. Those headers are under a confidentiality notice, and the project copies nothing from them (see AGENTS.md: GDK material stays out of the repository). The binary layout itself is an interoperability fact we can state: the sizes, offsets, the slot order and the result values. But please:src/lib.rsalready does), not the SDK's;2. Still needed: a game run with sound, as the PR's own "Not covered" section says. Once the header is reworked I'll boot ProjectScarlett with it myself, check that audio starts and plays, and look for the new warnings in the log.
Imported from brcly/TuxBox. Originally posted by csj0oe on 2026-11-30T10:04:43Z.
Reworked, second commit
503929f7, layout unchanged.abi.hnow names everything in this repository's style:apu_context_setwithsrc_count…pcm_count,src_host…pcm_host,src_apu…pcm_apu, the kind sizes assrc_context/eq_comp_context/…,MAX_*_CONTEXTS,ACP_ALREADY_ALLOCATED/ACP_NOT_ALLOCATED/ACP_NOT_CONNECTED,acp_message,acp_channel,apu_heap_state. The export names stay as they are because those strings are the ABI.abi.cpp,guest.cpp, the README and the Rust doc comments (including theapu.hcitations insrc/lib.rsand the tests), which is where the field names were repeated.Measured:
python build.py acphal, then the control under GE-Proton printsacphal PASS shapes=xma,all-six,invalid,max-xma channel=honest; 13 Rust tests pass on the Linux target; Windows typecheck passes;check --no-gpuis 11 passed, 1 failed, the failure being the pre-existingredundant_cloneatruntime/dxbc/src/fssm.rs:121that this branch does not touch.On your second point I have no audio evidence of my own to add, so I will leave the boot to you rather than guess at it.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T19:13:29Z.
Thanks,
abi.hreads as our own now: none of its names follow the SDK's.One leftover: the two Rust constants this PR adds in
src/lib.rs,ACP_E_ALREADY_ALLOCATEDandACP_E_NOT_ALLOCATED, keep the SDK's spelling. Please name them like theirabi.hcounterparts (ACP_ALREADY_ALLOCATED,ACP_NOT_ALLOCATED). The older SDK-style names already onmain(APU_E_HEAP_*and others) predate this PR and are ours to clean up separately.After that, I'll do the audio boot I promised and merge if sound starts and plays.