Commit Graph
9 Commits
Author SHA1 Message Date
Anees Iqbal 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.
2026-10-19 02:47:57 +03:00
Anees Iqbal 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.
2026-10-19 01:04:01 +03:00
Anees Iqbal 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.
2026-10-17 11:18:09 +03:00
Anees Iqbal 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.
2026-10-17 06:43:31 +03:00
Anees Iqbal 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.
2026-10-14 20:32:08 +03:00
Anees Iqbal 06f3069b34 🐛 Keep the trace's diagnostics quiet, flushed and documented
The review of the surface crash fix (be81ac03c) and the trace (9b93b71db)
found nothing wrong with either one's behaviour. It did find places where the
trace's diagnostics misbehave, or where the docs say something the code does
not do.

- REIMS_VGPU_TRACE_DEGRADE asked the runtime to announce every occurrence of
  every kind as soon as REIMS_VGPU_TRACE was set. The sink writes those to
  the trace, and relays a once-only kind only once, but only where the
  trace's file opened. With a path that could not be created, every
  occurrence went to stderr, some once per draw. The request now takes the
  sink's own condition, trace::on(). The variable is now on only at "1",
  like REIMS_VGPU_STRICT; before, any value turned it on, "0" included.
- A death aborts without running Drop, so a trace lost up to its last
  quarter second of events, the ones a hunt like the DEVICE_LOST one needs
  most. Core's one death path now flushes the trace after its stderr line
  and before abort(). The flush takes the file's lock only with try_lock,
  so a death never waits on it. trace.rs's doc now says when lines are
  written: a write flushes once a quarter second has passed since the last
  flush.
- a_line_per_event checks every line the trace writes, an imp/impfree pair
  included, flushed the way a death flushes.
- A surface over a single range of pages lies in the host's RAM, which the
  host maps and unmaps and core never unmaps through VulkanVm. So its unmap
  hold defers nothing under QEMU. surface.rs, remap.rs and the device
  test's doc now say so. The hold stays: it costs one leaf lock per import,
  and the test's second case still pins it.
- docs/api.md lists REIMS_VGPU_TRACE and REIMS_VGPU_TRACE_DEGRADE as
  diagnostics of the Vulkan platform; the Metal platform writes no trace.
- trace_degradations' doc gives the runtime's rule for announcing every
  occurrence: inside a program call or a host step only. A breach is the
  runtime's: a build with debug assertions aborts there, and the dist's
  release build logs a misplaced-notice line.

Nothing the guest or host observes changes, with or without the variables.
Checked: core's trace:: and raise::death tests, the Vulkan crate's answer::
and platform:: tests on the M3 Max, and clippy for macOS and x86-64 Linux.
2026-10-14 14:11:53 +03:00
Anees Iqbal 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.
2026-10-14 12:23:53 +03:00
Anees Iqbal 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.
2026-10-11 22:10:39 +03:00
Anees Iqbal 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.
2026-10-11 20:27:17 +03:00