runtime: count XMA context and XApu command activity in the audio stand-ins #2100
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2107"
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 R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-25T00:29:29Z.
Title (draft):
runtime: count XMA context and XApu command activity in the audio stand-insChange
Refs #1145. Before any XMA decode work, this adds a way to observe what a caller does with the audio processor through the
desktop stand-ins. With
X2W_AUDIO_PERMISSIVE=1and the new opt-inX2W_AUDIO_ACTIVITY=1:AcpHal.dllkeeps a copy of the XMA context array thatAcpHalAllocateShapeContextshands out, compares it about every 10 ms andcounts contexts filled (all zero to nonzero), changed and cleared, plus HAL slot2 submits by their type argument. No field inside
a context is read or identified.
ApuFreeof the array ends the count before the block can be reused.xapu.dllcounts everyXApuEnqueueCommandcall by command class (the firstUINT32of the command), with no cap. Unreadablecommands and unknown handles are counted separately.
x2w_acphal_xma_activityandx2w_xapu_command_countsreturn the totals.is for review to confirm; the fixture cannot observe it directly. What the fixture's off case does check is the observable
behaviour: the exports return
FALSEwith zeros, no activity line is logged, and every return value, output, last error and thefinal context bytes match the run with the counter on.
The 64-byte context stride and the command class are stand-in conventions, not console contracts. The counter decodes nothing and
does not establish which counted event starts playback.
The first commit closes a code fence that was already open in
docs/experiments.mdand is a prerequisite: without it, the newdocumentation section, together with the existing "ApuFree in the AcpHal stand-in" section, renders as code and its links are not
checked by
tests/docs_links_check.py. It is one line and can be split into its own PR if you prefer.Verification
Commit under test:
73728f98(base5a0b0aad).I have not run this on Windows. The pull-request job (
cmake --build --preset pr,ctest --preset pr) does not build thestartup stand-ins or run their fixtures, so a green PR check does not cover this change. That is the same for the existing
startup_acphal_apu_freeandstartup_xapu_queuefixtures. A Windows result for both configurations comes fromActions → Windows checks → Run workflow on this branch (
workflow_dispatch), or from the main-branch run after merge.Supporting evidence only (Linux host, clang-cl/xwin cross build, run under Wine):
startup_acphal_xma_activity:case on: ok,case none: ok,case off: ok,startup_acphal_xma_activity: ok, exit 0 (4.4 s).ctest --no-tests=error -R '^startup_(acphal|xapu|stubs$|local_log)' -V:startup_acphal_apu_freeandstartup_xapu_queuepass.startup_stubsresolvesAcpHal.dll10/10 andxapu.dll6/6 exports. Under Wine it also fails one unrelated case(
dstorage page-array control), and it fails that case the same way on the base commit.startup_local_logis run becausesrc/startup_stubs/local_log.hgains one inline helper. Under Wine it exits 5 with twoFAIL lines (
concurrent logf lines are all present and intact,concurrent logging child passes), the same as on the basecommit; its four
_controltests pass.tests/docs_links_check.py: 402 links, none broken.tests/bidi_controls_check.py: clean. Platform-independent Python checks(the CI list): 80 of 80 pass.
Not measured: Windows CI, the CMake presets on Windows, the Windows loader, and Windows timer resolution (the 10 ms sample period
depends on it).
Evidence and follow-up
The fixture is source-built and uses only synthetic inputs: one caller script, run in three child processes.
(classes 1, 2 and 0x20), plus one null command and one command on an unknown handle. The exports and the summed log lines must give
exactly these counts. The freed array must come back from
ApuAllocas the same block, and writes to it must not be counted.no line may be logged.
FALSEwith zeros, and no line is logged.Negative controls: I applied each mutation to the final tree and confirmed the fixture fails, each time on the check it targets:
ApuFree;control);
ApuFreenot returning the block;Next step for #1145: use these counts to see whether an application writes or enables XMA contexts, and which counted event goes
with it, before any decoder work.
Checklist
docs/startup-runtime.md,docs/experiments.md).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:37:28Z.
Review: CHANGES_REQUESTED
The opt-in AcpHal sampler runs forever after its first event and closes its thread handle immediately. A regular DLL client can FreeLibrary while that worker is asleep or inside the sampler, leaving it with a return address in the unloaded module. Please tie sampler lifetime to the DLL use (or use synchronous observations), and add a source-built test that loads the DLL, starts activity, then unloads it in a child that stays alive and exits cleanly. Please also run the actual stand-in tests on Windows; the fast PR job does not run them.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:49:30Z.
Review: COMMENTED
Review of head
73728f9854c442ec9fbec47baa4521a9ed2682dd(external PR, comment only).Commands executed
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.gh pr checks 2107: Linux Python checks, Windows build and gfx1013 fixtures pass; the /O2 and chart jobs are skipped.git diff --check origin/main...HEAD: clean.python3 tests/bidi_controls_check.py: pass.python3 tests/docs_links_check.py: pass (18 files, 402 links).startup_acphal_xma_activity,startup_stub_acphal,startup_stub_xapu, ctest-R startup_acphal_xma_activity: Debug 1/1 passed, Release /O2 1/1 passed.--scope directand the explicit targets above. This does not run the rest of the suite.Mutation
src/startup_stubs/acphal.cpp:152: swapped thechangedandclearedcounters (now ? activity.cleared : activity.changed).startup_acphal_xma_activityFAILED (expectedxma.changed=3 xma.cleared=2). The mutation is killed. Reverted withgit checkout -- ..Findings
src/startup_stubs/xapu.cpp(activity_thread, summary line):commands=counts classes plusunreadablebut notrejected, whilerejected=is printed on the same line. A reader may expectcommandsto be every call. Consider naming it in the doc line or in the log text.src/startup_stubs/acphal.cpp:129-146(sample_locked): sampling is a 10 ms poll, so a context filled and cleared between two samples is not counted. The comment and docs already say this. Fine as documented.src/startup_stubs/acphal.cpp(watch): ifAcpHalAllocateShapeContextsruns again without anApuFreeof the old array, the old shadow is replaced after one last sample. This is handled correctly. A test for this path would be a nice extra.Checked and fine: the activity code is off unless
X2W_AUDIO_ACTIVITY=1. Theunwatchcall under the lock inApuFreeruns beforeheap_give, so the sampler thread cannot read a reused block.GetLastErroris saved and restored. The unreadable command is guarded byx2w_local::readable.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:41:48Z.
Review: COMMENTED
Re-review of head
f4b2d80b2d52b78268b5ce7e485493a59b0bea6d(previous review was on73728f98; the new commits are the round-1/round-2 fixes plus merges of main).Scope read:
src/startup_stubs/acphal.cpp,xapu.cpp,local_log.h,CMakeLists.txt, docs,tests/startup_acphal_xma_activity.cpp(git diff --stat origin/main...HEAD: 9 files, +869/-1; clean-room, title neutral, mergeable).Commands executed locally
git diff origin/main...HEAD --check-> clean (rc=0)python3 tests/docs_links_check.py-> self-test passed, 18 files / 412 links OKpython3 tests/bidi_controls_check.py-> 1480 files, no bidi controlsgh pr checks 2107-> Linux Python checks, gfx1013 fixtures and Windows build+test all pass on this headWhat I verified by reading
X2W_AUDIO_ACTIVITY), no thread, nothing runs outside a call into the DLL, so unload leaves no code running (the new unload case covers it).watched,shadow, counts, ticks) is only touched underactivity_lock/count_lock; logging happens after the lock is released;GetLastErroris preserved on every counted path.ApuFreeof the watched array samples first, then dropswatched/shadowbefore the block can be reused, so no read of freed memory; a secondAcpHalAllocateShapeContextssamples the old array before swapping.u64(no padding), so thememcmp"did a count move" test is sound. Snprintf use guardsused >= sizeofbefore the next write; worst-case truncation only shortens the line.Findings
acphal.cpppoll_locked):types[256]/classes[320]can truncate if every bucket has a 20-digit delta; harmless, but the doc could say "line may be shortened".xapu.cppcount_command): the command class is the first UINT32, a stand-in convention; the docs already say so, keep it labelled that way if a real layout is found.Not done: I could not run the new CTest or a logic mutation locally: the stubs use MSVC
__try/__except(local_log.h:75), which the Linux mingw toolchain here cannot build, and I did not queue the Windows VM (not needed: no shader/gfx2hlsl change). The Windows CI result above is my only runtime evidence.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-25T03:36:16Z.
Thanks for the reviews. Two new commits on top of
73728f98, then a merge ofmain:6f9d0702(gh #1145 review round 2107-1) andc8067462(gh #1145 review round 2107-2). The branch merges cleanly with currentmain. Aftergit fetch origin,main009153b7is merged into the branch (f4b2d80b);git merge-tree --write-tree --name-only origin/main HEADatf4b2d80bagainstorigin/main009153b7printed only the tree id6d0a89a1and exited 0, with no conflicted files.Sampler lifetime (R0Y00). Both stand-ins no longer start a thread. AcpHal now compares the XMA context array with its copy only inside the calls that count:
AcpHalAllocateShapeContexts;ApuFreeonce counting has started;x2w_acphal_xma_activity.It samples at most once per 10 ms, except where a call needs a final sample (re-allocation,
ApuFreeof the watched array, the export). A counted call made at least a second after the DLL's previous line (or after its first counted call) writes the next line, but only if a count moved. Until then, the counts wait for a later call. As a result, counts from the last second before a caller's final call, and changes made after that call, are never logged, though the exports still return them. xapu does the same fromXApuEnqueueCommandandx2w_xapu_command_counts.I chose synchronous observation over keeping a worker thread, for three reasons:
FreeLibraryAndExitThreadwould be safe, but nothing could ask it to stop:DLL_PROCESS_DETACHnever arrives while the worker holds its reference. The DLL would then stay loaded after the client'sFreeLibrary, so the sampler still would not follow DLL use.DLL_PROCESS_DETACHwaits for a thread exit, and thread exit needs the loader lock thatDllMainalready holds.SetThreadpoolCallbackLibrarydepends on loader and pool behaviour that I cannot check on both Windows and Wine.With no thread, no code from either DLL runs except during a call into it. The cost is the logging gap above, and the sampling interval now follows the caller's call rate. The docs state both.
Unload test.
startup_acphal_xma_activityhas a fourth child case,unload, which runs with permissive and activity on. It:FreeLibraryon both DLLs;GetModuleHandleExA(FROM_ADDRESS)that both images are unmapped;The per-case wait is now 12 s, so all four cases fit the 60 s CTest timeout.
tedin7 P3s.
commands=vsrejected=: the xapu line now reads...; rejected=1 (not in commands), and the docs say thatcommands=is the classes plus the unreadable commands.AcpHalAllocateShapeContextsrun again withoutApuFree: the unload case covers this. A change to the old array before the second call is counted (by its last sample). A later change to the old array is not counted, and a fill of the new array is. Expected result:watched=4 live=1 filled=2.Results. Linux, clang-cl/xwin cross build, run under Proton Experimental Wine:
At
f4b2d80b(clean tree):ctest --test-dir out/build/w1 --no-tests=error -R '^startup_acphal_xma_activity$':Test #127: startup_acphal_xma_activity ... Passed, 1/1, exit 0.windows.yml(92 checks):all 92 checks passed.docs_links_check.py: 18 files, 412 links, pass.bidi_controls_check.py: pass.At
6f9d0702(clean tree),ctest ... -R '^startup_(acphal|xapu|stubs$|local_log)':startup_acphal_apu_free,startup_xapu_queueandstartup_acphal_xma_activitypassed.startup_local_logfails on its concurrent-lines check here. It failed the same way before this PR's review rounds.startup_local_log_reopen_controlfailed once and passed on re-run, which looks like a flake.startup_stubsfails because itschadconsumer scenario times out after 20 s. That scenario is outside this PR: its sources (tests/startup_stub_consumer.cpp,tests/startup_stub_check.py) name neither stand-in. On this same Wine setup it passed (chad: exit=0xe2570200 ok) at6a0b89aa,77b30ac1andmain32595645. It has failed since the base moved to5a0b0aad, including with this round'sacphal.cppandxapu.cppreverted to73728f98. The cause is not established.Mutations. Each was rebuilt, run, then restored and checked by hash. The first four ran at
6f9d0702; the last atc8067462:acphal.cppas at73728f98(thread handle closed, thread never joined)FAIL: case unload exited 0xc0000005xapu.cppas at73728f98FAIL: case unload exited 0xc0000005AcpHalAllocateShapeContextsskips the last sample of the old arrayFAIL: re-run without ApuFree: ... fields 4 1 1 ...FAIL: the stand-in is unloaded after FreeLibraryc8067462)FAIL: zero-write control logs no activity lineNot measured: any run on Windows. The stand-in tests have not run under the Windows loader or with
ctest --preset dev/release, and the PR job does not build these targets. No Windows run of this fix commit has been made yet.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T09:56:29Z.
Review: COMMENTED
Re-review of head
5c2715dd23957580648f7d789519588f19adad85(new since the last reviewed head: one commit,audio: count unreadable XApu commands on the early E_POINTER path, plus a merge of main).What changed
src/startup_stubs/xapu.cpp:266: the earlyE_POINTERreturn inXApuEnqueueCommand(null or unreadable 0x60-byte header) now callscount_command(hr_pointer, nullptr)before returning.Findings
command_header_sizebytes, whilecount_commandonly needs 4. A command pointer that is readable for 4 bytes but not for the whole header used to be counted by its class and is now counted asunreadable. That matches the "refused as unreadable" comment and theE_POINTERresult, so I think it is the right call. The docs and the comment at the top of the counter already say a command the call cannot read counts as unreadable.count_commandcallsreadable(nullptr, 4), which is false, so the call lands inunreadableand not inby_class[0]. A null command is not confused with class 0. The full-ringE_OUTOFMEMORYpath still goes through the normal class count at line 279.GetLastErroris saved and restored. WithX2W_AUDIO_ACTIVITYoff, the call returns before any work.tests/startup_acphal_xma_activity.cpp:266(null command) expectsunreadable = 1at line 286, so it covers the new line. The first-pass finding is therefore addressed.Commands executed locally (Linux)
git diff f4b2d80..5c2715ddfor the PR files, andgit show 5c2715dd: one line added inxapu.cpp.python3 tests/docs_links_check.py: "Checked 18 Markdown files and 442 links."python3 tests/bidi_controls_check.py: "no bidirectional controls."git diff --check origin/main...HEAD: clean.gh pr view: mergeable.gh pr checksat review time: Linux Python checks pass; the Windows build/test and the gfx1013 fixtures job were still pending.Not done
unreadable0 and the null-command expectation at line 286 fail. A Windows job should confirm this.gfx2hlslcode, so I did not queue the Windows VM. Please wait for the pending Windows CI job before marking Ready.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:52:41Z.
@JohnConnorNPC could you rebase this branch onto current
mainand force-push?GitHub reports head
5c2715ddas conflicting withmain, so it cannot be merged as is.Files that conflict with current
main(4aaea119):src/startup_stubs/xapu.cppCommands run locally:
Once it is rebased and CI is green it will be re-checked right away.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:58:04Z.
Review: APPROVED
Reviewed
b8cbea6cmerged over currentmain4b0350ea. The merge is clean andgit diff --cached --checkis clean.R0Y00's request on
73728f98is addressed.acphal.cppandxapu.cpphave noCreateThread,_beginthreadorstd::thread.AcpHalAllocateShapeContexts,ApuFreeonce counting has started, and the export. It does this at most once per 10 ms. The line is written from a counted call and logged after the lock is released.ApuFreeof the watched array stops the watch beforeheap_givecan decommit or reuse the block.FreeLibraryon both, checks withGetModuleHandleExthat both images are unmapped, then stays alive 1.5 s and must exit 0.X2W_AUDIO_ACTIVITYunset, the export returnsFALSEand the counted calls return before reading caller memory.What I ran. I did a full build in
devandrelease, then ranIn both presets, 5/5 pass:
startup_acphal_xma_activity,startup_acphal_apu_free,startup_xapu_queue,cpu_native_acphal_halandcpu_native_xapu_queue. I then ranstartup_acphal_xma_activity3 more times in each preset, and every run passed.Mutants. For each, I rebuilt the two stand-ins and the new test in
dev, then ranstartup_acphal_xma_activity,startup_acphal_apu_freeandstartup_xapu_queue:activity_on()always trueTRUE)activity_on()always truechangedandclearedswapped insample_lockedApuFreeof the watched array keeps watchingafter free and reuse)AcpHalAllocateShapeContextsskips the final sample of the old arrayre-run without ApuFree)E_POINTERrefusal not counted as unreadableXApu commands, summed lines)count_commanddoesn't restore the caller's last errorRestored and rebuilt afterwards;
git diff --quietis clean.Non-blocking.
count_commandis unpinned. The sentinel transcript would catch a stand-in that changes the last error, but nothing betweenGetLastErrorandSetLastErrorincount_commandchanges it in these runs. So dropping the restore goes unnoticed. That's harmless today. It only matters ifreadable()orlogfstart touching the last error.Build and test on Windowspasses onb8cbea6c, and the runs above are on Windows.Verdict: approve on
b8cbea6c.Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10 (no GPU tests in this set).
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass onb8cbea6c.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T00:42:20Z.
I merged current
main(b1e92256) into this branch as0ce61ab3, a plain merge commit with no rebase or force-push. It was approved atb8cbea6c, but it conflicted withmain.Conflicts. Both were additive, and I kept both sides:
src/startup_stubs/local_log.h: this branch'sprocess_seconds()comes first, followed bymain's probe pre-check helpers (faults_avoided,mapped_prefix,precheck_enabled) from #2846.src/startup_stubs/xapu.cppinXApuEnqueueCommand:main's#ifdef X2W_HAVE_OPUSrefusal counters come first, followed by this branch'scount_command(hr, ...).One thing for the author.
mainadded a new early return inXApuEnqueueCommand(short decode command -> E_POINTER, inside#ifdef X2W_HAVE_OPUS). It returns beforecount_command, so with Opus enabled that refused call isn't counted. TheE_POINTERreturn above it does callcount_command(hr_pointer, nullptr). I didn't add the call myself, because that path builds only withX2W_WITH_OPUS=ON, and I couldn't build or test it without libopus. If you want every call counted, addcount_command(hr_pointer, reinterpret_cast<const void*>(rdx));before that return.What I ran on
0ce61ab3:devandrelease.ctest --test-dir out/build/release --no-tests=error -R '^(startup_acphal.*|startup_xapu.*|startup_stub.*|startup_probe.*|cpu_native_acphal_hal|cpu_native_xapu_queue)$' -E '(_hardware$|startup_audio_)'. All 6 pass, includingstartup_acphal_xma_activity.ctest --test-dir out/build/dev --no-tests=error -j 8 -E '(_hardware$|startup_audio_)'. 1963 of 1975 pass.-j 8load. All ten pass when rerun alone with-j 1.startup_compute_dispatch_native_warpandnative_rtv_variant_warp. They fail onmainitself since #2820 (revision.txtin the cache) and aren't related to this branch.A different reviewer will re-review the merged head.
Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; D3D12 WARP.
This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T00:54:31Z.
Review: APPROVED
Retested
0ce61ab3(the merge ofmainb1e92256intob8cbea6c) integrated over currentmain86beae95(tree4287c49e). The trial merge is clean andgit diff --cached --check origin/mainis clean.The merge commit's two resolutions look right to me.
git show --remerge-diff 0ce61ab3shows that only the two conflicted files differ from a plain merge:src/startup_stubs/local_log.h: this branch'sprocess_seconds()is kept whole, with its closing brace.main's probe pre-check helpers follow unchanged. Nothing from either side is dropped.src/startup_stubs/xapu.cppXApuEnqueueCommand:main's#ifdef X2W_HAVE_OPUSrefusal counters run first, after the lock is released. This branch'scount_command(hr, rdx)follows, before the first-calls log. So every call that reaches the end of the function is still counted, with the finalhr.What I ran. I did a full build in
devandrelease, then ran6 of 6 pass in each preset, with no skips:
startup_acphal_apu_free,startup_xapu_queue,startup_acphal_xma_activity,startup_stubs,cpu_native_acphal_halandcpu_native_xapu_queue.Mutant on the resolved line: I removed
count_command(hr, …)after the Opus block.startup_acphal_xma_activityfails, printing its expected totals (xapu.commands=7, …) against the summed lines. So the counted call is still pinned at its new position. My earlier mutant table onb8cbea6ccovers the rest of the branch, which this merge doesn't change.Non-blocking, same as the merge comment: with
X2W_WITH_OPUS=ON, the newshort decode commandearly return (xapu.cpp, inside#ifdef X2W_HAVE_OPUS) returnsE_POINTERbeforecount_command, so that refusal isn't counted. I didn't build the Opus configuration (no libopus here).My two earlier non-blocking notes on
b8cbea6cstill apply: the last-error restore incount_commandis unpinned, and the PR description is stale.Verdict: approve on
0ce61ab3. R0Y00's changes-requested review on73728f98still stands. I addressed its request atb8cbea6c, but only R0Y00 can clear it, so I'm not merging.Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU tests in this set.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on0ce61ab3.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T03:45:01Z.
Thank you for merging main and for the approval, @pigalot. I took your
count_commandsuggestion:count_command(hr_pointer, reinterpret_cast<const void*>(rdx));now sits before the early short-decode-commandE_POINTERreturn, so the call is counted as class 3, like the in-lockE_POINTERrefusals. The "Not counted" sentence in the doc is updated andexperiments.mdlists the new command.A new case in the
xma_activitytest pins it: a type 3 command whose 8-byte header ends where unallocated address space begins, expecting class 3 = 1 and commands = 8. Removing the line turns the Opus build red (xapu.commands=7, noxapu.3) and restoring it passes again. The pin needsX2W_WITH_OPUS=ON; the default build stays green either way.With Wine (Linux), the Opus build has the same 8 failures as main at
0ce61ab3and the default build the same 6.xma_activitypasses in both.docs_linksandbidipass. I have not run this on native Windows.@R0Y00, pigalot approved
0ce61ab3, the merge this commit builds on; when you have time, could you re-review so CHANGES_REQUESTED can clear?This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T03:52:27Z.
Review: APPROVED
Retested
cdab51a0, integrated over currentmainfdba6e15(tree1a409785). The trial merge is clean, andgit diff --cached --check origin/mainis clean.What changed since my approval of
0ce61ab3: one line inxapu.cpp, plus a test case and doc updates. Inside#ifdef X2W_HAVE_OPUS, the short-decode-command refusal now callscount_command(hr_pointer, rdx)before it returnsE_POINTER. This addresses the non-blocking point I made on0ce61ab3.I traced it by reading the code. By that point the 8-byte
command_header_sizeread has already passedreadable, andcount_commandreads only the firstUINT32after its ownreadablecheck.hr_pointerisn'thr_handle, so the call lands inby_class[3]. That matches how the in-lockE_POINTERrefusals are counted, and the line runs after thetype3_commandsandrefused_short_commandOpus counters, so it doesn't change them.I couldn't build or run the Opus configuration. No libopus is installed here, and no CI job or preset sets
X2W_WITH_OPUS. So the added line is checked here only by reading the code, plus JohnConnorNPC's Wine run, which showsxapu.commands=7with the line removed.What I ran (default build). I did a full build in
devandrelease, then ran7 of 7 pass in each preset, with no skips:
startup_acphal_apu_free,startup_xapu_queue,startup_acphal_xma_activity,startup_stubs,docs_links,cpu_native_acphal_halandcpu_native_xapu_queue.Controls on the new test case (default build):
{"xapu.3", 1}removed from the test's expected totals,startup_acphal_xma_activityfails. So the short command does reach the counter and is classed as 3 without Opus, and the case isn't silently skipped by itsfree_aftercheck.X2W_PROBE_PRECHECK=1line removed fromspawn, the test still passes. As far as I can see,probe_readablealready refuses the free tail under__try, so precheck only avoids a first-chance fault. That matches the comment, which says the tail is "refused without a fault".Non-blocking: the short-command check runs before the handle lookup. So in an Opus build, a short type 3 command on an unknown handle counts as class 3, not as
rejected=, while the default build counts it asrejected=. The ordering was already there before this commit; the new line only makes it visible in the counts. If that's intended, a sentence instartup-runtime.mdwould cover it.Verdict: approve on
cdab51a0. R0Y00's changes-requested review on73728f98still stands, and only R0Y00 can clear it, so I'm not merging.Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. No GPU tests in this set.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass oncdab51a0.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T04:07:57Z.
Review: APPROVED
Independent native Windows review of
cdab51a0, integrated with mainf41806a9as treecd7c4e2a. Release /O2 passed 3/3 with Opus disabled. Using the installed libopus 1.5.2, Debug and Release /O2 passed 3/3 each withX2W_WITH_OPUS=ON. No skips.Removing just the short type-3 command's counter made the Opus Release fixture fail. After restoring the source and relinking, the same test passed. The existing fixture also covers on/off/zero-write behavior, unchanged return and error values, reallocation and DLL unload. The final source keeps polling inside the opt-in calls, with no worker thread.
Windows 11 26200.9974, MSVC x64 19.51, Windows SDK 10.0.26100.0. No GPU or original executable used. On the current merge base the tested audio source, build and fixture files are unchanged.