D3D12.X Presentation & Frame Pacing: multi-plane PresentX, HDR color space, multi-queue fallback lockout, and frame clock handle race #103
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#103
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?
@raylitebull on GitHub · 2026-11-23 11:15 UTC · original
Summary
During a codebase audit of
crates/xcl/src/hle/d3d12x/{present.rs, frame.rs, list_x.rs}(onmain60599a9), we verified several presentation and frame-pacing bugs that need deeper design/testing (some needing multi-plane or HDR title traces to verify end-to-end):1. Multi-plane
PresentXdrops planes>= 1(crates/xcl/src/hle/d3d12x/present.rs)present_x_framereads only plane 0 (planes.add(8)/planes.add(0x10)) and logs whenplane_count > 1, silently discarding all additional planes (e.g., separate console HUD/UI overlay planes that need compositing over plane 0).2. Fallback presentation can permanently lock out
PresentXon a second queue (present.rs)note_execute/on_queue_console_method) triggers once on Queue A before the firstPresentX,new_presenter(queue_A)permanently pinsPRESENTER.queue = queue_A.PresentXlater arrives on Queue B,if p.queue != queue { return; }silently drops everyPresentXframe forever.3. HDR swap chains never call
IDXGISwapChain3::SetColorSpace1(present.rs)swap_formatcreatesDXGI_FORMAT_R10G10B10A2_UNORMandDXGI_FORMAT_R16G16B16A16_FLOATswap chains, butensure_swapchainnever configuresDXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020/G10_NONE_P709viaSetColorSpace1, leaving HDR10 output displayed as washed-out SDR G22/P709.4.
frame.rsancillaryHANDLEuse-after-close race, pipelinedorigintimestamp, andinterval_validedge values (crates/xcl/src/hle/d3d12x/frame.rs)clock_threadclones rawHANDLEs fromk.extra, drops theCLOCKmutex, and then callsSetEvent/ReleaseSemaphoreon them without holdingCLOCK. A concurrentschedule_frame_event_xcall drainsk.extraand callsCloseHandle(h), allowingclock_threadto signal closed or OS-recycled handles.origintimestamp:mark_flipped(token)recordsLAST_ORIGIN.load(Relaxed)instead of the origin QPC associated withtoken. With 2–3 frames in flight,GetFrameStatisticsX(token)returns a newer frame's origin timestamp.interval_validtolerances:near(16667, 16)rejects16666 µs(1_000_000 / 60),near(66667, 67)rejects66666 µs, andnear(50000, 49)misses NTSC50050 µsby 1 µs.5.
Write64BitValue*OS QPC timestamp flags write GPU timestamps instead (crates/xcl/src/hle/d3d12x/list_x.rs)Write64BitValue*flags2/8,list_x.rswrites the PC GPU timestamp instead, which can differ from QPC frequency by 100× (e.g., 1 GHz GPU clock vs 10 MHz QPC) and distort dynamic-resolution/frame-time calculations.Notes
0×0client rect) and Alt-Tab were also audited inpresent.rsand confirmed safe (swapchain dimensions come from the game's texture descriptor andDXGI_MWA_NO_ALT_ENTERis set).@ivall on GitHub · 2026-11-23 11:42 UTC · original
Thanks for the audit. Triage against current
main:ea4bd62: a PresentX from another queue now moves the presenter (and the XCL window's swap chain) to that queue after the old copy completes, instead of dropping every frame.interval_valid– the tolerance part confirmed, fixed inea4bd62: the check is now either side of the nominal length (16 666 / 66 666 µs accepted). Whether 50 050 µs is a valid console interval we don't know, so it stays out.SetColorSpace1– true; PRs welcome, ideally with a title that actually outputs HDR10 to check it on screen.