PAGES_16K says every run of guest RAM the guest names, and a SURFACE_PAGES'
length, is whole 16 KiB pages. The arm64e kext named a surface's pages as the
bundle asks for them, its IOSurface's alloc size rounded to 4 KiB, and an arm64
guest's IOSurfaces are not 16 KiB multiples: a 1920 x 1080 surface of 8 bytes
a texel is 0xfd2000 bytes, 1013 runs whose last is 8 KiB. On the M3 host the
library refused 212 of 368 blocks in place on 26.6.2 as Unaligned (Ambrosia's
pages16k after-arm), and their surfaces were copied.
Where it took PAGES_16K, the kext now tells the device of every run of guest
RAM in whole 16 KiB pages: the runs it writes for a surface in place or a
deferred block's attach end at their last page's end, the SURFACE_PAGES length
with them (writeRuns, postPages), and a pages block's range is rounded out to
16 KiB pages, where the bundle places a no-copy buffer at the pointer's offset
in such a page (RgfxRegion::pagesPage). The bytes past a surface's own in its
last page are the same allocation's, which the kernel gives and wires in
whole pages; the kext's own copy of the runs, which a later ask compares with
its memory's segments, stays as the segments are.
For the guest: on a Mac host, surfaces whose length is no 16 KiB multiple lie
in place instead of being copied. The x86-64 kext never takes PAGES_16K, and
both changes compile only into the arm64e kext and the bundle's arm64 slices:
the x86-64 set keeps its bytes. pages_block_test checks the rounding.