Skip to content

Count completed copyback bytes and refresh partly copied pages - #1

Open
MichaelSmithAI wants to merge 1 commit into
jsthope:gpu/title-copies-without-region-queriesfrom
MichaelSmithAI:fix/partial-copyback-freshness
Open

MichaelSmithAI wants to merge 1 commit into
jsthope:gpu/title-copies-without-region-queriesfrom
MichaelSmithAI:fix/partial-copyback-freshness

Conversation

@MichaelSmithAI

Copy link
Copy Markdown

On the branch for VIctory #322, the kernel copy can write the accessible parts of a buffer and skip a read-only subpage. Shadow::copy_back still adds the whole requested length to its count and marks the shadow current. A subsequent refresh can then skip the bytes where guest and host differ.

This change returns the kernel-reported byte count, resumes retries after the prefix already copied and marks a page stale if the read or write was incomplete. A full successful copy retains the existing freshness behavior.

I checked the team's red/green runs on an RTX 4090 under Wine and vkd3d-proton. With a read-only 4 KiB subpage inside a 64 KiB buffer, the parent retained freshness epoch 2. With this change, the accessible 60 KiB were counted, the protected data remained intact, and the subsequent refresh read back the guest's value. Three focused tests passed. The tests also cover a destination with an unmapped hole, an initially refused read, unchanged data, and a simulated partially successful kernel copy. The nonzero-prefix case was simulated because this Wine version reported zero at the first refused range.

Run cargo test --locked -p victory-gpu --lib copy_back -- --nocapture --test-threads=1. The shadow test prints copy-back shadow refresh control completed after its assertions. Asset policy passed. Native Windows and retail runs remain pending. This targets Marvisak#322's current shadow implementation; Marvisak#261 and Marvisak#693 separately change that loop and would require reconciliation.

AI-assisted.

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.

1 participant