Renderer port 1: the title's 32-bit graphics heap used in place (VICTORY_PORT_CONSTANTS=1, off by default)

The title's routine at image+0x1e86440 reserves 185 MB of graphics memory
below 4 GiB, splits it into five pieces, takes all their physical pages
in one XMemAllocatePhysicalPages and maps them in order: one stretch of
one section. Its 174 MB buffer at 0x34e10000 (the ring of constants, and
what the skinning passes write through one view of all of it) had a host
copy in the card's memory, ~17 MB a frame sent up in ~600 pieces, shader
writes fetched back and compared, and ~6,000 constant fills a frame.

With the switch the stretch is mapped once more at an address of ours and
opened as a host heap there (OpenExistingHeapFromAddress1); title buffers
and windows in it are buffers placed in that heap, the existing in-place
form of a host copy: nothing tracked, sent up, fetched back or compared.
The title's own views stay free to change; when it maps other pages
there the region is forgotten. A line on the frame-rate report counts
the CPU fills and buffer copies of ours that still read or write it.

Replay (play-1125-0127, heap in the PC's memory): the title's own work
+~3 ms on the card; the 30 ms added there are our compare passes, which
do not run over memory in place.

Ported from Belobug/VIctory-Belobug-AMD 86dc109 (author: local); conflict with heap_marks in host.rs kept both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 authored and readmet3xt-lab committed 2026-11-27 02:07:40 +05:30
1 parent bda6e597da
commit 9075710d14
5 files changed
+484 -6

No files matched your search

+7 -1
View File
@@ -5217,6 +5217,12 @@ fn lookup(address: u64, len: u64, any: bool) -> Option<Arc<Shadow>> {
// memory. Not the big ones `cards` puts in the card's memory: those
// are read too often to stay in the PC's.
let big = cards() && (size >= card_limits().0 || card_all());
// Renderer port 1 (`crate::port`, `VICTORY_PORT_CONSTANTS=1`): the
// title's 32-bit graphics heap in place, big or not.
if let Some(placed) = crate::port::place_for(key.0, len, false) {
entry.shadow = Some(Arc::new(Shadow::placed(placed, key.0, len, false)));
return entry.shadow.clone();
}
if !big && let Some(placed) = crate::inplace::place_for(key.0, len, false) {
entry.shadow = Some(Arc::new(Shadow::placed(placed, key.0, len, false)));
return entry.shadow.clone();
@@ -5549,7 +5555,7 @@ fn loose(address: u64, end: u64, unsized_ask: bool, any: bool) -> Option<Arc<Sha
}
// In place, if asked for and the window's memory can be opened: the
// window is the title's own memory, with nothing to copy.
if let Some(placed) = crate::inplace::place_for(start, len, true) {
if let Some(placed) = crate::port::place_for(start, len, true).or_else(|| crate::inplace::place_for(start, len, true)) {
let shadow = Arc::new(Shadow::placed(placed, start, len, true));
note(&shadow);
map.insert((start, len), shadow.clone());