gpu: test Xbox frame events and pipeline token wait semantics #1007
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1014"
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 Holastor on 2026-11-23T21:16:37Z.
Summary
This pull request implements the source-built Xbox frame-event timing and token wait fixture requested in #874, updated per review feedback.
Call sequence and public citations
The fixture follows the public frame-pacing call sequence from Microsoft's Xbox GDK sample (
InGameStore/DeviceResources.cpp):SetFrameIntervalXinitializes cadence.ScheduleFrameEventX(D3D12XBOX_FRAME_EVENT_ORIGIN, 0, nullptr, 0)registers the frame origin once.WaitFrameEventX(D3D12XBOX_FRAME_EVENT_ORIGIN, ...)waits each frame and retrieves the pipeline token. Passing the token toPresentXis a cited follow-up (this caller verifies token delivery but does not callPresentX).Contract boundaries and fixture choices
SetFrameIntervalX → ScheduleFrameEventX(ORIGIN) once → WaitFrameEventX(ORIGIN) each framewithnullptrevent handle and token delivery.d3d12_xs.dllis a fixture choice (the GDK sample invokes device methods).SetFrameIntervalXis a fixture choice (the sample passes an actualIDXGIOutput*).HANDLEsignaling was dropped per review feedback.get_frame_events_blocked_waits() == 2) without relying on wall-clock timer resolution.WaitFrameEventXbefore a tick arrives returnsWAIT_TIMEOUT(0x00000102) and preserves the caller's output sentinel.D3D12XBOX_FRAME_EVENT_ORIGIN(value 0) returnE_INVALIDARG(0x80070057), leaving the output sentinel intact.cpu_frame_events_provider_clobbersimulates refusal sentinel overwrite, caught specifically at step 2 (asserted exit0xE03).cpu_frame_events_provider_earlysimulates premature release before tick, caught specifically at step 3 (asserted exit0xE04).Verification
Tested under Windows 10 (MSVC 19.44 x64) at commit
2b977cd:Outputs:
cpu_native_frame_eventspassed in 0.31s (exit0x874).cpu_native_frame_eventspassed in 0.31s (exit0x874).0xE03.0xE04.d3d12_xs.dllstoppedpe_mapat import resolution (STATUS["unresolved"]).Refs #874.
AI-assisted (Antigravity).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:25:45Z.
I reproduced
cpu_native_frame_eventson Windows Release at1b8cfbb7: the native and mapped callers return0x874, the withheld provider stops atWaitFrameEventX, and the combined faulty provider exits0xe03. That last exit is the refusal-sentinel assertion at step 2, before the premature-release mutation can run.Please separate the two mutations and assert their specific exit codes, so a loader failure cannot satisfy either control. Also separate scheduling from delivery: the Microsoft sample registers ORIGIN once, then waits each frame. A fixture control can inject two ticks after one registration, with a bounded wait and an explicit witness for the pending state. Currently calling Schedule again adds a tick directly and the two finite waits return immediately, so the fixture does not exercise a blocked waiter. If you keep the sequential version, describe it as polling an empty queue and narrow the timing claim.
The linked sample calls device methods and passes an actual DXGI output to SetFrameIntervalX. Please label the PE imports, null output, numeric values and seeded token as fixture choices, drop unused HANDLE signaling, and keep PresentX as a cited follow-up (this caller does not pass a token to it).
Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T21:33:17Z.
Updated in
2b977cdaddressing each point:cpu_frame_events_provider_clobber(asserts exit0xE03specifically for refusal sentinel clobber at step 2) andcpu_frame_events_provider_early(asserts exit0xE04specifically for premature wait release at step 3). Both are checked independently inframe_events_check.py.ScheduleFrameEventX(ORIGIN)once to register origin scheduling per the Microsoft sample.WaitFrameEventXcalls block until their respective tick arrives, verified by the explicit witnessget_frame_events_blocked_waits() == 2.d3d12_xs.dll, null output passed toSetFrameIntervalX, numeric constants, and seeded monotonic integer tokens as fixture choices.PresentXcited as a follow-up.Both
devandreleaseCTests pass in ~0.31s with zero wall-clock drift, and all Python lint checks pass.AI-assisted (Antigravity).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:39:50Z.
Thanks for separating the two mutants and pinning their exits. I pushed
ea777873to replace the twoSleep(15)guesses with a condition-variable handshake. The worker can deliver each tick only after the corresponding caller wait releases the shared lock, and the mapped check now reads the recorder counts. Windows Releasectest --preset release --no-tests=error -R '^cpu_native_frame_events$' --repeat until-fail:30 --output-on-failurepassed all 30 runs, including the exact refusal-clobber and early-release exits. This is the source-built recorder for #874.