284e0dfd51a01ca7456c906eb988147c19ef39b8
35
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ff0a952a2b |
🎨 Name the event-waits thread in the reims-vgpu scheme
Every other thread of the library's is named reims-vgpu.<role>, so a sample or a crash log groups it with its device; the watcher of command buffers waiting for shared events was still rgfx-event-waits. It is now reims-vgpu.graphics-event-waits, and docs/api.md's list of thread names has it with the graphics device's others. Thread names are diagnostics (docs/api.md), so nothing a guest or host sees changes. |
||
|
|
f892111aa6 |
🐎 Give each surface block and process a worker turn of its own
The surface worker and the ICB worker were one thread each, so one block's slow view (9000 mappings of a 3840x2400 layer took up to 478 ms on the msi 5080 host) held every other block's SURFACE_PAGES behind it, and one process's ICB creates every other process's. Each worker is now a pool of at most four threads, made as a job finds none waiting and gone after 1 s idle, that runs one key's jobs one at a time in the order handed over and different keys' at once. The surface worker's key is the block (its SURFACE_PAGES, its BUFFER_OVER_PAGES handed over, its release's drops, a buffer over its view at its destroy); the ICB worker's is the buffer's context. A key's job wakes one waiting thread, a ready key that finds every thread busy is counted, and a job runs where it is handed over where no thread can be started. No job waits for another key's job, so the cap cannot deadlock: a BUFFER_OVER_PAGES waits only for its own block's SURFACE_PAGES, which ran before it, and SURFACE_PAGES jobs wait for nothing. A debug build checks it in Unsettled::wait. The one order the single thread gave that nothing needs: two BUFFER_OVER_PAGES of one context on different blocks are made in either order, which no answer orders; the context's later messages still wait for both. The threads are named <name>-<i>, which docs/api.md, the header's comment and reims-vgpu's callbacks doc now say. Beside K blocks that each run 25 ms jobs back to back, another block's job starts after its hand-off in 0.015 ms at the median for K of 1 or 2, 5 to 6 ms for 4 and 35 to 38 ms for 8, where one thread took 24, 115 to 117 and 241 ms (another_blocks_job_beside_busy_blocks, release build, M3 Max, two alternated runs each at load averages of 28 to 52). |
||
|
|
05d23288a2 |
🆕 Carry each block's pages and downloads on a lane of its own
A block's SURFACE_PAGES rode its context's ring-0 lane and its SURFACE_DOWNLOAD ran on the control thread. The kext's hand-over of a surface's put-off pages is a SURFACE_PAGES for the surface's maker, posted from another process's CPU lock or from the release thread, and followed by a download or a release without waiting for its answer. On the maker's lane it sat behind the maker's unrelated messages, or behind a lane held by a maker that had closed, and the download on the control thread could go first. Every SURFACE_PAGES and SURFACE_DOWNLOAD now goes to the lane of the block it names, in ring order, whatever its flags or context. What reads what that lane makes of the block waits for it through its position: a buffer or heap over a pages block, a buffer over a surface's pages, and a release. A context's later messages and command buffers still wait for its SURFACE_PAGES, and a SURFACE_PAGES waits for its context's earlier makes over the same block. So the only order dropped is a SURFACE_PAGES waiting for its context's messages that do not name its block. A SURFACE_PAGES also no longer clears a block's holders, so a release after a hand-over still waits for the other holders' lanes. The lanes' module doc lists every message that names a block by offset and what orders it. What the guest sees: answers to a block's pages and downloads may come before those of messages its maker posted earlier on other lanes. The kext matches answers by seqno. The fuzz now generates every block-naming kind against held block lanes. |
||
|
|
17f6d6cf47 |
📝 Name every thread that raises a graphics interrupt [ci skip]
raise_interrupt's thread list named the control, refresh, queue, compile and ring-0 lane threads and the platform's handler thread, but not three threads of reims-vgpu's that post on the control completion ring. Counted by thread in two boots of 75 processes on the RTX 5080 host (car 8's image, before and after ring 0's lanes), the control ring's interrupt was also raised on a command queue's lane threads (reims-vgpu.graphics-lane-<id>, 84 and 62 times), the surface worker (reims-vgpu.graphics-surfaces, 4196 and 4284) and the ICB worker (reims-vgpu.icb-create, once each). The header's comment, docs/api.md and reims-vgpu's own doc now name them. |
||
|
|
4f666851e4 |
🐎 Carry each process's ring-0 messages out on a lane of its own
Ring 0's control thread carried out every guest process's control messages in ring order, so one slow message, a pipeline compile of tens of ms or a large buffer's make, held every other process's command buffers behind it: their queues wait until the control thread has carried out what they name. The control thread now takes each message and hands the lifecycle messages of a context to that context's lane (`reims-vgpu.graphics-context-<n>`) and PRESENT_SURFACE to the presents' lane (`reims-vgpu.graphics-presents`). Each lane carries its messages out in ring order, made on demand and ended after a second idle. A message waits on the lanes only where an order crosses processes: a present for the creates and destroys of its surface's textures and the closes of contexts that hold one, a block's release for its former holders, a scanout grant for every other context, a resource-ID chunk for its previous holder's close, and a context's first message for every close not yet carried out. A queue's gate also waits for its own context's lane to carry out the messages it names. Each lane's thread waits on a wake of its own: it is woken for its own messages and, where its next message waits for other lanes, as they carry theirs out. With one wake for every lane, a boot of 75 processes on the RTX 5080 host woke every lane at each message any lane took or carried out, so no lane ever went idle, and command buffers waited 1 ms or more for ring 0 1610 times (3266 ms in all) against 428 (1064 ms) on the control thread alone; beside 75 idle lanes a context's burst of 200 messages took 16 to 59 ms at the median against under 1 ms beside none. Display commands stay on the control thread, held, and a reset still drops what no lane has begun, after the lanes' begun messages return. The host's raise_interrupt may now run on a lane, which the header and docs/api.md say (an additive change to the thread list). |
||
|
|
5bde808250 |
🐎 Answer a command buffer on its doorbell's vCPU
A guest write to a command queue's DOORBELL can now answer the buffer at the head of that queue's ring, if it comes through rvg_graphics_device_mmio_write_taking. The answer posts the buffer's CB_SUBMITTED and raises the queue's vector on the writing vCPU, before the queue's thread wakes. The buffer stays on the ring. The queue's thread then takes it as it takes any other, without waiting for ring 0 again. The vCPU only tries locks, and never waits, loops or allocates: the message is copied onto its stack, at most 16 KiB. Any try that misses leaves the buffer to the queue's thread, as before: a lock held elsewhere, ring 0 not yet carried out as far as the buffer waits for, or a buffer that uses a device cache, waits for an event or sits behind a held buffer. The answer takes the buffer's lane turn and its ticket in the commit order together. The begin uses them in place of its own, so queue, commit and ring-0 order are those of an answer at the take. What the guest sees: CB_SUBMITTED of such a buffer arrives inside the doorbell write. A platform refusal of a buffer answered there fails the buffer in its turn, after the answer, as one answered at its take does. Tests: - a counting allocator holds the vCPU path to no allocation; - a reset between the answer and the begin lets the answer go; - a refused make after an answer fails in turn; - the decoder fuzz checks that queue and commit order match the worker-only path; - the device checks that an answered buffer waits for no later ring-0 message. |
||
|
|
55cdab6483 |
⬆️ Build on metal2vulkan e71efbe0e9's runtime
metal2vulkan e71efbe0e9 is c8a0481cf8 plus three stacks (RUNTIME 1747): - Command queues share VkQueues where the device's own check finds the GPU idles at each switch between queues (the 5080), with an unshared form for a queue that must never wait behind another's long command buffer: new_command_queue_unshared. The graphics lane's WindowServer queues (RGFX_QUEUE_UNSHARED) now take it through unshared_queue, which made the plain queue until the runtime had one; on a device that shares no VkQueue it is the queue every create makes. The runtime's exact answers keep every queue on its own VkQueue, so REIMS_VGPU_EXACT gains queue_sharing (QueueSharingPolicy::PerQueue), with its accuracy-ledger row; docs/api.md now also lists extended_range_blits there. - Noted textures' pattern reads and writes are logged once each, with no allocation per draw. - A command buffer joins its ended encoders' resources into its residency where its work reads them, not as each encoder ends (end_call with 4096 resident: 205 to 7.2 us on the RTX 5080); a sampler state's creation prunes the live states' map only once it has doubled (1.97 to 0.56 us at 1000 live, 16.75 to 0.48 us at 10000, on the M3 Max); a commit counts its buffers' host imports in place, and the translator's spec_key makes its lists once. |
||
|
|
da9c930aaf |
🐛 Drop every object the guest made at a device reset
A reset (the framebuffer's STATUS 0, and QEMU's reset of the device at a
reboot inside one QEMU run) put the rings and the display back, but told the
host nothing: the decoder kept every texture, heap, buffer, pipeline, library,
surface view (with its lease on guest RAM and its imports), device cache and
managed copy, and the region kept every block grant. A rebooted guest then met
its own leaked objects: the next boot's WindowServer had its buffer pins
refused by Metal's space ("refused the pin: Held { requested:
400000008000.., held: 400000008000 }"), and its command buffers faulted by
the thousand.
After a reset the device now looks new, as a real device does after a function
reset. Every queue ends and is fenced, no block is any process's, and the host
is told on the control thread (Host::device_reset), before the thread takes
anything published after the reset. The decoder drops every context's objects
as a close does, each in a refusal scope, lowest context first, and with them
the surface views, the device caches (uncopied: the pages are the rebooted
guest's), the library cache, the presents waiting, the pipelines compiling and
the shown surface. Nothing begun before the reset reaches the guest after it:
a poster carries the reset count its work began at, a queue made before the
reset hands the host nothing more (not even its destroy, which the reset
stands for), and a compile begun before it stores nothing.
What the guest observes after a reset: the ids it picks, the texture resource
ids and pinned GPU addresses it uses, and the samplers' ids it is handed are
free as on a new device; a library lookup misses; no answer or event of work
from before the reset arrives.
|
||
|
|
0600467702 |
⬆️ Ring a queue's doorbell with the plain write in QEMU
QEMU 67cc08ad takes reims-graphics-pci's command queue doorbells through rvg_graphics_device_mmio_write again, so the queue's thread takes its command buffers and the vCPU only wakes it. The library keeps _mmio_write_taking, additive and now unused by QEMU. The take on the vCPU did not pay on msi's x86-64 guest. 86% of the compositor queue's doorbells found ring 0 behind and fell back to the queue's thread, so the frame's command buffer was rarely taken inline. WindowServer's composite (CLTD, its CompositeLayersToDestination call's wall time) was a wash at the tip, mean 555 us with the take against 621 without and p50 442 against 435, and the take cost the vCPU about 15 us a doorbell at the p50. Its tail was jemalloc's decay purge, madvise calls of up to 340 us run on the vCPU inside the take's allocations. A cold boot of the x86-64 guest on msi with this QEMU reached the desktop and dragged a window with no fatal or ERROR line; CLTD measured mean 407 us, p50 396, p99 613. docs/qemu.md and docs/api.md say what QEMU calls again. |
||
|
|
38b6912e60 |
📝 Say which locks a graphics raise_interrupt may run under
The header, api.md section 5, the Rust API's GraphicsCallbacks and the device's Host doc said raise_interrupt runs with no lock of the library's held. It does not: on a queue's service thread it runs under the queue's claim on its next message, and some events are posted, and their vector raised, under locks of the library's: - the decoder's lock, at a command buffer's CB_SUBMITTED posted as the buffer is taken, on its queue's thread or inside rvg_graphics_device_mmio_write_taking, and, with the download's answer slot, at a SURFACE_DOWNLOAD answered at once; - a command buffer's CB_SUBMITTED latch, wherever that is posted, which keeps it once and ahead of the buffer's other records; - the presents' queue, at a present answered at once with no window. Moving those raises out from under the locks would delay the CB_SUBMITTED the guest's commitAndWaitUntilSubmitted waits for, or break its order. What a host relies on still holds: no function of the graphics device takes any of them, and rvg_graphics_device_mmio_write_taking only tries the claim and the decoder's lock. So the docs now say that: the library calls raise_interrupt with no lock held that a function it may call waits for, directly or through a thread of the library's, so it may call them at once, and it may still wait for a lock the host holds while it calls the device. api.md section 5 and GraphicsCallbacks name the locks. Two doc errors of the inline take's commits go with it: the Host doc still said no callback runs inside a call of the host's, though Device::mmio_write_taking calls take_command_buffer and may raise there, and GraphicsCallbacks did not name the host's own thread inside mmio_write_taking. A raise_interrupt doc line ran past 100 columns. |
||
|
|
0ee908e0a8 |
⬆️ Point vendor/qemu at reims-graphics-pci's taking doorbell
QEMU f2c7e2a5 sends the vCPU's BAR 0 writes of reims-graphics-pci to rvg_graphics_device_mmio_write_taking. A DOORBELL write of a command queue's ring can then take the queue's next command buffer on the vCPU, post its CB_SUBMITTED and raise the interrupt there, through the irqfd under KVM or the BH elsewhere. The control ring's doorbell still goes to the ioeventfd, and reads are unchanged. Measured on msi under KVM in one boot, the same guest under window-drag load, with the take switched on and off every 20 s (the first 5 s of each window left out; 60 s on, 51 s off): - WindowServer's commit to its wake in commitAndWaitUntilSubmitted fell to 173 us on average, from 218 (p50 168, from 185; p99 440, against 402); - its CA::Layer::commit_transaction-to-display (CLTD) fell to 384 us on average, from 434 (p50 376, from 400; p99 667, against 654). Every 20 s window with the take on beat both windows next to it; - the vCPU took 32% of all doorbell writes, and 62% of the buffers that ask for their CB_SUBMITTED. The rest went to the queue's thread: 2731 because a ring-0 message published before them was not carried out yet, 23 because a lock was held. The 6608 buffers that ask for no CB_SUBMITTED were left too; - a take cost the vCPU 14 us at the p50 and 31 us at the p99, 274 us at most, and a plain doorbell write 2 us. A vCPU-posted CB_SUBMITTED reached the ring 10.7 us after the doorbell, against 199 us for one the queue's thread posted; - the control thread waited for the decoder at 20.6% of its locks, from 15.3%, for 38.2 ms a second in all, from 36.8. 2204 of those waits were behind a take's carried lock. The queue's thread never waited for it. A boot of the plain build (no measurement) reached the desktop and dragged at 59.6 composites a second, with CLTD averaging 369 us and no fatal, ERROR or WARN line in the host log. docs/qemu.md and docs/api.md now say which BAR 0 call QEMU makes, and how the interrupt is sent since 36deb281. |
||
|
|
46324049a2 |
🐎 Take a command buffer on its doorbell's thread
rvg_graphics_device_mmio_write_taking is rvg_graphics_device_mmio_write, except that a DOORBELL write of a command queue's ring first offers the queue's next COMMAND_BUFFER to the host on the writing thread. Under QEMU that thread is the guest's vCPU. Where the buffer asks for its CB_SUBMITTED and nothing need be waited for, the vCPU takes it: it makes the buffer's command buffer, posts its CB_SUBMITTED onto the queue's completion ring and raises the queue's vector. It then hands the rest to the queue's service thread, which walks and commits the buffer before it takes anything more of the queue's. The guest's commitAndWaitUntilSubmitted no longer waits for that thread to wake, which costs about 85 us on msi's host, the exit of an idle CPU from its deep C-state. Nothing on the vCPU waits. Every lock the take needs is tried: the queue's claim, which its service thread holds from its take of a message to the hand-over; the queue's submission ring; the control submission ring; the compile table; and the decoder. Where any is held, the buffer stays on the ring and the write wakes the queue's thread, as rvg_graphics_device_mmio_write does. It also stays there where: - a ring-0 message published before it is not carried out yet; - it waits for an event, or a buffer before it holds its queue; - a pipeline it names is compiling; - a device cache it uses wants a fill, or a wait for one; - its queue holds 48 command buffers made and not completed (the platform's commandBuffer waits at 64); - it does not ask for its CB_SUBMITTED. The CB_SUBMITTED's post on the vCPU waits for nothing either. Where the completion ring is busy or full, the service thread posts it before the walk, where the post is today. The decoder's lock is taken on the vCPU and let go on the service thread after the commit. So every message the guest sends after it sees the CB_SUBMITTED is carried out after the buffer's commit, as it is today. Class: FREE. Only the thread that posts a buffer's CB_SUBMITTED and its timing change. Each queue's events keep its order: the vCPU takes only while the service thread holds none of the queue's messages, and the service thread carries out what the vCPU took before it takes the next. The interrupt still follows its ring write on the same thread. The C API gains the function, additively: the header and api.md list it, and section 5 names the calling thread for raise_interrupt inside it, which must not wait for a lock the host holds while it calls the function. rvg_graphics_device_mmio_write and its "Calls back: never" are unchanged, and so are the pins (re-recorded, no difference). The decoder's lock crosses threads through parking_lot's arc_lock and send_guard. |
||
|
|
b3db450e0a |
📝 Name every thread the graphics raise_interrupt arrives on
api.md section 5, the header's RvgGraphicsRaiseFn and the device's Host doc named only the control and refresh threads. The interrupt is raised on whichever thread posts the event it is for, so it also arrives on a command queue's service thread (an early CB_SUBMITTED), a pipeline compile's thread (a reflection) and the platform's thread that runs a command buffer's scheduled or completed handler. The thread-name list gains the queue and compile threads. Comments and docs only. [ci skip] |
||
|
|
0b798d10f7 |
🐎 Take no dirty source on the graphics device
This reverts 71d7ba107 (Give the graphics device the host's dirty source), 8f1b8b02e (Resolve an import's pages once per range for the dirty log) and 67edfb6ee (its test's fix), and points vendor/qemu at 926401c49, which reverts reims-graphics-pci's dirty source on its branch. With the source, the runtime asked the guest pages behind each IOSurface's import at each command buffer's reports and watches, and the graphics device's thread resolved them through the backing table and the registry, under locks the runtime's queue threads also took. On the msi's RTX 5080, the same guest under window-drag load, the host with the source against the host without it, back to back: - the decode and commit of a command buffer took 5.2-7.3 ms, against 0.33-0.51 ms; - WindowServer composited 27-30 times a second, against 40-45, and its CompositeLayersToDestination averaged 9.65 ms, against 3.24 ms; - QEMU used 122% of a core, against 89%. The copies the source saved, an IOSurface's shadow copied in whole at each use on a discrete GPU, are what the device cache of IOSurfaces replaces. RvgGraphicsDeviceConfig is at its second version again; the third was never in development. |
||
|
|
2705249327 |
🐎 Give the graphics device the host's dirty source
WindowServer composites into an IOSurface the GPU now draws in place over its guest pages. On the Vulkan platform the runtime keeps a render target over host pages as a shadow, copied in before each use: with no dirty source each copy in was the whole surface, 37 MB at 3840x2400, every composite. RvgGraphicsDeviceConfig's third version takes the host's dirty source, as RvgDeviceConfig does, and the device keeps the same harvest and log over the guest's RAM, so the runtime copies again only the pages the guest wrote. The log is closed while the host's reset runs, as a device's is under its host's lock. |
||
|
|
abf6571d4f |
🆕 Let the GPU use an IOSurface's own guest pages in place
WindowServer's composites spent most of their CPU copying IOSurfaces: each GPU view of a surface was a copy of its pages in the region, uploaded at newTexture and written back after every command buffer (55 GB per 10 s on the fix-1 boot, 83% of WindowServer's samples in memmove). With the guest RAM's map in its config (RvgGraphicsDeviceConfig v2, gated by struct_size), the graphics device offers RGFX_FEATURE_SURFACE_PAGES. The kext then names a surface's page runs with SURFACE_PAGES, and the decoder makes one view of them in guest RAM, through core's range mappings, and buffers over it for BUFFER_OVER_SURFACE_PAGES. The runs must lie in guest RAM, be page aligned and sum to the length; else that surface alone is refused and stays a copy. Views are cached by their runs (32 views, 1 GiB), since WindowServer makes a surface's block again about every frame; the map is fixed at create and nothing removes guest RAM under it. |
||
|
|
15eee48dbc |
⬆️ Build on metal2vulkan 45b3427434's runtime
metal2vulkan 45b3427434 is 4ba981e668 plus two things the guest's Metal reaches. Its encoder draws setLineWidth:'s every width as Metal does (the M3 Max, macOS 27.0.1): floor(16 width) / 16 clamped to [0, 16], width 0 as 1/16, by the device's own lines or a band of two triangles over each segment. What neither draws at the width (on MoltenVK, which has no wide lines, a triangle's edges in fill mode Lines and a mesh draw's lines) it draws by the device's lines at the nearest width they draw, 1 pixel there, announcing it. A draw of too few vertices for one primitive draws nothing, as Metal's. And binary functions linked into a pipeline give plain Metal's answers: a direct call to a function only binaryFunctions holds fails as an unresolved call, a function in both lists is made, and one not compiled to a binary fails with Metal's code 2. The Vulkan platform drew every line 1 pixel wide after another width, and relayed it (inexact-line-width), or died in strict mode. It now sends the width to the runtime's encoder, and the relay kind is gone. A new Metal-twin test draws lines and line strips at widths 1, 3, 2.5 and 0 pixel for pixel as the Metal platform does on MoltenVK. Its first vertex is white: the flat vertices' first colour is the clear's black, which hid the line it provokes. Two tests that died at a draw after a line width now leave what such a draw draws to the runtime's tests. The runtime announces two new kinds, placed with the kinds that die: relayed by default, a death in strict mode. device-wide-lines: a device's own wide lines that are not Metal's parallelogram (a strict device's rectangle, lines Vulkan does not state as parallelograms, a width off its granularity), the runtime's default. lines-at-nearest-width: lines drawn at another width than Metal's, where neither route draws it. REIMS_VGPU_EXACT's new name wide_lines takes the runtime's WideLinePolicy::Exact, the band over Metal's parallelogram, on a device with tessellationShader. The accuracy ledger lists the trade in place of the 1-pixel row. A pipeline whose function calls a visible function that only binaryFunctions holds now answers the guest Metal's code 3, where it was made. The Metal-twin test of linked functions drops that exception, and adds a function in binaryFunctions alone and in both lists, compiled to a binary and not. It makes the binary copy after the cases of the function made by name: while the copy lives Metal answers one object for both, of options 1 (measured on the M3 Max, macOS 27.0.1), so the cases after it linked the binary where they named the plain function. |
||
|
|
59df0ffbb5 |
🆕 Add the reims-graphics device to the C API
QEMU drives devices through the C API, so the graphics device gets seven functions there: create and release, the region QEMU maps as BAR 2, BAR 0's reads and writes, the doorbell file QEMU's ioeventfd fills, and the bus reset. Its two callbacks raise the MSI-X vector and ask QEMU's dirty log whether the guest wrote the scanout. Both run on the device's threads with no lock of the library's held, so QEMU may take the BQL inside them, and no function waits for those threads. The additions are strictly additive (docs/api.md section 1): new functions, types and constants, and status 17, RVG_ERR_HOST_RESOURCES, for a host that refuses the region's memory, a pipe or a thread. The C harness calls each new function and drives one GET_DISPLAYS through the region to its interrupt. |
||
|
|
c3aac4c217 |
⬆️ Build on metal2vulkan 0a1851164d's runtime
Move the runtime from eeb7934025 to 0a1851164d, six commits of metal2vulkan's development. What changes for the guest: - A draw, compute dispatch or tile dispatch whose pipeline the driver is still making 4.5 s after its command buffer's commit runs nothing, and the command buffer runs on (PipelineWaitPolicy::Bounded, the runtime's default, announced draw-dropped-still-making or dispatch-dropped-still-making). A state's creation likewise returns after 4.5 s with its predicted pipeline still being made. Before, a cold compile (11.59 s on an M2 Pro's MoltenVK boot) held the command buffer past the guest's 10 s check of its FIFO. - A draw whose pipeline the driver failed to make after the draw returned runs nothing, and the command buffer runs on (draw-dropped-unmade), where it failed before. - A no-copy buffer, heap or buffer rebind whose import fails (out of memory, or a driver out of mappings) is made over a copy of the pages in the device's own memory (copied-host-pages), where the call was refused before. - Nothing else in the span moves what a guest observes. On NVIDIA's driver on the RTX 5080 Laptop GPU, the 2.2 to 3.7 ms stall the driver spends in every 1,024th signalling submit of a queue is taken by empty submits while the queue is idle, not by a batch. A discrete GPU zeroes new buffers by a fill. A warm render state is linked from its recorded stages. The shader cache is keyed by its translator, so a runtime-only change no longer turns it cold. The four kinds are placed in DIES: by default each is relayed and counted, and in strict mode it ends the process, where a difference the guest can see does. Unplaced, they fail every_degradation_kind_is_placed_once. A strict process, every test of this crate among them, waits for each pipeline until it is made (PipelineWaitPolicy::Exact), so a slow compile under the check's load never dies there as a dropped draw. REIMS_VGPU_EXACT names the same exact form as pipeline_waits, and the accuracy ledger records the fast form's bound. A no-copy buffer over host memory with a page not mapped, or mapped without read access, is answered nil before the runtime is asked, as Metal answers it, where development asked the runtime and answered nil at its refusal. At 0a1851164d a placed buffer the runtime refuses keeps its range held, so the next buffer Metal places at that address met a conflict and died (measured on the M3 Max: no_copy_buffers_over_pages_without_access_are_nil_as_metals). Those pages are the only refusal there answered without dying, so nothing else meets the held range. metal2vulkan has the report. The import gate the runtime now takes (HostMemory::with_import_gate) is wired in the next commit. |
||
|
|
12765ee8ae |
🐎 Copy again only the guest pages written since the last copy
Where the Vulkan runtime keeps copies of guest memory in GPU memory (a
discrete GPU's, and an iGPU's whose driver cannot use the guest's pages in
place), it copied each one whole at each use, as nothing told it which pages
the guest wrote. Under KVM the host now gives the device a dirty source, and
the runtime copies only the row bands of the pages written since its copy.
- Core keeps the dirty log: a stamp per watched 4 KiB guest page (8 bytes),
read without a lock, fed by the harvests and by the library's own writes
into guest RAM (every GuestPtr write, the IOSurface byte copies, the video
decoders' lends), each stamped after its bytes land, so a copy racing a
write takes the page again. With no log a write costs one relaxed load.
Waits are bounded (about 4 ms) and refuse at once while the device resets,
pauses, stops or suspends; an answer the log cannot give is a whole copy,
never a missed write.
- The C API, additively: RvgDeviceConfig's fourth version (72 bytes) carries
an RvgDirtySource: the KVM VM's fd and four callbacks (start, flush_vcpus,
for_each_slot, take_host_writes), and rvg_dirty_slot, which for_each_slot
calls for each logged slot. The device's thread reims-vgpu.dirty
runs each harvest: the vCPUs' page-modification logs flushed where PML is
on, one KVM_GET_DIRTY_LOG and one KVM_CLEAR_DIRTY_LOG of exactly the
watched pages written per slot, then QEMU's own DMA. QEMU's side is 154
lines (vendor/qemu 01650c7f08).
- The Vulkan platform answers the runtime's DirtyPages per import, in the
import's offsets, and leaves a shadow's own copy back out of its next copy
in (REIMS_VGPU_DIRTY_WRITERS=0 counts it). The EFI framebuffer is never
logged, so the firmware's presents never start the KVM log.
- REIMS_VGPU_DIRTY_PAGE_TRACKING=0 turns the source off.
- The runtime moves from metal2vulkan 0db5825a60 to eeb7934025, its release
with the dirty-band copies, the discrete GPU's device copies of sampled
textures and one wait per log per submission. It also fixes the MoltenVK
failure the owner hit on the M3 Max with a macOS 26 guest ("Vulkan failure
-3 (the pipeline of draw 0 of the command buffer's render encoder 0)" after
a 4K HEVC decode): Core Animation's fragment that samples the in-place
Y'CbCr texture in a loop had its push field's uvec4[2] materialized with an
OpCopyObject, whose SPIRV-Cross copy Metal's compiler refused; 751c861c15
copies it element by element. And it takes the device's native forms: its
own depth bias on every depth format, its store of an extended-range,
padded 10-bit or bfloat attachment's untouched texels, a half colour output
declared 16-bit where the device enables storageInputOutput16, and its own
Y'CbCr conversion for 4:2:2 twins and planes read in place. Its semantics go
from 1907 to 1911, so every cached shader compiles again on the first boot.
- With the runtime's unused-bits load pass and its capture replay gone, a
pass that loads and stores such an attachment keeps the bytes its draws do
not write, and each draw announces extended-range-bits-kept; the
unreached-tiles-rewritten kind is gone. The Vulkan platform's answer table,
its tests of the extended-range formats and its docs follow, and the test of
the captured reach goes with the machinery.
Measured on an RTX 5080 Laptop GPU with an x86-64 macOS 26 guest
(docs/qemu.md, "Linux hosts: the dirty source"): a window drag at 3840x2160
went from 18.0 to 26.1 fps with 439 MB a frame host to GPU, from 938; at
1680x1050 the drag stays at about 56 fps with 98 MB a frame, from 182, and
SM use 46%, from 65%. Pixels are unchanged. Nothing changes on macOS, nor
where the runtime uses the guest's pages in place.
|
||
|
|
c8ec271abc |
⬆️ Build on metal2vulkan 0db5825a60's runtime
Move the runtime from a759d0e88f to 0db5825a60, metal2vulkan's development re-cut into one commit per work packet (tree 22aab1ece6, the same as its linear history's d0f1b87e2e, which is the public repository's development; 0db5825a60 is not on it yet). Runtime version 1648 to 1681, semantics 1907, artifact format 475; its runtime sources pinned as 4314cee1. Every cached artifact and plan is made again. What changes for the guest: - Answers come from one macOS release, 27.0.1, on every host. MoltenVK on a macOS host of another release answers as 27.0.1 too. MetalLevel, the metal_level of DeviceOptions and DeviceProperties, and the degradations metal-level-below-host, metal-level-not-macos and mipmaps-as-apple-m4 are gone, and so is our side of the levels: the OS's METAL_LEVEL, the level-dependent answers of format_info, the deaths on a host whose release the runtime did not measure, and Inexact::MetalLevel (the same adaptation as development-performance's e47f89760). - The device's own arithmetic and value answers are the contract, with a precision note where they can differ from Metal's (the owner's native-arithmetic rule): BC and sRGB texels, half precision, fast-math grouping, maths functions, sampler details and pixel samplers, two-plane YCbCr (the device's Y'CbCr sampler), clears and fills, multisample resolves, mipmaps (the device's blit chain) and vertex conversions. The runtime's exact emulations of these are deleted, so REIMS_VGPU_EXACT loses sampling, ycbcr_filter, float_maths, texel_conversion, vertex_normalized, half_rounding, nan_and_min_max, rounding_order, half_blend, half_texel_bits, multisample_depth_twin, decoded_texels, tile_store and resolve: such a name now writes the stderr line and changes nothing. It keeps batch_order and host_page_textures and gains half_chains (each half operation of a fast-math chain rounded on a device without shaderFloat16). docs/api.md and the accuracy ledger say so; the ledger lists the deleted forms' bounds as the device's own answers. - Degradations: 17 kinds retired, which leave DIES, NATIVE_RELAYED and the relayed lists. DevicePackConversion, DeviceVertexConversion and DeviceAlphaCoverage, notes of the device's own maths, vertex input and coverage, join DIES and NATIVE_RELAYED, as the other device-maths notes are placed. DeviceFilteredMipmaps, announced on every device, MoltenVK included, is relayed, never a death. None of them is in DIES_BY_DEFAULT, so by default nothing new ends the process. - The read-only store mask is gone: on macOS a read-only view drops the store, as Metal does; off macOS, GPU writes into read-only memory land (the runtime's known gap). set-past-layout-support is announced at every bind past the driver's support. Tests: the YCbCr comparisons and the resolve test run on the platform's own device, as the exact-form devices are gone (device_with_policy and device_with_ycbcr_filter with them); the mipmap tests no longer check the retired tie kind. Checked: - on the M3 Max: rustfmt and the three clippy passes cargo xtask check makes (all features, the tested features without the defaults, and x86_64-unknown-linux-gnu), clean; - the Vulkan crate on gem10's RX 7900 XTX and Radeon 780M, 432 of 432 each; - reims-vgpu's and the C API's video and scaler tests on the XTX, the 780M and msi's RTX 5080 Laptop GPU, 50 of 50 each. Failing, not fixed, at the owner's word (strict mode is not a concern): - the Vulkan crate on the RTX 5080, 429 of 432: three encode_render tests read a channel one code off the byte they assert (0x7f where 0x80), the device's own colour conversion; - reims-vgpu-vulkan's and reims-vgpu's 898 tests on MoltenVK, 796 passing: 102 fail, 57 of them the YCbCr comparisons with Metal, most dying in strict mode at the device notes MoltenVK now announces where the exact forms answered before (device-nan-encoding, native-half-conversion), the rest comparing Metal's exact bits. Not run: the rest of cargo xtask check (core, the Metal, window and video crates, the header) and the suite, which the runtime does not reach; no boot. |
||
|
|
aaec87ae4f |
⬆️ Build on metal2vulkan a759d0e88f's runtime
Move the runtime from f6a96b7da8 to a759d0e88f, the tip of metal2vulkan's development (runtime version 1643 to 1648; its runtime sources pinned as abac6049). metal2vulkan's gate on a759d0e88f was still running when this was committed; the owner chose not to wait for it. What changes for the guest: - A 2D texture over host pages whose usage only samples or reads it is a linear image over the pages, with no shadow and no copy in at each command buffer's first use, on a device whose startup check passes: on that device, an image's first move keeps every byte while the CPU writes beside it, checked for pointer imports, fresh pages and dma-bufs each, and kept in the shader cache by driver and runtime version. Vulkan does not promise that move (an image over imported memory starts UNDEFINED), so this relies on the driver, by the owner's ruling of 2026-10-26. REIMS_VGPU_EXACT gains `host_page_textures`, which keeps every such texture a shadow, as before, and `all` names it; the accuracy ledger and docs/api.md say so. Render targets, written textures and two-plane YCbCr surfaces keep their shadows. - A memoryless texture bound at a texture slot is taken, as plain Metal takes it, where the runtime refused the setter and this platform died there (an RX 580 user's guest, at setFragmentTextures:withRange:). A command whose function uses the slot, a useResource of it or a blit of it fails the command buffer with MTLCommandBufferErrorInvalidResource (9) from the Metal submission that holds it, as Metal's GPU does (measured by metal2vulkan on the M3 Max). This platform passes the new CommandBufferError::InvalidResource to core as one of Metal's failures: the fourteenth it lists. A memoryless texture's CPU reads and writes move nothing, and its views are nil, as on Metal. - new_texture_with_vk_image takes IdPlacement::Outside; nothing here passes it yet, so the window's swapchain images still take texture IDs. - Nothing else in the span moves what a guest computes or observes: the in-place check's dma-buf pages come from cached memory, and the rest is counts, docs, tests and the sources pins. The public surface gains CommandBufferError::InvalidResource, DevicePolicy::host_page_textures and its HostPageTexturePolicy, and WorkCounts' in-place and shadow-cause counts. No Degradation, RuntimeGap, refusal or notice kind moved, so DIES and the relayed kinds stand. Device info, GPU families and feature queries answer as before. The Vulkan platform ends the process at one site fewer: the memoryless binding. docs/video/bugs.md says what the pin carries for B73: the in-place textures and the counts that tell them from the shadows that stay. New tests, of the memoryless binding, on every platform: a_memoryless_texture_at_a_fragment_slot_fails_only_a_draw_that_uses_it; and on the Mac, memoryless_slots_fail_as_metals, which measured Metal's lines (macOS 27.0.1): a draw whose function ignores the slot completes; one that samples it fails the command buffer with code 9, the blit before its pass run and neither its clear nor the blit after it, the signal after them not firing. Checked, every test passing in its full run: - on the M3 Max (macOS 27.0.1): rustfmt, the three clippy passes cargo xtask check makes (the Mac's, its tested features', and x86_64-unknown-linux-gnu's), and the 900 tests of reims-vgpu-vulkan and reims-vgpu on MoltenVK; - the Vulkan crate's 434 tests and reims-vgpu's and the C API's 50 video and scaler tests on gem10's RX 7900 XTX and Radeon 780M, with no amdgpu reset. The RTX 5080 Laptop GPU's run was skipped at the owner's word: the GPU was busy with the owner's VM. Only those crates link the runtime, so the rest of cargo xtask check (core's tests, under Rosetta too, the Metal, window and video crates, and the header) and the suite, which drives the C API on the Metal platform, do not reach the change and were not run. |
||
|
|
95644d758d |
🆕 Add the VideoToolbox and M2 scaler devices to the library and QEMU
A macOS guest hands its VideoToolbox sessions, and its
IOSurfaceAccelerator's scaling and conversion, to the host through two
virtio-PCI devices, 106b:1a03 and 106b:1a0b, as Virtualization.framework
gives them. The library gains their host side, VideoDevice and
ScalerDevice over core's host session and scaler, and QEMU their
transports, apple-videotoolbox-pci and apple-m2scaler-pci, with no
properties of their own.
The library picks each device's backend itself and logs why, on the GPU
apple-gfx-pci's device runs on, taken from the runtime's identity of it:
NVDEC and NVENC on an NVIDIA GPU, else VA-API on its render node, and
VideoToolbox on macOS. The scaler device exists on every host and refuses
its features where it cannot transform; a guest message over 16 MiB is
answered -12904 unread.
For the host: the C API gains rvg_video_device_* and rvg_scaler_device_*,
additively. For the guest: a VM given the devices has the host's video
decode, encode and scaling.
Source: c5b409362 375acb462 8be7593eb fbbeebfb2 e3d5616a4 60d08c4f4 c4c476643
fe105edcb 36a6a82c6 ee2b1ca71 d7d5cfede b15f40717 a07ffd70b bfe6b8338
7433026a9 0030b24a7 64497f931 76acbacc7 3bf366e81 6d3b97a59 fa5b4aafc
401e0b727 1af53ce1a 0fa52d070 ce6eab571 33b40ae4a 82beaf64a ef26f02e1
08bb763c4 5ff2dd73f 62e19c8ef ce406ddb2 fd92f66c4 52fba93c9 e179dc0bd
b5f40ad74 d01bbdc9e 950a7e024 601c23067 9857b1fc8 b427bebfb 55a1d96e7
a0243edfc ef54c395f c23c83073 bc6fcdaa7 1b783baca
|
||
|
|
d527b7257c |
⬆️ Build on metal2vulkan 6c9cad047a's runtime
Move the runtime from 6b67bd44af to 6c9cad047a (runtime version 1520 to 1643), through dc80eb2bd4, 67c64f99d8 and 27935d575e, and hold three tests to the runtime's answers at the pin. For the guest: - a draw whose state's reflection the runtime could not finish asks per slot what a function may store through, where every read-only object counted as written and a user's Linux guest died in kept_write; - a detach in a completed handler of an object the last submission used answers YES, Metal's answer once the use retired; - shareable padded 10-bit formats are made in Private storage, and the packed ones answer nil and 0 bytes, as Metal's; - a command encoded again at a replace no longer writes the pages it was encoded over; - a shadowed texture copied back by a dispatch stores wide texels whole. The runtime's identity of the GPU device, which the video devices use to find their GPU, comes with this pin. Source: 7ad52b99b 0e37d329c cb582881c 94d2b0ef6 5ee2d000e 221176d06 051c64ebb |
||
|
|
c60e16cb18 |
🐛 Fix the window's capture, input and sizes, and offer the set rate
- A captured window drops its resize edges until capture ends, so a click
where the image meets the window's edge reaches the guest.
- No window input reaches the host once the display's release has
returned, and the display's end lets go of the keyboard grab, mouse rect
and size hold the capture set.
- A sixth mouse button or later captures nothing, as the guest's tablet
has no such button.
- A smooth scroll gesture whose end went unseen no longer decides where
the next one goes.
- A mode or cursor the guest sets while the window's opening is posted is
delivered.
- An X11 window is sized in pixels at the desktop's content scale, and a
Linux screen's rate comes from modes of its own size.
For the guest: its display modes run at the host screen's current rate,
the one the person set, where they ran at the highest its size offers.
For the host: HostScreen's max_refresh_hz is refresh_hz in the Rust API
(the header changes in a comment only), and features.md registers that a
captured window cannot be resized.
Source: 5806f9c1c bc50f04b4 b12cb3ab0 76b7ae409 f6c3b116b 5811164a5 2ad407c98
42c178305 6415d881f 1c0563f85 78426429a e61a8dc56
|
||
|
|
f0b1635053 |
🐛 Offer the guest modes where a window display's window cannot open
A VM started with reims-ctl from an ssh shell stopped its boot at the Apple logo. With no Wayland compositor or X server named, SDL starts no video, so the window does not open and there is no host screen to match. QEMU leaves the modes to a window display that matches its host screen, and the display offered none, so the guest had no mode to set. Now a display matching its host screen with no screen to match still offers modes: the window's chosen mode (QEMU's resolution) and the standard sizes within it, at its chosen density as on a screen, or 1920x1080 at 1x where none is chosen (resolution=host), at REIMS_VGPU_WINDOW_REFRESH's rate or else 60 Hz. Displays with a screen, and the modes a host sets, are unchanged. The docs that said a display with no screen offers what its config says now say what it offers. |
||
|
|
30c7cd604b |
🆕 Capture the pointer with the keyboard, held over the image
A click into the image captured only the keyboard: the host's pointer could still leave the window for the bars, the title bar or another app, where a click meant for the guest's edge landed on the host instead. Capture now takes the pointer too, and never one without the other: while captured, the host's pointer is held over the image, and ⌃⌥⌘ (Ctrl+Alt+Super on Linux), Release Input, losing focus or closing frees both. On AppKit's window the hold is NSWindow's mouseConfinementRect, the property SDL3 confines its macOS windows with, which AppKit leaves out of its headers; a window that does not answer it leaves the pointer free and logs one line. On SDL's windows it is SDL's mouse rect, rounded out to whole points so the image's last row and column stay in reach, which SDL keeps with the compositor's pointer constraints on Wayland, XFixes barriers on X11 and the same property on macOS; where SDL has no mouse rect, its mouse grab holds the pointer in the whole window. In native full screen an image that reaches the screen's top or bottom edge takes the pointer there, where macOS slides its own menu bar or Dock in. features.md, README.md, docs/api.md, docs/architecture.md and the module docs say so. The macOS walk releases capture wherever a step needs the pointer off the image, captures before Finder takes focus in C4, and walks the hold at each edge and corner (C2), at the window's edge (C2e), across Mission Control (C2m), in full screen (C2f) and after a mode change (M4), which only a person's own mouse shows: a warped pointer, or one moved by events posted at the HID tap, is not held. |
||
|
|
9f2e1c2c34 |
🐎 Move metal2vulkan to 62cad6be54: per-sample reads, ANV fits
62cad6be54 lands metal2vulkan's bug-fix wave on its development, 55 commits past 6b322fb50f (SEMANTICS_VERSION 1759 -> 1798, RUNTIME_VERSION 1314 -> 1496). What changes for the guest: - A multisampled fragment function that reads its colour attachment (so runs per sample) and [[position]]'s w, [[point_coord]], [[barycentric_coord]] or a centroid varying now compiles, those reads taken where Vulkan evaluates them for the sample and announced as multisample-position, where link refused it, which killed the guest at every launch of Claude Desktop (0a34e8c7). - On ANV, mesh render, tile render and compute pipelines whose largest stage passes the compiler's word bound under exact forms are fitted, as render pipelines were, where brw's allocator faulted the process (33e89bd4). - The UHD 770 splits an interlocked pass as every GPU measured does, faster there (affd8a5e). lavapipe records a dispatch of a variant that bakes samplers in a command buffer of its own, which 26.0.8 sampled as Repeat after a copy (ImmutableSamplersLostAfterCopies, 84ba0af3). - A texture over a no-copy buffer's host pages, padded rows included, is the runtime's shadow on every device, MoltenVK too: a CPU write to bytes a command buffer does not write is kept, as Metal keeps it, where an image's first move could undo it (e35bf78b). - ASTC LDR, ETC2/EAC and PVRTC textures read through decoded twins where the device lacks the format, A8Unorm through R8, and 4:2:2 through a twin on every device. - New fast defaults, each bounded, logged and behind an exact switch, none of which applies on MoltenVK: the device's resolve (resolve), the device's tile store of loaded snorm and RGB9E5Float attachments (tile_store), compact ASTC and EAC twins (decoded_texels), and batches ordered by their ends (batch_order). - Every device takes the runtime's exact completion, each command buffer seen complete at its own end as Metal's, not its new default of Mesa's grouped submissions: when work completes is the guest's to observe, and ip34 measured no frame rate gained on the Iris Xe (15.7-17.3 fps grouped, 16.4-17.6 exact). - Every device takes uncompressed heap textures too, not the new default of ANV's compressed image, which would change the heap size query's answers (0x4100 bytes at 0x10000 for a 64x64 BGRA8Unorm texture on the Iris Xe, where the guests booted with 0x4080 at 0x1000) and could hide writes through aliases. - A device's teardown no longer races the watch of the program's queue marks or the release of freed memory: the last drop tears the device down on its own thread before it returns (6898b52e). Here: REIMS_VGPU_EXACT names four of the new DevicePolicy fields, with their ledger rows and docs/api.md's list; completion and heap_compression have none, and the ledger and docs/api.md say every device takes their exact forms, and why. padded_reads, whose field and fast form are gone, falls to the path docs/api.md gives a name that is no field: nothing changes, and stderr says so. Its ledger row goes. The runtime's six new kinds are placed: CarriedDecodedTwin relayed (a performance kind); DecodedTexelPrecision, HeapTextureCompressed, SnormMinimumKept, SharedExponentKept and GroupedCompletion in DIES, GroupedCompletion and HeapTextureCompressed never announced under the exact forms, DecodedTexelPrecision also relayed on native devices as the runtime's default sampling. DeviceRoundedResolve moves from HEARD to DIES and is relayed on native devices too (class (e), the device's rounding of an average, as measured on RADV, ANV, NVIDIA and lavapipe), so Inexact::RoundedResolve and device_rounded go: a strict run on Mesa's drivers, this crate's tests among them, no longer dies at a grouped submission or a resolve the device averages, and MoltenVK, which resolves as Metal, announces neither. None dies by default. The retired UnorderedFramebufferFetch and UnrestoredFirstMoveBytes leave DIES. The docs of the runtime's VK_EXT_metal_objects, the first move's keep and the fitted pipeline kinds are brought up to date. Tests: the resolve test, a_device_resolve_ends_its_pass, ends passes under both resolve policies (device_with_policy). A texture over a surface's memory is now the runtime's shadow, so the runtime may free the surface buffer's import as it goes, a command buffer still running; the Linux test of the surface's memory hold, renamed a_released_surface_texture_keeps_the_surfaces_memory_while_imported, checks that the memory stays mapped while the device imports it, in place of until the command buffer completed. a_type_9_hang_is_in_flight_as_long_as_metals commits its queue's command buffer right after the hang's, before another queue's runs: under the suite's load that run took 42 to 98 ms on the Iris Xe, past the 40 ms hang, on 6b322fb50f too. Checked at this tree, built on c662e1c78b, metal2vulkan's commit whose tree 62cad6be54's equals. On the M3 Max: cargo xtask check, 3517 of 3528 tests passed; the 11 that failed under its load (nine YCbCr sampling sweeps, and detach_backing's detached_in_flight on Metal and on Vulkan) passed alone. On the Iris Xe (homelab-ms01, ANV, Mesa 26.2.4, strict): the Vulkan crate's tests, 388 of 388. Cold boots on the M3 Max's Vulkan platform (MoltenVK), each with an empty translation cache: arm64 macOS 27 to its login window and macOS 26 to its desktop, with no fatal line or refusal. x86-64 macOS 26 with the ported GPU kexts, headless at 1920x1080, opened 69 apps in turn on the Iris Xe (ANV), the RTX 5080 Laptop and the Radeon 780M (RADV), the last two from an empty translation cache: no QEMU death, fatal line, refusal or crash report on any of the three. Not run here: the suite, which drives the Metal platform alone. |
||
|
|
a0b288ed52 |
🐎 Move metal2vulkan to 6b322fb50f: YCbCr filter, ANV halves
6b322fb50f is metal2vulkan's development, three commits on 29d3ebb22e's line: the fetched 8-bit blend for every factor, mask and blend color (01841476dd), the device's filter of a two-plane YCbCr texture by default (b7da00074a), and the cut of ANV's and RADV's cold making of half-heavy shaders (6b322fb50f). What changes for the guest: - Intel (ANV) builds the guest's big A2X pipelines cold in about 4 s, where it took about 14 s plus two 38 s remakes at a draw, past the guest's 10 s GPU watchdog: a cold first boot of the x86-64 port on Iris Xe stalled with 19,572 FIFO resumes, and now boots with none. RADV's 780M takes 0.39-0.43 s where it took 0.80 s. A computed half rounds through an f32->f16->f32 pair under Vulkan's 16-bit float controls, exact by the spec, and a half read from its bits widens by the device's conversion, every value but a NaN exact (its bits the device's, announced as NativeNanEncoding). NVIDIA keeps its forms (DriverWorkaround::HalfConversionPairFolded). - A linear sample of a two-plane YCbCr texture is the device's own filter by default (the owner's ruling, 2026-10-17: the fast form, logged, the exact one behind a switch): within 1.18 codes of Metal's on the RTX 3090, 0.88 on RADV, 1.06 on ANV and 0.1245 on MoltenVK on the M3 Max, so a draw binding one makes no pipeline of its own. REIMS_VGPU_EXACT=ycbcr_filter, and `all`, take Metal's filter, byte for byte as before. Here: the switch's name in platform.rs, its docs in docs/api.md and its row in the accuracy ledger, with the half-rounding and NaN rows brought up to date. The runtime's seven new kinds are placed (AttachmentReadInPlace, NotMipmappedAnisotropicSampler and -Filter, UnmeasuredGroupSpeculation and DeviceSampleLevel in DIES, DeviceSampleLevel also relayed on native devices; FloatTininessAfterRounding and ExactFormsOverCompilerLimit relayed); none dies by default. The Mac's YCbCr comparisons run on a device under YCbCrFilterPolicy::Exact, compared exactly, and a new test holds the default to its bound and its notices. Checked at this tree (metal2vulkan's e742fe531c, the same tree): cargo xtask check on the M3 Max (the 11 load-sensitive failures passed alone), the Vulkan crate's tests on um780's RX 7900 XTX and 780M (388/388 each), and the port's cold boots on ms01's Iris Xe and gem10's 780M with no fatal line. |
||
|
|
afdb76f844 |
🆕 Give every x86-64 VM the IOSurface device over PCI
An x86-64 macOS guest running Apple's arm64 GPU driver, ported, needs the IOSurface host device vmapple has as apple-gfx-mmio's second region: the driver's start waits for its mapper's service, and every texture over an IOSurface is a mapper texture. reims-ctl now gives every x86-64 VM on reims-vgpu that device, with no opt-in, and Apple's own x86-64 driver keeps running as before. For the guest: - apple-gfx-iosurface-pci (106b:eeef, ours) sits at 00:06.0 next to the GPU at 00:04.0: its registers in BAR 0 at 0x1000, 8-byte accesses passed whole, one MSI vector per completed command. A reset returns its registers to 0, ring size aside. - 0x1028 offers the second, 0x400-byte descriptor form only where its table holds all 8192 mapping ids (16 KiB pages); on x86-64's 4 KiB pages it reads 0, and the guest's mapper takes the first form, which fills them. - On apple-gfx-pci, a task other than task 0 runs isolated only if the IOSurface device has a descriptor table when the guest defines it, and device info offers argument buffers (key 33 bit 0x20, key 42) only while it has one. Apple's x86-64 driver, stock (binary version 6) or patched by reims-util (245), never programs the IOSurface device and makes ref textures whose backing is in task 0, which an isolated task does not serve (testing.md 6.20); its tasks stay in process and its device info is as without isolation. The ported driver's mapper programs the device before its GPU driver starts, and its tasks run isolated, which its info replies need. apple-gfx-mmio still isolates every task. For the host: - apple-gfx-pci has no option for this: adding apple-gfx-iosurface-pci is the only switch, and a VM without it runs as before. Its gpu link is optional, the machine's only apple-gfx-pci when unset. vendor/qemu moves to bd95509a. - RvgDeviceConfig gains process_isolation_follows_guest at its end (64 bytes; a host that passes 56 reads it false), and the Rust API's DeviceConfig the same field; apple-gfx-pci always sets it with use_iosurface_mapper and process_isolation. Each task made under it logs whether it runs isolated or in process, and device info logs each change of its argument-buffer answer. - reims-ctl's q35-x86_64 profile adds apple-gfx-iosurface-pci,id=iosfc,gpu=gfx,addr=0x6; vmware-svga and vmapple VMs are unchanged. reims-ctl and QEMU from this commit go together, as its installer installs them. - On Linux, the detach heap's temporary and a writable alias with zeros past its pages come from a range of a file of the library's own, so the Vulkan platform can alias and import them; QEMU no longer ends at an x86-64 guest's first such heap. macOS is unchanged. - The first command given to a task whose service has died writes one warning naming the task. - scripts/qtest_iosurface_pci.py checks the device under qtest (27 checks). Checked: cargo xtask check and the suite on the M3 Max; reims-ctl's install and a cold boot on um780; stock, reims-util and ported-driver guests booted on gem10 and ms01 with the isolation rule, Apple's driver's tasks in process at about 62 fps, the port's isolated. |
||
|
|
2631a11edc |
🐛 Move metal2vulkan to 720ef1ce9a: exact padded surfaces
metal2vulkan fd22785008..720ef1ce9a (18 commits, one per work packet) brings: - padded guest surfaces, whose rows lie with bytes between them (a browser's tiles): on every device but MoltenVK, one a pass draws into or a shader writes is the runtime's shadow, as a render pass may write back any byte of its attachment and Metal never writes those bytes (measured on the M3 Max); a loaded colour attachment copies back only the rectangle bounding its draws' scissors, and a pass that reaches no tile copies nothing. One that only reads stays an image over the buffer's bytes, and REIMS_VGPU_EXACT's new `padded_reads` takes the shadow for it too; - scheduler fixes: a commit left to the scheduler is taken in before its next check, and a commit's passes are bounded; - function storage measured on the RTX 3090 (128 KiB) and RX 7900 XTX (96 KiB), where FunctionStorageAssumed no longer fires; - threads a runtime thread starts no longer inherit its utilization floor; - the execution status through a binding where the device addresses no buffer, the macOS 27 fixes on the M3 Max, and a half texel's NaN as Metal's under nan_and_min_max on MoltenVK, which the docs now say MoltenVK answers only under that switch; - RUNTIME_VERSION 1211, SEMANTICS 1698. Checked on the same runtime sources before metal2vulkan squashed its history: cargo xtask check on the M3 Max (only the known macOS 27 failures); the Vulkan and core crates' tests on Iris Xe, two 780Ms, the RX 7900 XTX, the RTX 3090 and the RTX 5080 Laptop GPU (nothing new but load flakes that pass alone); and a cold boot of the x86-64 guest on each, with no fatal line. Iris Xe's steady frames/s at the users' scheduling class matched the last round's. |
||
|
|
06f3069b34 |
🐛 Keep the trace's diagnostics quiet, flushed and documented
The review of the surface crash fix ( |
||
|
|
b1058d16fb |
🆕 Say "click to capture input" in an uncaptured window's title
The title said nothing until input was captured, so someone new to the window had no hint that a click into the image captures the keyboard, or that it was not captured yet. Uncaptured, the title now ends " — click to capture input", on macOS (AppKit's and SDL's window) and on Linux, and it says so again after a release. Captured, it reads as before. features.md's entries for the title now say both states, guarded by the renamed capture::the_title_says_whether_input_is_captured; docs/api.md and the macOS walk name the new title. |
||
|
|
2624fe619b |
📝 Move the README's developer reference to docs/development.md [ci skip]
The README now speaks to people running VMs through reims-ctl. The repository layout, the tests and the Rust library's crates, commands, profiles and features move to docs/development.md, which the README's Developing section, AGENTS.md and the docs that cited those sections now point to. The QEMU and VM section is gone (docs/qemu.md covers it), as are History, whose tags AGENTS.md now names itself, and the interoperability note under Legal. |
||
|
|
98fe2a3bd5 |
🆕 Replace the tree with libreims_vgpu and its C API
This repository now holds libreims_vgpu, a Rust library that is the host side of the paravirtualized GPU macOS guests drive, in place of Apple's ParavirtualizedGraphics.framework: the library and its C API (reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API (vendor/qemu), the behaviour-lock suite that drives the C API as QEMU does, and reims-ctl, the VM manager users run. README.md says what it is and how it is laid out, and AGENTS.md how to change it. Every file of the earlier tree is replaced. vendor/qemu moves to the steelbrain/reims-vgpu branch of the same public repository. |