Tests under Wine: the decoded XMA2 voice loses the title's context at the first GetState (null of 0x3003), so the audio checks cannot be exercised on the Linux lane #2481

Open
opened 2026-11-26 05:31:45 +00:00 by github-bot · 2 comments
Owner

@⁠pablogonz12 on GitHub · 2026-11-25 19:57 UTC · original

On Linux under Wine, the decoded (XMA2) source-voice test gets a null context from GetState at its first call, before any buffer ends, so the XMA2 context checks fail on that lane — on main and on #2410 alike. This is not #2386's ended-buffer race (that one needs OnBufferEnd to have run first) and it is not diagnosed here, just reported with a reproduction.

Setup

  • CachyOS (Arch), kernel 7.3.6-1-cachyos-eevdf, Mesa 26.3.1-5 (RADV GFX1201), AMD Radeon RX 9070 XT 16 GB, Ryzen 9 9900X.
  • GE-Proton11-14 wine (Wine 11.0), scratch prefix, WINEDEBUG=-all, WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b", VKD3D_CONFIG=ignore_shared_fence, DXC 1.9.2609.5.
  • main 2898511, release, x86_64-pc-windows-msvc static (RUSTFLAGS="-C target-feature=+crt-static").

Reproduction

RUSTFLAGS="-C target-feature=+crt-static" cargo xwin test -p xcl --lib --release \
    --target x86_64-pc-windows-msvc --no-run
WINEPREFIX=<scratch> WINEDEBUG=-all wine <target>/x86_64-pc-windows-msvc/release/build/xcl/*/out/xcl-*.exe \
    --test-threads=1 xma2
test hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime ... FAILED
thread '…xma2_source_voice_decodes_and_manages_lifetime' panicked at crates/xcl/src/hle/xaudio2.rs:1599:13:
assertion `left == right` failed
  left: 0
 right: 12291

12291 is 0x3003 = the test's CTX_VALID. The line just above (assert_eq!({ st.buffers_queued }, 2)) passes, so two submits were recorded; only the context is missing. left: 0 means GetState answered pCurrentBufferContext = null, the value the vtable-form test asserts against right after SubmitSourceBuffer, with no buffer ended in between.

The same symptom in the e2e test title (e2e integration test, test_title_runs_and_game_folder_is_untouched): 48 [PASS] lines, and among the two [FAIL] lines

[FAIL] XAudio2: console flags/device, XMA2 & Opus voices decoded, PCM passes, callbacks: XMA2 GetState: ctx=0x0, queued=1

(the other [FAIL] is the window-cloak check, which Wine cannot satisfy). With #2410 applied the value stays ctx=0x0, so the Wine lane cannot be used to validate that fix, although the PR's own unit test get_state_context_survives_buffer_end does pass here.

What would settle it

  • A run of the same test on Windows: if TestState/GetState returns 0x3003 there at the same point, this is a Wine-only difference in when the decoded buffer completes (no audio device in the prefix would also explain it — nothing here asserts a device exists).
  • WINEDEBUG=+xaudio2 (or an XCL log line at Submit) showing whether the buffer is already ended/flushed before the first GetState.

Not tested

  • No game run at all; this is the lib test and the e2e test title only.
  • Windows, NVIDIA, Intel, other Wine versions.

AI use

  • Prepared with AI assistance: DeepSeek V4.1 Flash in OpenCode ran the builds and the tests above and wrote this issue; it wrote no code for XCL.
**@⁠pablogonz12** on GitHub · 2026-11-25 19:57 UTC · [original](https://github.com/xcl-dev/xcl/issues/2481) On Linux under Wine, the decoded (XMA2) source-voice test gets a **null** context from `GetState` at its first call, before any buffer ends, so the XMA2 context checks fail on that lane — on `main` and on #2410 alike. This is not #2386's ended-buffer race (that one needs `OnBufferEnd` to have run first) and it is not diagnosed here, just reported with a reproduction. **Setup** - CachyOS (Arch), kernel 7.3.6-1-cachyos-eevdf, Mesa 26.3.1-5 (`RADV GFX1201`), AMD Radeon RX 9070 XT 16 GB, Ryzen 9 9900X. - GE-Proton11-14 wine (Wine 11.0), scratch prefix, `WINEDEBUG=-all`, `WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b"`, `VKD3D_CONFIG=ignore_shared_fence`, DXC 1.9.2609.5. - `main` `2898511`, release, `x86_64-pc-windows-msvc` static (`RUSTFLAGS="-C target-feature=+crt-static"`). **Reproduction** ``` RUSTFLAGS="-C target-feature=+crt-static" cargo xwin test -p xcl --lib --release \ --target x86_64-pc-windows-msvc --no-run WINEPREFIX=<scratch> WINEDEBUG=-all wine <target>/x86_64-pc-windows-msvc/release/build/xcl/*/out/xcl-*.exe \ --test-threads=1 xma2 ``` ``` test hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime ... FAILED thread '…xma2_source_voice_decodes_and_manages_lifetime' panicked at crates/xcl/src/hle/xaudio2.rs:1599:13: assertion `left == right` failed left: 0 right: 12291 ``` `12291` is `0x3003` = the test's `CTX_VALID`. The line just above (`assert_eq!({ st.buffers_queued }, 2)`) passes, so two submits were recorded; only the context is missing. `left: 0` means `GetState` answered `pCurrentBufferContext = null`, the value the vtable-form test asserts against right after `SubmitSourceBuffer`, with no buffer ended in between. **The same symptom in the e2e test title** (`e2e` integration test, `test_title_runs_and_game_folder_is_untouched`): 48 `[PASS]` lines, and among the two `[FAIL]` lines ``` [FAIL] XAudio2: console flags/device, XMA2 & Opus voices decoded, PCM passes, callbacks: XMA2 GetState: ctx=0x0, queued=1 ``` (the other `[FAIL]` is the window-cloak check, which Wine cannot satisfy). With #2410 applied the value stays `ctx=0x0`, so the Wine lane cannot be used to validate that fix, although the PR's own unit test `get_state_context_survives_buffer_end` does pass here. **What would settle it** - A run of the same test on Windows: if `TestState`/`GetState` returns `0x3003` there at the same point, this is a Wine-only difference in when the decoded buffer completes (no audio device in the prefix would also explain it — nothing here asserts a device exists). - `WINEDEBUG=+xaudio2` (or an XCL log line at `Submit`) showing whether the buffer is already ended/flushed before the first `GetState`. **Not tested** - No game run at all; this is the lib test and the e2e test title only. - Windows, NVIDIA, Intel, other Wine versions. **AI use** - Prepared with AI assistance: DeepSeek V4.1 Flash in OpenCode ran the builds and the tests above and wrote this issue; it wrote no code for XCL.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:31:45 +00:00
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 00:25 UTC · original

Windows check for #2481: the focused XMA2 source-voice test reaches its pre-playback GetState context assertion and passes here.

Setup: Windows 11 Home build 26200; Ryzen 9 5980HX. The GPU was not used by this test. I ran an existing Windows debug test binary built from clean XCL head 57853e017054d715cd46cd3c07cb70e58eddddc8 (PR #2514). Its crates/xcl/src/hle/xaudio2.rs is identical to current main 08db8020d323bf478964fcc586152cce54959cfc. Binary SHA-256: 35BAB9D76DEE45A9CDE50DE2B7B68CB6D629589E8F1144FB720896D6B8192072.

Command: work-pr2444\target\debug\deps\xcl-6ada34314a84214a.exe hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime --exact --test-threads=1 --show-output (from the local XCL-test directory; no rebuild).

Result: 1 passed, 0 failed, 0 ignored, 1326 filtered out; 0.82 s. There was no SKIPPED or no-audio-device message. The assertion that current_buffer_context == 0x3003 before playback passed. This answers the Windows comparison requested in the issue; the Wine cause remains open.

Limit: The run logged XMA buffer decoded 0 samples – substituting silence, so this confirms the context/lifetime assertions, not nonzero decoded PCM. I did not run the e2e test or a title.

AI use: Codex (GPT-6) located and verified the prebuilt binary, ran the focused test, checked source parity, and wrote this report; a Codex Luna subagent performed the initial test run.

**@⁠luckyteagirl** on GitHub · 2026-11-26 00:25 UTC · [original](https://github.com/xcl-dev/xcl/issues/2481#issuecomment-7178736507) **Windows check for #2481:** the focused XMA2 source-voice test reaches its pre-playback `GetState` context assertion and passes here. **Setup:** Windows 11 Home build 26200; Ryzen 9 5980HX. The GPU was not used by this test. I ran an existing Windows debug test binary built from clean XCL head `57853e017054d715cd46cd3c07cb70e58eddddc8` (PR #2514). Its `crates/xcl/src/hle/xaudio2.rs` is identical to current `main` `08db8020d323bf478964fcc586152cce54959cfc`. Binary SHA-256: `35BAB9D76DEE45A9CDE50DE2B7B68CB6D629589E8F1144FB720896D6B8192072`. **Command:** `work-pr2444\target\debug\deps\xcl-6ada34314a84214a.exe hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime --exact --test-threads=1 --show-output` (from the local XCL-test directory; no rebuild). **Result:** 1 passed, 0 failed, 0 ignored, 1326 filtered out; 0.82 s. There was no `SKIPPED` or no-audio-device message. The assertion that `current_buffer_context == 0x3003` before playback passed. This answers the Windows comparison requested in the issue; the Wine cause remains open. **Limit:** The run logged `XMA buffer decoded 0 samples – substituting silence`, so this confirms the context/lifetime assertions, not nonzero decoded PCM. I did not run the e2e test or a title. **AI use:** Codex (GPT-6) located and verified the prebuilt binary, ran the focused test, checked source parity, and wrote this report; a Codex Luna subagent performed the initial test run.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-26 06:30 UTC · original

Root cause, confirmed on two more Wine setups: the bundled FAudio reports pCurrentBufferContext = NULL for a stopped voice that has queued buffers. FAudio behavior older than 26.05, not XMA2-specific and not xcl-caused.

Tested

  • Machine A (primary rig): AMD Ryzen 9 9900X (12 cores), 96 GB DDR5, Radeon RX 7900 XT 20 GB (Navi 31), Arch, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0, target x86_64-pc-windows-gnu run under Wine. Red at b49be183 and caed44ec.
  • Machine B (secondary): Intel Core i5-10600K, 16 GB DDR4, NVIDIA GTX 1070 8 GB (driver 550.163.01), Debian 13, kernel 6.12.117, Debian wine-10.0, rustc 1.100.0. Red on plain b49be183 too, so not PR-induced.
  • Filed as #2671 before finding this thread; it is a duplicate, closing it there to keep one report.

Instrumentation: one log line added to xcl's get_state wrapper (crates/xcl/src/hle/xaudio2.rs, immediately after the original vtable call). The underlying XAudio2 answer at the test's first GetState, before Start:

XCLDBG raw cur=0x0 q=2 sp=0

Two buffers queued, context null, no samples played. Matches your passing buffers_queued == 2 exactly. xcl decodes XMA2 in its own submit wrapper and forwards plain PCM16 to the underlying voice, so queue/context semantics here are vanilla PCM, not the XMA2 path.

Mechanism (Wine's xaudio2_7/8/9 DLLs are thin wrappers over FAudio since the 2019 rewrite):

  • FAudio 26.03 and earlier (src/FAudio.c, tag 25.12): SubmitSourceBuffer sets voice->src.newBuffer = 1 when the queue was empty (:2775), and GetState reports the context only if (!voice->src.newBuffer) (:2931). newBuffer is cleared only when the audio graph thread begins playing the buffer (FAudio_internal.c:380) or by FlushSourceBuffers (:2826). A voice with buffers submitted but never Started therefore reports BuffersQueued = n with pCurrentBufferContext = NULL, exactly the observed signature.
  • FAudio 26.04 still gates: GetState requires queued_buffers[0].sent_OnStartBuffer (src/FAudio.c:2985), so still null until OnBufferStart has fired.
  • FAudio 26.05 onward: the gate is gone. GetState returns queued_buffers[0].buffer.pContext whenever the queue is nonempty, matching MSDN and the native Windows pass luckyteagirl reported above.

The Wine stacks in all three reports (Proton wine-11.0, GE-Proton11-14, Debian wine-10.0) vendor a FAudio predating that fix; behaviorally confirmed by the raw instrumented return on both of our machines.

Not tested: a Wine build with FAudio 26.05+, which should make this red go green without touching xcl. We did not rebuild Wine to verify.

Options for xcl (upstream's call): the test matches Windows, so leaving it as Wine-side staleness is a valid resolution. If the check should be meaningful on Wine anyway, xcl already mediates these submits, so its get_state wrapper can backfill a null pCurrentBufferContext from its own live-buffer tracking for the first submitted buffer; or gate that single assertion on crate::util::under_wine() as existing Wine-leniency asserts do.

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-26 06:30 UTC · [original](https://github.com/xcl-dev/xcl/issues/2481#issuecomment-7184491699) **Root cause, confirmed on two more Wine setups: the bundled FAudio reports `pCurrentBufferContext = NULL` for a stopped voice that has queued buffers. FAudio behavior older than 26.05, not XMA2-specific and not xcl-caused.** **Tested** - Machine A (primary rig): AMD Ryzen 9 9900X (12 cores), 96 GB DDR5, Radeon RX 7900 XT 20 GB (Navi 31), Arch, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0, target `x86_64-pc-windows-gnu` run under Wine. Red at `b49be183` and `caed44ec`. - Machine B (secondary): Intel Core i5-10600K, 16 GB DDR4, NVIDIA GTX 1070 8 GB (driver 550.163.01), Debian 13, kernel 6.12.117, Debian wine-10.0, rustc 1.100.0. Red on plain `b49be183` too, so not PR-induced. - Filed as #2671 before finding this thread; it is a duplicate, closing it there to keep one report. **Instrumentation**: one log line added to xcl's `get_state` wrapper (`crates/xcl/src/hle/xaudio2.rs`, immediately after the original vtable call). The underlying XAudio2 answer at the test's first `GetState`, before `Start`: ``` XCLDBG raw cur=0x0 q=2 sp=0 ``` Two buffers queued, context null, no samples played. Matches your passing `buffers_queued == 2` exactly. xcl decodes XMA2 in its own submit wrapper and forwards plain PCM16 to the underlying voice, so queue/context semantics here are vanilla PCM, not the XMA2 path. **Mechanism** (Wine's `xaudio2_7/8/9` DLLs are thin wrappers over FAudio since the 2019 rewrite): - FAudio 26.03 and earlier (`src/FAudio.c`, tag 25.12): `SubmitSourceBuffer` sets `voice->src.newBuffer = 1` when the queue was empty (:2775), and `GetState` reports the context only `if (!voice->src.newBuffer)` (:2931). `newBuffer` is cleared only when the audio graph thread begins playing the buffer (`FAudio_internal.c:380`) or by `FlushSourceBuffers` (:2826). A voice with buffers submitted but never `Start`ed therefore reports `BuffersQueued = n` with `pCurrentBufferContext = NULL`, exactly the observed signature. - FAudio 26.04 still gates: `GetState` requires `queued_buffers[0].sent_OnStartBuffer` (`src/FAudio.c:2985`), so still null until `OnBufferStart` has fired. - FAudio 26.05 onward: the gate is gone. `GetState` returns `queued_buffers[0].buffer.pContext` whenever the queue is nonempty, matching MSDN and the native Windows pass luckyteagirl reported above. The Wine stacks in all three reports (Proton wine-11.0, GE-Proton11-14, Debian wine-10.0) vendor a FAudio predating that fix; behaviorally confirmed by the raw instrumented return on both of our machines. **Not tested**: a Wine build with FAudio 26.05+, which should make this red go green without touching xcl. We did not rebuild Wine to verify. **Options for xcl** (upstream's call): the test matches Windows, so leaving it as Wine-side staleness is a valid resolution. If the check should be meaningful on Wine anyway, xcl already mediates these submits, so its `get_state` wrapper can backfill a null `pCurrentBufferContext` from its own live-buffer tracking for the first submitted buffer; or gate that single assertion on `crate::util::under_wine()` as existing Wine-leniency asserts do. **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
This discussion has been locked. Commenting is limited to contributors.
No description provided.