runtime-e8a2129
664
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
319f54dabb |
🆕 Encode an x86-64 guest's HEVC on the host's encoder
An x86-64 guest's hardware HEVC encoding never reached our GPU: macOS's HEVC encoder plug-in drives only an Intel GPU's driver, found by name, so an app that required hardware failed at its create (-12908) and others encoded in software (m3-max-77632, development's set on this host). What the guest sees now, where the host's video arm lists an HEVC encoder of Main and Main 10 with a constant QP that codes a frame in place of the last (Linux hosts' VA-API, and NVENC where its driver codes a frame without advancing its state): - the accelerator publishes an IntelAccelerator child of its own with IOGVAHEVCEncode and IOGVAHEVCEncodeCapabilities (Main and Main 10, up to the encoder's level), so VideoToolbox lists a hardware HEVC encoder (hevc.gva); - RgfxGate keeps the Intel driver path the plug-in loads from /Library/GPUBundles a hard link to the bundle's executable, at every boot; - the bundle's video driver takes the plug-in's encode commands (function 0x20, sub-ID 0x1000), codes each frame on the host (ENCODE_H265) at the QP the plug-in's rate control chose, an IRAP picture as a keyframe, Main from an 8-bit source and Main 10 from a 10-bit one, and hands back the access unit with 4-byte start codes, whose VPS, SPS and PPS make the session's format description; - a frame the plug-in codes again over its data rate limit, at a higher QP, is sent in place of the last one (RGFX_VIDEO_ENCODE_IN_PLACE): a P picture of the last frame's order count and source surface; a keyframe coded again is sent as a new IDR picture; - a session of a size the host does not encode is refused at its create, so an app that allows software encodes in software as before. A host whose encoder has Main alone gets no nub: VideoToolbox hands the plug-in a Main 10 session whatever profiles the nub lists, and the driver learns a session's profile only from its first frame. Nor does one that codes no frame in place, where a retry would predict from the frame it replaces. H.264 encode and both decodes are as before on either. The plug-in's per-CTU QP map (its pool 27) is not applied, and its frame statistics record is not supplied. The route is macOS 26.7.1's plug-in's, booted on 26.7.2. Windows hosts list no encoder, so encode in software as before. Rows (macOS 26.7.2 guest, 1080p, 300 frames at 8 Mbit/s, decoded back by VideoToolbox; the rate band is vboot's RATE_BAND_PCT, 6%, both codecs), the same with the frames in place (m3-max-77615, m3-max-77613, m3-max-77614), byte for byte but for 205 bytes of the Iris Xe's Main stream: - RX 7900 XTX (m3-max-77475): Main 105.1%, 45.02 dB; Main 10 104.8%, 45.17 dB - Iris Xe (m3-max-77476): Main 103.5%, 48.04 dB; Main 10 98.1%, 48.86 dB - RTX 3090 (m3-max-77477): Main 100.7%, 44.81 dB; Main 10 106.1%, 45.06 dB, where NVENC's own lands 104.6%: known-issues and video/bugs.md B97 At a data rate limit of 1 Mbyte a second, the plug-in coded 2 to 30 frames of a session again, each sent in place: no gap in the order counts, all 300 frames decoded back, and the most bytes in a second 1.7% to 3.0% over the limit (RX 7900 XTX m3-max-77611, RTX 3090 m3-max-77609, Iris Xe m3-max-77627; video/bugs.md B100, to be read on a user's report). With a keyframe every frame the stream comes to 4.1 to 5.0 times the asked rate, as a real Intel Mac's comes to 5.7 times with the same QPs frame for frame (m3-max-77635; design.md, known-issues); every frame decodes back. Main 10 from a retained pool and from the app's own 8-bit buffers decodes as from the pool taken per frame on all three. A real Intel Mac's hevc.gva (macOS 26.7.1, m3-max-77481) replaces the session's pool at the third Main 10 frame, as ours does. Speed (Iris Xe, m3-max-77497): 94 to 118 fps at 1080p against software's 3.3; 10.3 to 10.8 at 8K against 0.5 (B98, B99). Tests: the kext's publish condition and its pairing with a host that codes no frame in place (video_codecs_test: the caps of both decoders and encoders without the flag publish no HEVC encode and the rest as before), the link's update on real files (rgfxgate alias_test), and the driver's listing, create refusals, settings, keyframes, write-back, failures, refused sources and the frames it sends in place, and those it does not: never a keyframe, so a session of keyframes from one reused surface sends none (video_driver_tests; m3-max-77590). Development's set on this host (m3-max-77632) encodes H.264 to the same bytes as this one and decodes as before. Docs: design.md and devices.md, video/bugs.md B97 to B100, and known-issues.md's HEVC encoding line, which now says which GPUs encode HEVC for an Intel Mac guest, and its section on HEVC over the bitrate asked. |
||
|
|
40dadf7f77 |
📝 Document VP9 profiles 1 and 3 on arm64 guests [ci skip]
The host now takes VP9's profiles 1 and 3 and profile 2 at 12 bits where the driver decodes them. devices.md gets a section on which hosts take which, how the pictures land, the Iris Xe's boots and the 1080p rate; vaapi.md the surfaces, iHD's lists and its 4:2:2 failure, and the new streams' card runs; nvidia.md, backends.md and design.md drop the refusal of profiles 1 and 3 they stated; known-issues.md names the formats each tested GPU decodes. |
||
|
|
9d69b44da1 |
🆕 Take HEVC 4:2:2 sessions on NVDEC where its caps list them
What the guest sees: on an arm64 guest of an NVIDIA host whose NVDEC lists
HEVC 4:2:2 at the stream's depth and size, as the RTX 5080 Laptop GPU's
does at 8, 10 and 12 bits, a VideoToolbox session of an HEVC 4:2:2 stream
now decodes on the GPU, each picture copied into the surface's 422v, x422
or tv22 (or full-range twin) with no conversion by the CPU. Its dsta was
refused before, and the guest decoded the stream in software. On a card
whose caps lack it, as the RTX 3090's do, the session is still refused at
its start, and its warning now names the caps ("NVDEC does not decode HEVC
4:2:2 at 10 bits") where it said "NVDEC's decoders here land no HEVC 4:2:2
pictures".
declines_range_extensions takes the caps' answer for 4:2:2 as it does for
4:2:0 and 4:4:4, the decoder's output being NV16 at 8 bits and P216
deeper, and the VideoToolbox decoder checks a picture's chroma format
against the surface's from the picture itself.
Shown on the host, not from a guest on that card: the card test
(an_hevc_picture_lands_in_its_guest_format_as_the_software_decode_has_it)
on the RTX 5080 Laptop GPU decoded our x265 streams of 4:2:2 at 8, 10 and
12 bits through the arm's VideoToolbox decoder into pool-laid surfaces,
every picture byte for byte as ffmpeg's software decode, beside 4:2:0 and
4:4:4 at each depth, and landed 1920x1080 4:2:2 pictures at 344 to 384 a
second (potluck job m3-max-77563). The seam test holds the session-start
decision on the 5080's and the 3090's recorded caps.
|
||
|
|
e5b03f2d8b |
🐛 Refuse paravirtual H.264 and HEVC sessions of sizes the host lacks
An arm64 guest's VideoToolbox session of a 4:2:0 H.264, HEVC Main or Main 10
stream whose coded size lies outside the host decoder's own, as HEVC under
NVDEC's least size of 144x144, was started, and its pictures failed in the
host's decoder: NVDEC refuses to make a decoder of that size, and VA-API's
surfaces or context refuse it. A client that allowed software decoding got
failed frames rather than pictures.
For the guest: such a session's dsta is now refused with
kVTVideoDecoderUnsupportedDataFormatErr, its warning naming the stream and the
decoder's sizes, as the x86-64 route refuses it at create (
|
||
|
|
132868d988 |
🆕 Offer VP9 decode to arm64 guests
The hosts' drivers list VP9 decode at profiles 0 and 2, and an arm64 macOS 26 guest has no VP9 decoder of its own: every VP9 session fails -12906 without one from the host. The previous commit gave the host VA-API and NVDEC decoders; this one offers them to the guest. What the guest sees: the device's video caps gain a VP9 entry, codec 3 (RGFX_VIDEO_CODEC_VP9), where the host's arm decodes VP9, listing profile 0 into NV12 and profile 2 into P010 as the driver answers them, at the arm's sizes up to 16384 a side, and level 62 (6.2, as vpcC numbers it). On the paravirtual route (RGFX_FEATURE_VT_MESSAGES) the host then lists a vp09 decoder, reims-vgpu-video.videodecoder.vp9, with those profiles; once a process registers VP9 (VTRegisterSupplementalVideoDecoderIfAvailable, as on a Mac) the guest's VideoToolbox decodes VP9 on the host's hardware. A sample is a frame or a superframe whole, which the host splits. A stream the host does not decode (profiles 1 and 3, 12 bits) is refused at its session's start, as an HEVC format the arm lacks is, and the guest has no VP9 decoder of its own to fall back on: known-issues.md says so. No encoder of VP9 is listed. The guest's pictures of the two libvpx streams equal vpxdec's, frame by frame, on an RX 7900 XTX, an Iris Xe and an RTX 3090 under macOS 26.6.2 and on the 3090 under macOS 14.6.1, and VP9 decodes as fast as HEVC on the same route at 1080p and at 8192x4352 (devices.md, with the guest's CPU emulated). The wire change is additive. An x86-64 guest's kexts read no caps entry past HEVC's, and the device takes no session of codec 3. An older host's caps have no VP9 entry, so a newer guest's VideoToolbox lists no vp09; a newer host's caps list H.264's and HEVC's entries as before, beside VP9's (vt_decoders_list_vp9_beside_the_others_where_the_caps_decode_it). The header's hash moves in the option ROM's and both kext sets' source records; their bytes are unchanged. |
||
|
|
aab864f3ef |
🆕 Offer arm64 guests' VideoToolbox an AV1 decoder
What changes for the guest: an arm64 guest's VideoToolbox now lists an av01 decoder, profile 0 at level 19 as Apple's own lists, wherever the arm's capability query lists AV1 Main (VA-API's AV1Profile0, NVDEC's AV1 at 4:2:0), and decodes AV1 sessions on the host's GPU. Before, it had no AV1 decoder at all, and a session asking for one failed -12906. A session of another profile, or past the depths or sizes the arm lists (NVDEC's caps, VA-API's AV1 surfaces), is refused at its start with a warning that names why. A picture the hardware reports failed reaches the guest as a decode error, as H.264's and HEVC's do on this route. AV1's codec number is the host's own: the device's caps, its wire and the option ROM are unchanged, and x86-64 guests get no AV1, as AppleGVA decodes none. Measured on a Radeon 780M, AV1 decodes at 0.87 of HEVC's rate at 1920x1080 and 1.02 at 8192x4352 (medians, emulated guest CPUs). |
||
|
|
54bb7b0b4c |
🆕 Decode HEVC's range extensions for arm64 guests on the host's GPU
An arm64 guest's VideoToolbox paravirtual decoders now take HEVC's range extensions, 4:2:0, 4:2:2 and 4:4:4 at 8, 10 and 12 bits, wherever the host arm's own query lists a decoder of the stream. Until now they took 4:4:4 at 8 bits alone and refused the rest at the session's start. What changes for the guest: - dsta and dsts take a range extensions stream where VA-API lists the decoder of its profile with the render targets and surfaces it needs. iHD on an Iris Xe lists all six profiles, but its Main 12 has P012 and P016 surfaces alone, so 4:2:0 at 8 and 10 bits stays refused there. - They also take it where NVDEC's caps list its chroma format, depth and size: 4:2:0 and 4:4:4 on an RTX 3090. - Where nothing lists the stream, the refusal stays as before and names the stream and the arm's reason. radeonsi lists no decoder of them. - Each picture lands in the format the guest's own software decoder gives the stream, which Dpba names: 420v/x420/tv20, 422v/x422/tv22, 444v/x444/tv44 and their full-range forms. - NVDEC's 4:2:2 is not built: the 3090 lists none, and those streams stay refused there. - The x86-64 caps are unchanged. The codec takes the range extensions at 4:2:0, 4:2:2 and 4:4:4 and at 8, 10 and 12 bits, with their tools. It still refuses extended precision and high precision weighted prediction offsets past 8 bits. Its CPU tests decode streams of each chroma format and depth, and an SPS cut at every length or with any bit flipped is refused or decoded whole, with no panic. VA-API decodes on the stream's range extensions profile into P012, YUY2, Y210, Y212, XYUV, Y410 or Y412 surfaces. The CPU splits the packed ones into the guest's two planes; the GPU still splits XYUV where its import check passed. NVDEC's 4:2:0 lands as Main 10's, and the CPU interleaves its 10 and 12-bit 4:4:4 planes. Each picture the CPU converts is counted as video-pictures-cpu-converted. CoreVideo has no format with the layout of Y210, Y212, Y410 or Y412, and the Mac's decoders answer 422v, not yuvs, for 4:2:2 at 8 bits, so the conversions stay. Under TCG on the Iris Xe, hardware sessions took 0.36 to 0.66 s for 30 pictures at 1080p of every listed profile, against 1.88 to 5.32 s for the guest's software decode (docs/video/devices.md). The conformance suite decodes x265's streams of every listed profile. |
||
|
|
89785d5a90 |
🐛 Hold a decode's readers until its planes are said written
A picture that lands by the host's own work (VA-API's copy, NVDEC's, the Windows host's Direct3D 11 draw) writes the output's planes off the platform's queues, and the platform's reads see that write only in the command buffers committed after the landing's external_writes_done, the acquire. A buffer of another queue ordered after the decode, by its SURFACE_ORDER or by the decode's early CB_COMPLETE alone, waited on the GPU for the decode's buffer's end, but could be committed before that acquire and read the planes' earlier picture: picture 423 on the Windows host, read through a plain shape 22 ms before its acquire. What the guest sees: such a buffer's begin, and so its CB_SUBMITTED, its ticket and its commit, now wait until the decode's session signals the decode's value, which the landing gives once the planes are said written, or once the picture ended without landing. The key is the decode's buffer, by its queue and seqno, kept in its queue's marks from its walk until that signal. Nothing times the hold out; a hold past 2 s is named in the log, and the order's summary line counts the holds, those for a landing and the longest, and the named buffers not yet published, which hold nothing. A doorbell no longer answers a buffer that uses a block of a decode completed ahead of its end. The tests that run a reader behind a fake session's decode now signal the session's value as the landing does. The completed-ahead reader's test holds its begin past 2 s and checks the log's lines, and the red test of the reader named after a decode passes. |
||
|
|
fe09ba3c59 |
🐛 Begin a buffer named ahead of its walk only after its commit
Each queue's ring is taken on a thread of its own, so the host can take a buffer whose SURFACE_ORDER names a buffer of another queue, committed earlier by the guest, before the host has walked the named one. Until now the naming buffer waited for it on the GPU alone, and that can close a loop. The named buffer, a decode, fills its output's device cache at its begin for the CPU's newer generation. The fill waits on the GPU for the end of each buffer that used the cache, the naming buffer among them when it was begun and finished first. The naming buffer waits on the GPU for the decode's signal, which the decode's commit carries after its walk. The walk's video op waits on the CPU for the fill. None of them ever finishes: the Windows host's video decodes stopped this way. What changes for the guest: such a buffer's begin now waits, on its queue's thread, until the named buffer is committed. Its uses then count among no cache user that the named buffer's fill waits for. Its CB_SUBMITTED and CB_SCHEDULED, and the buffers behind it on its queue, come after that commit too. A buffer that names only buffers the host has walked, or not yet published, is begun as before. The wait is counted on the surface order's summary line (begins that waited, and the longest wait), and a wait past 2 s is named in the log with the buffer it waits for. The module doc of surface_order and the design's "Surface order" section give the wait and why the waits end. They also give the one shape that holds: names written wrong, by a process that writes the slots itself, which can make two buffers of two queues wait for each other until either queue ends or the device resets. Tests: - The test committed alone before (a buffer naming a decode not yet walked begins after its commit) now passes: the reader's begin waits, it counts one wait, and no fill waits behind a later buffer. - New: two buffers that name each other hold their queues, each named in the log, until one's process closes. - New: a buffer waiting so is answered at no doorbell, so it holds no ticket. - Changed, because they held the old order: the device tests of a reader in another process and of a buffer named while its queue's later buffer is walked first. Each reader is now committed only after the buffer it names, then waits on the GPU for its signal. - The counter test of a fill behind a later buffer now runs on rings the host gives no published seqnos. That is the one place its order is left. |
||
|
|
8a1fe8f0b1 |
🆕 Scroll x86-64 guests by a touchpad's own distance
A touchpad scrolled an x86-64 guest by turning its mouse's wheel, a notch per 10 points, which macOS accelerates as a wheel's: a quick swipe went several times as far as the fingers moved. The x86-64 kext now starts a precise scroller beside its mouse, "Reims vGPU Scroller" (product 0x5248): the mouse's descriptor with a physical range of -1 to 1 on its wheel and pan, which macOS reads as 127 counts a unit and so marks its events continuous and precise, in points, as a touchpad's; and HIDSupportsScrollAcceleration false on the device, which turns macOS's scroll acceleration off for it. SCROLL_DEVICES names it too (RGFX_SCROLL_DEVICE_PRECISE), so the host sends a touchpad's distance in 1/256 points, and the kext makes one count of it per 10 points, the rest carried on and started afresh where the scrolling turns back. For the guest: a touchpad's scrolling, and a Mac host's precise scrolling with its coasting, come from the scroller, continuous and precise, as far as the host reports and unaccelerated, in steps of 10 points, with no gesture phases. A wheel's notches still come from the mouse. The arm64e kext is unchanged. Why 10 points a step: with the acceleration off a count scrolls 10 points at any speed (120 counts made 1200 points slow, fast and in lumps, on both axes, at 127 and 90 counts a unit; potluck jobs m3-max-75987 on 26.7.2 and m3-max-75994 on 11.7.11). Apple's driver passes each count whole and reads no resolution multiplier, so no descriptor makes a count worth less. With the acceleration on, neither a flat acceleration table nor one linear curve scrolled as far a count at every speed (m3-max-76084). Measured in windowed walks with a wheel mouse over the window, on macOS 26.7.2 (potluck job m3-max-76127) and 11.7.11 (m3-max-76128): "Reims vGPU Scroller" reads HIDScrollResolution 127 and HIDSupportsScrollAcceleration No down to its event service; forty quarter-notch parts 16 ms apart (100 points) made ten continuous, precise events of 10 points each, up and sideways, where the mouse would have ramped; the wheel's notches and bursts read as before. |
||
|
|
0df657bde1 |
🆕 Scroll x86-64 guests sideways through their own mouse
An x86-64 guest scrolled only up and down: QEMU's usb-tablet, which took the host window's scrolling, has no sideways wheel. The x86-64 kext's mouse now has an AC Pan beside its wheel, which IOHIDEventDriver makes the scroll event's sideways axis, and once the mouse is up the kext names it to the host with the new SCROLL_DEVICES command. From then on the window sends its scrolling to the guest as SCROLL events instead of QEMU's wheel buttons: a wheel's notches as they are, and a touchpad's distance as one notch per 10 points, the points a line is on SDL (FINE_PER_NOTCH), the rest carried to the next event and counted afresh where the scrolling turns back. The kext posts the notches as the mouse's wheel and pan reports, at most 8 x 127 a SCROLL. For the guest: its scrolling comes from "Reims vGPU Mouse", sideways included, with macOS's own wheel acceleration, as the tablet's did. For the host: the window's wheel and scroll callbacks are not called for scrolling the guest's devices take. An arm64 guest names no devices, so its scrolling goes to the vmapple tablet as before; the arm64e kext's binary is unchanged. The wire also carries a SCROLL's distance in 1/256 points, for a guest that names a precise scroller (RGFX_SCROLL_DEVICE_PRECISE), which no kext names yet. Measured in windowed walks with a wheel mouse over the window, on macOS 26.7.2 (potluck job m3-max-76095) and 11.7.11 (m3-max-76100): notches up, down, right and left reach the guest three for three on their axes, in the tablet's directions; eight quarter-notch parts make two; a burst of ten at 16 ms ramps from 1 to 91 points, as the tablet's did; QEMU's tablet takes no wheel button. |
||
|
|
eed36c1d89 |
🐛 Keep the plain pointer through a hide the release chord ended
While the guest's screen is recorded or shared, macOS hides the cursor for the whole recording and draws it into the picture, which the window takes for a game's hide (lane ptrswitch, potluck job m3-max-75965: one setCursorState(x, y, false), then no call while the pointer moved, as in a game). Captured, the pointer then drives the guest's mouse until the share ends, and the release chord freed it only until the next click captured again. The person releasing capture (the release chord, or Release Input on macOS) now leaves the rest of that hide to the tablet, captured again or not, until the guest shows its cursor (Game::released). Losing the keyboard and the window's end do not: a player who switches away from a game and clicks back gets the guest's mouse as before. A player who presses the chord mid-game gets it back once the game shows its cursor and hides it again. The remembered hide is cleared where the guest shows its cursor, or where its hide reads shorter than at the release (a later hide). It is not cleared at capture's end: every show and hide of the guest's reaches Game::shown (the window asks at each), so it cannot outlive its hide, and clearing it there would undo the chord at the next switch away and back. features.md, the design doc and known-issues.md say so; known-issues.md's share entry now says to press the release chord once. |
||
|
|
d73c827d44 |
🐛 Drive the guest's mouse only once its hide outlives a move
The captured pointer drove the guest's own mouse once the guest had hidden its cursor for 50 ms. macOS hides the cursor while text is typed until the mouse moves, so the first move after typing locked the host's pointer: that move was lost, the next went to the guest's mouse with the guest's acceleration, and the host's pointer jumped to the guest's cursor once the guest showed it, about 9 ms later at 125 Hz (x86-64 26.7.2, potluck job m3-max-75911: the switch fired in each of three typing rounds). A hide's first captured move now goes to the tablet, as while the cursor shows, and the window drives the guest's mouse only once that hide has lasted the settle, 50 ms, past the move. A cursor hidden until the mouse moves shows at that move, so typing never drives the guest's mouse and no move after it is lost. A game's hide stays, and its mouse-look begins one move and 50 ms later, those moves reaching the game through the tablet. A show, a hide that reads shorter than at its first move, and a change of capture start the count over. It is the one rule: the count from the hide alone is gone. The same logic drives the window on Linux, Windows and macOS hosts. The game tests and both inputs' tests send the hide's first move, and new tests pin the typing case: a_hide_a_move_ends_drives_nothing, a_new_hide_starts_the_count_over, and each input's a_cursor_hidden_until_the_mouse_moves_drives_nothing. The register's entry changes in a commit of its own. |
||
|
|
d27ab921c2 |
🐎 Start a class with no slab again at its first size
A class's next slab doubled with each slab it made, up to kSlabMax, and never came down once its slabs went. A buffer of a page that came after its class had grown and let go took a slab of the largest size the class reached: 2 MiB from the region or the process's pages, and 16 MiB from the Shared pool, which the host zeroes as it gives it. Keeping empty slabs (the commit before) stops this for a buffer made and freed again and again, but not for one that comes more than 2 s after its class's last slab went. Now a class left with no slab, none holding a buffer and none kept, starts again from kSlabFirst (128 KiB), over every source. While it keeps an empty slab it goes on growing as before. What changes for the guest: after an idle let-go, a class's next slab is 128 KiB, or twice its buffer, rather than the size the class grew to, so its heap's size and the buffers' GPU addresses in it differ, and the host takes and zeroes a smaller block. test_slab_class_starts_again_once_empty holds it over the test's source and the pool's; the pool tests that took the grown size now read 128 KiB. The guest sets (guest/prebuilt, guest/prebuilt-arm64e) are rebuilt here from the bundle of this commit and the one before, which changed it too. |
||
|
|
2591c9022e |
🐎 Keep the Shared pool's empty slabs as the region's are
A class's slab of the Shared pool went back the moment its last buffer did
(RgfxPoolSlabSource::keepsFreed() answered false), and a large buffer's own slab
skipped the cache. A process that makes one buffer and frees it again and again
in an otherwise empty class then took a pool block for each buffer: a take the
thread waits for, a HEAP_OVER_POOL, the host zeroing the block, then the heap's
destroy and the block's give. Each new slab doubles its class's next one, so
after seven rounds every block was 16 MiB, for a buffer of one page. A user's
guest logged one process making and giving back about 17 such slabs a second,
none of them taken from again. The serialiser test of that pattern at
|
||
|
|
805c93a65c |
🎨 Count each in-place refusal of a surface by its reason
The kext answers an ask in place it does not carry out with one status for three reasons: the device uses no surface in place (no SURFACE_PAGES), an ask with no device cache meets a device that caches every surface (the kext's `uncacheable`), and the device refused the surface's pages. The bundle counted all three as "unsupported", and the first copy's line said "the device uses no surface in place, or refused its pages", which named neither the uncacheable refusal nor told the other two apart. The bundle now tells them apart by the ask and by the device's SURFACE_PAGES and SURFACE_CACHE_EVERY, and counts each under its own name. The guest's surface copies line gains two counts, "asked uncached where every surface is cached" and "refused by the device", and "unsupported" now counts only a device that uses no surface in place. No Metal answer changes. The in-place fallback test covers each reason. Both guest sets are rebuilt with it: RgfxGate in guest/prebuilt and guest/prebuilt-arm64e; Graft and ReimsGraphics keep their bytes. |
||
|
|
699d299e3c |
🐛 Refuse a Linux host below 7.2 for a VM on our GPU
A VM on reims-vgpu's GPU now needs Linux 7.2 or later on a Linux host, under any accelerator, where KVM's VMs needed 6.13: reims-ctl's start check refuses an older kernel, naming the running one and "Linux 7.2 or later", and so does the reims-graphics device's realize in QEMU (vendor/qemu 458f4b7b). Before 7.2 a udmabuf over large pages is malformed, and an AMD GPU's import binds the wrong pages of guest RAM (issue 185); 7.2 builds the table from the pages themselves (upstream 5bf888673e0d, read from v7.2's drivers/dma-buf/udmabuf.c). The floor holds KVM's 6.13 reason too. MIN_KVM_KERNEL is MIN_LINUX, and doctor's kernel line shows on every Linux host. The floor takes the place of the below-7.2 form: QEMU no longer advises guest RAM, the device's region or its pool pieces MADV_NOHUGEPAGE, nor logs the 4 KiB line, and the library's views of guest RAM take no advice (off_huge_pages, huge_pages_take and linux_release_at_least go, with their tests). On 7.2 and later nothing changes: QEMU's advice and its collapse with its share line stay. What hosts see: below 7.2 a start is refused, where it ran with guest RAM on 4 KiB pages; on 7.2 and later the VM starts as before. README, docs/qemu.md, docs/graphics-kext/design.md and docs/lessons.md say so. |
||
|
|
46f492f2c9 |
🐛 Name the Windows key Win in the window's title on Windows
The person at a Windows host saw the captured window's title say "press Ctrl+Alt+Super to release": Windows keyboards have no key named Super. The chord is SDL's GUI key with Ctrl and Alt, and on Windows SDL gives the left and right Windows keys as that GUI key (VK_LWIN/VK_RWIN and scan codes E0 5B/E0 5C to SDL_SCANCODE_LGUI/RGUI, read from SDL 3.4.18's code), so the title there now says " — input captured (press Ctrl+Alt+Win to release)". Linux keeps Ctrl+Alt+Super and macOS its ⌃⌥⌘. The text is now capture::captured_suffix(HostOs), one string per OS, and Capture::title_suffix takes the host's OS: each OS's file of native/ names its own (HOST_OS on Linux and Windows, HostOs::MacOs in AppKit's input), so no cfg spreads into shared code, and the_title_names_the_release_chord_in_the_host_s_keys checks every OS's string on every host, the Windows one included, which no test outside the Windows mini reached before. features.md's capture entry, README.md and the design doc name the Windows chord. |
||
|
|
a47f295910 |
📝 Say that a release waits for the command buffers begun [ci skip]
The design doc's BLOCK_RELEASE, POOL_GIVE and PRIVATE_GIVE answers, and the doc comments of their handlers, said the answer follows the command buffers the context committed. The code waits for the ones the decoder has begun for the context (drain_context): a command buffer posted on a ring and not yet begun is not waited for. Each place now says that. No code changes. |
||
|
|
3d5ff13d0a |
📝 Say how VA-API's 4:4:4 pictures reach the guest [ci skip]
The import check now tries XYUV beside NV12 and P010, and where it passes, the graphics arm has the driver write a 4:4:4 picture into a scratch of its device's and the device's GPU split it into the guest's surface; the CPU's split through vaGetImage stays where it does not. The VA-API doc and the device's design said the CPU split it always. They now say what the check tries, what the arm does with its answer, and radeonsi's measured answer: none, since its vaCreateImage refuses an XYUV image. |
||
|
|
4fba48b091 |
🔥 Remove the display's two mirror shaders, which nothing calls
displayMirrorTile and displayMirrorTileList, with the struct, constant and helper only they used (DisplayMirrorFrame, display_mirror_threads, display_mirror_tile_changed), were the window mirror's kernels. The mirror, reims-vgpu's graphics/mirror.rs, was deleted with VulkanPlatform, and since then no pipeline was made from either: the only name left was a test's check that the platform's shader library is ours, which now names displayPresentVertex, a function the display draws with. The metallibs are rewritten by cargo xtask metallibs (only shaders.metallib and its line in metallibs.toml change). design.md's route 1 says its kernels went with it. Nothing the guest or host sees changes: no pipeline, binding or result used these functions. |
||
|
|
82d2c8449d |
🆕 Answer supportsFunctionPointers with rt's answer on Vulkan
The guest now sees supportsFunctionPointers YES on every host on the Vulkan platform, where it saw NO: the answer is rt's Device::supports_function_pointers, which is true on every device and never chosen by vendor. Its compute pipelines' function handles, visible function tables, sets and binds are rt's (the previous commit), and the bundle's compileVisibleFunction: calls, which Metal's library sends for MTLFunctionOptionCompileToBinary, now answer no error. supportsFunctionPointersFromRender stays NO: rt makes no render stage's tables. A kernel that reads a table through an argument buffer is still refused (rt-refused-translation). The bundle answers from the FUNCTION_POINTERS feature bit, which every host offers, and this identity flag, so the guest needs no change. The identity's tests now hold rt's answer, and design.md's list of the lane's own NO answers names render pipelines' function pointers alone. |
||
|
|
3d53248877 |
🐎 Write NVDEC's 4:4:4 pictures into their surfaces on the GPU
NVDEC's 4:4:4 pictures were read back to the host and interleaved by the CPU into the guest's surface. Now, where CUDA imports the device's exportable buffers, CUDA copies each plane within the GPU into a scratch of the decoder's. videoGather444 then writes them into a Shared buffer over the surface's pages, and the pass is waited for. This is the route NVDEC's 4:2:0 pictures already take, which writes the surface in place. The guest's surface holds the same bytes as before. Each picture written this way is counted as video-pictures-gpu-gathered, and a session logs how many at its end. A refusal before anything is written (no exportable scratch, a plane off a 32-bit word, a plane past the surface or the scratch, a failed pass) falls back to the CPU's interleave, and its reason is logged once per decoder. |
||
|
|
fa1636f312 |
🆕 Decode HEVC 4:4:4 at 8 bits on VA-API where the driver lists it
What the guest sees now: where the driver lists HEVCMain444 VLD with 4:4:4 render targets (iHD on Intel's Iris Xe), VideoToolbox's paravirtual sessions of HEVC 4:4:4 at 8 bits are made, as on NVDEC. Where it lists none (radeonsi), they are refused at their start with "VA-API: the driver has no HEVC Main 4:4:4 decoder" in the refusal line. The accelerator sends the range extensions' picture and slice parameters, the base and Rext structures in the usual buffer types, and decodes into XYUV surfaces. A frame is read back through vaGetImage and split on the CPU into the surface's luma and Cb/Cr planes. The import check has no XYUV answer, so no GPU route lands these pictures yet. hevc-check.sh decodes x265's Main 4:4:4 streams where the driver lists the profile, and expects the driver's refusal elsewhere. |
||
|
|
e38755158d |
🆕 Decode HEVC 4:4:4 at 8 bits on NVDEC
VideoToolbox's paravirtual decoders refused every HEVC stream outside Main, Main 10 and Main Still Picture. At login, an arm64 macOS 26 guest opens a tile session of an HEVC 4:4:4 stream at 8 bits (a HEIC image's), which was refused. What the guest sees now: where NVDEC lists HEVC 4:4:4 at 8 bits (cuvidGetDecoderCaps, Yuv444 output), such a session is made and its pictures land in '444v' or '444f' surfaces, by their range. Where the arm declines it, the session is still refused at its start, and the refusal names the arm's reason. 4:2:2, monochrome, 12-bit and deeper 4:4:4 streams stay refused. The codec crate parses the range extensions of the SPS, the PPS and the slice header, each held to its range, and splits its check: the codec's own refusals, then the arm's. NVDEC's pictures take the range extensions' pic params, and its decoder writes three planes. The CPU interleaves them into the surface's two planes. The tests that held the old refusal now hold the new answer, and hevc-check.sh expects each refusal's own reason. |
||
|
|
6d83a5d4f8 |
🆕 Name the stream on a paravirtual decoder's refusal
The arm64 guest's VideoToolbox sessions of a stream the host does not decode were refused with a line that named no stream: b499's macOS 26 boot on the 780M opened a HEIC tile session at login, refused, and the log did not say which profile it was. The refusal's warning now names the stream: its codec, profile (HEVC's general_profile_idc, H.264's profile_idc), chroma_format_idc, luma and chroma bit depths and coded size. Its degradation kind spells the shape in words, size left out, so the first stream of each codec, profile, chroma format and depths in a boot is written and the rest are counted (the logger cuts a kind at its first digit). The guest is answered as before: nothing it sees changes. |
||
|
|
b35bda90d1 |
🔥 Delete the pages views' grouping, which no platform turns on
The pages blocks' views were grouped into shared udmabuf files only where the platform's VM answered HostVm::view_groups, and regrouped only where it answered HostVm::regroup_limits. Since the old Vulkan platform went, no platform answers either: rt's view imports are made at SURFACE_PAGES with the import's own address, each view one import, and the planner ruled that grouping does not come back in any part. The code only the testkit drove is deleted: - SurfaceViews::join_group, group_closed, seal, group_jobs and their types (Joined, Sealing, the forming groups, HandedOver, WaitsForViews), GROUP_WINDOW and GROUP_MEMBER_MAX, and the decoder's wrappers; - decode/surface_pages/regroup.rs, the decoder's regroup_moves, and GraphicsControl's regroup_step, seal_group, group_key and REGROUP_KEY; - HostVm::view_groups, group_views and regroup_limits with GroupLimits, GroupHold and ViewGroups, and the testkit FakeVm's answers to them; - Buffer::rebind_no_copy, which only regroups called, its testkit impl and the two tests of its refusal; - the grouping and regroup tests in graphics/tests.rs. start_over_pages hands the over-pages job to the surface worker as before grouping, and a context's close no longer drops groups first. Nothing the guest or the host observes changes: no platform grouped a view, so every view was already an import of its own. No degradation counts-line code is dropped; grouping wrote none. The diagnostics that go with it are the views log line's "imported as pieces of group dma-bufs" clause, the regroups info line, the trace events regroups, regroup, regpass and regcand, and the seal's and regroups' debug lines. The surface_pages module doc and docs/graphics-kext/design.md now say each pages block's view is one import, keeping the measured cost of an import a submission; docs/lessons.md keeps both grouping lessons as traps, in the past tense. |
||
|
|
97963584b8 |
🆕 Finish a pipeline's make with rt's finish_pipeline
The rt platform's state finishes, ComputePipeline::finish and RenderPipeline::finish, now call rt's finish_pipeline: the driver's create of the state's main pipelines, which rt's creators leave out since 951285e7a7, runs on the device's compile thread after the create's reply and before its store. For the guest: a pipeline create's reply no longer waits for the driver's create of its main pipeline, as it did before the pin move; the store, and the command buffers, indirect command buffer writes and function handle and table creates that name the pipeline, still do, so its first draw or dispatch no longer makes that pipeline on its queue's lane, as it did with the pin move alone. Every answer the reply carries is made before the driver's create, so nothing the guest reads changes beside timing. A finish rt fails is the create's late failure, pipeline-finish-failed, as before: the pipeline is stored as made, and a draw or dispatch that needs it makes it again, refused at its encode where that make fails too; the accuracy ledger lists it. A create whose destroy, context close or reset came before its finish began is no longer finished: its pipeline is never stored, so the driver's create would be wasted. A finish already running still ends. A keyed create skipped so keeps its answer as its make answered it. The counts line gains rt's new metrics: rt-finished-pipelines and rt-finished-pipeline-ns, rt-first-use-unfinished-waits and rt-first-use-unfinished-wait-ns, and rt-first-use-unfinished-wait-max-ns at its highest over the process's devices. The ten-second rt summary says the finishes and the unfinished waits, and the trace's rtmetrics event ends with the five values. rt's failed_finishes is not folded: the device's pipeline-finish-failed counts each failure at the platform's seam, where every platform's finish answers (a raise or death in the platform's refusal scope too, which rt never sees) and where the failure's guest-visible effect is decided, so the line carries each failure once. docs/conventions.md's stall rule names the reply ahead of the driver's create as its second exception, and compile.rs's Order, the design doc and the rt platform's pipeline docs say what the finish now does. |
||
|
|
506d193389 |
⬆️ Build on metal2vulkan development 10f83b636d
Moves the runtime pin from 91fed9449c to 10f83b636d, on metal2vulkan's
development, in a commit of its own.
For the host: rt's pipeline creators now answer once everything that can
refuse is made, before the driver's create of the state's main pipeline
(951285e7a7), which rt's new finish_pipeline makes: a compute state's
tiles', square workgroups' or required size's pipeline, a render state's
triangle or patch class and the class its inputPrimitiveTopology names. The
rt platform's finish does not call it yet (the next commit does), so with
this commit alone a state's main pipeline is made at its first draw or
dispatch, on its queue's lane, or by the dispatch pre-pass's make ahead,
since dispatch_variant's made bit reads false until it is made. rt counts
such a wait as first_use_unfinished_waits. A driver's create that fails
there fails that draw or dispatch, where it failed the create before.
Kernels past the stage bound still make their main pipeline in the
constructor. A heavy kernel's driver failure at creation that is not a
stage-bound refusal is now its first dispatch's error, as for tiled and
square kernels.
The push window is min(maxPushConstantsSize, 256) for each device
(d9077dfa0d), where it was a constant 256 that the floor required. The floor
now refuses only a device below 128 bytes, so a device of 128 runs with a
window of 128. Every device we ran on passed the old floor, so it reported
256 or more, and its window stays 256. The translator's binder plan goes
(fd5fcca9b0, a7dd2e846e): rt never made one.
Nothing the guest observes changes beside timing: every answer rt gives is
fixed before the driver's create, and the reply, which waited for the whole
make, now waits for rt's part of it.
Added to rt's public items: ComputePipelineState::finish_pipeline and
RenderPipelineState::finish_pipeline, VariantStart::Finish, and Metrics'
finished_pipelines, finished_pipeline_nanos, failed_finishes and
first_use_unfinished_waits with its nanoseconds and longest, and
DeviceProfile::push_window. Removed: 595 of the translator's items, the
binder plan's, and the runtime's PrecisionNote::FloatSampleFilter and
HalfSampleFilter. Nothing of ours names any of them. SEMANTICS (2273),
ARTIFACT_FORMAT (591) and RUNTIME (2550) are unchanged, so warm caches stay
warm. metal2vulkan's Cargo.lock is the same at both commits, so the stripped
lock is.
The device docs that said the make leaves nothing to the finish now say it
leaves the driver's pipeline to it: rt_platform/pipeline.rs ("Its main
pipeline") and both platform finishes, compile.rs ("Order") and the graphics
design doc.
|
||
|
|
e9c55782bf |
📝 Add the M3's queue priority answers to Q50 [ci skip]
Q50 measured a new queue's GPU priorities on the two Intel Macs only, and the bundle's arm64 builds share the answers it took from them (1 and 2). The M3 Max under macOS 27.0.1 answers the same: oracle_prio's first lines, built for arm64 and run on it in m3-max-68256, read GPU priority 1 and background priority 2 on a new queue, and every readback after the sets as the Intel Macs do. So Q50's queue answers are now class 3 on all three Macs, and the bundle's arm64 answer is measured. The flag that stopped the probe after those lines was not committed. |
||
|
|
a4da706118 |
📝 Say what the host does with WindowServer's queues [ci skip]
design.md said WindowServer's queue runs at high priority where the host
driver offers queue priorities, and that an unshared queue is the one the
runtime's unshared_queue makes. Neither is what the code does. On the Vulkan
platform new_command_queue_unshared answers the platform's plain
new_command_queue, and the runtime submits every command queue's work to its
one VkQueue, which it makes at priority 1.0 with no global priority. So no
queue priority reaches Vulkan, and an unshared queue's buffers wait behind
every buffer submitted before them, as any queue's do. The runtime has no
unshared_queue at the pin, and the library has no Metal platform, which the
paragraph also named.
Docs only: no check reaches it ("docs and comments" in AGENTS.md).
|
||
|
|
55e5dbef5b |
📝 Say what the wire's queue priority field is
RgfxQueueCreate.priority's doc read "0 normal and higher higher", which runs against Metal's order: a new queue's GPU priority is 1, and on an Intel 630 a queue of a lower value runs first (dgpu-oracle.md Q50). It now says what the field is: the bundle sends 0 for every queue, a guest's setGPUPriority: stays in the guest, and the host reads none, so no queue the platform makes takes a priority. Q50's note on the comment says it was changed. reims_graphics_wire.h is regenerated with it (cargo xtask header). The header is a source of the option ROM, so the ROM's record is rewritten with make -C firmware prebuilt. The ROM's bytes are unchanged: its sha256 is 749434f87f562895548f60681cd4cd8bf6cc0d0e967ac2fea297674426709161 before and after. |
||
|
|
92e20a326e |
🐛 Answer a new queue's GPU priorities as Metal's queues do
For the guest: a new command queue now reads GPU priority 1 (getGPUPriority, GPUPriority) and background GPU priority 2 (getBackgroundGPUPriority), where it read 0 and 0. A new queue on the Intel 630 and the AMD 5300M reads 1 and 2 under macOS 26.7.1 (dgpu-oracle.md Q50), and RenderBox reads both back as it sets up its queue. The setters and their readbacks are unchanged, and nothing is sent to the host. Q50's getters read no offset back, so the offsets' first values are not measured, and they stay 0. Q50 also set the background priority only to 2, a new queue's own value, so the bundle's readback of other background values is unchanged and not pinned. test_queue_priorities_read_back_as_metals runs Q50's readback sequence: a new queue, setBackgroundGPUPriority: 2, then setGPUPriority: 2, a second queue's setGPUPriority: 0, and the two offset forms. |
||
|
|
ff0f2ac817 |
📝 Say the wire's queue priority comment runs against Metal's order [ci skip]
Q50 found that a lower GPU priority value runs first on the Intel 630, and that a
new queue's value is 1. RgfxQueueCreate.priority's comment in
reims_graphics_wire.h reads "0 normal and higher higher", the opposite order.
Q50 now names that comment as found. The wire is not changed here: nothing reads
the field, and the bundle sends 0 for every queue.
Docs only: no check reaches it ("docs and comments" in AGENTS.md).
|
||
|
|
e4baca4322 |
📝 Add the queue priority oracle and its answer [ci skip]
On the Iris Xe, a guest's late frames come from the window server's writers
waiting on the GPU behind long buffers of the guest's background media-analysis
service. The guest marks that service's heavy queues setBackgroundGPUPriority: 2
and then setGPUPriority: 2, and WindowServer's setGPUPriority: 0. Our bundle
keeps the marks and answers them back, and nothing reaches the host. Before any
priority work is sized, the question was what an Intel Mac does with the marks.
oracle_prio answers first which of the four setters a queue answers and what its
getters read back. Then a second process commits a short compute buffer while
the first process's queue of 60 ms compute buffers runs, with that queue
unmarked, marked as the service marks its queues, both queues marked, and the
short buffer's queue alone marked as WindowServer marks its own.
Jobs m3-max-68129 and m3-max-68139 ran it on the MacBookPro16,1 oracle's Intel
UHD Graphics 630, and m3-max-68137 on its AMD Radeon Pro 5300M, under macOS
26.7.1. dgpu-oracle.md's Q50 records the answers:
- A new queue reads GPU priority 1 and background priority 2 on both GPUs, so
the service's marks change only its GPU priority, to 2.
- The 630 runs queues of one GPU priority first in, first out. When the short
buffer's queue has the lower value, it preempts the running long buffer and
starts the short one within 0.44 ms.
- The 5300M runs the short buffer beside the long one within 0.44 ms, marked
or not.
Our one VkQueue runs it after them all, in every case.
design.md's queue rings paragraph now says so, citing Q50. The oracle README
lists the probe, and build.sh builds it with the others.
Docs and the source of a probe built only for the oracle Mac: no check reaches
it ("docs and comments" in AGENTS.md). The probe was built with build.sh's flags
in jobs m3-max-68121 and m3-max-68136, with 0 warnings.
|
||
|
|
d555fad39c |
🆕 Reply to a pipeline create before its make's finish
A pipeline create's compile now settles in two steps on its compile thread. First the reply, posted once the platform's make has made every answer the reply carries; then the store, after a new second step of the make, ComputePipeline::finish and RenderPipeline::finish, on the same thread. The pipeline stays pending between the two, so the command buffers, ICB_WRITEs, ICB_SLOTS and function handles and tables that name it wait for its store, and a destroy, close or reset in that window cancels it as it cancels a compile. The finish is where rt's finish_pipeline will go: the driver's vkCreate*Pipelines, left out of the make, so that the guest's next create need not wait for it. A finish that fails is the create's late failure: it is counted as pipeline-finish-failed and its first line logged, no answer is kept for its key, and the pipeline is stored as made, its draws and dispatches meeting the failure at their encode, as an encode the platform refuses does. The VM goes on. The failure surfaces on the command buffers, not as the create's error. Nothing changes for the guest today: the reply is posted before the store, and with today's rt the make is whole before either, as RtPlatform's finish does nothing and cannot fail. |
||
|
|
4c8033a817 |
🆕 Let deferred dormant blocks age out again
This reverts cd369b7457, which kept deferred dormant blocks out of the 10 s age rule. That commit followed the reading's fixed rule, whose item 2 tripped on a let-go's BLOCK_RELEASE answered in 27.451 ms, 10.2 s after the browser's close. The planner amended item 2 (02:4x): it trips only on a let-go's own work on the answer's line, meaning its copies and rt's release and free calls. The wait for the context's command buffers to end does not count. The with-walk's trace splits that answer: its ring-0 job took 0.447 ms. The one command buffer it committed holds only event waits, on values signalled 64 to 70 s before, and a signal. rt stamped that buffer's GPU start 26.244 ms after its submission, and it ran in 0 ms on the GPU. No other command buffer ran in the 9.4 s before it, so the wait was the host GPU's start after an idle stretch, not other work. The answer came 0.507 ms after the buffer completed. Over the whole walk, no BLOCK_RELEASE answered in 16.7 ms or more has own work that long. The jobs took 1.614 ms at most, and the longest command buffer committed between a job and its answer, from any context, ran 7.660 ms on the GPU. Items 1 and 3 held as measured: frames -0.86%, and the Mac's footprint 90 s after the close was 12893 MiB with the deferred part against 15381 MiB without it. So the deferred part stays, with its footprint gain. The option ROM's record goes back to its build before cd369b7457, and both guest sets are rebuilt from this tree. |
||
|
|
88fa50cd8f |
🔥 Keep deferred dormant blocks out of the 10 s age rule
Walks m3-max-66747 (without the age rule) and m3-max-66749 (with it), arm64 macOS 27.0.1 on the M3, headless, read the rule fixed for the deferred part: it stays only if frames are within 1%, no guest answer of 16.7 ms or more names a let-go, and the Mac's footprint after the close is not higher than without it. Frames were 5402 against 5449 (-0.86%), and the footprint 90 s after the close 12893 MiB against 15381. But 10.2 s after the browser closed, the release of a block let go for its age was answered in 27.451 ms, and the walk's BLOCK_RELEASE answers of 16.7 ms or more rose from 311 to 445. The trace does not say whether that block was deferred; the rule removes the deferred part. So a deferred block goes past its caps and for the other causes alone, as before the age rule, and the age timer waits for the others alone. A dormant block not deferred still goes once it has slept 10 s. What the guest sees: a deferred surface's pages take the GPU's writes at its next lock, or at its block's let-go past a cap, as before the age rule. guest/prebuilt and guest/prebuilt-arm64e are rebuilt from these sources, and firmware/prebuilt/ReimsGraphics.toml records the wire header's new comment. |
||
|
|
447f14fe10 |
🆕 Let go of dormant surface blocks once they have slept 10 s
A dormant block kept its surface's cache on the host, and a non-deferred one its surface's memory wired, until a cap, a client's going or a new block's want of room let it go. After a browser closed, walk m3-max-66448 (arm64 macOS 27.0.1 on the M3) kept 250 dormant deferred blocks, 1013 MiB of caches that held the only copy of surfaces other processes still held, and 3 to 5 wired blocks of 6016x6016 surfaces with nothing to copy, 432 to 580 MiB. Each dormant block now also goes once it has slept 10 s (kRgfxDormantAgeMs), the host's age for a shape no texture references (UNREFERENCED_FOR). The release worker lets it go, run by a timer armed for the next block's age; none is armed while no block sleeps. The let-go is the one the caps make: - a block whose cache the GPU has not written since its last copy is released with nothing to copy, and the host drops the cache; - a written block's release copies the cache into its pages, a deferred one's pages named first where its surface lives on. One such release is in flight at a time, the next let go at its answer, so the copies the blocks a close leaves owe come one after another, not as one burst beside the frames. The surface's next ask makes a new block over its pages. What the guest sees: a surface's pages take the GPU's writes when its block ages out rather than at its next lock, so only a CPU read without IOSurfaceLock sees the bytes earlier, and IOSurface leaves that read undefined. A lock reads what it read before. The release worker also logs, for eight a minute at most of the blocks let go for their age with clients of the surface left, which processes with a context open find the surface by its ID: a diagnostic, for who holds them. guest/prebuilt and guest/prebuilt-arm64e are rebuilt from these sources. |
||
|
|
f0ec246215 |
📝 Record what Metal answers past a length or a heap's size [ci skip]
The oracle doc's Q8 named one bound, a buffer past maxBufferLength. The bounds case measured the rest on the AMD 5300M and the Intel 630: lengths, bytes, no-copy bytes, heaps and the tiled texture SPI at maxBufferLength and past it, and a Placement heap's buffer and texture at its end and past it. The table says what each answers, which class each is read in, and what the bundle answers now; the M3's no-copy bound goes in the list of what is not measured. |
||
|
|
468c97bbc5 |
📝 Say the Shared pool's pieces change the VM's memory map [ci skip]
design.md's section 5 said that blocks are ranges inside the BAR, so making or
freeing one never changes the VM's memory map. That holds for the region's
blocks, but Shared memory lies in the pool now: pool.rs places each block it
takes from the runtime as a piece of its own, which QEMU adds to the VM as a
RAM region on its main loop and removes when the piece goes back
(reims-graphics-pci.c's header). The section now says so, and that a block
carved from a piece already mapped changes nothing.
The same section put "the staging rings" in the pool and the slabs and upload
chunks in the process's own pages. The rings, command buffers' bodies and
library staging chunks are region blocks (RgfxRegion.cpp's allocateRingPair,
RgfxBodyPool and RgfxLibraryStream), and with a pool every slab is a pool block
("Shared and Managed buffers lie in slabs" and "The Shared pool"). The BAR 2
table's row for the kext's blocks named Shared buffers and heaps unqualified;
they lie there only where the device offers no pool (an arm64 guest on a
Windows host).
|
||
|
|
96cc4a9344 |
🆕 Add oracle probes of a queue's depth and the GL renderer's
The guest's GPU benchmark scene keeps about 3.4 to 3.8 frames of command buffers in flight on our device, against about 1.7 on the 5300M Mac. The question was whether an answer of ours lets the app run further ahead than a Mac would. oracle_depth measures how many buffers one queue keeps uncompleted in front of a busy GPU, where -commandBuffer blocks, whether commit or commitAndWaitUntilSubmitted blocks before that, and when each buffer is scheduled. oracle_gldepth hooks the Metal device's queue creators and the queues' command-buffer creators under a CGL context that draws into an FBO, so it reads what Apple's GL renderer over Metal asks for and how many buffers it keeps in flight. Q49 holds what they found: - On the 5300M, the 630 and the M3, a queue keeps its maxCommandBufferCount of buffers uncompleted (34 on the 630 for an ask of 32), and blocks only in -commandBuffer. - Each buffer is scheduled within 0.8 ms of its commit, 32 deep. The M3 alone schedules at most 36 of a queue ahead. - Apple's GL renderer asks for 32 and keeps 32 in flight when the GPU is the slower side, as the guest's does on our device. - The 5300M's 1.7 frames belong to AMD's own GL driver, which is not over Metal. |
||
|
|
36655c417b |
🐛 Name the x86-64 guest's GPU "AMD - " without Intel or NVIDIA
WindowServer died while QuickTime Player played a 4K video full screen: a
user's 780M host, and measured here on a 780M (macOS 26.7.2 and 15.8.2) and on
an Iris Xe (26.7.2), each time on a walk's second clip. Read from their code,
SkyLight's compositor takes a Metal device whose name holds "Intel" for an
Intel GPU, and scales a full-screen video's YUV layer through Intel's video
pixel processor (AppleGVACore). That keeps only plugins of Intel's renderer
IDs, so with ours it has none and asserts. The naming rule gave integrated
hosts "Intel - ", and an Intel host's own name holds "Intel" under any prefix.
What an x86-64 guest sees now, on every host (the owner's rule):
- MTLDevice.name, and the GPU's `model` that System Information shows as its
Chipset Model, are "AMD - " and the host's name with "Intel" and "NVIDIA"
taken out, in any case, each with a mark directly after it ("(R)", "(TM)",
"®", "™") and one space:
- 780M: "AMD - AMD Radeon 780M Graphics (RADV PHOENIX)" (was "Intel - ...")
- Iris Xe: "AMD - Iris(R) Xe Graphics (RPL-P)" (was "Intel - Intel(R) ...")
- UHD 630: "AMD - UHD Graphics 630 (CFL GT2)", on Windows "AMD - UHD
Graphics 630"
- Arc A770: "AMD - Arc(tm) A770 Graphics (DG2)"
- RTX 3090: "AMD - GeForce RTX 3090" (was "AMD - NVIDIA GeForce RTX 3090")
- 7900 XTX and llvmpipe: unchanged, "AMD - " and the host's name
The kext's `model` was the host's name whole, and none for no name; it is
now the same name as Metal's, "AMD - reims-graphics" for no name.
- vendorName is "AMD" on every host (was "NVIDIA" or "Intel(R)" by the host
name's first word), so the GL renderer takes NVIDIA's settings on every
host, as on a 5300M, where an Intel host's guest took Intel's
(design.md, "The renderer's settings").
- SkyLight's NVIDIA name test finds nothing on an NVIDIA host either: it takes
an AMD GPU's path there (MetalTiledBacking's +0x71 now set).
The device info's `integrated` byte stays on the wire and the host still
writes it; nothing in the guest reads it now, as its docs say. arm64 guests
see what they saw. The ROM's bytes are unchanged: its record changes for the
wire header's comment alone.
Tests: serializer_tests' test_metal_names, test_vendor_names and
test_metal_answers_hold_no_vendor_word; the kext's device_name_test, now built
for the x86-64 kext's rules and, as device_name_arm64_test, the arm64e kext's.
|
||
|
|
ad48374fae |
🆕 Ask for Linux 6.13 or later for KVM VMs on our GPU
A user's x86-64 VM hung at boot on Linux 6.12 (Debian 13) with amdgpu, on both an RX 9070 XT and the Granite Ridge iGPU. QEMU logged "kvm run failed Bad address" at the guest's first write to Shared memory. The guest's Shared memory is the runtime's blocks: host-cached memory the driver allocates, which QEMU maps into the guest. Before 6.13, KVM's hva_to_pfn_remapped maps a page of a VM_PFNMAP mapping only where it can take a reference on the page. TTM's ttm_pool_alloc_page makes its higher-order pages without __GFP_COMP, so their tail pages have no reference to take, and KVM returns EFAULT. 6.13 resolves the pfn without a reference. Our hosts run 7.3, so no boot of ours met it. The owner's ruling (11-21): require Linux 6.13 or later, with no fallback. For the host: reims-ctl refuses to start a VM on reims-vgpu's GPU under KVM on a Linux older than 6.13, and says why and what to do, where the guest used to hang at boot. reims-ctl doctor gains a kernel line, a failure below 6.13. The README states the requirement, and design.md no longer says that Shared memory is anonymous memory KVM maps on any kernel. |
||
|
|
4ae93c1409 |
🐛 Cap dormant deferred blocks at an eighth of the guest's memory
The kext let a dormant deferred block go past half the device's deferred budget, a quarter of the host GPU's memory budget, and that half is sized by the host's GPU, not the guest's memory: on an M3 Max it is about 5.3 GiB for an 8 GiB guest, so only the count of 1024 dormant blocks bound them. Only the host's device cache holds a dormant deferred block's bytes, and after the browser closed the dormant blocks' caches held 3,862 MiB of images on the host (arm64 macOS 27.0.1 walk m3-max-63600). trimDormant() now passes the smaller of half the deferred budget and the dormant bytes' cap, an eighth of the guest's memory, through rgfxSurfaceDormantDeferredCap(), with its test in surface_blocks_test. What the guest observes: no change in contents. A deferred block let go past the new cap is released as one past the count is today: where the GPU wrote it and another process holds the surface, its release names its pages and the host copies the cache into them first, and op 6 still answers the old state volatile, the contents kept. The cost is time: a surface asked again after its block went makes a new block (SURFACE_PAGES and a fill) instead of reviving the old one. Volatile surfaces' blocks go first, then the oldest, so quick revivals are kept. The dormancy line's "past the deferred bytes" count rises. What the host observes: fewer host-only textures and texture-block bytes held for dormant blocks after the guest's scenes end, about 1 GiB of dormant deferred caches at most on an 8 GiB guest beside the 1 GiB of dormant wired blocks, and more BLOCK_RELEASE copies, which it already paces one at a time. |
||
|
|
341c86217c |
🐎 Bound the device caches on a GPU of its own memory too
What changes for the host on a GPU with memory of its own (a discrete card): the IOSurface device caches now fit one budget together, two thirds of the GPU's own memory's budget as the platform answers it at the device's start. Past it, in the per-shape form the Vulkan platform takes, the shapes no texture references are trimmed, least recently used first (never a dirty or plane one), and a texture that takes one again has it made again and filled from its cache's buffer. The guest reads the same bytes; only the GPU's work and time change. Before, only a GPU that shares the CPU's memory had a budget; its half stays as it was. The device's info line now names the budget and the GPU's memory on both kinds. Why: on a 4 GiB Radeon RX 550 (RADV) with no budget, QEMU asked the card for more than it has in a browser's 3D page (by 201-270 MiB) and in a video (by up to 1283 MiB, most of it the host's video decoder's). What did not fit stayed in GTT after the card had room, and where long-lived allocations stayed there a later benchmark scene ran at 17.2-17.5 frames a second against 29.4-32.6 (jobs m3-max-63976 and 64138). The caches were the most of what QEMU asked; of them the budget can trim only the unreferenced shapes, 353-670 MiB at each over-asking moment, more than the 3D page's over-ask, above a floor (buffers and referenced shapes) of 2912-3634 MiB. Two thirds of the card is under every such floor, so it trims all it may there, and in those walks would have trimmed elsewhere only where QEMU asked within 415 MiB of the card's room; half would also have trimmed a scroll that asked 2.2 GB of it. The test that held the budget for unified memory alone takes both kinds, and a new one checks a device on a GPU of its own memory sets it. |
||
|
|
00b884d33b |
🐎 Answer presents once the window's draw is scheduled
A window draw held the answers of the presents after the one whose surface it may read until the draw finished on the GPU. Behind a GPU-bound guest the draw queues behind the guest's own work, so each answer waited for that work too: on an Iris Xe under a 3D benchmark's scene, presents were answered 47.5 ms after their show at the median, and the scene presented 10.2 frames a second against its own 26.4 (m3-max-63530). A draw of a surface whose every write is the platform's work now lets go of the answers as it is scheduled on rt: the present's texture lies over its block's device cache, or a shape of it, and the cache was not made for the host's video. The guest commits its next write of the surface only after the answer, and rt submits every queue's work to its one VkQueue in commit order, each segment ending in a full memory barrier, so that write runs after the draw however long the draw waits on the GPU. A surface the guest's CPU or the host's video may write (pages with no cache, a texture over the pages' view, a video cache) still waits for the draw to finish, and the surface's block hold still ends at the finish either way. What the guest sees: a present of a device-cached surface is answered as soon as the window's draw of it is scheduled, up to that draw's wait on the GPU earlier, so a GPU-bound app gets its surfaces back sooner and presents more often. The answers keep their order, and no write of the guest's reaches a surface ahead of a draw that reads it. The timing line says "its draw scheduled" or "its draw done", and "its draw under way" for "its draw running". Tests: a_later_answer_waits_for_the_scheduling_of_a_draw_of_an_earlier_surface and the_guest_never_writes_a_surface_ahead_of_a_window_draw_that_reads_it replace the two tests of the finish rule; sink's block test checks that the hold waits for the finish, queued or not; a decoder test pins which presents are queued; and rt_platform::command's work_committed_after_a_scheduling_runs_after_it_on_vulkan fails if work committed after a scheduling stops running after it on rt. |
||
|
|
fd1316d5ac |
📝 Add the cross-process backlog oracle and its answer [ci skip]
Q16 measured another process's access to an IOSurface behind one long pass.
It left open whether a read waits out the writing process's whole queue of
work ahead of the write, whether it also waits for what that queue commits
after the write, and whether a writer committed by a plain commit is ordered
at all.
oracle_backlog asks those three, as arms 1 to 3, each against control rounds
in which the read has nothing to wait for. Job m3-max-64081 ran it on the
MacBookPro16,1 oracle's AMD Radeon Pro 5300M and Intel UHD Graphics 630
under macOS 26.7.1, and dgpu-oracle.md's Q48 records the answers. On both
GPUs the read waits out the writer's queue ahead of the write, as our surface
order makes it. The 5300M orders the read by the surface alone and lets it
pass buffers the writer committed after the write; the 630 runs both
processes' work first in, first out, as our one VkQueue does. On the 5300M a
read after a plain-commit writer ran ahead of the write in 1 of 3 rounds;
our order, which never lets it, matches the 630 and is kept.
design.md's "Surface order" and surface_order.rs's module doc cite Q48 beside
Q16, the oracle README lists the probe, and build.sh builds it with the
others.
Docs, a doc comment and the source of a probe built only for the oracle Mac:
no check reaches it ("docs and comments" in AGENTS.md), and nothing was built
or run for this commit.
|
||
|
|
f73865a7d8 |
🐛 Give a destroyed object's ids back after the buffers before it
The host's runtime keeps a destroyed object for the command buffers committed before its destroy, but a new object made with the old one's resource id or at its GPU address takes them at once. A buffer still running there then read the new object in place of the old one. What a destroy gives back now waits until the host has completed every command buffer the process committed before the object was let go, a failed buffer included: its resource id and GPU address, its heap's bytes, its region and pool blocks, its pages and its ICB slots (RgfxRetireGate in RgfxSerializer.hpp). Every RgfxSerializer::destroy `after` goes through the gate, stamped at the call. A command buffer takes a serial at its commit and gives it back at its completion, or at its dealloc where no completion came. makeAliasable still gives a heap range back at once. What the guest sees: ids and ranges are reused later than before. A texture made while a buffer committed before another texture's release is in flight takes a different resource id. A new buffer's address and a heap's usedSize can differ the same way. With nothing in flight, everything goes back at once as before. Under the game step's -r, no id is reused before frame f+3. The serialiser's end, the context's, runs whatever still waits and logs once the most that waited at once. A guest context ends only with its process, so a new peak is also logged at each power of two from 64. guest/prebuilt and guest/prebuilt-arm64e are rebuilt from these sources. |
||
|
|
0050cb2afd |
🐎 Wake a queue's completion thread at its interrupt's filter
A command buffer's completion reached the bundle's completion thread only after the framebuffer's work loop thread was woken and had taken the control ring: on msi's RTX 5080 (v5, compute commits with a copy-in, n 9782) the handler to the thread's take was 47.8 / 16.3 / 177.6 us mean / p50 / p90. The vector's source is now an IOFilterInterruptEventSource whose filter, at primary interrupt context, has the accelerator look at the watched rings and wake each client with untaken records (queueFilter); the work loop's look (queueInterrupt) then skips a producer the filter looked at (RgfxQueueWakes.hpp, queue_wakes_test). The filter returns true for every interrupt, so the work loop's pass runs as before and in the same order: takeCompletions, the room wake, queueInterrupt, rgfxSurfaceLocksWake, each display's service and the refreshes. The wake count now rises once where both looks saw one completion; the bundle only waits on its value. The count moves under a spin lock taken with interrupts disabled, and the waiter asserts its wait under it and blocks after, as IOWorkLoop's thread does. Every call is in the SDK's Kernel.framework headers and defined by every release's kernel collection we ship (kc-check: x86-64 11.7.11 to 26.7.2, arm64 14.6.1 to 27.0.1). The kernel's own MSI path calls thread_wakeup_thread at primary interrupt level with interrupts masked under a spin lock (IOWorkLoop::signalWorkAvailable on 11.7.11, 26.7.2, 14.6.1 and 27.0.1), and thread_wakeup_prim enters the same waitq wakeup, which masks interrupts itself (26.7.2); IOWorkLoop::threadMain asserts its wait under a spin lock with interrupts disabled (11.7.11, 26.7.2): read from code. |