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
Serph91P wants to merge 1 commit from upstream-pr/274 into main
Serph91P commented 2026-11-26 14:03:31 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Serph91P on 2026-11-26T14:03:31Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5511440685 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/274). Originally posted by [Serph91P](https://github.com/Serph91P) on 2026-11-26T14:03:31Z. --- 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://github.com/avatarmanz/VIctory-7900XTX/issues/163#issuecomment-7194071259)): 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)
flamme-demon commented 2026-11-26 22:05:02 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by flamme-demon on 2026-11-26T22:05:02Z.


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).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7204343863 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7204343863). Originally posted by [flamme-demon](https://github.com/flamme-demon) on 2026-11-26T22:05:02Z. --- **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).
UwUCammie commented 2026-11-26 22:50:44 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-26T22:50:44Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7205034316 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7205034316). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-26T22:50:44Z. --- 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)
UwUCammie commented 2026-11-26 23:08:04 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-26T23:08:04Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7205283298 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7205283298). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-26T23:08:04Z. --- 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)
UwUCammie commented 2026-11-26 23:17:47 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-26T23:17:47Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7205421530 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/274#issuecomment-7205421530). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-26T23:17:47Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/274:upstream-pr/274'
git switch 'upstream-pr/274'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/274'
git switch 'upstream-pr/274'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/274'
git switch 'upstream-pr/274'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/274'
git switch 'main'
git merge --squash 'upstream-pr/274'
git switch 'main'
git merge --ff-only 'upstream-pr/274'
git switch 'main'
git merge 'upstream-pr/274'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!274
No description provided.