d3d12_xs: the queue's slot 32 is PresentX, wired to the presentation core with a shared token source (RT-PRESENTX) #414

Merged
Mumogg merged 27 commits from upstream-pr/414 into main 2026-11-25 03:46:20 +00:00
Mumogg commented 2026-11-24 04:51:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T04:51:46Z.


Claimed in #14 as RT-PRESENTX. Depends on: the stack up to #403 (their commits come first here; this pull request is the last two commits).

What and why

After #403 the retail title reaches its first present: command-queue slot 32, PresentX(plane count, planes, parameters). It is past the PC queue's 19 slots, so main refuses it and nothing can be shown, although main already has the call's implementation (XboxPresentation, xbox_present.h).

Two commits:

  1. Mine: queue slot 32 calls XboxPresentation::PresentX. The first call on a device builds a window and the Vulkan layer's presenter for it, once, and the state dies with the device proxy. A device that cannot present answers S_OK and shows nothing, so the frame loop runs either way; the mock and COM builds of the file have no presenter and answer S_OK. It follows old PR 2490's wiring (Nolan Cotter, 2be25cee2), written again for main's queue proxy, where that commit does not apply.
  2. afb14d56c by Logan (-x, authorship kept; an ancestor of main whose content is not in the tree): device slot 80 (WaitFrameEventX) and the presentation's pacer share one FrameTokenSource. Without it the title waits through the device, gets tokens from the device's own counter and presents them to a pacer that never issued them. Adapted to main: the uncapped pacer path issues from the shared source too, and the queue's PresentX hands the device's source to its XboxPresentation.

Left out on purpose:

  • The older console queue layout, which has PresentX at slot 30. Only slot 32 is measured on this title.
  • Presenting into the title's own window (old PR 8591). The window here is one this layer creates; that is an assumption marked in the code.

Measured

Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on main ece4ba5b3, with #142, #219, #328 and #387 applied on top for the boot runs (they are not in this branch).

--run The present call in the trace
up to #403 XboxID3D12CommandQueue::Slot32 unsupported
+ commit 1 only PresentX ready (window ...), then XboxPresentation::PresentX failed
+ commit 2, and the list fix of the next pull request XboxPresentation::PresentX ok

The last row is the first successful present on this path. Two honest limits on it:

  • I have it in one of two runs. In the other, an int3 of the title on a worker thread came first; that stop is there in every run now and is a race with the present, not caused by it. I have not looked at it yet.
  • I did not get a run with commit 2 and without the next pull request's list fix that reached the present, for the same reason, so the table's last row has both.

I have not looked at what is on screen. At this point of the boot the integration branch (#321) shows a black frame.

Tests under Wine: xs_proxy_mock_test passes; frame_pacer_test exits 0; xbox_present_test: all cases pass (both have the cases that came with afb14d56c).

Not built with MSVC and not run on Windows. device_proxy_test gets a case from afb14d56c that I cannot run here.

AI-assisted (Claude Code); built and run on the machine above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466299883 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T04:51:46Z. --- Claimed in #14 as `RT-PRESENTX`. Depends on: the stack up to #403 (their commits come first here; this pull request is the last two commits). ### What and why After #403 the retail title reaches its first present: command-queue slot 32, `PresentX(plane count, planes, parameters)`. It is past the PC queue's 19 slots, so `main` refuses it and nothing can be shown, although `main` already has the call's implementation (`XboxPresentation`, `xbox_present.h`). Two commits: 1. **Mine**: queue slot 32 calls `XboxPresentation::PresentX`. The first call on a device builds a window and the Vulkan layer's presenter for it, once, and the state dies with the device proxy. A device that cannot present answers `S_OK` and shows nothing, so the frame loop runs either way; the mock and COM builds of the file have no presenter and answer `S_OK`. It follows old PR 2490's wiring (Nolan Cotter, `2be25cee2`), written again for `main`'s queue proxy, where that commit does not apply. 2. **`afb14d56c` by Logan** (`-x`, authorship kept; an ancestor of `main` whose content is not in the tree): device slot 80 (`WaitFrameEventX`) and the presentation's pacer share one `FrameTokenSource`. Without it the title waits through the device, gets tokens from the device's own counter and presents them to a pacer that never issued them. Adapted to `main`: the uncapped pacer path issues from the shared source too, and the queue's PresentX hands the device's source to its `XboxPresentation`. Left out on purpose: - The older console queue layout, which has PresentX at slot 30. Only slot 32 is measured on this title. - Presenting into the title's own window (old PR 8591). The window here is one this layer creates; that is an **assumption** marked in the code. ### Measured Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on `main` `ece4ba5b3`, with #142, #219, #328 and #387 applied on top for the boot runs (they are not in this branch). | `--run` | The present call in the trace | |---|---| | up to #403 | `XboxID3D12CommandQueue::Slot32 unsupported` | | + commit 1 only | `PresentX ready (window ...)`, then `XboxPresentation::PresentX failed` | | + commit 2, and the list fix of the next pull request | `XboxPresentation::PresentX ok` | The last row is the first successful present on this path. Two honest limits on it: - I have it in one of two runs. In the other, an `int3` of the title on a worker thread came first; that stop is there in every run now and is a race with the present, not caused by it. I have not looked at it yet. - I did not get a run with commit 2 and without the next pull request's list fix that reached the present, for the same reason, so the table's last row has both. I have not looked at what is on screen. At this point of the boot the integration branch (#321) shows a black frame. Tests under Wine: `xs_proxy_mock_test` passes; `frame_pacer_test` exits 0; `xbox_present_test`: all cases pass (both have the cases that came with `afb14d56c`). Not built with MSVC and not run on Windows. `device_proxy_test` gets a case from `afb14d56c` that I cannot run here. AI-assisted (Claude Code); built and run on the machine above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Mumogg commented 2026-11-24 05:04:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T05:04:20Z.


A correction to my own pull request: the PresentX wiring broke queue_proxy_test, which I had not run on it. Its coverage gate asks for every queue slot to have been called and skips the overridden ones in its sweep of the refused tail; slot 32 is overridden now, so nothing called it and the gate failed with queue slot 32 never called.

Fixed with one more commit on this branch: the test calls slot 32 where it calls the console ExecuteCommandLists slot (that build of the proxy has no presenter, so the answer is S_OK). queue_proxy_test passes under Wine again on the Vulkan backend. #416 is rebased onto it.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7122597227 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7122597227). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T05:04:20Z. --- A correction to my own pull request: the PresentX wiring broke `queue_proxy_test`, which I had not run on it. Its coverage gate asks for every queue slot to have been called and skips the overridden ones in its sweep of the refused tail; slot 32 is overridden now, so nothing called it and the gate failed with `queue slot 32 never called`. Fixed with one more commit on this branch: the test calls slot 32 where it calls the console `ExecuteCommandLists` slot (that build of the proxy has no presenter, so the answer is `S_OK`). `queue_proxy_test` passes under Wine again on the Vulkan backend. #416 is rebased onto it. AI-assisted.
sodove commented 2026-11-24 06:02:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-24T06:02:31Z.


checked: independent native Windows verification of the exact #414 head 11d44eee9f. Windows 11 x64 build 26100, MSVC 19.44.35220, SDK 10.0.26100, Release, RTX 5070 Ti / NVIDIA 610.74, Vulkan loader 1.4.341.

  • Stock frame_pacer, xbox_present, queue_proxy and xs_proxy_mock passed. The new slot-80 token checks also passed in device_proxy and device_proxy_trace. Both modes failed the same two slot-25 allocation-info assertions (C ABI and PC form) on this head and on e7044cb9b immediately before the PresentX changes. The HDR10 swapchain subcase skipped on this display.
  • An extension of xbox_present_test exercised the queue slot with the runtime Vulkan path compiled in and counted successful vkQueuePresentKHR calls. In 3/3 runs a token issued via device slot 80 before the first PresentX reached Vulkan exactly once. The lazy window was visible and owned by the test process. The next, still unissued token returned E_INVALIDARG with zero additional presents. Slot 80 then issued that token and the second present reached Vulkan on the same window.
  • A control build gave the lazy presenter a separate token source. The first issued token then returned E_INVALIDARG, with zero Vulkan presents.

Synthetic fixtures only. AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7123517467 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7123517467). Originally posted by [sodove](https://github.com/sodove) on 2026-11-24T06:02:31Z. --- checked: independent native Windows verification of the exact #414 head 11d44eee9f00c2c1273240ad2220ddf14c5a8a1d. Windows 11 x64 build 26100, MSVC 19.44.35220, SDK 10.0.26100, Release, RTX 5070 Ti / NVIDIA 610.74, Vulkan loader 1.4.341. - Stock frame_pacer, xbox_present, queue_proxy and xs_proxy_mock passed. The new slot-80 token checks also passed in device_proxy and device_proxy_trace. Both modes failed the same two slot-25 allocation-info assertions (C ABI and PC form) on this head and on e7044cb9b immediately before the PresentX changes. The HDR10 swapchain subcase skipped on this display. - An extension of xbox_present_test exercised the queue slot with the runtime Vulkan path compiled in and counted successful vkQueuePresentKHR calls. In 3/3 runs a token issued via device slot 80 before the first PresentX reached Vulkan exactly once. The lazy window was visible and owned by the test process. The next, still unissued token returned E_INVALIDARG with zero additional presents. Slot 80 then issued that token and the second present reached Vulkan on the same window. - A control build gave the lazy presenter a separate token source. The first issued token then returned E_INVALIDARG, with zero Vulkan presents. Synthetic fixtures only. AI-assisted verification.
towade commented 2026-11-24 15:25:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by towade on 2026-11-24T15:25:39Z.


@Mumogg, a retail data point and two integration notes for this PR on current main (d0da7dade, which now has #402). RX 9070 XT, own 1.0.2.1 copy, with #511 and the other open boot pull requests below it (ladder on #14). Counts only.

  • Without this PR, the run ends right after queue slot 32 answers unsupported: main has #402's routing, but nothing calls attach_xbox_presentation outside the tests. With 8ba15dd44 and 77c801c82 on top, PresentX ready is logged, and the title's 8 PresentX calls reach XboxPresentation::PresentX.
  • All 8 fail without your token commit af8c42bb1. The title passes tokens from the device-side WaitFrameEventX, which the presentation's pacer never issued, so check_present_token refuses them. af8c42bb1 does not apply to main, because #402 rewrote frame_pacer.h (per-event ticks, issue_token_locked), so it needs adapting rather than a rebase. With a local-only change that lets such tokens through, all PresentX calls return ok and no ExecuteCommandLists fails.
  • On the combination, xs_proxy_mock and xs_proxy_mock_env_slots fail (lines 2776 and 1582 of the combined tree). Both are #402's tests: they expect raw(queue, 32) to be E_NOTIMPL while PresentX is routed to slot 30 or an env slot. Here slot 32 is fixed. Going through #402's handler, with its PresentX default at 32, might settle both.

Not run: your branch as is (it conflicts with main in d3d12_xs_device.cpp, .h and frame_pacer.h), and anything past the next stop: the title's own int3, which this PR doesn't change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7136007615 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7136007615). Originally posted by [towade](https://github.com/towade) on 2026-11-24T15:25:39Z. --- @Mumogg, a retail data point and two integration notes for this PR on current `main` (`d0da7dade`, which now has #402). RX 9070 XT, own 1.0.2.1 copy, with #511 and the other open boot pull requests below it (ladder on #14). Counts only. - Without this PR, the run ends right after queue slot 32 answers unsupported: `main` has #402's routing, but nothing calls `attach_xbox_presentation` outside the tests. With `8ba15dd44` and `77c801c82` on top, `PresentX ready` is logged, and the title's 8 `PresentX` calls reach `XboxPresentation::PresentX`. - **All 8 fail without your token commit `af8c42bb1`.** The title passes tokens from the device-side `WaitFrameEventX`, which the presentation's pacer never issued, so `check_present_token` refuses them. `af8c42bb1` does not apply to `main`, because #402 rewrote `frame_pacer.h` (per-event ticks, `issue_token_locked`), so it needs adapting rather than a rebase. With a local-only change that lets such tokens through, all `PresentX` calls return `ok` and no `ExecuteCommandLists` fails. - On the combination, `xs_proxy_mock` and `xs_proxy_mock_env_slots` fail (lines 2776 and 1582 of the combined tree). Both are #402's tests: they expect `raw(queue, 32)` to be `E_NOTIMPL` while `PresentX` is routed to slot 30 or an env slot. Here slot 32 is fixed. Going through #402's handler, with its `PresentX` default at 32, might settle both. Not run: your branch as is (it conflicts with `main` in `d3d12_xs_device.cpp`, `.h` and `frame_pacer.h`), and anything past the next stop: the title's own `int3`, which this PR doesn't change. AI-assisted (Claude Code).
QemmHD commented 2026-11-25 01:01:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T01:01:58Z.


@aslan2142 @Mumogg: #414 is the next rung after #403, and it needs more than a merge now that #402 is in. PresentX has to go through #402's handler at slot 32, a presenter has to be created, and the token source has to be shared. Mumogg has been away since ~10:24Z.

If it helps, I can carry the adaptation onto current main as a separate PR. I'd keep Mumogg's commits 8ba15dd44 and 77c801c82 with their authorship, re-implement Logan's frame-pacer piece over #402's rewritten frame_pacer.h with a Co-authored-by, and update the two #402 tests that expect slot 32 to be E_NOTIMPL. It would be tested on Windows 11 / MSVC / RTX 4070 SUPER with xs_proxy_mock, queue_proxy, frame_pacer and xbox_present (no game files). It's about 200 lines.

I'll only do it if you want it, since #984's merge may make it redundant. Just say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7149135870 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7149135870). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T01:01:58Z. --- @aslan2142 @Mumogg: #414 is the next rung after #403, and it needs more than a merge now that #402 is in. PresentX has to go through #402's handler at slot 32, a presenter has to be created, and the token source has to be shared. Mumogg has been away since ~10:24Z. If it helps, I can carry the adaptation onto current main as a separate PR. I'd keep Mumogg's commits `8ba15dd44` and `77c801c82` with their authorship, re-implement Logan's frame-pacer piece over #402's rewritten `frame_pacer.h` with a `Co-authored-by`, and update the two #402 tests that expect slot 32 to be `E_NOTIMPL`. It would be tested on Windows 11 / MSVC / RTX 4070 SUPER with `xs_proxy_mock`, `queue_proxy`, `frame_pacer` and `xbox_present` (no game files). It's about 200 lines. I'll only do it if you want it, since #984's merge may make it redundant. Just say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-11-25 01:28:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T01:28:07Z.


@QemmHD thanks for the offer, and for keeping an eye on the ladder. Please don't start it: we'll settle #414 after #984 and #939 are in, because between them they cover most of it.

  • #984 merged with main is tested and goes in shortly. It brings the presenter that is created on the first PresentX, the FrameTokenSource shared between device slot 80 and the pacer, and PresentX routed through #402's XboxQueueSlotRoutes. That's what towade found missing.
  • The slot: in that merge PresentX is queue slot 30, or 32 once a queue is detected as the newer layout (#984's measured rule), and LEONIDA_XS_PRESENT_X_SLOT pins it. The two #402 tests that expected E_NOTIMPL at 32 are adapted there.
  • Two things a local rework of #414 turned up, both handled in that merge:
    • the lazily built presenter held a reference on the device proxy that owns it, so the proxy, the window and the swapchain were never released;
    • handing device slots 78 to 81 to the presentation, as a plain attach_xbox_presentation does, makes the next WaitFrameEventX fail, because that pacer never saw the title's SetFrameIntervalX. The merge keeps them on the device.
  • #939 goes on top of that next; its presentation path is being merged into the same code.
  • After #939: we'll compare what's left of #414 against main and either merge the remainder, keeping Mumogg's commits and Logan's credit, or close it as carried. If something is left that you'd like to take, it'll be much smaller by then; I'll say here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7149579843 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7149579843). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T01:28:07Z. --- @QemmHD thanks for the offer, and for keeping an eye on the ladder. Please don't start it: we'll settle #414 after #984 and #939 are in, because between them they cover most of it. - **#984 merged with `main`** is tested and goes in shortly. It brings the presenter that is created on the first `PresentX`, the `FrameTokenSource` shared between device slot 80 and the pacer, and `PresentX` routed through #402's `XboxQueueSlotRoutes`. That's what towade found missing. - **The slot:** in that merge `PresentX` is queue slot 30, or 32 once a queue is detected as the newer layout (#984's measured rule), and `LEONIDA_XS_PRESENT_X_SLOT` pins it. The two #402 tests that expected `E_NOTIMPL` at 32 are adapted there. - **Two things a local rework of #414 turned up, both handled in that merge:** - the lazily built presenter held a reference on the device proxy that owns it, so the proxy, the window and the swapchain were never released; - handing device slots 78 to 81 to the presentation, as a plain `attach_xbox_presentation` does, makes the next `WaitFrameEventX` fail, because that pacer never saw the title's `SetFrameIntervalX`. The merge keeps them on the device. - **#939** goes on top of that next; its presentation path is being merged into the same code. - **After #939:** we'll compare what's left of #414 against `main` and either merge the remainder, keeping Mumogg's commits and Logan's credit, or close it as carried. If something is left that you'd like to take, it'll be much smaller by then; I'll say here. AI-assisted (Claude Code, Claude Opus 5.5).
QemmHD commented 2026-11-25 01:37:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T01:37:40Z.


@aslan2142 understood, I won't start it, and thanks for the detail on the two defects. Since you can't build with MSVC here: the merged #984 head (71a783e56) is building now on native Windows 11 with MSVC (VS 2022) and an RTX 4070 SUPER. I'll post the build result, full ctest and the validation run on #984 as soon as they're in.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7149767903 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7149767903). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T01:37:40Z. --- @aslan2142 understood, I won't start it, and thanks for the detail on the two defects. Since you can't build with MSVC here: the merged #984 head (71a783e56) is building now on native Windows 11 with MSVC (VS 2022) and an RTX 4070 SUPER. I'll post the build result, full ctest and the validation run on #984 as soon as they're in. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-11-25 03:47:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T03:47:01Z.


Marked merged through #430, whose branch contains this one. The content was already in main since #984 and #939, in this form:

  • PresentX goes through XboxQueueSlotRoutes to queue_present_x, which builds the presenter on the first call.
  • The slot is 30, or 32 once the queue is detected as the newer layout (a fence at 16/17, or SignalX at 25); LEONIDA_XS_PRESENT_X_SLOT pins it.
  • Logan's piece: device slot 80 and the pacer share the device's FrameTokenSource.
  • Both defects of the earlier rework are fixed there: the presenter holds no reference on the device proxy, and slots 78–81 stay on the device.
  • The queue_proxy_test change isn't needed: slot 32 is not an overridden slot on main, and the console-tail sweep calls it.

As promised in the thread, this was settled after #939. Thanks to Mumogg and Logan, and to QemmHD and towade for the analysis.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152237526 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/414#issuecomment-7152237526). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T03:47:01Z. --- Marked merged through #430, whose branch contains this one. The content was already in `main` since #984 and #939, in this form: - PresentX goes through `XboxQueueSlotRoutes` to `queue_present_x`, which builds the presenter on the first call. - The slot is 30, or 32 once the queue is detected as the newer layout (a fence at 16/17, or SignalX at 25); `LEONIDA_XS_PRESENT_X_SLOT` pins it. - Logan's piece: device slot 80 and the pacer share the device's `FrameTokenSource`. - Both defects of the earlier rework are fixed there: the presenter holds no reference on the device proxy, and slots 78–81 stay on the device. - The `queue_proxy_test` change isn't needed: slot 32 is not an overridden slot on `main`, and the console-tail sweep calls it. As promised in the thread, this was settled after #939. Thanks to Mumogg and Logan, and to QemmHD and towade for the analysis. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!414
No description provided.