XGameRuntime: skip canceled device association callbacks and serialize sign-in check #1222
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1231"
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 ivall/xcl. Originally posted by b3IKK on 2026-11-24T13:26:27Z.
association_callignored the task queue'scanceledparameter, so terminating the queue before dispatching still invoked the guest'sXUserDeviceAssociationChangedCallbackon a terminated queue instead of only droppingBox<AssociationCall>.In addition,
XUserRegisterForDeviceAssociationChangedpushed toASSOCIATION_CALLBACKSand checkedUSER_SIGNED_INoutside the lock whileuser_signed_in()swappedUSER_SIGNED_INbefore locking, allowing a concurrent sign-in and registration to deliver the same callback twice.This skips invoking the guest callback when
canceledis true and reads/setsUSER_SIGNED_INwhile holdingASSOCIATION_CALLBACKS.What is in it
crates/xcl/src/hle/xgameruntime/mod.rs: return without invoking the guest callback inassociation_callwhencanceledis true; check/setUSER_SIGNED_INunderASSOCIATION_CALLBACKS.lock(); add unit testdevice_association_callback_not_invoked_when_queue_terminated(verified failing before the fix).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 742 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib device_association_callback_not_invoked_when_queue_terminated: 1 passed, 0 failed (failed before the fix with callback invoked once on queue termination)Regression run
main:
PR:
Not tested
AI use
xgameruntime/mod.rs, wrote the fix and regression test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:47:25Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Note: the full
d3d12xlib filter currently aborts with 0xc0000005 on unmodifiedmaintoo (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-25T00:04:59Z.
Closing in favour of #1753, this account's later PR on the same callbacks (#1607, group D58). #1753's
association_callalready skips a call the queue canceled, which is the first half of this PR, and also cancels queued calls on unregister. The second half here (reading the sign-in flag under the callbacks lock) is what #1418 and #1583 do more completely. AI use: OpenCode, Claude Fable 5.2.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:17:20Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Pull request closed