Skip to content

D3D12.X: use dedicated PC direct queue for PresentX under Wine (#175) - #793

Open
gsucristo wants to merge 1 commit into
xcl-dev:mainfrom
gsucristo:d3d12x/wine-present-dedicated-queue
Open

gsucristo wants to merge 1 commit into
xcl-dev:mainfrom
gsucristo:d3d12x/wine-present-dedicated-queue

Conversation

@gsucristo

Copy link
Copy Markdown
Contributor

Use a dedicated presenter-owned unadopted PC direct command queue for DXGI swap-chain creation and PresentX copies when running under Wine, synchronized with the title's adopted queue via GPU fence Signal/Wait. Under Wine + vkd3d-proton, presenting on the title's adopted queue leaves the output window black. Native Windows behavior is unchanged. Part of #175.

What is in it

  • crates/xcl/src/hle/d3d12x/present.rs: add WineQueue and raw-vtable helpers (create_pc_queue, create_pc_allocator, create_pc_list, create_pc_fence) used only when util::under_wine() is true; bind the DXGI swap chain to the dedicated queue and fence-bridge title queue → presenter queue → title queue on each present.
  • crates/xcl/src/hle/d3d12x/present.rs (frame_dump_tests): add dedicated_pc_queue_copies_across_fence_from_title_queue verifying cross-queue fence-synchronized render target copy and readback.

Tested

  • NVIDIA GeForce RTX 4090 (driver 610.57.04), AMD Ryzen 9 7950X3D, Linux + Proton Experimental / vkd3d-proton (relaxed vtable check), rustc 1.98.1 (x86_64-pc-windows-msvc cross-compile), debug.
  • cargo test --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 700 passed, 4 failed (pre-existing Wine-only failures: hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime, test_title_runs_and_game_folder_is_untouched, disk_free_space_ex_reports_pls_quota, set_predication_buffer_state_and_kickoff), 41 ignored, 1 filtered (a_freed_block_is_decommitted_before_its_address_is_reused).
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64).
  • New GPU test passed: hle::d3d12x::present::frame_dump_tests::dedicated_pc_queue_copies_across_fence_from_title_queue.

Regression run

  • Pending native Windows scripts/smoke.ps1 runs on a retail title (Linux/Proton environment only).

Not tested

  • Native Windows 10/11 (code path is gated behind util::under_wine()), AMD RDNA, Intel GPUs, scripts/smoke.ps1 retail regression run.

AI use

  • Antigravity (Google DeepMind; exact model version not exposed to the agent) — assisted with code, test, and PR description; reviewed, built, and run on hardware by the author.

…ev#175)

Under Wine + vkd3d-proton, creating the DXGI swap chain and submitting the
present copy on the title's adopted command queue leaves the window black.

When running under Wine (`util::under_wine()`), allocate a presenter-owned
unadopted PC direct queue, allocator, command list, and sync fences via the
raw device vtable, hand out the swap chain on that queue, and synchronize
each present copy across the title queue and presenter queue with GPU fence
Signal/Wait. Native Windows behavior is unchanged.
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 6f4bef3c81a981d8c85a2bb7f153115ddb00e61c on AMD RDNA4. I merged it onto current main e50836b locally (clean merge).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200 (native Windows, not Wine), Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 705 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 664 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the present tests pass.

Review: Under Wine it presents on a dedicated PC direct queue; on native Windows, which is what this run is, the behaviour is meant to be unchanged, and the suite agrees. I could not run it under Wine, so the black-window fix itself is not checked here.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

Clean-room build, audit, and native hardware test run on NVIDIA RTX 5080 (Windows 11 Pro 25H2 26200.9974, driver 617.42 / 32.0.16.1742, rustc 1.100.0, DXC Windows SDK 10.0.26100.0).

  • Commit tested: 6f4bef3c81a981d8c85a2bb7f153115ddb00e61c
  • Build (cargo build --workspace): clean (only the pre-existing fetch_update deprecation warning).
  • Tests (cargo test --workspace -- --test-threads=4): 705 passed; 0 failed; 41 ignored (SKIPPED: only the 2 hardware no wave64 tests).
  • PR-specific test: hle::d3d12x::present::frame_dump_tests::dedicated_pc_queue_copies_across_fence_from_title_queue passed on real hardware.
  • Audit: Clean — Wine-only branch stays inert on native Windows; orig_fn slots (8/9/12/36) match ID3D12Device vtable order and signatures (CreateCommandQueue, CreateCommandAllocator, CreateCommandList, CreateFence), and COM ownership via from_raw is balanced. One tiny non-blocking note: title_q.Wait(&p.fence, ...) ignores its Result, though CPU waits still prevent corruption.

(Clean-room hardware check only; no retail title or smoke.ps1 run. Assisted-by: Antigravity / Claude Sonnet 5.5 + Gemini 4 Neon)

@Anon64

Anon64 commented Nov 24, 2026

Copy link
Copy Markdown

Regression runs for this PR's head 6f4bef3 and for its base main d208e14, on a retail title (same title, 60 s each), made with scripts/smoke.ps1 (release, clean tree at each commit) and pasted unedited, for Regression run.

main:

xcl-smoke v1
commit: d208e14b765f469f4b56301b78afa8dac5378339
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1647 (PresentX 1648)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16733 MB

this PR:

xcl-smoke v1
commit: 6f4bef3c81a981d8c85a2bb7f153115ddb00e61c
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1641 (PresentX 1641)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 16722 MB

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 581.80, wave32), Intel Core i9-14900KF, Windows 11 25H2 26200.9974 (native Windows), Rust 1.90.0

Not tested

  • the unit tests on this machine
  • Wine: on native Windows the Wine-only path is not taken; this is a regression check only

Report written with Claude Code (Claude Opus 5.5) from runs on this machine.

@upipibi upipibi mentioned this pull request Nov 24, 2026

@crastinator crastinator left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on RDNA2 under Proton with a patched vkd3d-proton: the test suite shows no new failures.

Tested (head 6f4bef3, merged onto main 930e8b4: no conflicts)

  • AMD Radeon RX 6700 XT (RDNA2, gfx1031, RADV NAVI22, Mesa 26.3.1), Ryzen 7 5700X, Linux 7.3.5 (CachyOS)
  • Proton Experimental 11.0-20261112's Wine, vkd3d-proton v3.1 + #257's patch (-Db_ndebug=true, dxil-spirv 53aac418 from #775), DXVK v3.1.1-209 dxgi, DXC 1.9.2609.5, libopus 1.5.2, XCL_REQUIRE_GPU=wave64,mesh (0 SKIPPED)
  • cross-built for x86_64-pc-windows-msvc (clang-cl / lld-link, xwin SDK 10.0.26100), Rust 1.99.1, debug
  • cargo test -p xcl --lib -- --test-threads=1 plus every integration test (--test '*' -- --test-threads=1), compared per test with the same runs on main 930e8b4. main here: 8 stable Wine-lane failures (#530 ×2, #676, #890 ×2, e2e, pls_quota #810, predication_e2e #1272). Separately, title_textures::{placed_title_textures_share_vram_and_preserve_pixels, transitions_apply_when_their_list_is_submitted} and vram::d32s8_targets… fail together in 2 of 5 main runs (the #718 family), so I do not count a pass of those as a fix either way.
  • PR: 744 passed, 8 failed, 41 ignored (main: 740 / 11 / 41, with the #718 flakes failing in that run). No test fails here that passes on main. The e2e test title still fails here at its user32 … not cloaked check, as it does on main; that check is #794's area, not this PR's.

Not tested

  • Anything that needs game files: no XCL_SAMPLE_* was set, so the tests that read them (about 66) pass without running.
  • What the PR fixes, a black window with a retail title: no game here. Real presentation on screen.

AI use

  • Claude Code (Claude Opus 5.5) merged, built and ran this and wrote the report; I checked the results.

@Filip722

Copy link
Copy Markdown

On an RTX 5060 Laptop GPU (8 GB), the cross-queue regression passed under Proton in 1.16 s with no skip. It read the expected green texel after a clear on the title queue and a fenced copy on the presenter queue.

I also compared main 6987e496c35653f9ccc9dbdc1f1d342734306811 with only this PR's patch from 6f4bef3c81a981d8c85a2bb7f153115ddb00e61c applied. Each Series X run started from an independent copy of the same offline profile, shader and driver caches. The patched run confirmed it selected the dedicated PC direct queue.

Observation Main With #793
Present-source frames sampled 20, 116, 212, 308, 404, 500 20, 116, 212
Samples above the black threshold per source frame 0 / 518,400 0 / 518,400
Entirely black title-window captures 18 / 18 14 / 14
Storage requests / failures 9,764 / 0 9,764 / 0
Free VRAM when the guard stopped the run 2,494 MiB 2,474 MiB

The input to presentation was already black on the three frames sampled by both builds. The patched run ended before frame 404. I couldn't verify a visible title screen in this workload with the queue change alone.

Bazzite 44, kernel 7.2.9-ogc2.1.fc44.x86_64, NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton 3.1.0 (4522cc1a8b1347f+), Rust 1.98.1 Windows MSVC target. Codex (GPT-6.2-Sol, high reasoning) assisted with the builds, tests and this report.

@ClosetPie107

Copy link
Copy Markdown

Linux / AMD RDNA4 (RADV) test report on 6f4bef3 merged locally onto main 568e7db (clean merge).

Environment

  • AMD Radeon RX 9070 16 GB (RDNA4, RADV GFX1201, Mesa 26.3.1, native wave64), Ryzen 5 9600X, 30 GiB RAM, CachyOS
  • Proton Experimental (experimental-11.0-20261112), vkd3d-proton v3.1 (#257 + dxil-spirv 53aac418), DXVK v3.1.1-209, DXC 1.9.2609.5, x86_64-pc-windows-gnu cross-compile

Unit & GPU tests (debug test binary, XCL_ADAPTER=9070 XCL_REQUIRE_GPU=wave64, --test-threads=1 --nocapture)

  • hle::d3d12x::present: 7 passed, 0 failed, 0 ignored, 0 skipped (0.21 s), including dedicated_pc_queue_copies_across_fence_from_title_queue.

Short retail check under Wine/RADV (release xcl.exe, XCL_RUN_SECONDS=35, XCL_NETWORK=0, XCL_COHERENT_MB=512, XCL_ADAPTER=9070)

  • Selected the Wine path: present: using a dedicated PC direct queue under Wine
  • Presented 851 frames at 30.0 fps (851 PresentX calls), exit 0, 0 device removals, 0 crashes.
  • Note: XCL_DXC_DIR was not passed in this 35 s run (no DXC logged), so this confirms the dedicated presenter queue lifecycle and frame pacing under Wine/RADV, not rendered pixel content.

Not tested: full workspace suite, rendered pixel verification with DXC set, native Windows.

AI use: T3 Code / Antigravity (Gemini 4 Neon) merged, built, ran these checks on this machine, and drafted this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants