mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 09:03:22 -05:00
A host import that leaves its range watched can resolve the write protection of the imported pages without storing anything, as NVIDIA's Linux driver does for every page. ImportWatched stamped those pages as a possible CPU store (BlockMaybeWritten), and only a storage image tracked by 64 KiB unit could clear the stamp, by comparing with a copy of the guest bytes it was uploaded from. Since #3372 a fast-cleared upload therefore reads its whole surface from guest memory wherever such an import is possible, although nothing but that compare uses the copy. ImportWatched now takes whether the import leaves its range watched. If it does, the range is copied before the stores made so far are collected, and after the import each page whose write protection was resolved is compared with that copy. A page with other bytes is stamped as a CPU store. A page with the same bytes keeps only the CPU-side stamp the label rules read, so UnchangedSince holds for it for every consumer: storage images tracked by layer, snapshots and caches as well. If it does not (a host-pointer import on a device whose imports are compared, a direct import on Windows), nothing is copied or compared: the pages resolved in the window get the CPU-side stamp and the range leaves the watch before the tracker is unlocked. Where host-pointer and dma-buf imports differ in this, the dma-buf import that follows a failed host-pointer import is a window of its own, so each window knows its kind before it starts. BlockMaybeWritten, the written-stamp table, WatchedImportsStampPages and the unit compare in StorageTexture::Refresh are gone. The fast-clear upload skips the guest-byte copy whenever its range is watched, as before #3372.