Linux: renderer port 1 opens no region when a heap on a section's view does not show the card its bytes (#163) #274

Open
github-bot wants to merge 1 commit from github-bot/gh-274 into main AGit
Owner

@⁠Serph91P on GitHub · 2026-11-26 14:03 UTC · original
Serph91P:linux-port1-refusal → main · +101 −0 · 2 files · 1 commits · open

Fixes the black world of #163 by not opening a region the card cannot see. One commit, two files, on c9c932c.

What was wrong (details and the standalone reproduction in #163): under Wine with vkd3d-proton on RADV, OpenExistingHeapFromAddress1 on a view of a section is accepted, but the import of the view's pages is refused by the kernel (libdrm asks for anonymous memory only; a section's view has a file behind it) and vkd3d-proton opens the heap on fresh memory of its own without saying so. Buffers placed in it read zeros.

What this does

  • inplace::section_views_seen: once, a 128 KiB section of our own, a view of it, a heap opened on the view, a buffer placed in it, and what the card copies back compared with the view. One log line says what was found (seen=true how="the card read the view's bytes", or accepted, but the card read zeros, or the refusal's code).
  • port::open_region asks it under Wine only and returns the existing "refused by the host" count if the card did not read the bytes: title memory is copied as before.
  • A small on_wine() in port.rs, the same lookup xmem does. If #166's crate::wine goes in first, it can use that instead.

Windows is unchanged: the question is not asked there.

Tested (RX 7900 XTX, RADV Mesa 26.3.1, kernel 7.3, vkd3d-proton 71cae091, Proton Experimental 11.0-20261112, with this change on top of other local commits):

  • With the import made to work (an LD_PRELOAD shim that clears AMDGPU_GEM_USERPTR_ANONONLY), the line reads seen=true, port 1 opens its region (185 MB, 0 refused by the host) and the world renders.

  • This branch alone builds for x86_64-pc-windows-msvc (cargo-xwin); cargo xtask policy and cargo test -p xtask pass; the new lines are rustfmt-clean.

  • This branch alone (c9c932c plus the commit), stock RADV, VICTORY_PORT_CONSTANTS=1: the line reads seen=false how="accepted, but the card read zeros", both of the title's stretches are refused with why="the host does not show the card a view's pages (a heap of its own memory)" (2 by the host, no region opened), title memory is copied as before, and the world renders instead of being black (one observer, one scene, 110 s).

Not tested: Windows, NVIDIA under Proton, other AMD generations.

cargo clippy -- -D warnings fails on main itself at watch.rs:3626 (open(&mut title_memory_changed(..))), which this branch does not touch.

No game data in the commit.

🤖 Generated with Claude Code

**@⁠Serph91P** on GitHub · 2026-11-26 14:03 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/274) `Serph91P:linux-port1-refusal` → `main` · +101 −0 · 2 files · 1 commits · open Fixes the black world of #163 by not opening a region the card cannot see. One commit, two files, on c9c932c. **What was wrong** (details and the standalone reproduction in [#163](https://git.gtahub.st/github/avatarmanz--VIctory-7900XTX/issues/163)): under Wine with vkd3d-proton on RADV, `OpenExistingHeapFromAddress1` on a view of a section is accepted, but the import of the view's pages is refused by the kernel (libdrm asks for anonymous memory only; a section's view has a file behind it) and vkd3d-proton opens the heap on fresh memory of its own without saying so. Buffers placed in it read zeros. **What this does** - `inplace::section_views_seen`: once, a 128 KiB section of our own, a view of it, a heap opened on the view, a buffer placed in it, and what the card copies back compared with the view. One log line says what was found (`seen=true how="the card read the view's bytes"`, or `accepted, but the card read zeros`, or the refusal's code). - `port::open_region` asks it under Wine only and returns the existing "refused by the host" count if the card did not read the bytes: title memory is copied as before. - A small `on_wine()` in `port.rs`, the same lookup `xmem` does. If #166's `crate::wine` goes in first, it can use that instead. Windows is unchanged: the question is not asked there. **Tested** (RX 7900 XTX, RADV Mesa 26.3.1, kernel 7.3, vkd3d-proton 71cae091, Proton Experimental 11.0-20261112, with this change on top of other local commits): - With the import made to work (an `LD_PRELOAD` shim that clears `AMDGPU_GEM_USERPTR_ANONONLY`), the line reads `seen=true`, port 1 opens its region (185 MB, 0 refused by the host) and the world renders. - This branch alone builds for `x86_64-pc-windows-msvc` (cargo-xwin); `cargo xtask policy` and `cargo test -p xtask` pass; the new lines are rustfmt-clean. - This branch alone (c9c932c plus the commit), stock RADV, `VICTORY_PORT_CONSTANTS=1`: the line reads `seen=false how="accepted, but the card read zeros"`, both of the title's stretches are refused with `why="the host does not show the card a view's pages (a heap of its own memory)"` (`2 by the host`, no region opened), title memory is copied as before, and the world renders instead of being black (one observer, one scene, 110 s). **Not tested:** Windows, NVIDIA under Proton, other AMD generations. `cargo clippy -- -D warnings` fails on main itself at `watch.rs:3626` (`open(&mut title_memory_changed(..))`), which this branch does not touch. No game data in the commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Under Wine with vkd3d-proton on RADV, OpenExistingHeapFromAddress1 on a view of a section is
accepted, but the heap holds memory of the host's own: the import of the view's pages is refused
(libdrm asks for anonymous memory only, a section's view has a file behind it) and vkd3d-proton
takes fresh memory instead. The card read zeros and every world frame was black.

Asked once, under Wine only: a section of our own, a view of it, a heap opened on the view, a
buffer placed in it, and what the card copies back compared. Unless the card read the view's
bytes, title memory is copied as before (counted as refused by the host).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:06:55 +00:00
Author
Owner

@⁠flamme-demon on GitHub · 2026-11-26 22:05 UTC · original

Tested under Proton. With this PR and VICTORY_PORT_CONSTANTS=1, port 1 places nothing here (0 regions of the title's graphics memory in place (0 MB), 0 title buffers and windows placed in them, every frame) and the world went on with the usual draw counts. So the switch is safe to leave on under Wine, but it brings nothing on this setup either; we keep it off.

Setup: RX 7900 XTX (RDNA 3), Mesa RADV 26.2.4, Proton Experimental 20261112 with its wineserver rebuilt with the view tree, vkd3d-proton master 71cae09, Microsoft's d3dcompiler_47; main c9c932c + #151, #166, #200, #201, #274; diagnostics build, Series S (VICTORY_UPSCALER=6). Linux runs in a KVM guest with the card passed through.

Tested by Claude Code (Claude Opus 5.5) on my machine; I only watched the picture. No captures posted (asset policy).

**@⁠flamme-demon** on GitHub · 2026-11-26 22:05 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7204343863) **Tested under Proton.** With this PR and `VICTORY_PORT_CONSTANTS=1`, port 1 places nothing here (`0 regions of the title's graphics memory in place (0 MB), 0 title buffers and windows placed in them`, every frame) and the world went on with the usual draw counts. So the switch is safe to leave on under Wine, but it brings nothing on this setup either; we keep it off. Setup: RX 7900 XTX (RDNA 3), Mesa RADV 26.2.4, Proton Experimental 20261112 with its wineserver rebuilt with the view tree, vkd3d-proton master `71cae09`, Microsoft's `d3dcompiler_47`; main `c9c932c` + #151, #166, #200, #201, #274; diagnostics build, Series S (`VICTORY_UPSCALER=6`). Linux runs in a KVM guest with the card passed through. Tested by Claude Code (Claude Opus 5.5) on my machine; I only watched the picture. No captures posted (asset policy).
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 22:50 UTC · original

I backported this to linux-amd-best after seeing the same failure on a 7900 XT under Wine 11.22 and RADV 26.3.1. On both GE cae8353e and upstream 71cae091, the synthetic reserved section read back as all zero on the GPU, even with every page filled before import. The GPU could read back its own write, while the two CPU mappings could not. The AMD backport adds a test that the capability check sends that case down the copied-buffer path. Its physical test and waterfront replay are queued. AMD backport

**@⁠UwUCammie** on GitHub · 2026-11-26 22:50 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7205034316) I backported this to `linux-amd-best` after seeing the same failure on a 7900 XT under Wine 11.22 and RADV 26.3.1. On both GE `cae8353e` and upstream `71cae091`, the synthetic reserved section read back as all zero on the GPU, even with every page filled before import. The GPU could read back its own write, while the two CPU mappings could not. The AMD backport adds a test that the capability check sends that case down the copied-buffer path. Its physical test and waterfront replay are queued. [AMD backport](https://github.com/jtrudeau1530/VIctory-7900XTX/pull/25)
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 23:08 UTC · original

The backport’s hardware test passed on my 7900 XT. In two saved launches the GPU probe rejected the import and opened zero regions, but I still saw five page-layout rearrangements from XMemMapPhysicalPages. Those launches stopped early with different errors, so I don't know that the rearrangements caused either one. The AMD PR now checks the same capability on the mapper side, before it touches the section layout, and I queued a same-build on/off replay. Mapper change

**@⁠UwUCammie** on GitHub · 2026-11-26 23:08 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7205283298) The backport’s hardware test passed on my 7900 XT. In two saved launches the GPU probe rejected the import and opened zero regions, but I still saw five page-layout rearrangements from `XMemMapPhysicalPages`. Those launches stopped early with different errors, so I don't know that the rearrangements caused either one. The AMD PR now checks the same capability on the mapper side, before it touches the section layout, and I queued a same-build on/off replay. [Mapper change](https://github.com/jtrudeau1530/VIctory-7900XTX/pull/25/commits/c2cdabb1)
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 23:17 UTC · original

The shared check finished both waterfront replays on the 7900 XT. They used the same 720p executable, copied save and launch inputs. With VICTORY_PORT_CONSTANTS=1, the probe ran once, declined the heap, and both the imported-region count and page-rearrangement count stayed at zero. The switch-off run skipped the probe. Both finished the route and showed the player, porch and glass door at the four late checkpoints. The AMD backport is ready for review. Test details

**@⁠UwUCammie** on GitHub · 2026-11-26 23:17 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7205421530) The shared check finished both waterfront replays on the 7900 XT. They used the same 720p executable, copied save and launch inputs. With `VICTORY_PORT_CONSTANTS=1`, the probe ran once, declined the heap, and both the imported-region count and page-rearrangement count stayed at zero. The switch-off run skipped the probe. Both finished the route and showed the player, porch and glass door at the four late checkpoints. The AMD backport is ready for review. [Test details](https://github.com/jtrudeau1530/VIctory-7900XTX/pull/25)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/274/head:github-bot/gh-274'
git switch 'github-bot/gh-274'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-274'
git switch 'github-bot/gh-274'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-274'
git switch 'github-bot/gh-274'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-274'
git switch 'main'
git merge --squash 'github-bot/gh-274'
git switch 'main'
git merge --ff-only 'github-bot/gh-274'
git switch 'main'
git merge 'github-bot/gh-274'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.