D3D12: SYSTEM_TIMESTAMP frequency for Write64BitValueBottomOfPipeX (info wanted) #14
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator#14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@omonkeyz on GitHub · 2026-11-21 17:19 UTC · original
D3D12 CommandList slot 70, Write64BitValueBottomOfPipeX, SYSTEM_TIMESTAMP flag (
crates/compat/d3d12_xs/src/bop64.rs)Flag bit 1 makes the console write EVENT_WRITE_EOP with data_sel 4 (the system counter), not data_sel 3 (the GPU timestamp). Neither the counter's frequency nor its epoch appears in any console binary we have (xgs12, xgs12_10, the debug drivers, xgskmd10.sys, pixrt), and no title we have uses the flag.
The emulator currently converts to the QPC time base. The competing reading is the GPU core-clock counter: PS4 Gnm names data_sel 4 GpuCoreClockCounter, which would be a fixed 1825 MHz on Series X and 1563 MHz on Series S.
If you know the frequency and epoch of the Scarlett system counter, or have a title that uses this flag, please share it here.
@QuentinDanblon on GitHub · 2026-11-21 18:29 UTC · original
Public sources don't settle the epoch. They do point to the core-clock reading over QPC.
Encoding (high confidence)
gfx9_plus_merged_f32_me_pm4_packets.hME_RELEASE_MEM_data_sel_enum: 3 =send_gpu_clock_counter, 4 =send_system_clock_counter, 6 =send_emulated_sclk_counter(GFX11). The MEC and PFP headers have the same 3/4 values.nvd.h(gfx10) L375-381, alsosoc15d.handcikd.h: "3 - send 64bit GPU counter value / 4 - send 64bit sys counter value".gfx9UniversalCmdBuffer.cppL4378,gfx9ComputeCmdBuffer.cppL434) and RADV (radv_query.c) write timestamps with 3. They convert it with the kernel'sgpu_counter_freq. On gfx10, including the Van Gogh APU, that is SMUIO GOLDEN_TSC: "The SMUIO TSC clock frequency is 100MHz" (gfx_v10_0.cL7715-7786). GOLDEN_TSC is not the CPU TSC; PAL and RADV calibrate against the CPU clock separately.What 4 counts (medium confidence, inference)
amd_shared.hL187/190). PAL's GFX11 enum putssend_emulated_sclk_counternext to it.GnmConstant.hL1137-1163, GPL) names 3 the "system's 100Mhz global clock" and 4 the "timestamp from the GPU's Core clock". shadPS4 (GPL) implements 4 as host time scaled to the GPU core clock.send_cp_perfcounter_hi_lo, which would be a count in the SCLK domain.Suggested reading
origin + muldiv_u128(qpc_now - qpc_origin, F_sclk, qpc_freq), kept monotonic.Still unknown: whether Microsoft's CP firmware remaps 4 on Scarlett, the real epoch, gating behaviour, Scarlett's exact refclk (100 vs 99.81 MHz, as on gfx11 APUs), and the frequency the Xbox API reports. To check empirically, use an RDNA2 Linux box (Steam Deck is the closest APU): pin
pp_dpm_sclk, then compare data_sel 4 and 3 deltas around a known delay.@omonkeyz on GitHub · 2026-11-23 13:12 UTC · original
Thanks, recorded. We'll keep data_sel 4 as an SCLK-domain counter at the fixed clock (1.825 GHz on Series X, 1.565 GHz on Series S) unless a title capture shows otherwise.