diff --git a/AGENTS.md b/AGENTS.md index d4b53541d..63c233c88 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -50,13 +50,14 @@ The Makefile's header lists every target. README.md lists the requirements. | what | where | |---|---| -| the Cargo workspace: eight crates and `xtask` | `Cargo.toml`, `crates/`, `xtask/` | +| the Cargo workspace: seven crates and `xtask` | `Cargo.toml`, `crates/`, `xtask/` | | `reims-ctl`, the VM manager users run, and its installer | `crates/reims-ctl` (a workspace of its own, linking nothing of the library), `scripts/install-ctl.sh`; reims-util, which it runs to make an x86-64 VM's OpenCore image and download its installer, is pinned in `crates/reims-ctl/src/reims_util.rs` | | the C API | `crates/reims-vgpu-c/include/reims_vgpu.h`, specified in [docs/api.md](docs/api.md) | | the device: its wire, rings and transport | `crates/reims-vgpu-graphics`, whose `include/reims_graphics_wire.h` the guest's kexts and the option ROM compile; its design and protocol are [docs/graphics-kext](docs/graphics-kext) | | the device over the platform: the Metal-call decoder, the display and its window, the host's read-back | `crates/reims-vgpu/src/graphics.rs` and `graphics/` | | the display's shaders | `crates/reims-vgpu-vulkan/src/gpu/shaders.metal` | | the Vulkan platform | `crates/reims-vgpu-vulkan`, over metal2vulkan's runtime, at the commit of its public repository `Cargo.toml` names; what its defaults trade against Metal's answers is [docs/accuracy-ledger.md](docs/accuracy-ledger.md) | +| core: the platform traits, the runtime, raises and deaths, the guest's RAM, the testkit | `crates/reims-vgpu-vulkan/src/core.rs` and `core/`, the Vulkan crate's module `core`; the testkit is its `testkit` feature | | the Vulkan platform's metallibs, which a build off a Mac copies | `crates/reims-vgpu-vulkan/metallibs`, written on a Mac by `cargo xtask metallibs` (README.md, Building) | | a display's own window, and the register of what it does | `crates/reims-vgpu-window`, its `features.md` and its manual walk on macOS, `scripts/internal/walk_window_macos.sh`; the wiring is `crates/reims-vgpu/src/window.rs` | | the reims-graphics device's video on the host, on NVDEC or VA-API | `crates/reims-vgpu-video`, in modules: `core` (what the arms share: their runtime, locks, a guest surface's memory and bounded waits), `codec` (the codecs above the hardware), and on Linux `vaapi` and `nvidia` (the hardware's); its subcrate `conformance` is the test streams' readers and writers; the arms are reims-vgpu's `crates/reims-vgpu/src/graphics/{nvidia,vaapi,video_choice,video_host}.rs`, on the runtime in `crates/reims-vgpu/src/video/runtime.rs` | @@ -315,9 +316,10 @@ Three tiers: pointer authentication, and its binaries crash before `main` (`rust-toolchain.toml`). `cargo xtask check` on a Mac also clippy-checks the Linux target, and, where - Rosetta is installed, runs core's tests as `x86_64-apple-darwin`, for - the x86-64 guest's 4 KiB pages and instructions; it skips them, saying - so, where Rosetta is not. No x86-64 macOS binary ships. + Rosetta is installed, runs core's tests (the Vulkan crate's unit tests + below `core::`) as `x86_64-apple-darwin`, for the x86-64 guest's 4 KiB + pages and instructions; it skips them, saying so, where Rosetta is not. + No x86-64 macOS binary ships. - **Run `cargo xtask check` once before a branch that changes the library merges**, not before each commit (Checking a change). - **Stage explicit paths, and never commit build output.** Before each diff --git a/Cargo.toml b/Cargo.toml index 5a645f551..019e09629 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ memchr = "2.8.3" # built from the crate's bundled source, with its symbols prefixed. tikv-jemallocator = "0.7.0" -# Architecture 17.4. reims-vgpu-core adds its stricter set in lib.rs. +# Architecture 17.4. reims-vgpu-vulkan's core module adds its stricter set in core.rs. [workspace.lints.rust] unsafe_op_in_unsafe_fn = "deny" missing_docs = "warn" diff --git a/clippy.toml b/clippy.toml index fb40a918f..43754fdc8 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,5 +1,5 @@ -# Architecture 17.4. reims-vgpu-core denies clippy::disallowed_types and -# clippy::disallowed_methods; other crates see them as warnings. +# Architecture 17.4. The Vulkan crate's core module denies clippy::disallowed_types and +# clippy::disallowed_methods; other code sees them as warnings. disallowed-types = [ { path = "std::sync::Mutex", reason = "use sync::Mutex (parking_lot) (7.1)" }, diff --git a/crates/reims-vgpu-graphics/Cargo.toml b/crates/reims-vgpu-graphics/Cargo.toml index 299415985..3d2721f3a 100644 --- a/crates/reims-vgpu-graphics/Cargo.toml +++ b/crates/reims-vgpu-graphics/Cargo.toml @@ -15,6 +15,6 @@ workspace = true zerocopy.workspace = true # The region's mapping, the control thread's pipe and poll, and the monotonic clock. libc.workspace = true -# The device's locks, reims-vgpu-core's (`sync`). +# The device's locks, the Vulkan crate's core's (`core::sync`). parking_lot.workspace = true log.workspace = true diff --git a/crates/reims-vgpu-video/Cargo.toml b/crates/reims-vgpu-video/Cargo.toml index 161f4f3bc..e2b60ecbb 100644 --- a/crates/reims-vgpu-video/Cargo.toml +++ b/crates/reims-vgpu-video/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] thiserror = "2" log = "0.4" -# The locks the video code takes, reims-vgpu-core's (`core::sync`). +# The locks the video code takes, the Vulkan crate's core's (`core::sync`). parking_lot.workspace = true # The Annex B start-code scan (`codec::h264::nal`), a vectorized substring search. memchr.workspace = true diff --git a/crates/reims-vgpu-video/src/core.rs b/crates/reims-vgpu-video/src/core.rs index dd5408c32..28da438f5 100644 --- a/crates/reims-vgpu-video/src/core.rs +++ b/crates/reims-vgpu-video/src/core.rs @@ -13,7 +13,7 @@ //! - [`backend`] is what a backend answers: the pixel formats it writes, //! whether its device wrote a guest surface, and why it failed. -// The library's lint set, reims-vgpu-core's and the codec crate's: no +// The library's lint set, the Vulkan crate's core's and the codec crate's: no // unsafe code but what is marked, no indexing that can panic, and no silent // `as` conversion outside tests, where clippy.toml lets code unwrap, index // and panic. diff --git a/crates/reims-vgpu-video/src/core/runtime.rs b/crates/reims-vgpu-video/src/core/runtime.rs index e0cad533f..512fad673 100644 --- a/crates/reims-vgpu-video/src/core/runtime.rs +++ b/crates/reims-vgpu-video/src/core/runtime.rs @@ -1,6 +1,6 @@ //! The threads and the clock the video crates run on: [`Runtime`], which their host gives them. //! -//! This crate is independent of reims-vgpu-core and of QEMU, so it does not link the library's +//! This crate is independent of the library's crates and of QEMU, so it does not link the library's //! platform: it is handed a runtime of three calls instead, a thread's start, the monotonic //! clock's time and one timed wait, which each backend that starts a thread, waits or times a //! call keeps from its making. diff --git a/crates/reims-vgpu-video/src/core/sync.rs b/crates/reims-vgpu-video/src/core/sync.rs index 0c4e28188..2631b8bc5 100644 --- a/crates/reims-vgpu-video/src/core/sync.rs +++ b/crates/reims-vgpu-video/src/core/sync.rs @@ -1,5 +1,5 @@ -//! Locks: `parking_lot`'s, the same types reims-vgpu-core's `sync` re-exports, which every video -//! crate locks with. +//! Locks: `parking_lot`'s, the same types the Vulkan crate's `core::sync` re-exports, which every +//! video crate locks with. //! //! None is poisoned: a lock a panicking thread held is the next locker's, as it was, so no caller //! handles poisoning. In the library a panic on its threads ends the process before anything diff --git a/crates/reims-vgpu-vulkan/Cargo.toml b/crates/reims-vgpu-vulkan/Cargo.toml index 7a71ace6c..217476431 100644 --- a/crates/reims-vgpu-vulkan/Cargo.toml +++ b/crates/reims-vgpu-vulkan/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reims-vgpu-vulkan" -description = "The library's platform: the Platform implementation over metal2vulkan-runtime, on Vulkan" +description = "The library's platform: core, what the graphics device and its platform share, and the Platform implementation over metal2vulkan-runtime, on Vulkan" version.workspace = true edition.workspace = true rust-version.workspace = true diff --git a/crates/reims-vgpu-vulkan/src/core.rs b/crates/reims-vgpu-vulkan/src/core.rs index 9f98c97b4..76a933359 100644 --- a/crates/reims-vgpu-vulkan/src/core.rs +++ b/crates/reims-vgpu-vulkan/src/core.rs @@ -1,7 +1,7 @@ //! What the reims-graphics device and the platform under it share, generic over one //! `P: Platform` (D3): the platform traits, the runtime (threads, queues, holds), raises and //! deaths, the guest's RAM as the host maps it, and the testkit's fake platform, which the tests -//! run in the Vulkan platform's place. Links no Apple framework. +//! run in the Vulkan platform's place. It uses nothing else of this crate, and no Apple framework. // The module denies `unsafe_code` (D43): `forbid` cannot be lowered by the per-module // `#![allow(unsafe_code)]` that 17.3 grants `testkit/guest_ram.rs` (E0453). diff --git a/crates/reims-vgpu-vulkan/src/lib.rs b/crates/reims-vgpu-vulkan/src/lib.rs index 63bfd4114..7540535ce 100644 --- a/crates/reims-vgpu-vulkan/src/lib.rs +++ b/crates/reims-vgpu-vulkan/src/lib.rs @@ -2,6 +2,10 @@ //! (architecture D1): the library's only platform, natively on Linux, and over MoltenVK on macOS, //! a build for development and tests. //! +//! - **Core** ([`core`](crate::core)): what the reims-graphics device and its platform share, +//! generic over one `P: Platform`: the platform traits, the runtime, raises and deaths, the +//! guest's RAM and the testkit. It uses nothing else of this crate; the rest of the crate is +//! the platform it is generic over. //! - **GPU objects** are the runtime's ([`gpu`]): each handle is an [`Obj`] over the runtime's //! object and what core's trait asks of it beside (the device it came from, the IOSurface it //! retains). diff --git a/crates/reims-vgpu-window/Cargo.toml b/crates/reims-vgpu-window/Cargo.toml index 8a4a9d405..4447b2f1d 100644 --- a/crates/reims-vgpu-window/Cargo.toml +++ b/crates/reims-vgpu-window/Cargo.toml @@ -11,8 +11,9 @@ license.workspace = true log.workspace = true # ash's Vulkan types for a window's surface (`present`): SDL's on Linux, the layer's on macOS. ash.workspace = true -# The Vulkan crate's OS layer: its threads, and on macOS its clock and the message layer the -# AppKit side sends through (`reims_vgpu_vulkan::os`). +# The Vulkan crate: core's threads and holds (`reims_vgpu_vulkan::core`), and its OS layer: its +# threads, and on macOS its clock and the message layer the AppKit side sends through +# (`reims_vgpu_vulkan::os`). reims-vgpu-vulkan.workspace = true # The window on Linux (`sdl`): SDL3 for the window, its input and its Vulkan surface. diff --git a/docs/api.md b/docs/api.md index f9c049497..22ad534ba 100644 --- a/docs/api.md +++ b/docs/api.md @@ -21,7 +21,7 @@ library's `reims-vgpu.ui` on Linux. | layer | crate | what it is | |---|---|---| -| core | `reims-vgpu-core` | the platform traits, the runtime (threads, queues, holds), raises and deaths, the display's present pipeline, guest memory and the fake platform the tests run on | +| core | `reims-vgpu-vulkan`'s `core` | the platform traits, the runtime (threads, queues, holds), raises and deaths, the display's present pipeline, guest memory and the fake platform the tests run on | | platform | `reims-vgpu-vulkan` | core's `Platform`: `VulkanPlatform`, over metal2vulkan's runtime, on Linux, and on macOS over MoltenVK, a build for development and tests | | window | `reims-vgpu-window` | a display's own window (AppKit's or SDL3's on macOS, SDL3's on Linux), its input and the host's screens; it knows nothing of devices | | device | `reims-vgpu-graphics` | the wire: the records, rings and registers the guest and the host share, and the C header the guest's kexts and the option ROM compile | diff --git a/docs/architecture.md b/docs/architecture.md index 0f6f07ccc..967fb43bd 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -67,7 +67,7 @@ table is retired and not reused. | # | decision | why | |---|---|---| -| D1 | One Cargo workspace at the repository root: the library's crates (`reims-vgpu-core`, `-vulkan`, `-window`, `reims-vgpu-graphics`, `reims-vgpu`, `-c`), the host video crates (`reims-vgpu-video-*`), and `xtask`. `reims-vgpu-vulkan` is the library's `Platform`, over `metal2vulkan-runtime`, a Metal-shaped API on Vulkan: on Linux, and on macOS over MoltenVK, a build for development and tests (2.1, 2.2). | Each crate does one job the others cannot without breaking a rule below. | +| D1 | One Cargo workspace at the repository root: the library's crates (`reims-vgpu-vulkan`, `-window`, `reims-vgpu-graphics`, `reims-vgpu`, `-c`), the host video crates (`reims-vgpu-video-*`), and `xtask`. `reims-vgpu-vulkan` is the library's `Platform`, over `metal2vulkan-runtime`, a Metal-shaped API on Vulkan: on Linux, and on macOS over MoltenVK, a build for development and tests; its module `core` is what the platform and the device share (2.1, 2.2). | Each crate does one job the others cannot without breaking a rule below. | | D2 | Modules by area and responsibility, not one file per Objective-C class. | The code is Rust; the contract binds behaviour, not file shape. | | D3 | Core is generic over one `P: Platform` whose associated types name every Metal object kind. `dyn` only for the host's callbacks, the display executor and the OS services. | A handle flows into another Metal call (a texture into an encoder) with its kind checked at compile time. | | D4 | One typed platform method per Metal method the library calls, and one enum variant per encoder and ICB command (`BlitCmd`, `ComputeCmd`, `RenderCmd`, `IcbRenderCmd`, `IcbComputeCmd`), with no table of ops between the caller and Metal. The platform's dispatch is one exhaustive `match` per command family, and it names each call by its selector and raise policy (4.3, 4.6). A call whose position the guest or host observes (a creation, release or retain, an aliasing setter, a command, a call with raw guest values) is sent where the caller makes it; a getter or device query is not ordered. | A send per guest operation, in order, with raw guest values: Metal's results, aborts and numbering follow the calls a process makes. | @@ -111,10 +111,10 @@ D26, D28, D40 and D48. ``` Cargo.toml Cargo.lock rust-toolchain.toml clippy.toml .cargo/config.toml crates/ - reims-vgpu-core/ what the platforms and the device share, generic over P: Platform; - links no Apple framework - reims-vgpu-vulkan/ Platform over metal2vulkan-runtime, the library's only one: on Linux, and - over MoltenVK on macOS; its OS services; the library's shaders + reims-vgpu-vulkan/ core (src/core.rs, src/core/), what the platform and the device share, + generic over P: Platform; Platform over metal2vulkan-runtime, the + library's only one: on Linux, and over MoltenVK on macOS; its OS + services; the library's shaders reims-vgpu-window/ the device's own window: AppKit or SDL3, input, the host's screens, and features.md, the register of what the window does reims-vgpu-graphics/ the device's wire, its rings and control, and the C header the guest @@ -140,7 +140,7 @@ preferences domain and no entitlement: the device's options are its config's fie ### 2.2 Crate graph ``` -reims-vgpu-core, metal2vulkan-runtime <- reims-vgpu-vulkan <- reims-vgpu-window <- reims-vgpu +metal2vulkan-runtime <- reims-vgpu-vulkan <- reims-vgpu-window <- reims-vgpu reims-vgpu-graphics, reims-vgpu-video-* <- reims-vgpu <- reims-vgpu-c <- QEMU ``` @@ -152,9 +152,11 @@ reims-vgpu-graphics, reims-vgpu-video-* <- reims-vgpu <- reims-vgpu-c <- Q Linux `os/linux/` (a host VM over `mmap` of the guest RAM's files, and an IOSurface stand-in over that memory). It compiles the library's shaders (4.7). Where its answer differs from Metal's it logs the difference and goes on, and dies where Metal would or where the runtime cannot run the call ([accuracy-ledger.md](accuracy-ledger.md)). -- **Core** depends on `parking_lot`, `zerocopy`, `bitflags` and `log` only. Its `testkit` feature - exposes `core::testkit` outside core's own tests; only dev-dependencies enable it, and - `cargo xtask testkit` checks that (D50). +- **Core** (`reims_vgpu_vulkan::core`) uses `parking_lot`, `zerocopy` and `log`, and nothing else + of the Vulkan crate: the crate's platform implements core's traits, and core is generic over + them. The crate's `testkit` feature exposes `core::testkit` outside the crate's own unit tests; + only dev-dependencies enable it (the crate's own, for its integration tests), and `cargo xtask + testkit` checks that (D50). - **The window** (`reims-vgpu-window`) is the device's own window (D51), and knows nothing of devices. Its pure logic is unit-tested with no AppKit or SDL: `geometry` (the image's rectangle in the window, the pointer's position in the guest's mode, the buttons), `keymap` (key codes to @@ -213,8 +215,9 @@ is built for it too. ## 3. Core's modules -`crates/reims-vgpu-core/src/`, one file per module beside its directory (D44). Each module's `//!` -doc holds its ordering contracts and the odd behaviours it keeps, each naming its test. +`crates/reims-vgpu-vulkan/src/core/`, below its root `core.rs`, one file per module beside its +directory (D44). Each module's `//!` doc holds its ordering contracts and the odd behaviours it +keeps, each naming its test. | module | what it owns | |---|---| @@ -781,7 +784,8 @@ tested features are every feature but the C API's `vulkan` (`TESTED_FEATURES` in `xtask/src/main.rs`), which makes the C API's platform the Vulkan one (11.1); on Linux, where the Vulkan platform is the only one, it is among them. On a Mac the check also runs clippy for `x86_64-unknown-linux-gnu`, which type-checks every Linux file with SDL left unbuilt, and, where -Rosetta runs x86-64 code, core's tests as `x86_64-apple-darwin`. +Rosetta runs x86-64 code, core's tests (the Vulkan crate's unit tests below `core::`) as +`x86_64-apple-darwin`. ### 13.2 The testkit diff --git a/docs/development.md b/docs/development.md index a4e4b1f46..40d649fb8 100644 --- a/docs/development.md +++ b/docs/development.md @@ -11,7 +11,7 @@ AGENTS.md the rules for working on the repository Cargo.toml the Cargo workspace, with Cargo.lock, rust-toolchain.toml, clippy.toml and .cargo/config.toml -crates/ its eight crates (below), and reims-ctl, a +crates/ its seven crates (below), and reims-ctl, a workspace of its own that links none of them xtask/ cargo xtask (below) firmware/ the reims-graphics device's option ROM: its UEFI @@ -88,8 +88,7 @@ doc holds its area's ordering contracts and the measured platform facts it relie | crate | path | role | |---|---|---| -| `reims-vgpu-core` | `crates/reims-vgpu-core` | what the platforms and the device share, generic over `P: Platform`: the platform traits, the runtime, raises and deaths, the testkit; links no Apple framework | -| `reims-vgpu-vulkan` | `crates/reims-vgpu-vulkan` | the `Platform` over metal2vulkan's runtime, the library's only one: on Linux, and on macOS over MoltenVK, a build for development and tests; its OS services (on macOS IOSurface, Mach VM, threads and the Objective-C message layer the window's AppKit side sends through), and the library's shaders (`src/gpu/shaders.metal`) | +| `reims-vgpu-vulkan` | `crates/reims-vgpu-vulkan` | `core` (`src/core.rs`, `src/core/`), what the platform and the device share, generic over `P: Platform`: the platform traits, the runtime, raises and deaths, the testkit, using nothing else of the crate; and the `Platform` over metal2vulkan's runtime, the library's only one: on Linux, and on macOS over MoltenVK, a build for development and tests; its OS services (on macOS IOSurface, Mach VM, threads and the Objective-C message layer the window's AppKit side sends through), and the library's shaders (`src/gpu/shaders.metal`) | | `reims-vgpu-window` | `crates/reims-vgpu-window` | the device's own window: AppKit's or SDL3's on macOS, SDL3's on Linux, its input and the host's screens; knows nothing of devices or displays. `features.md` lists what the window does, each entry deliberate | | `reims-vgpu` | `crates/reims-vgpu` | the public Rust API: the reims-graphics device over the platform, its Metal-call decoder and its window; the process's platform | | `reims-vgpu-c` | `crates/reims-vgpu-c` | the C API (`rvg_*`, `include/reims_vgpu.h`), which QEMU links; `cdylib`, `staticlib` and `rlib` | @@ -122,9 +121,9 @@ cargo xtask metallibs # on a Mac: the Vulkan platform's metallibs and their `cargo xtask check` tests with every feature but `reims-vgpu-c/vulkan`, which puts the C API on the Vulkan platform, and lints with every feature too. On a Mac it also clippy-checks the Linux target, -and, where Rosetta is installed, runs core's tests as `x86_64-apple-darwin`. Its cargo steps run -in the environment it was started in, incremental as cargo's dev and test profiles are, so a check -run again after a fix rebuilds what the fix changed. +and, where Rosetta is installed, runs core's tests (the Vulkan crate's unit tests below `core::`) +as `x86_64-apple-darwin`. Its cargo steps run in the environment it was started in, incremental as +cargo's dev and test profiles are, so a check run again after a fix rebuilds what the fix changed. #### Building through kache @@ -139,7 +138,7 @@ developer's builds take it up through `scripts/internal/dev-env.sh`, sourced fro root before each cargo command: ```sh -. scripts/internal/dev-env.sh && cargo nextest run -p reims-vgpu-core +. scripts/internal/dev-env.sh && cargo nextest run -p reims-vgpu-vulkan -E 'test(/^core::/)' ``` which, where `kache` is on the PATH, sets `RUSTC_WRAPPER=kache`, `KACHE_LOCAL_ONLY=1` and @@ -160,10 +159,11 @@ kache seeds only between target directories inside their worktrees, cargo's defa no `CARGO_TARGET_DIR`. It maps the compiler's working directory, the worktree's root, to one path (`-Zremap-cwd-prefix=/src`), and a target directory elsewhere puts a path of its own in the compiler's arguments, so each target's state is compatible with no other's. Measured on the M3 Max -on 2026-11-03, the first edit of `reims-vgpu-core` after a build of the tree: with targets inside -the worktrees, a second worktree's compile seeded from the first's state took 4.3 s, against 7.0 s -for the first worktree's, which had no donor; with each target in a directory of its own under -`~/.cache`, the two units' seed identities differed and the second took 5.7 s, against 6.0 s. +on 2026-11-03, the first edit of core (then the crate `reims-vgpu-core`) after a build of the +tree: with targets inside the worktrees, a second worktree's compile seeded from the first's state +took 4.3 s, against 7.0 s for the first worktree's, which had no donor; with each target in a +directory of its own under `~/.cache`, the two units' seed identities differed and the second took +5.7 s, against 6.0 s. A unit is shared between worktrees when nothing it is built from names the worktree's path, and a build script's run when nothing it writes does. So the tests find the tree at run time: they read @@ -298,7 +298,8 @@ Set in `Cargo.toml` (architecture 2.3): SDL3's window on macOS, which `REIMS_VGPU_WINDOW_IMPL=sdl` opens in place of AppKit's. Without it the macOS library has no SDL. - `reims-vgpu-window/sdl-no-link`: SDL left unbuilt, for the Linux target's clippy on a Mac. -- `reims-vgpu-vulkan/testkit`: `core::testkit` for other crates' tests. +- `reims-vgpu-vulkan/testkit`: `core::testkit` for other crates' tests and the Vulkan crate's + integration tests. - `reims-vgpu/testkit`: the same, through the public crate, and each handle's core object. [api.md](api.md) section 2 lists the device's settings and the environment variables the library diff --git a/docs/graphics-kext/design.md b/docs/graphics-kext/design.md index 95c981302..c366a34bc 100644 --- a/docs/graphics-kext/design.md +++ b/docs/graphics-kext/design.md @@ -1337,8 +1337,7 @@ has a queue it hands the pool's first range out twice, so the host checks it wit a few plain textures and logs an error where one takes a guest id. Were the paravirt lane's device in the same process, on the same GPU, the graphics lane's reservation would win: it is made as the device is, before any guest runs, while -the paravirt lane reserves its placed objects as each task starts -(`crates/reims-vgpu-core/src/resources/manager/reserve.rs`), and Metal takes only +the paravirt lane reserves its placed objects as each task starts, and Metal takes only a type's first reservation. That would not make the two safe together: both lanes' guests place textures in the device's one table, at ids each picks alone. So a process runs one lane's device on a GPU, and today a VM has one lane or the other. @@ -1591,7 +1590,7 @@ completion rings. Our guest Metal GPU bundle is the host of Apple's Metal SPI: every Metal call an app makes lands in one of the bundle's objects, and the bundle serialises it into this stream. The host reads the stream and drives the library's `Platform` -(Metal on the Mac, metal2vulkan on Linux), the same trait reims-vgpu-core +(Metal on the Mac, metal2vulkan on Linux), the same trait core already drives from the Apple-lane command stream. So the host decoder is: wire message → handle-table lookup/insert → `Platform` call → completion. The bundle's serialiser is the mirror of that decoder. @@ -1635,7 +1634,7 @@ buffer then completes as it would have. Where there is no stand-in (a message too short to name its queue, a queue the process does not hold), the error status is posted at once. Nothing in this lane ends the offending context or its process on malformed input. The -host runs each op in a refusal scope (`reims_vgpu_core::raise::refusals`): a +host runs each op in a refusal scope (`reims_vgpu_vulkan::core::raise::refusals`): a death at a platform call, where the platform refuses a create or an encode and the paravirt device ends the process, unwinds to the op's scope instead, and the op is refused there, logged once at WARN with the platform's reason. A panic in @@ -2601,7 +2600,7 @@ command-buffer/queue descriptors and `errorOptions`; labels and debug groups answered guest-side; residency sets (`useResource`/`useHeap` are in); `MTLIOCommandQueue`; Metal 4. -**Where the decoder lives.** In reims-vgpu-core, generic over `P: Platform`, +**Where the decoder lives.** In reims-vgpu (`graphics::decode`), generic over `P: Platform`, beside the Apple-lane decode it mirrors (same handle machinery, descriptor structs and `Platform` calls). The reims-vgpu-graphics crate stays the transport (rings, region, registers); the decoder consumes ring bytes and drives diff --git a/docs/testing.md b/docs/testing.md index 09c053873..93070952e 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -8,9 +8,10 @@ How the code is tested, and how a claim about Metal or the hardware says where i - **Unit tests** sit beside the code, in `mod tests`, named by the behaviour they hold. `cargo xtask check` runs every one with cargo-nextest, and the doc-tests: on a Mac on the Vulkan platform over MoltenVK, and on Linux on the host's Vulkan driver. -- **Core's testkit** (`reims-vgpu-core`'s `testkit` feature) is a fake `Platform` that models - Metal's objects and logs the calls whose order Metal observes ([architecture.md](architecture.md) - 13.2). Core's tests, and the tests of other crates that need no GPU, run on it. +- **Core's testkit** (`core::testkit`, the Vulkan crate's `testkit` feature) is a fake `Platform` + that models Metal's objects and logs the calls whose order Metal observes + ([architecture.md](architecture.md) 13.2). Core's tests, and the tests of other crates that need + no GPU, run on it. - **The Vulkan platform's tests** run on the host's Vulkan device. On a Mac, its `metal_tests` modules compare what MoltenVK answers with Metal's answers, recorded from Metal on the M3 Max under macOS 27.0.1 into text files beside each test (`metal_answers/`, read by core's diff --git a/docs/video/core.md b/docs/video/core.md index 45d60f278..2f668e46f 100644 --- a/docs/video/core.md +++ b/docs/video/core.md @@ -15,7 +15,7 @@ overview. makes virtual. `StdRuntime` is std's threads and clock, for the examples and the hardware tests. A `Bell` is the one place the video code waits on a condition variable with a deadline. -- **`sync`**: the locks, `parking_lot`'s, the types reims-vgpu-core's `sync` re-exports. +- **`sync`**: the locks, `parking_lot`'s, the types `reims_vgpu_vulkan::core::sync` re-exports. ## A guest surface's memory diff --git a/scripts/internal/dev-env.sh b/scripts/internal/dev-env.sh index b779f6d15..29259f1bc 100644 --- a/scripts/internal/dev-env.sh +++ b/scripts/internal/dev-env.sh @@ -1,7 +1,7 @@ # The environment a developer's builds run in. Source it from the worktree's root, which builds in # its own target/ (no CARGO_TARGET_DIR), before each cargo command: # -# . scripts/internal/dev-env.sh && cargo nextest run -p reims-vgpu-core +# . scripts/internal/dev-env.sh && cargo nextest run -p reims-vgpu-vulkan -E 'test(/^core::/)' # # Builds are incremental, as cargo's dev and test profiles are. Where kache is on the PATH, rustc # runs through it (RUSTC_WRAPPER=kache): a compiler cache that stores each unit's outputs on this