diff --git a/AGENTS.md b/AGENTS.md index d57f92475..6196083d4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,7 +53,7 @@ The Makefile's header lists every target. README.md lists the requirements. | the Cargo workspace: eight 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-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: 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) | @@ -128,7 +128,7 @@ passes run again alone. | `xtask/` | `cargo test -p xtask`, rustfmt and clippy on it | | `crates/reims-ctl` | `cargo test`, `cargo fmt --check` and `cargo clippy --all-targets` in it (`cargo xtask check` does not reach it); a change to the QEMU command it builds, or to `scripts/install-ctl.sh`, also needs an install and a VM boot on each host it touches | | `guest/` (kext, bundle, rgfxgate, loader) | `make -C guest test` on a Mac; a change to a source the set is built from also needs `make -C guest prebuilt KDK=`, committing `guest/prebuilt` with it (`make -C guest prebuilt-check` fails otherwise) | -| `firmware/`, the option ROM | build it (`make -C firmware`); a change not meant to alter what the guest's firmware sees keeps the ROM's bytes; a change to what `ReimsGraphics.rom` is built from (its sources, the Makefile, `crates/reims-graphics/include/reims_graphics_wire.h`) also runs `make -C firmware prebuilt` on a Mac, committing the ROM and record it writes | +| `firmware/`, the option ROM | build it (`make -C firmware`); a change not meant to alter what the guest's firmware sees keeps the ROM's bytes; a change to what `ReimsGraphics.rom` is built from (its sources, the Makefile, `crates/reims-vgpu-graphics/include/reims_graphics_wire.h`) also runs `make -C firmware prebuilt` on a Mac, committing the ROM and record it writes | | `firmware/ambrosia` | build it (`make -C firmware/ambrosia bundle`); a change to what it does with the device also needs an arm64 guest's boot on Ambrosia with the device and the module ([docs/qemu.md](docs/qemu.md), "arm64 guests") | | `vendor/qemu` | build it (`make qemu`) and realize the device paused (`-S`); a change to `hw/display/reims-graphics-pci.c`, or to what QEMU calls, also needs a VM boot ([docs/lessons.md](docs/lessons.md), [docs/qemu.md](docs/qemu.md)) | | docs and comments | nothing | diff --git a/Cargo.lock b/Cargo.lock index 1c8c7b3a2..3eda91935 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -437,16 +437,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "reims-graphics" -version = "0.1.0" -dependencies = [ - "libc", - "log", - "parking_lot", - "zerocopy", -] - [[package]] name = "reims-vgpu" version = "0.1.0" @@ -458,8 +448,8 @@ dependencies = [ "objc2-foundation", "objc2-metal", "parking_lot", - "reims-graphics", "reims-vgpu-core", + "reims-vgpu-graphics", "reims-vgpu-video", "reims-vgpu-vulkan", "reims-vgpu-window", @@ -476,9 +466,9 @@ dependencies = [ "objc2", "objc2-foundation", "parking_lot", - "reims-graphics", "reims-vgpu", "reims-vgpu-core", + "reims-vgpu-graphics", "tikv-jemallocator", ] @@ -492,6 +482,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "reims-vgpu-graphics" +version = "0.1.0" +dependencies = [ + "libc", + "log", + "parking_lot", + "zerocopy", +] + [[package]] name = "reims-vgpu-video" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 3ab64c98d..d257855aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "crates/reims-vgpu-vulkan", "crates/reims-vgpu-video", "crates/reims-vgpu-video/conformance", - "crates/reims-graphics", + "crates/reims-vgpu-graphics", "xtask", ] @@ -28,7 +28,7 @@ reims-vgpu-window = { path = "crates/reims-vgpu-window", default-features = fals reims-vgpu = { path = "crates/reims-vgpu", default-features = false } reims-vgpu-vulkan = { path = "crates/reims-vgpu-vulkan" } # The reims-graphics device: its wire format and host side. -reims-graphics = { path = "crates/reims-graphics" } +reims-vgpu-graphics = { path = "crates/reims-vgpu-graphics" } # The reims-graphics device's video on the host: its runtime and memory (`crate::video` of # `reims-vgpu`), and, on Linux, VA-API through libva and NVDEC through CUDA, their libraries # loaded at run time (`graphics::vaapi` and `graphics::nvidia` of `reims-vgpu`). diff --git a/README.md b/README.md index dbe6e2de2..529b3e8cc 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ reads them once per process, and an unset or unparsable value is the default. | Variable | Effect | |---|---| -| `REIMS_VGPU_LOG=info` | the library's log lines to stderr, filtered by a level and `target=level` pairs (`warn,reims_graphics=debug`); unset, nowhere. `reims-ctl set --log-level` sets it | +| `REIMS_VGPU_LOG=info` | the library's log lines to stderr, filtered by a level and `target=level` pairs (`warn,reims_vgpu_graphics=debug`); unset, nowhere. `reims-ctl set --log-level` sets it | | `REIMS_VGPU_WINDOW=0` | QEMU stays headless under `-display none` (QEMU reads it, not the library) | | `REIMS_VGPU_WINDOW_BORDERLESS=1` | a borderless window that fills its screen | | `REIMS_VGPU_STRICT=1` | end the process at each difference from Metal's answer the Vulkan platform would otherwise log | @@ -142,7 +142,7 @@ resize it. [docs/api.md](docs/api.md) section 2 lists every setting and variable ## What's here - The library: `crates/`. Core holds the behavior, generic over its platform; beside it are the - Vulkan platform, which runs on metal2vulkan, the reims-graphics device's host side (`crates/reims-graphics`), a display's window, host video on VA-API and NVDEC/NVENC, + Vulkan platform, which runs on metal2vulkan, the reims-graphics device's host side (`crates/reims-vgpu-graphics`), a display's window, host video on VA-API and NVDEC/NVENC, the Rust API and the C API ([docs/development.md](docs/development.md#crates)). - The guest's side: `guest/`, the kexts that drive the device and the Metal bundle that turns the guest's Metal calls into its command stream. `guest/prebuilt` holds the built set, which diff --git a/crates/reims-vgpu-c/Cargo.toml b/crates/reims-vgpu-c/Cargo.toml index 56367d3be..59c49cec8 100644 --- a/crates/reims-vgpu-c/Cargo.toml +++ b/crates/reims-vgpu-c/Cargo.toml @@ -24,7 +24,7 @@ vulkan = ["reims-vgpu/vulkan"] [dependencies] reims-vgpu.workspace = true # The graphics device's wire constants, which the C API's PCI constants are checked against. -reims-graphics.workspace = true +reims-vgpu-graphics.workspace = true # The death of a NULL handle, and the mark of the library's threads (the unit tests' testkit # platform stands where VulkanPlatform stands in the product). reims-vgpu-core.workspace = true diff --git a/crates/reims-vgpu-c/src/graphics.rs b/crates/reims-vgpu-c/src/graphics.rs index 6f5c7b61b..93e11a008 100644 --- a/crates/reims-vgpu-c/src/graphics.rs +++ b/crates/reims-vgpu-c/src/graphics.rs @@ -64,7 +64,7 @@ pub const RVG_GRAPHICS_DOORBELL_CONTROL: u32 = 0; pub const RVG_GRAPHICS_ALLOCATIONS_OFFSET: u64 = 0x40_0000; const _: () = { - use reims_graphics::wire; + use reims_vgpu_graphics::wire; assert!(RVG_GRAPHICS_PCI_VENDOR_ID == wire::RGFX_PCI_VENDOR_ID); assert!(RVG_GRAPHICS_PCI_DEVICE_ID == wire::RGFX_PCI_DEVICE_ID); assert!(RVG_GRAPHICS_PCI_CLASS == wire::RGFX_PCI_CLASS); diff --git a/crates/reims-vgpu-c/src/graphics/tests.rs b/crates/reims-vgpu-c/src/graphics/tests.rs index cb4ce55b6..bc2c9a459 100644 --- a/crates/reims-vgpu-c/src/graphics/tests.rs +++ b/crates/reims-vgpu-c/src/graphics/tests.rs @@ -49,12 +49,12 @@ fn a_headless_graphics_device_lives_and_ends() { // SAFETY: a live device; the size is writable. let base = unsafe { rvg_graphics_device_region(device, &mut size) }; assert!(!base.is_null() && base.addr() % 4096 == 0); - assert_eq!(size, reims_graphics::REGION_SIZE); + assert_eq!(size, reims_vgpu_graphics::REGION_SIZE); // SAFETY: a live device. unsafe { assert_eq!( rvg_graphics_device_mmio_read(device, 0), - reims_graphics::wire::RGFX_MAGIC + reims_vgpu_graphics::wire::RGFX_MAGIC ); rvg_graphics_device_mmio_write_taking(device, 0x10, 1); assert_eq!(rvg_graphics_device_mmio_read(device, 0x10), 1); @@ -256,8 +256,8 @@ fn command_buffer_copy_cost() { use std::hint::black_box; use std::time::Instant; - use reims_graphics::region::Region; - use reims_graphics::wire::RGFX_CONTEXT_ALLOCATIONS_OFFSET; + use reims_vgpu_graphics::region::Region; + use reims_vgpu_graphics::wire::RGFX_CONTEXT_ALLOCATIONS_OFFSET; const BLOCK: u64 = RGFX_CONTEXT_ALLOCATIONS_OFFSET; const SPAN: usize = 8 << 20; diff --git a/crates/reims-vgpu-core/src/logging.rs b/crates/reims-vgpu-core/src/logging.rs index 3a5ebe4fd..676a5ab0d 100644 --- a/crates/reims-vgpu-core/src/logging.rs +++ b/crates/reims-vgpu-core/src/logging.rs @@ -483,7 +483,7 @@ mod tests { /// debug line, from every walk thread at once. #[test] fn a_line_not_written_takes_no_lock() { - for env in [None, Some("info,reims_graphics=trace")] { + for env in [None, Some("info,reims_vgpu_graphics=trace")] { let l = logger(env); let (seen, hook) = recording_hook(); l.keep( @@ -514,7 +514,7 @@ mod tests { }); assert!(seen.lock().is_empty(), "{env:?}"); // A line the filter passes still reaches the hook. - write(&l, Level::Info, "reims_graphics", "kept"); + write(&l, Level::Info, "reims_vgpu_graphics", "kept"); assert_eq!(seen.lock().len(), 1, "{env:?}"); } } diff --git a/crates/reims-graphics/Cargo.toml b/crates/reims-vgpu-graphics/Cargo.toml similarity index 95% rename from crates/reims-graphics/Cargo.toml rename to crates/reims-vgpu-graphics/Cargo.toml index 0f3acb036..299415985 100644 --- a/crates/reims-graphics/Cargo.toml +++ b/crates/reims-vgpu-graphics/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "reims-graphics" +name = "reims-vgpu-graphics" description = "The reims-graphics device's wire format and host side: its registers, rings, control commands and display state" version.workspace = true edition.workspace = true diff --git a/crates/reims-graphics/cbindgen.toml b/crates/reims-vgpu-graphics/cbindgen.toml similarity index 97% rename from crates/reims-graphics/cbindgen.toml rename to crates/reims-vgpu-graphics/cbindgen.toml index 17e0c5930..a0de9f638 100644 --- a/crates/reims-graphics/cbindgen.toml +++ b/crates/reims-vgpu-graphics/cbindgen.toml @@ -3,7 +3,7 @@ # drift. The header holds `wire` alone: the host side's public items are not C's. language = "C" include_guard = "REIMS_GRAPHICS_WIRE_H" -autogen_warning = "/* Generated by cbindgen from crates/reims-graphics (cbindgen.toml): `cargo xtask header`.\n * Committed and drift-checked by `cargo xtask header --check`. Do not edit by hand. */" +autogen_warning = "/* Generated by cbindgen from crates/reims-vgpu-graphics (cbindgen.toml): `cargo xtask header`.\n * Committed and drift-checked by `cargo xtask header --check`. Do not edit by hand. */" style = "type" documentation = true documentation_style = "c99" @@ -12,7 +12,7 @@ sys_includes = ["stdint.h"] no_includes = true header = """/* * reims_graphics_wire.h: the wire format of the reims-graphics device (PCI 1234:5247), which the - * guest's kext and option ROM share with the host (crates/reims-graphics/src/wire.rs, and + * guest's kext and option ROM share with the host (crates/reims-vgpu-graphics/src/wire.rs, and * docs/graphics-kext/design.md, "Stage 2 wire protocol"). * * Every value is little-endian. A message's struct is the whole message, its header included. diff --git a/crates/reims-graphics/include/reims_graphics_wire.h b/crates/reims-vgpu-graphics/include/reims_graphics_wire.h similarity index 99% rename from crates/reims-graphics/include/reims_graphics_wire.h rename to crates/reims-vgpu-graphics/include/reims_graphics_wire.h index 320ab9122..679fef617 100644 --- a/crates/reims-graphics/include/reims_graphics_wire.h +++ b/crates/reims-vgpu-graphics/include/reims_graphics_wire.h @@ -1,6 +1,6 @@ /* * reims_graphics_wire.h: the wire format of the reims-graphics device (PCI 1234:5247), which the - * guest's kext and option ROM share with the host (crates/reims-graphics/src/wire.rs, and + * guest's kext and option ROM share with the host (crates/reims-vgpu-graphics/src/wire.rs, and * docs/graphics-kext/design.md, "Stage 2 wire protocol"). * * Every value is little-endian. A message's struct is the whole message, its header included. @@ -10,7 +10,7 @@ #ifndef REIMS_GRAPHICS_WIRE_H #define REIMS_GRAPHICS_WIRE_H -/* Generated by cbindgen from crates/reims-graphics (cbindgen.toml): `cargo xtask header`. +/* Generated by cbindgen from crates/reims-vgpu-graphics (cbindgen.toml): `cargo xtask header`. * Committed and drift-checked by `cargo xtask header --check`. Do not edit by hand. */ #include @@ -4579,7 +4579,7 @@ typedef struct { // image its rows of texel blocks. A level of `w` by `h` texels (the texture's halved `level` // times, at least 1) has rows of `ceil(w / block_width) * bytes_per_block` bytes rounded up to // [`RGFX_MANAGED_ROW_ALIGN`], and `ceil(h / block_height)` of them an image. The guest and the -// host each compute it from these fields alone (`reims_graphics::managed`). +// host each compute it from these fields alone (`reims_vgpu_graphics::managed`). typedef struct { // [`RGFX_CMD_MANAGED_TEXTURE_CREATE`]. RgfxMsgHeader header; diff --git a/crates/reims-graphics/src/control.rs b/crates/reims-vgpu-graphics/src/control.rs similarity index 98% rename from crates/reims-graphics/src/control.rs rename to crates/reims-vgpu-graphics/src/control.rs index ca6147f2c..e49a1ed02 100644 --- a/crates/reims-graphics/src/control.rs +++ b/crates/reims-vgpu-graphics/src/control.rs @@ -340,7 +340,7 @@ fn present(shared: &Shared, message: &Message, epoch: u64) -> Option> { Some(command) if command.display == 0 => { if command.flags & RGFX_PRESENT_KEEP != 0 { log::trace!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "PRESENT_SURFACE of transaction {}: the display keeps what it shows", command.transaction_id ); @@ -366,7 +366,10 @@ fn present(shared: &Shared, message: &Message, epoch: u64) -> Option> { /// names, or naming more than [`RGFX_COLOR_PART_ENTRIES`], is logged and dropped. fn display_color(shared: &Shared, message: &Message) { let Some(color) = read::(message) else { - log::warn!(target: "reims_graphics", "a DISPLAY_COLOR shorter than its fields was dropped"); + log::warn!( + target: "reims_vgpu_graphics", + "a DISPLAY_COLOR shorter than its fields was dropped" + ); return; }; let fields = size_of::(); @@ -385,13 +388,13 @@ fn display_color(shared: &Shared, message: &Message) { match entries { Some(entries) if color.display == 0 => shared.host.display_color(&color, &entries), Some(_) => log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "a DISPLAY_COLOR of display {} (transaction {}) was dropped: there is no such display", color.display, color.transaction_id ), None => log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "a DISPLAY_COLOR of transaction {} naming {} entries was dropped: the message does \ not carry them, or they are past {RGFX_COLOR_PART_ENTRIES}", color.transaction_id, @@ -410,7 +413,7 @@ fn present_surface( epoch: u64, ) { log::trace!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "PRESENT_SURFACE of transaction {}: IOSurface {}", command.transaction_id, command.iosurface_id diff --git a/crates/reims-graphics/src/device.rs b/crates/reims-vgpu-graphics/src/device.rs similarity index 99% rename from crates/reims-graphics/src/device.rs rename to crates/reims-vgpu-graphics/src/device.rs index 77e9358f6..e72681920 100644 --- a/crates/reims-graphics/src/device.rs +++ b/crates/reims-vgpu-graphics/src/device.rs @@ -1393,7 +1393,7 @@ impl Shared { // message in flight comes before it. self.lanes.wait_begun(self.epoch.load(Ordering::Acquire)); self.host.device_reset(); - log::info!(target: "reims_graphics", "the device was reset"); + log::info!(target: "reims_vgpu_graphics", "the device was reset"); } } @@ -1514,7 +1514,7 @@ impl Shared { } Err(broken) => { log::error!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "the control submission ring is broken ({broken}): it takes nothing \ more until the device is reset" ); @@ -1581,7 +1581,7 @@ impl Shared { .spawn(move || serve_ring0(&lanes, &shared, index, key)); if let Err(e) = started { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "{} could not be started ({e}): the messages of {key:?}'s lane are carried out on \ the control thread", lanes::thread_name(index) @@ -1602,7 +1602,7 @@ impl Shared { /// Posts ring 0's `SUBMIT_ROOM` record on the control completion ring, for work begun at reset /// count `epoch`: the guest's posts waiting for room on ring 0 look again. fn post_room(&self, epoch: u64) { - log::debug!(target: "reims_graphics::room", "SUBMIT_ROOM posted for the control ring"); + log::debug!(target: "reims_vgpu_graphics::room", "SUBMIT_ROOM posted for the control ring"); self.post_waiting(&submit_room(), epoch); } @@ -1643,7 +1643,7 @@ impl Shared { Posted::NoRoom => return Post::NoRoom, Posted::Broken(broken) => { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "the control completion ring is broken ({broken}): an event is dropped" ); return Post::Dropped; @@ -1701,7 +1701,7 @@ impl Shared { }); } self.host.context_closed(context, answer); - log::info!(target: "reims_graphics", "context {context} closed"); + log::info!(target: "reims_vgpu_graphics", "context {context} closed"); } /// `BLOCK_GRANT`: the region keeps the block as its context's, where it lies in the @@ -1717,7 +1717,7 @@ impl Shared { && !within(RGFX_ALLOCATIONS_OFFSET, RGFX_CONTEXT_ALLOCATIONS_OFFSET) { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "a BLOCK_GRANT of {:#x} bytes at {:#x} lies outside the processes' blocks and the \ scanout: ignored", grant.size, grant.offset @@ -1736,7 +1736,7 @@ impl Shared { || share.offset.checked_add(share.size).is_none_or(|e| e > end) { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "a {} of {:#x} bytes at {:#x} lies outside the processes' blocks: ignored", if holds { "BLOCK_SHARE" } else { "BLOCK_UNSHARE" }, share.size, share.offset @@ -1769,7 +1769,7 @@ impl Shared { ) -> Option { let Some(runs) = page_runs(&self.region, pages) else { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "a SURFACE_PAGES of {} runs at {:#x} for the block of {:#x} bytes at {:#x} lies \ outside it: the block gets no view of its surface's pages", pages.run_count, pages.runs_offset, pages.block_size, pages.block_offset @@ -2074,7 +2074,7 @@ impl Shared { let refused_flags = flags & !self.queue_flags_allowed(); if refused_flags != 0 { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}: it asks for flags {refused_flags:#x}, which the host does not \ carry out or whose feature the driver did not take, so it is refused", q.obj_id ); @@ -2082,7 +2082,7 @@ impl Shared { } let Some((submit_at, complete_at)) = self.validate_rings(q) else { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}: its ring parameters are refused (submit {:#x}/{}, complete \ {:#x}/{}; a ring must lie whole in one block of its process's)", q.obj_id, q.submit_offset, q.submit_data_size, q.complete_offset, @@ -2095,7 +2095,7 @@ impl Shared { }; let Some(wake) = Wake::new() else { log::error!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}: no wake pipe; it is refused", q.obj_id ); return RGFX_STATUS_INVALID_ARGUMENT; @@ -2165,7 +2165,7 @@ impl Shared { if started.is_err() { self.queues.lock().remove(&queue); log::error!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}: no service thread; it is refused", q.obj_id ); return RGFX_STATUS_INVALID_ARGUMENT; @@ -2290,7 +2290,7 @@ impl Shared { } if let Err(broken) = &next { log::error!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}'s submission ring is broken ({broken}): it takes nothing \ more until the device is reset", queue.obj_id ); @@ -2301,7 +2301,7 @@ impl Shared { // Told with nothing held, on the queue's completion ring. if room { log::debug!( - target: "reims_graphics::room", + target: "reims_vgpu_graphics::room", "SUBMIT_ROOM posted for queue {:#x}'s submission ring", queue.obj_id ); self.post_queue_waiting(queue, &submit_room(), queue.epoch); @@ -2318,7 +2318,7 @@ impl Shared { // message rides ring 0, through the kext, which checks that its sender owns // the object it names. Refused here, and the ring goes on. log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}'s submission ring carried a message of type {:#x} \ (seqno {}), which it may not carry: refused", queue.obj_id, message.header.r#type, message.header.seqno @@ -2399,7 +2399,7 @@ impl Shared { Some(message) => message, None => { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}'s submission ring carried a COMMAND_BUFFER_IN_REGION \ (seqno {}) that names no whole COMMAND_BUFFER in a block of its \ process's: refused", @@ -2530,7 +2530,7 @@ impl Shared { Posted::NoRoom => return Post::NoRoom, Posted::Broken(broken) => { log::warn!( - target: "reims_graphics", + target: "reims_vgpu_graphics", "queue {:#x}'s completion ring is broken ({broken}): an event is dropped", queue.obj_id ); @@ -2773,7 +2773,7 @@ impl Shared { { let waited = self.handed_wait_ns.swap(0, Ordering::Relaxed); log::info!( - target: "reims_graphics::handed", + target: "reims_vgpu_graphics::handed", "{} completion records handed over to the queues' threads in all, from threads \ that may not post them; the longest wait for a thread to post one since the \ last line: {} us", diff --git a/crates/reims-graphics/src/device/backlog.rs b/crates/reims-vgpu-graphics/src/device/backlog.rs similarity index 100% rename from crates/reims-graphics/src/device/backlog.rs rename to crates/reims-vgpu-graphics/src/device/backlog.rs diff --git a/crates/reims-graphics/src/device/gate.rs b/crates/reims-vgpu-graphics/src/device/gate.rs similarity index 100% rename from crates/reims-graphics/src/device/gate.rs rename to crates/reims-vgpu-graphics/src/device/gate.rs diff --git a/crates/reims-graphics/src/device/gate/tests.rs b/crates/reims-vgpu-graphics/src/device/gate/tests.rs similarity index 100% rename from crates/reims-graphics/src/device/gate/tests.rs rename to crates/reims-vgpu-graphics/src/device/gate/tests.rs diff --git a/crates/reims-graphics/src/device/lanes.rs b/crates/reims-vgpu-graphics/src/device/lanes.rs similarity index 100% rename from crates/reims-graphics/src/device/lanes.rs rename to crates/reims-vgpu-graphics/src/device/lanes.rs diff --git a/crates/reims-graphics/src/device/tests.rs b/crates/reims-vgpu-graphics/src/device/tests.rs similarity index 100% rename from crates/reims-graphics/src/device/tests.rs rename to crates/reims-vgpu-graphics/src/device/tests.rs diff --git a/crates/reims-graphics/src/device/tests/lanes_fuzz.rs b/crates/reims-vgpu-graphics/src/device/tests/lanes_fuzz.rs similarity index 100% rename from crates/reims-graphics/src/device/tests/lanes_fuzz.rs rename to crates/reims-vgpu-graphics/src/device/tests/lanes_fuzz.rs diff --git a/crates/reims-graphics/src/device/tests/peer.rs b/crates/reims-vgpu-graphics/src/device/tests/peer.rs similarity index 99% rename from crates/reims-graphics/src/device/tests/peer.rs rename to crates/reims-vgpu-graphics/src/device/tests/peer.rs index eaccfecbc..f160c2437 100644 --- a/crates/reims-graphics/src/device/tests/peer.rs +++ b/crates/reims-vgpu-graphics/src/device/tests/peer.rs @@ -10,7 +10,7 @@ //! A script's trace is kept in a file beside this one (`peer_wire2.trace` for the wire-2 //! guest's). The test fails where the device's traffic differs from it. Where a change means //! to alter that traffic, the file is recorded again from its own build -//! (`RVG_PEER_RECORD=1 cargo nextest run -p reims-graphics -E 'test(/peer/)'`), and its diff is +//! (`RVG_PEER_RECORD=1 cargo nextest run -p reims-vgpu-graphics -E 'test(/peer/)'`), and its diff is //! reviewed with the change. //! //! The script fixes every choice the wire leaves to timing: diff --git a/crates/reims-graphics/src/device/tests/peer_wire2.trace b/crates/reims-vgpu-graphics/src/device/tests/peer_wire2.trace similarity index 100% rename from crates/reims-graphics/src/device/tests/peer_wire2.trace rename to crates/reims-vgpu-graphics/src/device/tests/peer_wire2.trace diff --git a/crates/reims-graphics/src/device/tests/round_trip.rs b/crates/reims-vgpu-graphics/src/device/tests/round_trip.rs similarity index 100% rename from crates/reims-graphics/src/device/tests/round_trip.rs rename to crates/reims-vgpu-graphics/src/device/tests/round_trip.rs diff --git a/crates/reims-graphics/src/device/tests/threads.rs b/crates/reims-vgpu-graphics/src/device/tests/threads.rs similarity index 100% rename from crates/reims-graphics/src/device/tests/threads.rs rename to crates/reims-vgpu-graphics/src/device/tests/threads.rs diff --git a/crates/reims-graphics/src/display.rs b/crates/reims-vgpu-graphics/src/display.rs similarity index 100% rename from crates/reims-graphics/src/display.rs rename to crates/reims-vgpu-graphics/src/display.rs diff --git a/crates/reims-graphics/src/icb.rs b/crates/reims-vgpu-graphics/src/icb.rs similarity index 100% rename from crates/reims-graphics/src/icb.rs rename to crates/reims-vgpu-graphics/src/icb.rs diff --git a/crates/reims-graphics/src/keep.rs b/crates/reims-vgpu-graphics/src/keep.rs similarity index 100% rename from crates/reims-graphics/src/keep.rs rename to crates/reims-vgpu-graphics/src/keep.rs diff --git a/crates/reims-graphics/src/lib.rs b/crates/reims-vgpu-graphics/src/lib.rs similarity index 100% rename from crates/reims-graphics/src/lib.rs rename to crates/reims-vgpu-graphics/src/lib.rs diff --git a/crates/reims-graphics/src/managed.rs b/crates/reims-vgpu-graphics/src/managed.rs similarity index 100% rename from crates/reims-graphics/src/managed.rs rename to crates/reims-vgpu-graphics/src/managed.rs diff --git a/crates/reims-graphics/src/ops.rs b/crates/reims-vgpu-graphics/src/ops.rs similarity index 100% rename from crates/reims-graphics/src/ops.rs rename to crates/reims-vgpu-graphics/src/ops.rs diff --git a/crates/reims-graphics/src/ops/blit.rs b/crates/reims-vgpu-graphics/src/ops/blit.rs similarity index 100% rename from crates/reims-graphics/src/ops/blit.rs rename to crates/reims-vgpu-graphics/src/ops/blit.rs diff --git a/crates/reims-graphics/src/ops/compute.rs b/crates/reims-vgpu-graphics/src/ops/compute.rs similarity index 100% rename from crates/reims-graphics/src/ops/compute.rs rename to crates/reims-vgpu-graphics/src/ops/compute.rs diff --git a/crates/reims-graphics/src/ops/render.rs b/crates/reims-vgpu-graphics/src/ops/render.rs similarity index 100% rename from crates/reims-graphics/src/ops/render.rs rename to crates/reims-vgpu-graphics/src/ops/render.rs diff --git a/crates/reims-graphics/src/ops/video.rs b/crates/reims-vgpu-graphics/src/ops/video.rs similarity index 100% rename from crates/reims-graphics/src/ops/video.rs rename to crates/reims-vgpu-graphics/src/ops/video.rs diff --git a/crates/reims-graphics/src/region.rs b/crates/reims-vgpu-graphics/src/region.rs similarity index 100% rename from crates/reims-graphics/src/region.rs rename to crates/reims-vgpu-graphics/src/region.rs diff --git a/crates/reims-graphics/src/ring.rs b/crates/reims-vgpu-graphics/src/ring.rs similarity index 100% rename from crates/reims-graphics/src/ring.rs rename to crates/reims-vgpu-graphics/src/ring.rs diff --git a/crates/reims-graphics/src/ring/interleavings.rs b/crates/reims-vgpu-graphics/src/ring/interleavings.rs similarity index 100% rename from crates/reims-graphics/src/ring/interleavings.rs rename to crates/reims-vgpu-graphics/src/ring/interleavings.rs diff --git a/crates/reims-graphics/src/wake.rs b/crates/reims-vgpu-graphics/src/wake.rs similarity index 100% rename from crates/reims-graphics/src/wake.rs rename to crates/reims-vgpu-graphics/src/wake.rs diff --git a/crates/reims-graphics/src/wire.rs b/crates/reims-vgpu-graphics/src/wire.rs similarity index 99% rename from crates/reims-graphics/src/wire.rs rename to crates/reims-vgpu-graphics/src/wire.rs index 55e21d589..1ac7583e0 100644 --- a/crates/reims-graphics/src/wire.rs +++ b/crates/reims-vgpu-graphics/src/wire.rs @@ -2355,7 +2355,7 @@ pub const RGFX_MANAGED_TEXTURE_LINEAR: u32 = 1; /// image its rows of texel blocks. A level of `w` by `h` texels (the texture's halved `level` /// times, at least 1) has rows of `ceil(w / block_width) * bytes_per_block` bytes rounded up to /// [`RGFX_MANAGED_ROW_ALIGN`], and `ceil(h / block_height)` of them an image. The guest and the -/// host each compute it from these fields alone (`reims_graphics::managed`). +/// host each compute it from these fields alone (`reims_vgpu_graphics::managed`). #[repr(C)] #[derive( Clone, Copy, Debug, Default, PartialEq, Eq, FromBytes, IntoBytes, Immutable, KnownLayout, diff --git a/crates/reims-graphics/tests/header.rs b/crates/reims-vgpu-graphics/tests/header.rs similarity index 100% rename from crates/reims-graphics/tests/header.rs rename to crates/reims-vgpu-graphics/tests/header.rs diff --git a/crates/reims-vgpu/Cargo.toml b/crates/reims-vgpu/Cargo.toml index d52c5b1f6..31e21ff20 100644 --- a/crates/reims-vgpu/Cargo.toml +++ b/crates/reims-vgpu/Cargo.toml @@ -26,7 +26,7 @@ reims-vgpu-window.workspace = true # on Linux the arms' VA-API and NVDEC (`graphics::vaapi`, `graphics::nvidia`). reims-vgpu-video.workspace = true # The reims-graphics device's host side (`graphics`). -reims-graphics.workspace = true +reims-vgpu-graphics.workspace = true # Reads the reims-graphics device's wire messages into their records (`graphics::decode`). zerocopy.workspace = true # A library's content key, by which the reims-graphics device keeps the libraries it made diff --git a/crates/reims-vgpu/src/graphics.rs b/crates/reims-vgpu/src/graphics.rs index bd4c9d30d..38a6f5e88 100644 --- a/crates/reims-vgpu/src/graphics.rs +++ b/crates/reims-vgpu/src/graphics.rs @@ -1,4 +1,4 @@ -//! [`GraphicsDevice`]: the reims-graphics device (PCI 1234:5247), `reims-graphics`'s host side +//! [`GraphicsDevice`]: the reims-graphics device (PCI 1234:5247), `reims-vgpu-graphics`'s host side //! with its display shown in a window of the library's, made from a [`GraphicsConfig`]. //! //! The device's region (BAR 2) is made here and shared: the device takes the guest's commands @@ -43,9 +43,20 @@ use std::sync::{Arc, OnceLock, Weak}; use parking_lot::lock_api::ArcRwLockReadGuard; use parking_lot::{RawRwLock, RwLock}; -use reims_graphics::ops::RgfxCommandBuffer; -use reims_graphics::region::Region; -use reims_graphics::wire::{ +use reims_vgpu_core::host::HostQueue; +use reims_vgpu_core::memory::map::MemoryMap as CoreMemoryMap; +use reims_vgpu_core::num::ToU64; +use reims_vgpu_core::platform::command::CommandBuffer as _; +use reims_vgpu_core::platform::device::GpuDevice; +use reims_vgpu_core::platform::os::clock::Clock as _; +use reims_vgpu_core::platform::resource::Texture; +use reims_vgpu_core::platform::values::TextureDesc; +use reims_vgpu_core::platform::{Handle, Platform}; +use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::ops::RgfxCommandBuffer; +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ RGFX_CMD_ARGUMENT_LAYOUT, RGFX_CMD_BUFFER_OVER_PAGES, RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_COMPUTE_PIPELINE_CREATE, RGFX_CMD_HEAP_OVER_PAGES, RGFX_CMD_HEAP_TEXTURE_SIZE_AND_ALIGN, RGFX_CMD_ICB_CREATE, RGFX_CMD_ICB_SLOTS, @@ -69,21 +80,10 @@ use reims_graphics::wire::{ RgfxHeapOverPages, RgfxIcbState, RgfxLibraryLookup, RgfxMsgHeader, RgfxPageRun, RgfxSamplerState, RgfxSharedEventName, RgfxSurfacePages, RgfxSurfacePagesLayout, RgfxVideoCaps, }; -use reims_graphics::{ +use reims_vgpu_graphics::{ CompleteAnswer, CompletionPoster, CursorImage, Host, Mode, PresentAnswer, QueueClaim, Scanout, Screen, }; -use reims_vgpu_core::host::HostQueue; -use reims_vgpu_core::memory::map::MemoryMap as CoreMemoryMap; -use reims_vgpu_core::num::ToU64; -use reims_vgpu_core::platform::command::CommandBuffer as _; -use reims_vgpu_core::platform::device::GpuDevice; -use reims_vgpu_core::platform::os::clock::Clock as _; -use reims_vgpu_core::platform::resource::Texture; -use reims_vgpu_core::platform::values::TextureDesc; -use reims_vgpu_core::platform::{Handle, Platform}; -use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; -use reims_vgpu_core::sync::Mutex; use reims_vgpu_window::{FrameSink, Window, WindowConfig, geometry}; use zerocopy::{FromBytes, IntoBytes}; @@ -165,7 +165,7 @@ pub struct GraphicsCallbacks { /// Raises the device's interrupt. Without it the guest gets no interrupt. pub raise_interrupt: Option, /// The guest set its cursor's image: its pixels as straight-alpha RGBA, which the guest - /// gave premultiplied BGRA (`reims-graphics`' `display`), and its hot spot. + /// gave premultiplied BGRA (`reims-vgpu-graphics`' `display`), and its hot spot. pub cursor_glyph: Option, /// Whether the cursor shows changed, hidden until the first call: 1 once the guest has an /// image while it shows its cursor, 0 once it has none or hides it. @@ -213,7 +213,7 @@ pub struct GraphicsDevice { /// The window, which closes when the link drops: before the device. window: Option, /// The device. - device: reims_graphics::Device, + device: reims_vgpu_graphics::Device, /// The guest's cursor as the host is told it. cursor: Arc, /// The stage-3 decoder and the device handle it drives, shared with the device's [`Host`], @@ -250,8 +250,8 @@ impl GraphicsDevice

{ /// refuses the region's memory, a pipe or a thread. pub fn with_platform(platform: Arc

, config: GraphicsConfig) -> Result { entry::run(|_| { - let size = - usize::try_from(reims_graphics::REGION_SIZE).map_err(|_| Error::HostResources)?; + let size = usize::try_from(reims_vgpu_graphics::REGION_SIZE) + .map_err(|_| Error::HostResources)?; let region = platform .graphics_region(size) .or_else(|| Region::new(size)) @@ -470,7 +470,7 @@ impl GraphicsDevice

{ screen, cursor: Arc::clone(&cursor), }; - let device = reims_graphics::Device::new(region, host, Box::new(screen)) + let device = reims_vgpu_graphics::Device::new(region, host, Box::new(screen)) .ok_or(Error::HostResources)?; Ok(GraphicsDevice { window, @@ -555,7 +555,7 @@ impl GraphicsDevice

{ /// [`Self::mmio_write`], but a `DOORBELL` write of a command queue's ring may answer the /// queue's next command buffer on the calling thread, posting its `CB_SUBMITTED` there and - /// calling `raise_interrupt` inside this call (`reims-graphics`'s `Device::mmio_write_taking`), + /// calling `raise_interrupt` inside this call (`reims-vgpu-graphics`'s `Device::mmio_write_taking`), /// allocating nothing; the queue's thread then takes it as it takes any. A write of ring 0's /// may take and answer the control ring's next message there, where it is a /// `SURFACE_DOWNLOAD` whose pages hold the surface's device cache already @@ -585,7 +585,7 @@ impl GraphicsDevice

{ } impl Drop for GraphicsDevice

{ - /// The window closes, then the device ends; neither waits (`reims-graphics`'s `device`). + /// The window closes, then the device ends; neither waits (`reims-vgpu-graphics`'s `device`). fn drop(&mut self) { entry::run(|_| { drop(self.window.take()); @@ -594,7 +594,7 @@ impl Drop for GraphicsDevice

{ } /// The stage-3 decoder and the device handle it drives, shared by the device's [`Host`], which -/// feeds it ring 0's object lifecycle on each context's lane (`reims-graphics`' device) and the +/// feeds it ring 0's object lifecycle on each context's lane (`reims-vgpu-graphics`' device) and the /// command queues' own rings' messages on their service threads. Each message is carried out on a /// decoder of its own over the shared state ([`Decoders::sender`]), whose locks are each held for a /// short section (`decode`'s module doc): no thread holds one across a command buffer's walk, so a diff --git a/crates/reims-vgpu/src/graphics/color.rs b/crates/reims-vgpu/src/graphics/color.rs index acec7e4c6..5bece4d41 100644 --- a/crates/reims-vgpu/src/graphics/color.rs +++ b/crates/reims-vgpu/src/graphics/color.rs @@ -1,5 +1,5 @@ //! The display pipe's colour: what the guest's display does to the pixels it shows, as the -//! display pipe's transactions set it (`DISPLAY_COLOR`, `reims_graphics::wire`'s +//! display pipe's transactions set it (`DISPLAY_COLOR`, `reims_vgpu_graphics::wire`'s //! [`RgfxDisplayColor`]). Four stages apply in order, after the surface's own colour: plane 0's //! gamma table, the pipe's gamma table before its colour matrix, the colour matrix, and the gamma //! table after it. Each is off (it passes its input through) until a transaction sets it, and keeps @@ -35,7 +35,7 @@ use std::sync::Arc; -use reims_graphics::wire::{ +use reims_vgpu_graphics::wire::{ RGFX_COLOR_MATRIX, RGFX_COLOR_MAX_ENTRIES, RgfxColorEntry, RgfxDisplayColor, }; @@ -184,7 +184,7 @@ impl ColorStaging { #[cfg(test)] mod tests { - use reims_graphics::wire::{RGFX_COLOR_POST_GAMMA, RGFX_COLOR_PRE_GAMMA}; + use reims_vgpu_graphics::wire::{RGFX_COLOR_POST_GAMMA, RGFX_COLOR_PRE_GAMMA}; use super::*; diff --git a/crates/reims-vgpu/src/graphics/compile.rs b/crates/reims-vgpu/src/graphics/compile.rs index bc855992a..f4ce60bf9 100644 --- a/crates/reims-vgpu/src/graphics/compile.rs +++ b/crates/reims-vgpu/src/graphics/compile.rs @@ -1,7 +1,7 @@ //! Pipeline compiles off ring 0's threads: the [`CompilePool`] that runs them and the //! [`Pending`] pipelines a command buffer waits for. //! -//! A pipeline create on ring 0 is prepared on its context's lane (`reims-graphics`' device, on one +//! A pipeline create on ring 0 is prepared on its context's lane (`reims-vgpu-graphics`' device, on one //! of ring 0's threads, `reims-vgpu.graphics-ring0-*`), which then goes on with the context's later //! messages, and is compiled on one of the pool's threads, `reims-vgpu.graphics-compile-*`; its //! reply goes on ring 0's completion ring when the compile ends, keyed to the create by its seqno. @@ -37,23 +37,25 @@ use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::Duration; -use reims_graphics::icb::{ +use reims_vgpu_core::platform::os::clock::MonoTime; +use reims_vgpu_core::sync::{Condvar, Mutex}; +use reims_vgpu_graphics::icb::{ RGFX_ICB_OP_COMPUTE_PIPELINE, RGFX_ICB_OP_RENDER_PIPELINE, RGFX_ICB_SLOT_PIPELINE, RgfxIcbObject, RgfxIcbRecord, slot_bytes, }; -use reims_graphics::ops::compute::{ +use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_SET_COMPUTE_PIPELINE_STATE, RgfxComputeOpSetComputePipelineState, }; -use reims_graphics::ops::render::{ +use reims_vgpu_graphics::ops::render::{ RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RgfxOpSetRenderPipelineState, }; -use reims_graphics::ops::{ +use reims_vgpu_graphics::ops::{ RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_BODY_OFFSET, RgfxCommandBuffer, RgfxOpHeader, }; -use reims_graphics::region::Region; -use reims_graphics::wire::{RGFX_CONTEXT_OBJ_ID_SHIFT, RgfxIcbSlotRun, RgfxIcbSlots, RgfxIcbWrite}; -use reims_vgpu_core::platform::os::clock::MonoTime; -use reims_vgpu_core::sync::{Condvar, Mutex}; +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ + RGFX_CONTEXT_OBJ_ID_SHIFT, RgfxIcbSlotRun, RgfxIcbSlots, RgfxIcbWrite, +}; use zerocopy::FromBytes; /// The most compile threads a device runs. diff --git a/crates/reims-vgpu/src/graphics/completion.rs b/crates/reims-vgpu/src/graphics/completion.rs index 194d478bc..f31ff1998 100644 --- a/crates/reims-vgpu/src/graphics/completion.rs +++ b/crates/reims-vgpu/src/graphics/completion.rs @@ -19,11 +19,11 @@ //! host could not carry a command buffer out at all, so a guest blocked on it //! unblocks. -use reims_graphics::wire::{ +use reims_vgpu_core::platform::types::NsErrorText; +use reims_vgpu_graphics::wire::{ RGFX_CB_ACCESS_REVOKED, RGFX_CB_INTERNAL, RGFX_CB_INVALID_RESOURCE, RGFX_CB_OK, RGFX_CB_PAGE_FAULT, RGFX_CB_TIMEOUT, RGFX_EVT_CB_COMPLETE, RgfxCbComplete, RgfxMsgHeader, }; -use reims_vgpu_core::platform::types::NsErrorText; /// `MTLCommandBufferErrorInternal`. const MTL_CB_ERROR_INTERNAL: i64 = 1; diff --git a/crates/reims-vgpu/src/graphics/decode/argument.rs b/crates/reims-vgpu/src/graphics/decode/argument.rs index ebcd3b0ef..1328f1f59 100644 --- a/crates/reims-vgpu/src/graphics/decode/argument.rs +++ b/crates/reims-vgpu/src/graphics/decode/argument.rs @@ -12,7 +12,12 @@ //! argument buffer, or is a struct, names its layout by its index. A layout's members follow every //! member of the layouts before it, so the guest reads the records in one pass. -use reims_graphics::wire::{ +use reims_vgpu_core::platform::Platform; +use reims_vgpu_core::platform::device::GpuDevice; +use reims_vgpu_core::platform::types::{ArgumentKind, ArgumentLayout}; +use reims_vgpu_core::platform::values::ArgumentDesc; +use reims_vgpu_core::raise::RaiseResult; +use reims_vgpu_graphics::wire::{ RGFX_ARGUMENT_ACCELERATION_STRUCTURE, RGFX_ARGUMENT_BUFFER, RGFX_ARGUMENT_COMPUTE_PIPELINE, RGFX_ARGUMENT_CONSTANT, RGFX_ARGUMENT_DEPTH_STENCIL, RGFX_ARGUMENT_INDIRECT_COMMAND_BUFFER, RGFX_ARGUMENT_INTERSECTION_FUNCTION_TABLE, RGFX_ARGUMENT_NO_LAYOUT, @@ -23,11 +28,6 @@ use reims_graphics::wire::{ RgfxArgumentLayoutQuery, RgfxArgumentLayoutRecord, RgfxArgumentLayoutReply, RgfxArgumentMemberRecord, RgfxMsgHeader, }; -use reims_vgpu_core::platform::Platform; -use reims_vgpu_core::platform::device::GpuDevice; -use reims_vgpu_core::platform::types::{ArgumentKind, ArgumentLayout}; -use reims_vgpu_core::platform::values::ArgumentDesc; -use reims_vgpu_core::raise::RaiseResult; use zerocopy::{FromBytes, IntoBytes}; use super::{GraphicsDecoder, ObjHandle, constants_tail, read, specialised, str_tail}; @@ -218,13 +218,13 @@ impl GraphicsDecoder

{ mod tests { use std::sync::Arc; - use reims_graphics::region::Region; - use reims_graphics::wire::{ + use reims_vgpu_core::platform::device::GpuDevice; + use reims_vgpu_core::testkit::FakePlatform; + use reims_vgpu_graphics::region::Region; + use reims_vgpu_graphics::wire::{ RGFX_CMD_ARGUMENT_LAYOUT, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RgfxFunctionConstant, }; - use reims_vgpu_core::platform::device::GpuDevice; - use reims_vgpu_core::testkit::FakePlatform; use super::super::{GraphicsDecoder, ObjHandle}; use super::*; diff --git a/crates/reims-vgpu/src/graphics/decode/blit.rs b/crates/reims-vgpu/src/graphics/decode/blit.rs index 3bbac7433..c66f4fcd9 100644 --- a/crates/reims-vgpu/src/graphics/decode/blit.rs +++ b/crates/reims-vgpu/src/graphics/decode/blit.rs @@ -1,4 +1,4 @@ -//! The blit-encoder op decoder: one arm per [`reims_graphics::ops::blit`] op, +//! The blit-encoder op decoder: one arm per [`reims_vgpu_graphics::ops::blit`] op, //! turning a wire op into a `BlitCmd` on the open `P::BlitEncoder` //! (docs/graphics-kext/design.md, "Stage 3 wire protocol"). The command-buffer //! walk ([`super::cmdbuf`]) routes every blit-group op @@ -14,14 +14,14 @@ //! `ENCODER_END` (`endEncoding`, [`super::cmdbuf`]), so `BlitCmd::EndEncoding` has no //! arm here; every other `MTLBlitCommandEncoder` selector does. //! -//! [`RGFX_OP_GROUP_BLIT`]: reims_graphics::ops::RGFX_OP_GROUP_BLIT +//! [`RGFX_OP_GROUP_BLIT`]: reims_vgpu_graphics::ops::RGFX_OP_GROUP_BLIT -use reims_graphics::ops::blit::*; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::blit::{BlitCmd, BlitEncoder, ResourceRef}; use reims_vgpu_core::platform::host_range::HostRange; use reims_vgpu_core::platform::types::{ClearColor, MtlOrigin, MtlRegion, MtlSize, NsRange}; use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; +use reims_vgpu_graphics::ops::blit::*; use zerocopy::FromBytes; use super::{GraphicsDecoder, op_fault}; @@ -44,7 +44,7 @@ fn short_body(tag: u16) -> Raise { } /// Decodes one blit-encoder op: `tag` its op, `payload` its body (the bytes after -/// the [`RgfxOpHeader`](reims_graphics::ops::RgfxOpHeader)). `objs` resolves object +/// the [`RgfxOpHeader`](reims_vgpu_graphics::ops::RgfxOpHeader)). `objs` resolves object /// references, `enc` is the open blit encoder, and `on` says how an encode's raise /// is taken. `Ok(true)` when the op was handled, `Ok(false)` for an unknown tag /// (the walk then faults); a platform raise propagates as `Err`. @@ -530,17 +530,17 @@ fn clear_color(bits: [u64; 4]) -> ClearColor { mod tests { use std::sync::Arc; - use reims_graphics::ops::{RGFX_OP_BODY_OFFSET, RgfxOpHeader}; - use reims_graphics::wire::{ - RGFX_CMD_BUFFER_CREATE, RGFX_CMD_FENCE_CREATE, RGFX_CMD_TEXTURE_CREATE, RgfxBufferCreate, - RgfxMsgHeader, RgfxObjectCreate, RgfxTextureCreate, RgfxTextureDescriptor, - }; use reims_vgpu_core::platform::Handle; use reims_vgpu_core::platform::command::{CommandBuffer, CommandQueue}; use reims_vgpu_core::platform::device::GpuDevice; use reims_vgpu_core::platform::values::IcbDesc; use reims_vgpu_core::testkit::FakePlatform; use reims_vgpu_core::testkit::calllog::Arg; + use reims_vgpu_graphics::ops::{RGFX_OP_BODY_OFFSET, RgfxOpHeader}; + use reims_vgpu_graphics::wire::{ + RGFX_CMD_BUFFER_CREATE, RGFX_CMD_FENCE_CREATE, RGFX_CMD_TEXTURE_CREATE, RgfxBufferCreate, + RgfxMsgHeader, RgfxObjectCreate, RgfxTextureCreate, RgfxTextureDescriptor, + }; use zerocopy::IntoBytes; use super::super::ObjHandle; @@ -558,7 +558,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); for id in [2, 3] { diff --git a/crates/reims-vgpu/src/graphics/decode/close_cost.rs b/crates/reims-vgpu/src/graphics/decode/close_cost.rs index ba6f39124..7e41216d8 100644 --- a/crates/reims-vgpu/src/graphics/decode/close_cost.rs +++ b/crates/reims-vgpu/src/graphics/decode/close_cost.rs @@ -18,13 +18,13 @@ use std::sync::Arc; use std::time::Instant; -use reims_graphics::wire::{ - RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_QUEUE_CREATE, RGFX_CONTEXT_ALLOCATIONS_OFFSET, - RGFX_CURSOR_SPAN, RgfxBufferOverHostMemory, RgfxMsgHeader, RgfxQueueCreate, -}; use reims_vgpu_core::platform::device::GpuDevice as _; use reims_vgpu_core::platform::values::{RenderPipelineDesc, SamplerDesc, TextureDesc}; use reims_vgpu_core::raise::OnFault; +use reims_vgpu_graphics::wire::{ + RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_QUEUE_CREATE, RGFX_CONTEXT_ALLOCATIONS_OFFSET, + RGFX_CURSOR_SPAN, RgfxBufferOverHostMemory, RgfxMsgHeader, RgfxQueueCreate, +}; use zerocopy::IntoBytes; use super::draw_cost::{counts, fixture, spread, test_shaders}; @@ -110,7 +110,7 @@ fn made(kind: Kind, n: u64) -> (GraphicsDecoder

, P::Device) { let platform = P::process(); let device = platform.metal_device(None).unwrap(); let region_size = RGFX_CONTEXT_ALLOCATIONS_OFFSET + n * HOST_LENGTH + RGFX_CURSOR_SPAN; - let region = reims_graphics::region::Region::new(region_size as usize).unwrap(); + let region = reims_vgpu_graphics::region::Region::new(region_size as usize).unwrap(); let mut decoder = GraphicsDecoder::

::new(Arc::clone(&platform), Arc::new(region)); let o = OnFault::Die; let pipeline_functions = match kind { diff --git a/crates/reims-vgpu/src/graphics/decode/cmdbuf.rs b/crates/reims-vgpu/src/graphics/decode/cmdbuf.rs index 102e7bbd1..6a435c70a 100644 --- a/crates/reims-vgpu/src/graphics/decode/cmdbuf.rs +++ b/crates/reims-vgpu/src/graphics/decode/cmdbuf.rs @@ -1,5 +1,5 @@ //! The command-buffer decoder: it carries out one -//! [`RGFX_CMD_COMMAND_BUFFER`](reims_graphics::wire::RGFX_CMD_COMMAND_BUFFER) +//! [`RGFX_CMD_COMMAND_BUFFER`](reims_vgpu_graphics::wire::RGFX_CMD_COMMAND_BUFFER) //! message (docs/graphics-kext/design.md, "Stage 3 wire protocol"). It resolves //! the queue the buffer runs on, opens a `P::CommandBuffer`, walks the op stream //! that follows the message, and at the end registers the completion path and @@ -44,7 +44,7 @@ //! //! **An answer on the doorbell's thread.** A buffer that gets its `CB_SUBMITTED` at its take may //! get it on the thread of the guest's doorbell write instead, before its queue's service thread -//! takes it off its ring (`reims_graphics`'s `Device::mmio_write_taking`), where nothing need be +//! takes it off its ring (`reims_vgpu_graphics`'s `Device::mmio_write_taking`), where nothing need be //! waited for or allocated there ([`Decoders::answer_at_doorbell`]): it waits for no copy of a //! device cache it uses, and every lock the answer takes is tried. Its turn in its queue's lane //! and its ticket in the commit order are taken there, in the order its begin would take them, @@ -90,28 +90,6 @@ use std::mem::MaybeUninit; use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; -use reims_graphics::ops::render::{ - RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_VERTEX_BUFFER, RgfxOpDrawPrimitives, - RgfxOpSetVertexBuffer, -}; -use reims_graphics::ops::{ - RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_COMPUTE_PASS_FLAG_DISPATCH_TYPE, RGFX_OP_BODY_OFFSET, - RGFX_OP_COMMIT_ORDER, RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_BEGIN_COMPUTE, - RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_BEGIN_VIDEO, RGFX_OP_ENCODER_END, - RGFX_OP_GROUP_BLIT, RGFX_OP_GROUP_COMPUTE, RGFX_OP_GROUP_FRAMING, RGFX_OP_GROUP_RENDER, - RGFX_OP_GROUP_VIDEO, RGFX_OP_SIGNAL_EVENT, RGFX_OP_SUBMITTED, RGFX_OP_SURFACE_ORDER, - RGFX_OP_SURFACE_USE, RGFX_OP_WAIT_EVENT, RGFX_PASS_FLAG_DEFAULT_RASTER_SAMPLE_COUNT, - RGFX_PASS_FLAG_RT_ARRAY_LENGTH, RGFX_PASS_FLAG_RT_SIZE, RGFX_PASS_FLAG_SAMPLE_POSITIONS, - RGFX_PASS_FLAG_VISIBILITY_RESULT, RGFX_PASS_MAX_SAMPLE_POSITIONS, - RGFX_RENDER_PASS_COLOR_OFFSET, RgfxCommandBuffer, RgfxComputePassDesc, RgfxOpEvent, - RgfxOpHeader, RgfxOpSurfaceUse, RgfxOpVideoPass, RgfxRenderPassColorAttachment, - RgfxRenderPassDesc, RgfxRenderPassSamplePositions, RgfxRenderPassVisibility, - RgfxSurfaceOrderWait, op_group, -}; -use reims_graphics::wire::{ - RGFX_EVT_CB_SCHEDULED, RGFX_EVT_CB_SUBMITTED, RGFX_EVT_EVENT_SIGNALLED, RgfxCbScheduled, - RgfxCbSubmitted, RgfxEventSignalled, RgfxMsgHeader, -}; use reims_vgpu_core::platform::blit::{BlitCmd, BlitEncoder}; use reims_vgpu_core::platform::caps::{DeviceCaps, SAMPLE_COUNTS}; use reims_vgpu_core::platform::command::{ @@ -131,6 +109,28 @@ use reims_vgpu_core::platform::values::{ use reims_vgpu_core::platform::{Handle, Platform}; use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::ops::render::{ + RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_VERTEX_BUFFER, RgfxOpDrawPrimitives, + RgfxOpSetVertexBuffer, +}; +use reims_vgpu_graphics::ops::{ + RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_COMPUTE_PASS_FLAG_DISPATCH_TYPE, RGFX_OP_BODY_OFFSET, + RGFX_OP_COMMIT_ORDER, RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_BEGIN_COMPUTE, + RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_BEGIN_VIDEO, RGFX_OP_ENCODER_END, + RGFX_OP_GROUP_BLIT, RGFX_OP_GROUP_COMPUTE, RGFX_OP_GROUP_FRAMING, RGFX_OP_GROUP_RENDER, + RGFX_OP_GROUP_VIDEO, RGFX_OP_SIGNAL_EVENT, RGFX_OP_SUBMITTED, RGFX_OP_SURFACE_ORDER, + RGFX_OP_SURFACE_USE, RGFX_OP_WAIT_EVENT, RGFX_PASS_FLAG_DEFAULT_RASTER_SAMPLE_COUNT, + RGFX_PASS_FLAG_RT_ARRAY_LENGTH, RGFX_PASS_FLAG_RT_SIZE, RGFX_PASS_FLAG_SAMPLE_POSITIONS, + RGFX_PASS_FLAG_VISIBILITY_RESULT, RGFX_PASS_MAX_SAMPLE_POSITIONS, + RGFX_RENDER_PASS_COLOR_OFFSET, RgfxCommandBuffer, RgfxComputePassDesc, RgfxOpEvent, + RgfxOpHeader, RgfxOpSurfaceUse, RgfxOpVideoPass, RgfxRenderPassColorAttachment, + RgfxRenderPassDesc, RgfxRenderPassSamplePositions, RgfxRenderPassVisibility, + RgfxSurfaceOrderWait, op_group, +}; +use reims_vgpu_graphics::wire::{ + RGFX_EVT_CB_SCHEDULED, RGFX_EVT_CB_SUBMITTED, RGFX_EVT_EVENT_SIGNALLED, RgfxCbScheduled, + RgfxCbSubmitted, RgfxEventSignalled, RgfxMsgHeader, +}; use zerocopy::{FromBytes, IntoBytes}; use super::super::completion::{cb_complete, cb_failed, cb_unlanded}; @@ -936,7 +936,7 @@ pub(crate) struct Answered { impl Decoders

{ /// A `SURFACE_DOWNLOAD` of the block at `block` on a doorbell's thread, the guest's vCPU - /// (`reims_graphics::Host::surface_downloaded`): whether it is carried out already, its + /// (`reims_vgpu_graphics::Host::surface_downloaded`): whether it is carried out already, its /// `SURFACE_PAGES` settled ([`super::worker::Unsettled`]) and the caches answering it at once /// with nothing to copy and nothing to wait for ([`super::surface_cache`]), as /// [`super::GraphicsDecoder::try_surface_download`] would; each lock tried. Allocates and @@ -1168,7 +1168,7 @@ fn makes_sample_count(caps: &DeviceCaps, count: u32) -> bool { impl GraphicsDecoder

{ /// Carries out one `COMMAND_BUFFER` message (`decode`'s - /// [`RGFX_CMD_COMMAND_BUFFER`](reims_graphics::wire::RGFX_CMD_COMMAND_BUFFER) + /// [`RGFX_CMD_COMMAND_BUFFER`](reims_vgpu_graphics::wire::RGFX_CMD_COMMAND_BUFFER) /// arm): opens a command buffer on the named queue, walks the op stream, and /// commits with a completion handler, which holds `drain` (its context's) until it has run. /// The IOSurfaces whose device caches it uses (its `SURFACE_USE` ops) are filled first where @@ -2655,7 +2655,15 @@ fn clear_color(bits: [u64; 4]) -> ClearColor { mod tests { use std::sync::Arc; - use reims_graphics::ops::render::{ + use reims_vgpu_core::platform::Handle; + use reims_vgpu_core::platform::descriptor::RenderPassDescriptor; + use reims_vgpu_core::platform::values::AttachmentState; + use reims_vgpu_core::sync::Mutex; + use reims_vgpu_core::testkit::FakePlatform; + use reims_vgpu_core::testkit::Step; + use reims_vgpu_core::testkit::calllog::Arg; + use reims_vgpu_core::testkit::objects::CompleteOn; + use reims_vgpu_graphics::ops::render::{ RGFX_OP_RENDER_DRAW_INDEXED_PRIMITIVES, RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_FRAGMENT_TEXTURE, RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RGFX_OP_RENDER_SET_SCISSOR_RECT, RGFX_OP_RENDER_SET_VERTEX_BUFFER, @@ -2664,11 +2672,11 @@ mod tests { RgfxOpSetRenderPipelineState, RgfxOpSetScissorRect, RgfxOpSetVertexBuffer, RgfxOpSetViewport, RgfxOpSetVisibilityResultMode, }; - use reims_graphics::ops::video::{ + use reims_vgpu_graphics::ops::video::{ RGFX_OP_VIDEO_DECODE_H264, RGFX_OP_VIDEO_DECODE_H265, RgfxVideoOpDecodeH264, RgfxVideoOpDecodeH265, }; - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_CB_INTERNAL, RGFX_CB_OK, RGFX_CMD_BUFFER_CREATE, RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_EVENT_CREATE, RGFX_CMD_QUEUE_CREATE, RGFX_CMD_SHARED_EVENT_CREATE, RGFX_CMD_SHARED_EVENT_SET_VALUE, RGFX_CMD_TEXTURE_CREATE, RGFX_CMD_TEXTURE_FROM_IOSURFACE, @@ -2678,14 +2686,6 @@ mod tests { RgfxSharedEventSetValue, RgfxTextureCreate, RgfxTextureDescriptor, RgfxTextureFromIOSurface, RgfxVideoSessionCreate, }; - use reims_vgpu_core::platform::Handle; - use reims_vgpu_core::platform::descriptor::RenderPassDescriptor; - use reims_vgpu_core::platform::values::AttachmentState; - use reims_vgpu_core::sync::Mutex; - use reims_vgpu_core::testkit::FakePlatform; - use reims_vgpu_core::testkit::Step; - use reims_vgpu_core::testkit::calllog::Arg; - use reims_vgpu_core::testkit::objects::CompleteOn; use reims_vgpu_video::core::device_memory::MemoryIdentity; use zerocopy::IntoBytes; @@ -2720,7 +2720,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(size).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(size).unwrap()), ); let queue = RgfxQueueCreate { @@ -3144,7 +3144,7 @@ mod tests { } impl GraphicsVideo for FakeVideo { - fn caps(&self) -> Vec { + fn caps(&self) -> Vec { Vec::new() } fn session( @@ -3443,7 +3443,7 @@ mod tests { /// ends at the block's `BLOCK_RELEASE`, one for the block whichever decode names it. #[test] fn a_video_decode_s_planes_carry_their_block_s_memory() { - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RgfxBufferOverHostMemory, }; @@ -3535,7 +3535,7 @@ mod tests { /// buffer has finished starts at once. #[test] fn a_video_decode_waits_for_the_buffers_its_command_buffer_runs_after() { - use reims_graphics::ops::{RGFX_OP_SURFACE_ORDER, RgfxSurfaceOrderWait}; + use reims_vgpu_graphics::ops::{RGFX_OP_SURFACE_ORDER, RgfxSurfaceOrderWait}; let (p, mut dec) = setup(); let device = p.device(); @@ -3738,7 +3738,7 @@ mod tests { /// and textures 7 and 8 over its planes; and what the video is handed. fn cached_video() -> (super::super::surface_pages::tests::Rig, Arc) { use super::super::surface_pages::tests::{BLOCK, rig}; - use reims_graphics::wire::RGFX_STATUS_OK; + use reims_vgpu_graphics::wire::RGFX_STATUS_OK; let mut r = rig(8); let page = r.page; @@ -3797,7 +3797,9 @@ mod tests { /// session 40. fn writes_cached_video(cb_obj_id: u64, seqno: u64, decodes: bool) -> Vec { use super::super::surface_pages::tests::BLOCK; - use reims_graphics::ops::{RGFX_OP_SURFACE_USE, RGFX_SURFACE_USE_WRITES, RgfxOpSurfaceUse}; + use reims_vgpu_graphics::ops::{ + RGFX_OP_SURFACE_USE, RGFX_SURFACE_USE_WRITES, RgfxOpSurfaceUse, + }; let surface_use = RgfxOpSurfaceUse { block_offset: BLOCK, @@ -3856,7 +3858,7 @@ mod tests { #[test] fn a_decode_read_back_is_copied_out_behind_the_next_decode() { use super::super::surface_pages::tests::{BLOCK, Rig}; - use reims_graphics::ops::{RGFX_OP_SURFACE_USE, RgfxOpSurfaceUse}; + use reims_vgpu_graphics::ops::{RGFX_OP_SURFACE_USE, RgfxOpSurfaceUse}; use std::sync::atomic::AtomicBool; const COPY: &str = "copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:"; @@ -4920,19 +4922,19 @@ mod tests { fn a_later_commit_on_another_queue() -> (bool, Vec) { use std::time::{Duration, Instant}; - use reims_graphics::ops::blit::{ + use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_graphics::ops::blit::{ RGFX_OP_BLIT_COPY_BUFFER_TO_BUFFER, RGFX_OP_BLIT_FILL_BUFFER, RgfxBlitOpCopyBufferToBuffer, RgfxBlitOpFillBuffer, }; - use reims_graphics::wire::RgfxSharedEventSetValue; - use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_graphics::wire::RgfxSharedEventSetValue; const LEN: u64 = 1 << 20; let _pool = reims_vgpu_core::rt::Pool::here(); let platform = P::process(); let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let submitted = Arc::new(Mutex::new(Vec::new())); let sink = Arc::clone(&submitted); @@ -5063,14 +5065,14 @@ mod tests { fn a_cpu_wait_for_a_mid_buffer_signal() -> (bool, bool, bool) { use std::time::{Duration, Instant}; - use reims_graphics::ops::blit::{RGFX_OP_BLIT_FILL_BUFFER, RgfxBlitOpFillBuffer}; + use reims_vgpu_graphics::ops::blit::{RGFX_OP_BLIT_FILL_BUFFER, RgfxBlitOpFillBuffer}; const LEN: u64 = 1 << 20; let _pool = reims_vgpu_core::rt::Pool::here(); let platform = P::process(); let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let posted = Arc::new(Mutex::new(Vec::<(u32, u64, u64)>::new())); let sink = Arc::clone(&posted); @@ -5186,18 +5188,18 @@ mod tests { -> Vec { use std::time::{Duration, Instant}; - use reims_graphics::ops::blit::{ + use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_graphics::ops::blit::{ RGFX_OP_BLIT_COPY_BUFFER_TO_BUFFER, RGFX_OP_BLIT_FILL_BUFFER, RgfxBlitOpCopyBufferToBuffer, RgfxBlitOpFillBuffer, }; - use reims_vgpu_core::platform::resource::Buffer as _; const LEN: u64 = 1 << 20; let _pool = reims_vgpu_core::rt::Pool::here(); let platform = P::process(); let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let completed = Arc::new(Mutex::new(Vec::new())); let sink = Arc::clone(&completed); @@ -5332,19 +5334,19 @@ mod tests { -> (Vec, bool, Vec, Vec) { use std::time::{Duration, Instant}; - use reims_graphics::ops::blit::{ + use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_graphics::ops::blit::{ RGFX_OP_BLIT_COPY_BUFFER_TO_BUFFER, RGFX_OP_BLIT_FILL_BUFFER, RgfxBlitOpCopyBufferToBuffer, RgfxBlitOpFillBuffer, }; - use reims_graphics::wire::RgfxSharedEventSetValue; - use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_graphics::wire::RgfxSharedEventSetValue; const LEN: u64 = 1 << 20; let _pool = reims_vgpu_core::rt::Pool::here(); let platform = P::process(); let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); // B's records, and every completion. let records = Arc::new(Mutex::new(Vec::new())); @@ -5504,7 +5506,7 @@ mod tests { let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let completed = Arc::new(Mutex::new(Vec::new())); let sink = Arc::clone(&completed); @@ -5689,12 +5691,12 @@ mod tests { ::Device, ) { use crate::platform::ApiPlatform as _; - use reims_graphics::wire::RGFX_CONTEXT_VA_BASE; + use reims_vgpu_graphics::wire::RGFX_CONTEXT_VA_BASE; let platform = reims_vgpu_vulkan::VulkanPlatform::process(); let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); dec.hold_resource_ids(0, 0); let queue = RgfxQueueCreate { @@ -5740,7 +5742,7 @@ mod tests { /// buffer's bytes where it picks. #[test] fn on_vulkan_a_pin_meets_no_range_of_a_texture_buffer() { - use reims_graphics::wire::RGFX_CONTEXT_VA_BASE; + use reims_vgpu_graphics::wire::RGFX_CONTEXT_VA_BASE; let _pins = CONTEXT_RANGE_PINS.lock(); let _pool = reims_vgpu_core::rt::Pool::here(); let (mut dec, device) = decoder_with_a_texture_buffer(); @@ -5754,10 +5756,10 @@ mod tests { /// are made. #[test] fn on_vulkan_the_host_s_own_ranges_lie_below_every_unit() { - use reims_graphics::wire::{ + use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_graphics::wire::{ RGFX_CONTEXT_VA_BASE, RGFX_CONTEXT_VA_END, RGFX_CONTEXT_VA_UNIT, RGFX_CONTEXT_VA_UNITS, }; - use reims_vgpu_core::platform::resource::Buffer as _; let _pins = CONTEXT_RANGE_PINS.lock(); let _pool = reims_vgpu_core::rt::Pool::here(); let (mut dec, device) = decoder_with_a_texture_buffer(); @@ -6258,11 +6260,11 @@ mod tests { /// stands in for the GPU reaching the signal. So does a stand-in's signal before its wait. #[test] fn a_signal_before_more_of_its_buffer_goes_as_the_event_reaches_it() { - use reims_graphics::ops::compute::{ + use reims_vgpu_core::platform::event::SharedEvent as _; + use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_SET_COMPUTE_PIPELINE_STATE, RgfxComputeOpSetComputePipelineState, }; - use reims_graphics::wire::RGFX_CB_INTERNAL; - use reims_vgpu_core::platform::event::SharedEvent as _; + use reims_vgpu_graphics::wire::RGFX_CB_INTERNAL; let (p, mut dec) = setup(); let device = p.device(); create_events(&p, &mut dec, 0); @@ -6442,10 +6444,10 @@ mod tests { /// decoder holds has no stand-in. #[test] fn a_faulted_command_buffer_is_stood_in_for_by_its_event_ops() { - use reims_graphics::ops::compute::{ + use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_SET_COMPUTE_PIPELINE_STATE, RgfxComputeOpSetComputePipelineState, }; - use reims_graphics::wire::RGFX_CB_INTERNAL; + use reims_vgpu_graphics::wire::RGFX_CB_INTERNAL; let (p, mut dec) = setup(); let device = p.device(); create_events(&p, &mut dec, 0); @@ -6521,7 +6523,7 @@ mod tests { /// among them, so none is dropped with the ops the count leaves out. #[test] fn a_buffer_whose_op_bytes_are_short_is_refused_and_stood_in_for_by_all_its_events() { - use reims_graphics::wire::RGFX_CB_INTERNAL; + use reims_vgpu_graphics::wire::RGFX_CB_INTERNAL; let (p, mut dec) = setup(); let device = p.device(); create_events(&p, &mut dec, 0); @@ -6569,7 +6571,7 @@ mod tests { /// queue's next buffer is committed and completes. #[test] fn a_commit_refused_after_its_handlers_were_added_fails_that_buffer_alone() { - use reims_graphics::wire::{RGFX_CB_INTERNAL, RGFX_CB_OK}; + use reims_vgpu_graphics::wire::{RGFX_CB_INTERNAL, RGFX_CB_OK}; for (step, death) in [ (Step::crash(), true), ( @@ -6738,10 +6740,10 @@ mod tests { } fn destroy(obj_id: u64) -> Vec { - reims_graphics::wire::RgfxObjectDestroy { + reims_vgpu_graphics::wire::RgfxObjectDestroy { header: RgfxMsgHeader { - r#type: reims_graphics::wire::RGFX_CMD_OBJECT_DESTROY, - size: size_of::() as u32, + r#type: reims_vgpu_graphics::wire::RGFX_CMD_OBJECT_DESTROY, + size: size_of::() as u32, seqno: 0, }, obj_id, @@ -6985,10 +6987,10 @@ mod tests { let gate = Gate::on(&dec, 0); drop(dec); let range = |obj_id| { - reims_graphics::wire::RgfxBufferDidModifyRange { + reims_vgpu_graphics::wire::RgfxBufferDidModifyRange { header: RgfxMsgHeader { - r#type: reims_graphics::wire::RGFX_CMD_BUFFER_DID_MODIFY_RANGE, - size: size_of::() as u32, + r#type: reims_vgpu_graphics::wire::RGFX_CMD_BUFFER_DID_MODIFY_RANGE, + size: size_of::() as u32, seqno: 0, }, obj_id, @@ -7028,7 +7030,7 @@ mod tests { other .decode( &device, - &range((2 << reims_graphics::wire::RGFX_CONTEXT_OBJ_ID_SHIFT) | 2) + &range((2 << reims_vgpu_graphics::wire::RGFX_CONTEXT_OBJ_ID_SHIFT) | 2) ) .unwrap(), Err(DecodeError::BadReference) @@ -7178,7 +7180,7 @@ mod tests { ( RGFX_EVT_CB_COMPLETE, 301, - reims_graphics::wire::RGFX_CB_PAGE_FAULT + reims_vgpu_graphics::wire::RGFX_CB_PAGE_FAULT ) ] ); @@ -7339,7 +7341,7 @@ mod tests { [( RGFX_EVT_CB_COMPLETE, 330, - reims_graphics::wire::RGFX_CB_INTERNAL + reims_vgpu_graphics::wire::RGFX_CB_INTERNAL )] ); assert!( diff --git a/crates/reims-vgpu/src/graphics/decode/commit_order.rs b/crates/reims-vgpu/src/graphics/decode/commit_order.rs index 0f50aa426..c1b050dd2 100644 --- a/crates/reims-vgpu/src/graphics/decode/commit_order.rs +++ b/crates/reims-vgpu/src/graphics/decode/commit_order.rs @@ -34,7 +34,7 @@ //! their waiters each. One that holds the op takes the order's lock once at its begin, and waits //! only where the queues' threads took the buffers in another order than the guest posted them. //! -//! [`RGFX_OP_COMMIT_ORDER`]: reims_graphics::ops::RGFX_OP_COMMIT_ORDER +//! [`RGFX_OP_COMMIT_ORDER`]: reims_vgpu_graphics::ops::RGFX_OP_COMMIT_ORDER use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}; @@ -214,16 +214,16 @@ mod tests { use std::thread::JoinHandle; use std::time::{Duration, Instant}; - use reims_graphics::ops::{ + use reims_vgpu_core::sync::Mutex; + use reims_vgpu_core::testkit::FakePlatform; + use reims_vgpu_graphics::ops::{ RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_COMMIT_ORDER, RGFX_OP_SUBMITTED, RgfxCommandBuffer, RgfxOpHeader, RgfxSurfaceOrderWait, }; - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_QUEUE_CREATE, RGFX_CONTEXT_OBJ_ID_SHIFT, RgfxMsgHeader, RgfxObjectDestroy, RgfxQueueCreate, }; - use reims_vgpu_core::sync::Mutex; - use reims_vgpu_core::testkit::FakePlatform; use zerocopy::IntoBytes; use super::super::{DecodeError, GraphicsDecoder}; @@ -251,7 +251,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let submitted = Arc::new(Mutex::new(Vec::new())); let sink = Arc::clone(&submitted); diff --git a/crates/reims-vgpu/src/graphics/decode/composite_cost.rs b/crates/reims-vgpu/src/graphics/decode/composite_cost.rs index cffabb356..189a410b2 100644 --- a/crates/reims-vgpu/src/graphics/decode/composite_cost.rs +++ b/crates/reims-vgpu/src/graphics/decode/composite_cost.rs @@ -34,7 +34,10 @@ use std::sync::Arc; use std::sync::mpsc; use std::time::{Duration, Instant}; -use reims_graphics::ops::render::{ +use reims_vgpu_core::platform::device::GpuDevice as _; +use reims_vgpu_core::platform::values::{FullRenderPipelineDesc, SamplerDesc, TextureDesc}; +use reims_vgpu_core::raise::OnFault; +use reims_vgpu_graphics::ops::render::{ RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_MEMORY_BARRIER_WITH_SCOPE, RGFX_OP_RENDER_SET_FRAGMENT_SAMPLER_STATES, RGFX_OP_RENDER_SET_FRAGMENT_TEXTURE, RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RGFX_OP_RENDER_SET_VERTEX_BUFFER, @@ -42,19 +45,16 @@ use reims_graphics::ops::render::{ RgfxOpSetFragmentTexture, RgfxOpSetRenderPipelineState, RgfxOpSetVertexBuffer, RgfxSamplerBinding, }; -use reims_graphics::ops::{ +use reims_vgpu_graphics::ops::{ RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_END, RGFX_PASS_FLAG_RT_SIZE, RgfxCommandBuffer, RgfxOpHeader, RgfxRenderPassColorAttachment, RgfxRenderPassDesc, }; -use reims_graphics::wire::{ +use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_QUEUE_CREATE, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RgfxBufferOverHostMemory, RgfxCbComplete, RgfxMsgHeader, RgfxQueueCreate, }; -use reims_vgpu_core::platform::device::GpuDevice as _; -use reims_vgpu_core::platform::values::{FullRenderPipelineDesc, SamplerDesc, TextureDesc}; -use reims_vgpu_core::raise::OnFault; use zerocopy::IntoBytes; use super::draw_cost::{counts, fixture, over, spread}; @@ -306,7 +306,7 @@ impl Bench

{ let device = platform.metal_device(None).unwrap(); let chunk = (shape.quads() * QUAD).next_multiple_of(0x4000); let region_size = RGFX_CONTEXT_ALLOCATIONS_OFFSET + chunk + RGFX_CURSOR_SPAN; - let region = reims_graphics::region::Region::new(region_size as usize).unwrap(); + let region = reims_vgpu_graphics::region::Region::new(region_size as usize).unwrap(); for quad in 0..shape.quads() { let at = RGFX_CONTEXT_ALLOCATIONS_OFFSET + quad * QUAD; assert!(region.write(at, quad_positions(shape, quad).as_bytes())); diff --git a/crates/reims-vgpu/src/graphics/decode/compute.rs b/crates/reims-vgpu/src/graphics/decode/compute.rs index d947c4fa1..69fc3b579 100644 --- a/crates/reims-vgpu/src/graphics/decode/compute.rs +++ b/crates/reims-vgpu/src/graphics/decode/compute.rs @@ -1,5 +1,5 @@ //! The compute-encoder op decoder: one arm per -//! [`reims_graphics::ops::compute`] op, turning a wire op into a `ComputeCmd` on +//! [`reims_vgpu_graphics::ops::compute`] op, turning a wire op into a `ComputeCmd` on //! the open `P::ComputeEncoder` (docs/graphics-kext/design.md, "Stage 3 wire //! protocol"). The command-buffer walk ([`super::cmdbuf`]) routes every //! compute-group op (`tag >> 12 == `[`RGFX_OP_GROUP_COMPUTE`]) here. @@ -8,15 +8,20 @@ //! through the [object-resolution API](super) (`require_*`/`get_*`), and sends the //! matching [`ComputeCmd`] with [`ComputeEncoder::encode`]. A body too short for its //! op faults the exec ([`super::op_fault`]); a bad reference faults through the -//! resolution API. The array-tailed ops ([`reims_graphics::ops::compute`], "Array-tailed +//! resolution API. The array-tailed ops ([`reims_vgpu_graphics::ops::compute`], "Array-tailed //! ops") read a fixed head, then its `length`/`count` element records right after it. //! //! `endEncoding` has no arm here: the walk's `ENCODER_END` framing op ends the open //! compute encoder ([`super::cmdbuf`]). //! -//! [`RGFX_OP_GROUP_COMPUTE`]: reims_graphics::ops::RGFX_OP_GROUP_COMPUTE +//! [`RGFX_OP_GROUP_COMPUTE`]: reims_vgpu_graphics::ops::RGFX_OP_GROUP_COMPUTE -use reims_graphics::ops::compute::{ +use reims_vgpu_core::platform::Platform; +use reims_vgpu_core::platform::blit::ResourceRef; +use reims_vgpu_core::platform::compute::{ComputeCmd, ComputeEncoder}; +use reims_vgpu_core::platform::types::{MtlOrigin, MtlRegion, MtlSize, NsRange}; +use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; +use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_COMPRESSED_TEXTURE_REINTERPRETATION_FLUSH, RGFX_OP_COMPUTE_DISPATCH_THREADGROUPS, RGFX_OP_COMPUTE_DISPATCH_THREADGROUPS_INDIRECT, RGFX_OP_COMPUTE_DISPATCH_THREADS, RGFX_OP_COMPUTE_DISPATCH_THREADS_INDIRECT, @@ -49,11 +54,6 @@ use reims_graphics::ops::compute::{ RgfxComputeOpUseResources, RgfxComputeOpWaitForFence, RgfxComputeResourceRef, RgfxComputeSamplerBinding, RgfxComputeSamplerLodBinding, RgfxComputeTextureBinding, }; -use reims_vgpu_core::platform::Platform; -use reims_vgpu_core::platform::blit::ResourceRef; -use reims_vgpu_core::platform::compute::{ComputeCmd, ComputeEncoder}; -use reims_vgpu_core::platform::types::{MtlOrigin, MtlRegion, MtlSize, NsRange}; -use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; use zerocopy::{FromBytes, Immutable}; use super::refused::{self, Bound, Marks, Slot, Stage}; @@ -169,7 +169,7 @@ fn bind_each<'a, R, T>( } /// Decodes one compute-encoder op: `tag` its op, `payload` its body (the bytes -/// after the [`RgfxOpHeader`](reims_graphics::ops::RgfxOpHeader)). `objs` resolves +/// after the [`RgfxOpHeader`](reims_vgpu_graphics::ops::RgfxOpHeader)). `objs` resolves /// object references, `enc` is the open compute encoder, `marks` its slots that hold an object /// whose create the host refused, and `on` says how an encode's raise is taken. `Ok(true)` when /// the op was handled, `Ok(false)` for an unknown tag (the walk then faults); a platform raise @@ -612,11 +612,6 @@ pub(crate) fn decode_op( mod tests { use std::sync::Arc; - use reims_graphics::wire::{ - RGFX_CMD_BUFFER_CREATE, RGFX_CMD_FENCE_CREATE, RGFX_CMD_QUEUE_CREATE, - RGFX_CMD_TEXTURE_CREATE, RgfxBufferCreate, RgfxMsgHeader, RgfxObjectCreate, - RgfxQueueCreate, RgfxTextureCreate, RgfxTextureDescriptor, - }; use reims_vgpu_core::platform::Handle; use reims_vgpu_core::platform::command::{CommandBuffer, CommandQueue}; use reims_vgpu_core::platform::device::GpuDevice; @@ -624,6 +619,11 @@ mod tests { use reims_vgpu_core::raise::OnFault; use reims_vgpu_core::testkit::FakePlatform; use reims_vgpu_core::testkit::calllog::Arg; + use reims_vgpu_graphics::wire::{ + RGFX_CMD_BUFFER_CREATE, RGFX_CMD_FENCE_CREATE, RGFX_CMD_QUEUE_CREATE, + RGFX_CMD_TEXTURE_CREATE, RgfxBufferCreate, RgfxMsgHeader, RgfxObjectCreate, + RgfxQueueCreate, RgfxTextureCreate, RgfxTextureDescriptor, + }; use zerocopy::IntoBytes; use super::*; @@ -639,7 +639,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let queue = RgfxQueueCreate { diff --git a/crates/reims-vgpu/src/graphics/decode/draw_cost.rs b/crates/reims-vgpu/src/graphics/decode/draw_cost.rs index 4202d3270..37df14c84 100644 --- a/crates/reims-vgpu/src/graphics/decode/draw_cost.rs +++ b/crates/reims-vgpu/src/graphics/decode/draw_cost.rs @@ -31,24 +31,6 @@ use std::sync::Arc; use std::sync::mpsc; use std::time::{Duration, Instant}; -use reims_graphics::ops::render::{ - RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_FRAGMENT_BUFFER, - RGFX_OP_RENDER_SET_FRAGMENT_SAMPLER_STATES, RGFX_OP_RENDER_SET_FRAGMENT_TEXTURE, - RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RGFX_OP_RENDER_SET_VERTEX_BUFFER, - RgfxOpDrawPrimitives, RgfxOpSetFragmentBuffer, RgfxOpSetFragmentSamplerStates, - RgfxOpSetFragmentTexture, RgfxOpSetRenderPipelineState, RgfxOpSetVertexBuffer, - RgfxSamplerBinding, -}; -use reims_graphics::ops::{ - RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_END, - RGFX_PASS_FLAG_RT_SIZE, RgfxCommandBuffer, RgfxOpHeader, RgfxRenderPassColorAttachment, - RgfxRenderPassDesc, -}; -use reims_graphics::wire::{ - RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_QUEUE_CREATE, - RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RgfxBufferOverHostMemory, RgfxMsgHeader, - RgfxQueueCreate, -}; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::command::{CommandBuffer as _, CommandQueue as _}; use reims_vgpu_core::platform::descriptor::RenderPassDescriptor as _; @@ -60,6 +42,24 @@ use reims_vgpu_core::platform::values::{ ColorAttachmentDesc, ColorAttachmentSet, FullRenderPipelineDesc, SamplerDesc, TextureDesc, }; use reims_vgpu_core::raise::OnFault; +use reims_vgpu_graphics::ops::render::{ + RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_FRAGMENT_BUFFER, + RGFX_OP_RENDER_SET_FRAGMENT_SAMPLER_STATES, RGFX_OP_RENDER_SET_FRAGMENT_TEXTURE, + RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RGFX_OP_RENDER_SET_VERTEX_BUFFER, + RgfxOpDrawPrimitives, RgfxOpSetFragmentBuffer, RgfxOpSetFragmentSamplerStates, + RgfxOpSetFragmentTexture, RgfxOpSetRenderPipelineState, RgfxOpSetVertexBuffer, + RgfxSamplerBinding, +}; +use reims_vgpu_graphics::ops::{ + RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_END, + RGFX_PASS_FLAG_RT_SIZE, RgfxCommandBuffer, RgfxOpHeader, RgfxRenderPassColorAttachment, + RgfxRenderPassDesc, +}; +use reims_vgpu_graphics::wire::{ + RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_QUEUE_CREATE, + RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RgfxBufferOverHostMemory, RgfxMsgHeader, + RgfxQueueCreate, +}; use zerocopy::IntoBytes; use super::{GraphicsDecoder, ObjHandle}; @@ -559,7 +559,7 @@ impl Bench

{ let device = platform.metal_device(None).unwrap(); let region_size = RGFX_CONTEXT_ALLOCATIONS_OFFSET + shape.chunks() * CHUNK + RGFX_CURSOR_SPAN; - let region = reims_graphics::region::Region::new(region_size as usize).unwrap(); + let region = reims_vgpu_graphics::region::Region::new(region_size as usize).unwrap(); let mut decoder = GraphicsDecoder::

::new(Arc::clone(&platform), Arc::new(region)); let (tx, completed) = mpsc::channel(); let tx = reims_vgpu_core::sync::Mutex::new(tx); diff --git a/crates/reims-vgpu/src/graphics/decode/fuzz.rs b/crates/reims-vgpu/src/graphics/decode/fuzz.rs index ecc9988a2..66da7b532 100644 --- a/crates/reims-vgpu/src/graphics/decode/fuzz.rs +++ b/crates/reims-vgpu/src/graphics/decode/fuzz.rs @@ -26,22 +26,22 @@ use std::collections::HashMap; use std::sync::Arc; -use reims_graphics::ops::{ +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_core::testkit::FakePlatform; +use reims_vgpu_core::testkit::objects::CompleteOn; +use reims_vgpu_graphics::ops::{ RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_BEGIN_COMPUTE, RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_END, RGFX_OP_SUBMITTED, RGFX_PASS_FLAG_RT_SIZE, RgfxCommandBuffer, RgfxOpHeader, RgfxRenderPassColorAttachment, RgfxRenderPassDesc, }; -use reims_graphics::region::Region; -use reims_graphics::wire::{ +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_CREATE, RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_EVENT_CREATE, RGFX_CMD_FENCE_CREATE, RGFX_CMD_QUEUE_CREATE, RGFX_CMD_SHARED_EVENT_CREATE, RGFX_CMD_TEXTURE_CREATE, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RGFX_EVT_CB_SCHEDULED, RgfxBufferCreate, RgfxCbScheduled, RgfxMsgHeader, RgfxObjectCreate, RgfxQueueCreate, RgfxSharedEventCreate, RgfxTextureCreate, RgfxTextureDescriptor, }; -use reims_vgpu_core::sync::Mutex; -use reims_vgpu_core::testkit::FakePlatform; -use reims_vgpu_core::testkit::objects::CompleteOn; use zerocopy::{FromBytes, IntoBytes}; use super::{DecodeError, GraphicsDecoder, ObjHandle, refusing}; diff --git a/crates/reims-vgpu/src/graphics/decode/icb.rs b/crates/reims-vgpu/src/graphics/decode/icb.rs index 48f838cf3..5291c2ca9 100644 --- a/crates/reims-vgpu/src/graphics/decode/icb.rs +++ b/crates/reims-vgpu/src/graphics/decode/icb.rs @@ -2,7 +2,7 @@ //! `gpuResourceID`, and `ICB_WRITE`, the CPU's encodes into one. //! //! The platform's buffer is the one copy of the commands. The guest's CPU encodes reach it as -//! records ([`reims_graphics::icb`]) on ring 0, which the guest posts before any command buffer +//! records ([`reims_vgpu_graphics::icb`]) on ring 0, which the guest posts before any command buffer //! that may execute them, and a kernel's encodes write it on the GPU, through the //! `gpuResourceID` the guest's argument buffers hold. So a command buffer executes the commands //! as both sides last wrote them, as Metal's does. @@ -19,8 +19,16 @@ //! and dispatches are dropped until the guest resets it ([`Dropped`]). Nothing else of the //! buffer changes, and the command buffers that execute it go on. -use reims_graphics::icb::*; -use reims_graphics::wire::{ +use reims_vgpu_core::platform::Platform; +use reims_vgpu_core::platform::device::GpuDevice; +use reims_vgpu_core::platform::icb::{ + IcbComputeCmd, IcbRenderCmd, IndirectCommandBuffer, IndirectComputeCommand, + IndirectRenderCommand, +}; +use reims_vgpu_core::platform::types::{MtlOrigin, MtlRegion, MtlSize}; +use reims_vgpu_core::platform::values::IcbDesc; +use reims_vgpu_graphics::icb::*; +use reims_vgpu_graphics::wire::{ RGFX_EVT_ICB_STATE, RGFX_ICB_INHERIT_BLEND_COLOR, RGFX_ICB_INHERIT_BUFFERS, RGFX_ICB_INHERIT_CULL_MODE, RGFX_ICB_INHERIT_DEPTH_BIAS, RGFX_ICB_INHERIT_DEPTH_CLIP_MODE, RGFX_ICB_INHERIT_DEPTH_STENCIL_STATE, RGFX_ICB_INHERIT_DEPTH_TEST_BOUNDS, @@ -31,14 +39,6 @@ use reims_graphics::wire::{ RGFX_STATUS_INVALID_ARGUMENT, RGFX_STATUS_OK, RGFX_STATUS_REFUSED, RgfxIcbCreate, RgfxIcbSlotRun, RgfxIcbSlots, RgfxIcbState, RgfxIcbWrite, RgfxMsgHeader, }; -use reims_vgpu_core::platform::Platform; -use reims_vgpu_core::platform::device::GpuDevice; -use reims_vgpu_core::platform::icb::{ - IcbComputeCmd, IcbRenderCmd, IndirectCommandBuffer, IndirectComputeCommand, - IndirectRenderCommand, -}; -use reims_vgpu_core::platform::types::{MtlOrigin, MtlRegion, MtlSize}; -use reims_vgpu_core::platform::values::IcbDesc; use std::collections::BTreeSet; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -1061,15 +1061,15 @@ fn slot_fields( mod tests { use std::sync::Arc; - use reims_graphics::wire::{ - RGFX_CMD_BUFFER_CREATE, RGFX_CMD_ICB_CREATE, RGFX_CMD_ICB_WRITE, RgfxBufferCreate, - }; use reims_vgpu_core::platform::Handle; use reims_vgpu_core::testkit::{Arg, FakePlatform, Step}; + use reims_vgpu_graphics::wire::{ + RGFX_CMD_BUFFER_CREATE, RGFX_CMD_ICB_CREATE, RGFX_CMD_ICB_WRITE, RgfxBufferCreate, + }; use zerocopy::{Immutable, IntoBytes}; - use reims_graphics::region::Region; - use reims_graphics::wire::{ + use reims_vgpu_graphics::region::Region; + use reims_vgpu_graphics::wire::{ RGFX_CMD_ICB_SLOTS, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CONTEXT_OBJ_ID_SHIFT, RGFX_CURSOR_SPAN, RGFX_ICB_SLOTS_COMPUTE, }; diff --git a/crates/reims-vgpu/src/graphics/decode/icb_slots_cost.rs b/crates/reims-vgpu/src/graphics/decode/icb_slots_cost.rs index 014266ec5..e7897ee3e 100644 --- a/crates/reims-vgpu/src/graphics/decode/icb_slots_cost.rs +++ b/crates/reims-vgpu/src/graphics/decode/icb_slots_cost.rs @@ -21,15 +21,6 @@ use std::sync::Arc; -use reims_graphics::icb::{ - RGFX_ICB_OP_DRAW, RGFX_ICB_SLOT_ACTION, RGFX_ICB_SLOT_BUFFER_0, RGFX_ICB_SLOT_PIPELINE, - RgfxIcbDraw, RgfxIcbRenderSlot, RgfxIcbSlotBuffer, -}; -use reims_graphics::region::Region; -use reims_graphics::wire::{ - RGFX_CMD_ICB_CREATE, RGFX_CMD_ICB_SLOTS, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, - RGFX_ICB_SLOTS_RENDER, RgfxIcbCreate, RgfxIcbSlotRun, RgfxIcbSlots, RgfxMsgHeader, -}; use reims_vgpu_core::platform::blit::ResourceRef; use reims_vgpu_core::platform::command::{CommandBuffer as _, CommandQueue as _}; use reims_vgpu_core::platform::descriptor::RenderPassDescriptor as _; @@ -44,6 +35,15 @@ use reims_vgpu_core::platform::values::{ TextureDesc, }; use reims_vgpu_core::raise::OnFault; +use reims_vgpu_graphics::icb::{ + RGFX_ICB_OP_DRAW, RGFX_ICB_SLOT_ACTION, RGFX_ICB_SLOT_BUFFER_0, RGFX_ICB_SLOT_PIPELINE, + RgfxIcbDraw, RgfxIcbRenderSlot, RgfxIcbSlotBuffer, +}; +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ + RGFX_CMD_ICB_CREATE, RGFX_CMD_ICB_SLOTS, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, + RGFX_ICB_SLOTS_RENDER, RgfxIcbCreate, RgfxIcbSlotRun, RgfxIcbSlots, RgfxMsgHeader, +}; use zerocopy::IntoBytes; use super::draw_cost::{Counts, FIGURES, counts, fixture, spread}; diff --git a/crates/reims-vgpu/src/graphics/decode/lane.rs b/crates/reims-vgpu/src/graphics/decode/lane.rs index b73652993..c4224994a 100644 --- a/crates/reims-vgpu/src/graphics/decode/lane.rs +++ b/crates/reims-vgpu/src/graphics/decode/lane.rs @@ -16,7 +16,7 @@ //! a device of many busy queues holds one thread a busy lane and the budget's at most. //! - **Which thread takes a job.** A job goes to the lane's thread that went idle last, so the //! jobs of a lane that needs one thread at a time stay on one thread, and a thread goes once it -//! has had no job for [`KEEP`](reims_graphics::keep::KEEP), 10 s: the threads a steady load runs +//! has had no job for [`KEEP`](reims_vgpu_graphics::keep::KEEP), 10 s: the threads a steady load runs //! at once stay through its pauses, those only a burst of jobs made go 10 s after the burst, and //! a burst after that grows the lane again as the first did. A thread that goes gives back the //! budget's thread first, so the lane's own is the last to go. Woken in turn instead, the @@ -167,8 +167,8 @@ pub(crate) struct Lane { /// The device's budget of extra threads. budget: Arc, /// How long a thread of the lane's stays with no job before it goes: - /// [`KEEP`](reims_graphics::keep::KEEP), but in the tests. - idle_for: reims_graphics::keep::Keep, + /// [`KEEP`](reims_vgpu_graphics::keep::KEEP), but in the tests. + idle_for: reims_vgpu_graphics::keep::Keep, state: Mutex, /// A turn passed. turned: Condvar, @@ -183,16 +183,24 @@ impl std::fmt::Debug for Lane { impl Lane { /// The lane of queue `queue`, with no thread yet, its extra threads from `budget`. pub(crate) fn new(queue: u64, budget: Arc) -> Arc { - Lane::with_idle(queue, budget, reims_graphics::keep::KEEP) + Lane::with_idle(queue, budget, reims_vgpu_graphics::keep::KEEP) } /// The lane of queue `queue`, whose threads go after `idle_for` with no job. fn with_idle(queue: u64, budget: Arc, idle_for: Duration) -> Arc { - Lane::with_keep(queue, budget, reims_graphics::keep::Keep::new(idle_for)) + Lane::with_keep( + queue, + budget, + reims_vgpu_graphics::keep::Keep::new(idle_for), + ) } /// The lane of queue `queue`, whose threads go once they have waited `keep` with no job. - fn with_keep(queue: u64, budget: Arc, keep: reims_graphics::keep::Keep) -> Arc { + fn with_keep( + queue: u64, + budget: Arc, + keep: reims_vgpu_graphics::keep::Keep, + ) -> Arc { Arc::new(Lane { queue, budget, @@ -798,7 +806,7 @@ mod tests { mod kept { use std::collections::HashSet; - use reims_graphics::keep::{KEEP, Keep, TestClock}; + use reims_vgpu_graphics::keep::{KEEP, Keep, TestClock}; use super::*; diff --git a/crates/reims-vgpu/src/graphics/decode/library.rs b/crates/reims-vgpu/src/graphics/decode/library.rs index 692c6d6ee..3f9122c9a 100644 --- a/crates/reims-vgpu/src/graphics/decode/library.rs +++ b/crates/reims-vgpu/src/graphics/decode/library.rs @@ -31,19 +31,19 @@ use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; -use reims_graphics::wire::{ +use reims_vgpu_core::platform::device::GpuDevice; +use reims_vgpu_core::platform::{Handle, Platform}; +use reims_vgpu_core::raise::RaiseResult; +use reims_vgpu_core::sync::{Condvar, Mutex}; +use reims_vgpu_graphics::wire::{ RGFX_CMD_LIBRARY_CREATE, RGFX_CMD_LIBRARY_FROM_REGION, RGFX_EVT_COMPLETE, RGFX_LIBRARY_BYTES_OFFSET, RGFX_LIBRARY_FLAG_KEYED, RGFX_STATUS_INVALID_ARGUMENT, RGFX_STATUS_NOT_FOUND, RGFX_STATUS_OK, RGFX_STATUS_REFUSED, RgfxComplete, RgfxLibraryCreate, RgfxLibraryFromRegion, RgfxLibraryLookup, RgfxMsgHeader, }; -use reims_vgpu_core::platform::device::GpuDevice; -use reims_vgpu_core::platform::{Handle, Platform}; -use reims_vgpu_core::raise::RaiseResult; -use reims_vgpu_core::sync::{Condvar, Mutex}; use sha2::{Digest, Sha256}; -use reims_graphics::wire::RGFX_CONTEXT_OBJ_ID_SHIFT; +use reims_vgpu_graphics::wire::RGFX_CONTEXT_OBJ_ID_SHIFT; use super::tables::Entry; use super::{DecodeError, GraphicsDecoder, ObjHandle, read}; diff --git a/crates/reims-vgpu/src/graphics/decode/managed.rs b/crates/reims-vgpu/src/graphics/decode/managed.rs index 9cdbd95f7..7e17ba6df 100644 --- a/crates/reims-vgpu/src/graphics/decode/managed.rs +++ b/crates/reims-vgpu/src/graphics/decode/managed.rs @@ -52,12 +52,6 @@ use std::ptr; use std::sync::Arc; -use reims_graphics::managed::LinearLayout; -use reims_graphics::wire::{ - RGFX_MANAGED_TEXTURE_LINEAR, RgfxBufferDidModifyRange, RgfxBufferManagedAtOffset, - RgfxBufferOverHostMemory, RgfxManagedBufferCreate, RgfxManagedTextureCreate, - RgfxTextureReplaceRegion, -}; use reims_vgpu_core::host::HostPtr; use reims_vgpu_core::platform::blit::{BlitCmd, BlitEncoder}; use reims_vgpu_core::platform::device::GpuDevice; @@ -66,6 +60,12 @@ use reims_vgpu_core::platform::types::{MtlOrigin, MtlRegion, MtlSize, NsRange}; use reims_vgpu_core::platform::values::{BufferDesc, OptionSet}; use reims_vgpu_core::platform::{Handle, HostRange, Platform}; use reims_vgpu_core::raise::{OnFault, RaiseResult}; +use reims_vgpu_graphics::managed::LinearLayout; +use reims_vgpu_graphics::wire::{ + RGFX_MANAGED_TEXTURE_LINEAR, RgfxBufferDidModifyRange, RgfxBufferManagedAtOffset, + RgfxBufferOverHostMemory, RgfxManagedBufferCreate, RgfxManagedTextureCreate, + RgfxTextureReplaceRegion, +}; use super::tables::{Entry, GuestBytes}; use super::{DecodeError, Drain, GraphicsDecoder, ObjHandle, op_fault, read, texture_desc}; @@ -82,7 +82,7 @@ const TEXTURE_TYPE_2D: u32 = 2; const TEXTURE_TYPE_2D_ARRAY: u32 = 3; // The linear SPI lays a 2D array's slices at their rows' bytes rounded up to 128, which a CPU // copy's slices are where every row is a multiple of 128 ([`in_place_shape`]). -const _: () = assert!(reims_graphics::wire::RGFX_MANAGED_ROW_ALIGN.is_multiple_of(128)); +const _: () = assert!(reims_vgpu_graphics::wire::RGFX_MANAGED_ROW_ALIGN.is_multiple_of(128)); /// `MTLTextureType3D`. const TEXTURE_TYPE_3D: u64 = 7; @@ -812,13 +812,15 @@ impl GraphicsDecoder

{ mod tests { use std::sync::Arc; - use reims_graphics::ops::blit::{ + use reims_vgpu_core::platform::command::{CommandBuffer, CommandQueue}; + use reims_vgpu_core::testkit::{Arg, FakePlatform, GuestRam, Step}; + use reims_vgpu_graphics::ops::blit::{ RGFX_BLIT_RESOURCE_BUFFER, RGFX_BLIT_RESOURCE_TEXTURE, RGFX_OP_BLIT_SYNCHRONIZE_RESOURCE, RGFX_OP_BLIT_SYNCHRONIZE_TEXTURE, RgfxBlitOpSynchronizeResource, RgfxBlitOpSynchronizeTexture, }; - use reims_graphics::region::Region; - use reims_graphics::wire::{ + use reims_vgpu_graphics::region::Region; + use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_AT_OFFSET, RGFX_CMD_BUFFER_DID_MODIFY_RANGE, RGFX_CMD_BUFFER_MANAGED_AT_OFFSET, RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_BUFFER_OVER_PAGES, RGFX_CMD_HEAP_OVER_HOST_MEMORY, RGFX_CMD_MANAGED_BUFFER_CREATE, @@ -827,8 +829,6 @@ mod tests { RGFX_SURFACE_PAGES_PRIVATE, RgfxBufferAtOffset, RgfxBufferOverPages, RgfxHeapOverHostMemory, RgfxMsgHeader, RgfxObjectDestroy, RgfxTextureDescriptor, }; - use reims_vgpu_core::platform::command::{CommandBuffer, CommandQueue}; - use reims_vgpu_core::testkit::{Arg, FakePlatform, GuestRam, Step}; use zerocopy::IntoBytes; use super::super::blit::decode_op; @@ -1375,7 +1375,7 @@ mod tests { fn a_managed_texture_on_a_discrete_gpu_is_two_copies() { let mut r = rig(false); let at = BLOCKS + 0x1_0000; - // 100x60 RGBA8, three levels: 42240 bytes (reims_graphics::managed's case). + // 100x60 RGBA8, three levels: 42240 bytes (reims_vgpu_graphics::managed's case). assert_eq!(r.buffer(20, at, 42240, 0), Ok(())); assert_eq!(r.buffer(22, at + 0x2_0000, 42239, 0), Ok(())); assert_eq!(r.buffer(23, at + 0x3_0000, 42240, MANAGED), Ok(())); diff --git a/crates/reims-vgpu/src/graphics/decode/mod.rs b/crates/reims-vgpu/src/graphics/decode/mod.rs index 9874b645c..9b54f11ce 100644 --- a/crates/reims-vgpu/src/graphics/decode/mod.rs +++ b/crates/reims-vgpu/src/graphics/decode/mod.rs @@ -82,8 +82,28 @@ use std::ptr::NonNull; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::sync::{Arc, OnceLock, Weak}; -use reims_graphics::region::Region; -use reims_graphics::wire::{ +use reims_vgpu_core::host::HostPtr; +use reims_vgpu_core::memory::map::MemoryMap; +use reims_vgpu_core::platform::command::{CommandBuffer as _, CommandQueue as _}; +use reims_vgpu_core::platform::device::GpuDevice; +use reims_vgpu_core::platform::event::{EventRef, SharedEvent}; +use reims_vgpu_core::platform::os::clock::{Clock as _, MonoTime}; +use reims_vgpu_core::platform::resource::{ + Buffer, ComputePipeline, FunctionConstant, Heap, Library, RenderPipeline, SamplerState, +}; +use reims_vgpu_core::platform::types::{MtlSize, Swizzle}; +use reims_vgpu_core::platform::values::{ + AttributeDesc, BufferDesc, BufferLayoutDesc, ColorAttachmentDesc, DepthStencilDesc, + FullComputePipelineDesc, FullMeshRenderPipelineDesc, FullRenderPipelineDesc, HeapDesc, + LinkedFunctionsDesc, OptionSet, PagesInPlace, PagesPlane, PrivateRenderDesc, SamplerDesc, + StageInputDesc, StencilDesc, SurfaceFacts, SurfaceMatrix, SurfacePlane, TextureDesc, + VertexDesc, +}; +use reims_vgpu_core::platform::{Handle, HostRange, Platform}; +use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult, refusals}; +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_AT_OFFSET, RGFX_CMD_BUFFER_CREATE, RGFX_CMD_BUFFER_DID_MODIFY_RANGE, RGFX_CMD_BUFFER_MANAGED_AT_OFFSET, RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_BUFFER_OVER_PAGES, RGFX_CMD_BUFFER_OVER_SURFACE_PAGES, RGFX_CMD_COMMAND_BUFFER, @@ -132,26 +152,6 @@ use reims_graphics::wire::{ RgfxTextureDescriptor, RgfxTextureFromBuffer, RgfxTextureFromIOSurface, RgfxVertexAttribute, RgfxVertexBufferLayout, RgfxVideoSessionCreate, }; -use reims_vgpu_core::host::HostPtr; -use reims_vgpu_core::memory::map::MemoryMap; -use reims_vgpu_core::platform::command::{CommandBuffer as _, CommandQueue as _}; -use reims_vgpu_core::platform::device::GpuDevice; -use reims_vgpu_core::platform::event::{EventRef, SharedEvent}; -use reims_vgpu_core::platform::os::clock::{Clock as _, MonoTime}; -use reims_vgpu_core::platform::resource::{ - Buffer, ComputePipeline, FunctionConstant, Heap, Library, RenderPipeline, SamplerState, -}; -use reims_vgpu_core::platform::types::{MtlSize, Swizzle}; -use reims_vgpu_core::platform::values::{ - AttributeDesc, BufferDesc, BufferLayoutDesc, ColorAttachmentDesc, DepthStencilDesc, - FullComputePipelineDesc, FullMeshRenderPipelineDesc, FullRenderPipelineDesc, HeapDesc, - LinkedFunctionsDesc, OptionSet, PagesInPlace, PagesPlane, PrivateRenderDesc, SamplerDesc, - StageInputDesc, StencilDesc, SurfaceFacts, SurfaceMatrix, SurfacePlane, TextureDesc, - VertexDesc, -}; -use reims_vgpu_core::platform::{Handle, HostRange, Platform}; -use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult, refusals}; -use reims_vgpu_core::sync::Mutex; use reims_vgpu_video::core::device_memory::MemoryLife; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; @@ -252,7 +252,7 @@ pub(crate) type ReflectionSink = Arc; /// limits ([`RgfxMeshPipelineReflection`], at [`RGFX_PIPELINE_REFLECTION_MESH_OFFSET`]), which /// no other reply carries. /// -/// [`RGFX_PIPELINE_REFLECTION_MESH_OFFSET`]: reims_graphics::wire::RGFX_PIPELINE_REFLECTION_MESH_OFFSET +/// [`RGFX_PIPELINE_REFLECTION_MESH_OFFSET`]: reims_vgpu_graphics::wire::RGFX_PIPELINE_REFLECTION_MESH_OFFSET #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) struct PipelineReply { /// The record. @@ -1023,7 +1023,7 @@ impl GraphicsDecoder

{ /// Whether `SURFACE_PAGES` makes views ([`RGFX_FEATURE_SURFACE_PAGES`]). /// - /// [`RGFX_FEATURE_SURFACE_PAGES`]: reims_graphics::wire::RGFX_FEATURE_SURFACE_PAGES + /// [`RGFX_FEATURE_SURFACE_PAGES`]: reims_vgpu_graphics::wire::RGFX_FEATURE_SURFACE_PAGES pub(crate) fn surface_pages_available(&self) -> bool { self.shared.surface_views.lock().available(&self.platform) } @@ -1713,9 +1713,9 @@ impl GraphicsDecoder

{ /// The block at `offset` was released, its `RGFX_BLOCK_RELEASE_*` `flags`: its surface view, /// if any, goes once the buffers over it have, and its device cache once the pages hold what /// a command buffer wrote of it, whether its surface had a client left or not - /// ([`RGFX_BLOCK_RELEASE_NO_CLIENT`](reims_graphics::wire::RGFX_BLOCK_RELEASE_NO_CLIENT), which + /// ([`RGFX_BLOCK_RELEASE_NO_CLIENT`](reims_vgpu_graphics::wire::RGFX_BLOCK_RELEASE_NO_CLIENT), which /// is only counted). Where nothing but the kext held the surface - /// ([`RGFX_BLOCK_RELEASE_UNHELD`](reims_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD)) the cache + /// ([`RGFX_BLOCK_RELEASE_UNHELD`](reims_vgpu_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD)) the cache /// goes uncopied. There is no wait here for a buffer still walked; `done` then, or `failed` /// where the platform raised at the copy ([`surface_cache`]). The block's holds of them are /// let go of on the surface worker, where either may be the last of an import or a mapping. @@ -2376,7 +2376,7 @@ impl GraphicsDecoder

{ self.shared.close_worker.flush(); } - /// The device's reset (`reims_graphics::Host::device_reset`): every context's objects dropped + /// The device's reset (`reims_vgpu_graphics::Host::device_reset`): every context's objects dropped /// as at its close ([`Self::drop_context`]), the lowest context first, then what the decoder /// keeps beside them for the guest's processes: the surfaces' names, the libraries' chunks, /// makes and cache, the blocks' views of their surfaces' pages and their device caches @@ -2689,7 +2689,7 @@ impl GraphicsDecoder

{ Ok(Ok(())) } RGFX_CMD_QUEUE_CREATE => { - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_QUEUE_CREATE_FLAGS_OFFSET, RGFX_QUEUE_UNSHARED, RgfxQueueCreateFlags, }; let Some(m) = read::(message) else { @@ -5263,11 +5263,11 @@ fn stencil(s: &RgfxStencilDescriptor) -> StencilDesc { mod tests { use std::sync::Arc; - use reims_graphics::wire::{ + use reims_vgpu_core::testkit::{Arg, FakePlatform, Step}; + use reims_vgpu_graphics::wire::{ RGFX_CMD_HEAP_TEXTURE_SIZE_AND_ALIGN, RGFX_LIBRARY_BYTES_OFFSET, RGFX_RESOURCE_ID_CHUNKS, RgfxLibraryCreate, RgfxLibraryFromRegion, RgfxTextureView, }; - use reims_vgpu_core::testkit::{Arg, FakePlatform, Step}; use zerocopy::IntoBytes; use super::*; @@ -5290,7 +5290,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let grant = RgfxResourceIdChunk { header: RgfxMsgHeader { @@ -5496,7 +5496,7 @@ mod tests { // cursor's span. let blocks = RGFX_CONTEXT_ALLOCATIONS_OFFSET; let size = blocks + 0x10_0000 + RGFX_CURSOR_SPAN; - let region = Arc::new(reims_graphics::region::Region::new(size as usize).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(size as usize).unwrap()); let (staging, ack) = (blocks + 0x4000, blocks + 0x100); let air: Vec = (0..0x2345u32).map(|i| (i * 7) as u8).collect(); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); @@ -5575,7 +5575,7 @@ mod tests { let device = p.device(); let blocks = RGFX_CONTEXT_ALLOCATIONS_OFFSET; let size = blocks + 0x10_0000 + RGFX_CURSOR_SPAN; - let region = Arc::new(reims_graphics::region::Region::new(size as usize).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(size as usize).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); let buffer = |obj_id: u64, region_offset: u64, length: u64| RgfxBufferOverHostMemory { header: RgfxMsgHeader { @@ -5688,7 +5688,7 @@ mod tests { let device = p.device(); let blocks = RGFX_CONTEXT_ALLOCATIONS_OFFSET; let size = blocks + 0x10_0000 + RGFX_CURSOR_SPAN; - let region = Arc::new(reims_graphics::region::Region::new(size as usize).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(size as usize).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); region.grant(1, blocks, 0x2_0000); dec.set_context(Some(1)); @@ -5762,7 +5762,7 @@ mod tests { let device = p.device(); let blocks = RGFX_CONTEXT_ALLOCATIONS_OFFSET; let size = blocks + 0x10_0000 + RGFX_CURSOR_SPAN; - let region = Arc::new(reims_graphics::region::Region::new(size as usize).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(size as usize).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); region.grant(1, blocks, 0x2_0000); dec.set_context(Some(1)); @@ -5816,14 +5816,14 @@ mod tests { /// way, is refused, and stores and makes nothing more. #[test] fn an_unshared_queue_create_makes_the_platforms_unshared_queue() { - use reims_graphics::wire::{ + use reims_vgpu_core::testkit::impls::device::UNSHARED_QUEUE; + use reims_vgpu_graphics::wire::{ RGFX_QUEUE_QUIET_SCHEDULED, RGFX_QUEUE_UNSHARED, RgfxQueueCreateFlags, }; - use reims_vgpu_core::testkit::impls::device::UNSHARED_QUEUE; let p = Arc::new(FakePlatform::new()); let device = p.device(); - let region = Arc::new(reims_graphics::region::Region::new(0x1_0000).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(0x1_0000).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); let create = |obj_id: u64, flags: Option| { let mut bytes = RgfxQueueCreate { @@ -5909,7 +5909,7 @@ mod tests { fn a_sampler_create_answers_the_platforms_id() { let p = Arc::new(FakePlatform::new()); let device = p.device(); - let region = Arc::new(reims_graphics::region::Region::new(0x1_0000).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(0x1_0000).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); let create = |obj_id, seqno| RgfxSamplerCreate { header: RgfxMsgHeader { @@ -5981,7 +5981,7 @@ mod tests { fn heap_texture_sizes_are_the_devices() { let p = Arc::new(FakePlatform::new()); let device = p.device(); - let region = Arc::new(reims_graphics::region::Region::new(0x1_0000).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(0x1_0000).unwrap()); let dec = GraphicsDecoder::::new(Arc::clone(&p), Arc::clone(®ion)); let query = RgfxHeapTextureSizeAndAlign { header: RgfxMsgHeader { @@ -6069,7 +6069,7 @@ mod tests { use reims_vgpu_core::platform::device::GpuDevice as _; let p = Arc::new(FakePlatform::new()); let device = p.device(); - let region = Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), region); dec.set_context(Some(1)); let fence = || ObjHandle::Fence(device.new_fence().unwrap().unwrap()); @@ -6129,7 +6129,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let obj = |context: u64, n: u64| context << RGFX_CONTEXT_OBJ_ID_SHIFT | n; let create = |ty: u32, obj_id: u64| { @@ -6283,7 +6283,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let obj = |ty: u32, obj_id: u64| RgfxObjectCreate { @@ -7203,7 +7203,7 @@ mod tests { /// texture's warning names the facts it carried. #[test] fn a_surface_texture_reads_its_facts_by_the_message_size() { - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_SURFACE_FACTS_OFFSET, RGFX_YCBCR_MATRIX_ITU_R_2020, RgfxSurfaceFacts, }; let p = Arc::new(FakePlatform::new()); @@ -7343,7 +7343,7 @@ mod tests { /// wire names no value for is malformed, and reaches no platform call. #[test] fn a_surface_texture_s_facts_reach_the_platform() { - use reims_graphics::wire::{RGFX_SURFACE_FACTS_OFFSET, RgfxSurfaceFacts}; + use reims_vgpu_graphics::wire::{RGFX_SURFACE_FACTS_OFFSET, RgfxSurfaceFacts}; let p = Arc::new(FakePlatform::new()); let device = p.device(); let mut dec = GraphicsDecoder::::new( @@ -7530,13 +7530,13 @@ mod tests { Arc>>, ) { pipeline_decoder_over(Arc::new( - reims_graphics::region::Region::new(0x10000).unwrap(), + reims_vgpu_graphics::region::Region::new(0x10000).unwrap(), )) } /// [`pipeline_decoder`] over `region`. pub(super) fn pipeline_decoder_over( - region: Arc, + region: Arc, ) -> ( Arc, GraphicsDecoder, @@ -7990,7 +7990,7 @@ lacks {part}" (100, RGFX_PIPELINE_OK, RGFX_PIPELINE_KIND_MESH) ); let (limits, _) = RgfxMeshPipelineReflection::read_from_prefix( - &reply[reims_graphics::wire::RGFX_PIPELINE_REFLECTION_MESH_OFFSET as usize..], + &reply[reims_vgpu_graphics::wire::RGFX_PIPELINE_REFLECTION_MESH_OFFSET as usize..], ) .unwrap(); assert_eq!( @@ -8013,7 +8013,7 @@ lacks {part}" ); let reply = replies.lock()[1].clone(); let (limits, _) = RgfxMeshPipelineReflection::read_from_prefix( - &reply[reims_graphics::wire::RGFX_PIPELINE_REFLECTION_MESH_OFFSET as usize..], + &reply[reims_vgpu_graphics::wire::RGFX_PIPELINE_REFLECTION_MESH_OFFSET as usize..], ) .unwrap(); assert_eq!( @@ -8615,7 +8615,7 @@ lacks {part}" let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let replies = Arc::new(reims_vgpu_core::sync::Mutex::new(Vec::new())); let sink_replies = Arc::clone(&replies); @@ -8908,7 +8908,7 @@ lacks {part}" let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let replies = Arc::new(reims_vgpu_core::sync::Mutex::new(Vec::new())); let sink_replies = Arc::clone(&replies); @@ -9127,7 +9127,7 @@ lacks {part}" let device = platform.metal_device(None).unwrap(); let mut dec = GraphicsDecoder::

::new( Arc::clone(&platform), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let replies = Arc::new(reims_vgpu_core::sync::Mutex::new(Vec::new())); let sink_replies = Arc::clone(&replies); @@ -9226,7 +9226,7 @@ lacks {part}" /// sends a function made with constant values that set none of its constants, or by a /// descriptor without them; then its constant, an `int` (`MTLDataTypeInt`) of 5. fn optional_constant_cases() -> [Vec; 2] { - let mut value = [0; reims_graphics::wire::RGFX_FUNCTION_CONSTANT_VALUE_BYTES]; + let mut value = [0; reims_vgpu_graphics::wire::RGFX_FUNCTION_CONSTANT_VALUE_BYTES]; value[..4].copy_from_slice(&5i32.to_le_bytes()); [ Vec::new(), @@ -9425,9 +9425,9 @@ lacks {part}" n: u64, desc: RgfxTextureDescriptor, bytes_per_row: u64, - facts: &reims_graphics::wire::RgfxSurfaceFacts, + facts: &reims_vgpu_graphics::wire::RgfxSurfaceFacts, ) -> Vec { - use reims_graphics::wire::{RGFX_SURFACE_FACTS_OFFSET, RgfxSurfaceFacts}; + use reims_vgpu_graphics::wire::{RGFX_SURFACE_FACTS_OFFSET, RgfxSurfaceFacts}; let m = RgfxTextureFromIOSurface { header: RgfxMsgHeader { r#type: RGFX_CMD_TEXTURE_FROM_IOSURFACE, @@ -9498,7 +9498,7 @@ lacks {part}" /// and by the IOSurface creator (`TEXTURE_FROM_IOSURFACE`, its facts saying no planes). fn surface_textures_without_planes() -> Vec<[TextureAnswer; 2]> { - use reims_graphics::wire::RgfxSurfaceFacts; + use reims_vgpu_graphics::wire::RgfxSurfaceFacts; let (mut dec, device) = surface_decoder::

(); buffer_holding(&mut dec, &device, 10, &pin_bytes()); let answer = |dec: &GraphicsDecoder

, n: u64| { @@ -9608,7 +9608,7 @@ lacks {part}" /// with the surface's facts in its `TEXTURE_FROM_IOSURFACE`; `None` where the create is /// refused. fn ycbcr_through_the_decoder() -> Option> { - use reims_graphics::wire::{RGFX_YCBCR_MATRIX_ITU_R_2020, RgfxSurfaceFacts}; + use reims_vgpu_graphics::wire::{RGFX_YCBCR_MATRIX_ITU_R_2020, RgfxSurfaceFacts}; let (mut dec, device) = surface_decoder::

(); buffer_holding(&mut dec, &device, 10, &ycbcr_bytes()); let facts = RgfxSurfaceFacts { @@ -9846,7 +9846,7 @@ lacks {part}" let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let replies = Arc::new(Mutex::new(Vec::::new())); diff --git a/crates/reims-vgpu/src/graphics/decode/refused.rs b/crates/reims-vgpu/src/graphics/decode/refused.rs index d4176f11a..edb169f3a 100644 --- a/crates/reims-vgpu/src/graphics/decode/refused.rs +++ b/crates/reims-vgpu/src/graphics/decode/refused.rs @@ -39,7 +39,8 @@ use std::cell::{Cell, RefCell}; use std::collections::HashSet; use std::sync::atomic::{AtomicBool, Ordering}; -use reims_graphics::wire::{ +use reims_vgpu_core::raise::{Origin, Raise, RaiseResult}; +use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_AT_OFFSET, RGFX_CMD_BUFFER_CREATE, RGFX_CMD_BUFFER_MANAGED_AT_OFFSET, RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_BUFFER_OVER_PAGES, RGFX_CMD_BUFFER_OVER_SURFACE_PAGES, RGFX_CMD_COMPUTE_PIPELINE_CREATE, @@ -51,7 +52,6 @@ use reims_graphics::wire::{ RGFX_CMD_TEXTURE_CREATE, RGFX_CMD_TEXTURE_FROM_BUFFER, RGFX_CMD_TEXTURE_FROM_IOSURFACE, RGFX_CMD_TEXTURE_VIEW, RGFX_CMD_VIDEO_SESSION_CREATE, RgfxObjectCreate, }; -use reims_vgpu_core::raise::{Origin, Raise, RaiseResult}; use super::read; @@ -448,7 +448,7 @@ mod tests { /// command buffer, do not. #[test] fn only_posted_creates_stand_refused() { - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_LIBRARY_CREATE, RGFX_CMD_QUEUE_CREATE, RgfxMsgHeader, }; use zerocopy::IntoBytes; diff --git a/crates/reims-vgpu/src/graphics/decode/render.rs b/crates/reims-vgpu/src/graphics/decode/render.rs index c2ff096e4..8cc2d9ab0 100644 --- a/crates/reims-vgpu/src/graphics/decode/render.rs +++ b/crates/reims-vgpu/src/graphics/decode/render.rs @@ -1,8 +1,8 @@ -//! The render-encoder op decoder: one arm per [`reims_graphics::ops::render`] op, +//! The render-encoder op decoder: one arm per [`reims_vgpu_graphics::ops::render`] op, //! turning a wire op into a `RenderCmd` on the open `P::RenderEncoder` //! (docs/graphics-kext/design.md, "Stage 3 wire protocol"). The command-buffer //! walk ([`super::cmdbuf`]) routes every render-group op -//! (`tag >> 12 == `[`RGFX_OP_GROUP_RENDER`](reims_graphics::ops::RGFX_OP_GROUP_RENDER)) +//! (`tag >> 12 == `[`RGFX_OP_GROUP_RENDER`](reims_vgpu_graphics::ops::RGFX_OP_GROUP_RENDER)) //! here. //! //! Each arm reads its op's body with zerocopy, resolves its object references @@ -27,7 +27,6 @@ use std::cell::Cell; // The render-op tags and body structs (`Rgfx*`): the whole render group, so a glob. -use reims_graphics::ops::render::*; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::blit::ResourceRef; use reims_vgpu_core::platform::render::{RenderCmd, RenderEncoder}; @@ -36,6 +35,7 @@ use reims_vgpu_core::platform::types::{ VertexAmplificationViewMapping, }; use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult}; +use reims_vgpu_graphics::ops::render::*; use zerocopy::FromBytes; use super::refused::{self, Bound, Marks, Slot, Stage}; @@ -85,7 +85,7 @@ fn elems(tag: u16, payload: &[u8], head: usize, count: usize) -> R } /// Resolves one resource-array element: `None` for 0, else the object its -/// [kind](reims_graphics::ops::render::RGFX_RESOURCE_KIND_BUFFER) names (a miss or an +/// [kind](reims_vgpu_graphics::ops::render::RGFX_RESOURCE_KIND_BUFFER) names (a miss or an /// unknown kind faults); `None` too for an object whose create the host refused, which no draw /// reads ([`refused`]). fn resolve_resource<'a, P: Platform>( @@ -296,7 +296,7 @@ fn visibility_offset(pass: &PassFacts, mode: u64, offset: u64) -> u64 { } /// Decodes one render-encoder op: `tag` its op, `payload` its body (the bytes -/// after the [`RgfxOpHeader`](reims_graphics::ops::RgfxOpHeader)). `objs` resolves +/// after the [`RgfxOpHeader`](reims_vgpu_graphics::ops::RgfxOpHeader)). `objs` resolves /// object references, `enc` is the open render encoder, `pass` what its ops' checks read of /// its pass, and `on` says how an encode's raise is taken. `Ok(true)` when the op was handled, /// `Ok(false)` for an unknown tag (the walk then faults); a platform raise, a bad reference or @@ -1843,17 +1843,17 @@ pub(crate) fn decode_op( mod tests { use std::sync::Arc; - use reims_graphics::wire::{ - RGFX_CMD_BUFFER_CREATE, RGFX_CMD_DEPTH_STENCIL_CREATE, RGFX_CMD_FENCE_CREATE, - RGFX_CMD_HEAP_CREATE, RGFX_CMD_SAMPLER_CREATE, RGFX_CMD_TEXTURE_CREATE, RgfxBufferCreate, - RgfxDepthStencilCreate, RgfxHeapCreate, RgfxMsgHeader, RgfxObjectCreate, RgfxSamplerCreate, - RgfxTextureCreate, RgfxTextureDescriptor, - }; use reims_vgpu_core::platform::command::{CommandBuffer, CommandQueue}; use reims_vgpu_core::platform::device::GpuDevice; use reims_vgpu_core::platform::values::IcbDesc; use reims_vgpu_core::platform::{Handle, Platform}; use reims_vgpu_core::testkit::{Arg, FakePlatform}; + use reims_vgpu_graphics::wire::{ + RGFX_CMD_BUFFER_CREATE, RGFX_CMD_DEPTH_STENCIL_CREATE, RGFX_CMD_FENCE_CREATE, + RGFX_CMD_HEAP_CREATE, RGFX_CMD_SAMPLER_CREATE, RGFX_CMD_TEXTURE_CREATE, RgfxBufferCreate, + RgfxDepthStencilCreate, RgfxHeapCreate, RgfxMsgHeader, RgfxObjectCreate, RgfxSamplerCreate, + RgfxTextureCreate, RgfxTextureDescriptor, + }; use zerocopy::IntoBytes; use super::super::ObjHandle; @@ -1901,7 +1901,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); for id in [BUF_VERTEX, BUF_INDEX, BUF_INDIRECT, BUF_AUX] { diff --git a/crates/reims-vgpu/src/graphics/decode/shares.rs b/crates/reims-vgpu/src/graphics/decode/shares.rs index bfe71f290..0ef9391e4 100644 --- a/crates/reims-vgpu/src/graphics/decode/shares.rs +++ b/crates/reims-vgpu/src/graphics/decode/shares.rs @@ -39,15 +39,15 @@ use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use std::time::Duration; -use reims_graphics::wire::{ +use reims_vgpu_core::platform::event::SharedEvent as _; +use reims_vgpu_core::platform::{Handle, Platform}; +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::wire::{ RGFX_CONTEXT_OBJ_ID_SHIFT, RGFX_EVT_EVENT_SIGNALLED, RGFX_EVT_SHARED_EVENT_VALUE, RGFX_STATUS_INVALID_ARGUMENT, RGFX_STATUS_NOT_FOUND, RGFX_STATUS_OK, RgfxEventSignalled, RgfxMsgHeader, RgfxSharedEventImport, RgfxSharedEventName, RgfxSharedEventUnname, RgfxSharedEventValue, }; -use reims_vgpu_core::platform::event::SharedEvent as _; -use reims_vgpu_core::platform::{Handle, Platform}; -use reims_vgpu_core::sync::Mutex; use super::{Entry, GraphicsDecoder, ObjHandle, read}; @@ -700,7 +700,7 @@ mod tests { /// and an id or a listen queue of another context's, are refused, naming and making nothing. #[test] fn a_named_event_is_one_host_event_in_two_processes() { - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_SHARED_EVENT_CREATE, RGFX_CMD_SHARED_EVENT_IMPORT, RGFX_CMD_SHARED_EVENT_NAME, RGFX_CMD_SHARED_EVENT_SET_VALUE, RGFX_CMD_SHARED_EVENT_UNNAME, RgfxObjectDestroy, RgfxSharedEventCreate, @@ -711,7 +711,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); let obj = |context: u64, n: u64| context << RGFX_CONTEXT_OBJ_ID_SHIFT | n; let header = |r#type: u32, size: usize| RgfxMsgHeader { diff --git a/crates/reims-vgpu/src/graphics/decode/surface_cache.rs b/crates/reims-vgpu/src/graphics/decode/surface_cache.rs index b1b66572d..cdebae53e 100644 --- a/crates/reims-vgpu/src/graphics/decode/surface_cache.rs +++ b/crates/reims-vgpu/src/graphics/decode/surface_cache.rs @@ -61,7 +61,7 @@ //! pages still in flight lands, and a `SURFACE_PAGES` over pages a release still copies into //! (the kext made a new block of the surface before the release's answer) waits for the copy //! before it is carried out ([`Caches::wait_copies_into`]), and for the release itself where -//! its context's lane has not carried it out yet (`reims_graphics`'s `device::lanes`). +//! its context's lane has not carried it out yet (`reims_vgpu_graphics`'s `device::lanes`). //! - **Early copy.** A surface the CPU reads back after each GPU write (a decoder's output, or a //! pixel transfer's, that its client locks each frame to read) is copied into its pages as the //! write ends, not at the lock that follows it ([`SurfaceCaches::early_copies`]). Once a @@ -90,11 +90,11 @@ //! cache. //! - **Deferred blocks.** Where the guest took `RGFX_FEATURE_SURFACE_DEFERRED`, the kext names a //! fresh surface only the GPU has touched with no pages -//! ([`RGFX_SURFACE_PAGES_DEFERRED`](reims_graphics::wire::RGFX_SURFACE_PAGES_DEFERRED)), as a +//! ([`RGFX_SURFACE_PAGES_DEFERRED`](reims_vgpu_graphics::wire::RGFX_SURFACE_PAGES_DEFERRED)), as a //! GPU of its own memory keeps such a surface in that memory alone: its cache is made as zeros, //! on the transfer queue before any use, at the CPU's generation 0, with no pages to fill from, //! download into or watch. The kext names the pages at the first CPU lock that needs them -//! ([`RGFX_SURFACE_PAGES_ATTACH`](reims_graphics::wire::RGFX_SURFACE_PAGES_ATTACH)), and the +//! ([`RGFX_SURFACE_PAGES_ATTACH`](reims_vgpu_graphics::wire::RGFX_SURFACE_PAGES_ATTACH)), and the //! cache takes them as they are, keeping its bytes, its generation and whether a buffer wrote //! it, so the download that follows copies what the GPU wrote. A release of a block whose pages //! were never named copies nothing. Pages the host makes no view of, or no buffer over, at that @@ -139,7 +139,7 @@ //! color attachment of the pass is linear; elsewhere it renders through a stand-in copied within //! the GPU's memory. Neither is measured on a discrete RADV or ANV device yet. //! -//! [`RGFX_SURFACE_PAGES_CACHED`]: reims_graphics::wire::RGFX_SURFACE_PAGES_CACHED +//! [`RGFX_SURFACE_PAGES_CACHED`]: reims_vgpu_graphics::wire::RGFX_SURFACE_PAGES_CACHED use std::collections::hash_map::Entry; use std::collections::{BTreeSet, HashMap, HashSet, VecDeque}; @@ -147,11 +147,6 @@ use std::ops::Range; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{Arc, OnceLock}; -use reims_graphics::ops::{RGFX_SURFACE_USE_WRITES, RgfxOpSurfaceUse}; -use reims_graphics::region::Region; -use reims_graphics::wire::{ - RGFX_BLOCK_RELEASE_NO_CLIENT, RGFX_BLOCK_RELEASE_UNHELD, RgfxBufferOverSurfacePages, -}; use reims_vgpu_core::host::HostPtr; use reims_vgpu_core::num::{ToU64 as _, ToUsize as _}; use reims_vgpu_core::platform::blit::{BlitCmd, BlitEncoder}; @@ -164,6 +159,11 @@ use reims_vgpu_core::platform::values::PagesPlane; use reims_vgpu_core::platform::{Handle, Platform}; use reims_vgpu_core::raise::{OnFault, Raise, RaiseResult, refusals}; use reims_vgpu_core::sync::{Condvar, Mutex, MutexGuard}; +use reims_vgpu_graphics::ops::{RGFX_SURFACE_USE_WRITES, RgfxOpSurfaceUse}; +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ + RGFX_BLOCK_RELEASE_NO_CLIENT, RGFX_BLOCK_RELEASE_UNHELD, RgfxBufferOverSurfacePages, +}; use reims_vgpu_video::core::device_memory::{MemoryIdentity, MemoryLife}; use super::refusing; @@ -3549,19 +3549,19 @@ fn copy( mod tests { use std::sync::atomic::AtomicBool; - use reims_graphics::ops::{ + use reims_vgpu_core::testkit::FakePlatform; + use reims_vgpu_core::testkit::calllog::{Arg, Call}; + use reims_vgpu_core::testkit::objects::CompleteOn; + use reims_vgpu_graphics::ops::{ RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_SUBMITTED, RGFX_OP_SURFACE_USE, RgfxCommandBuffer, RgfxOpHeader, }; - use reims_graphics::wire::{ + use reims_vgpu_graphics::wire::{ RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_QUEUE_CREATE, RGFX_STATUS_INVALID_ARGUMENT, RGFX_STATUS_OK, RGFX_STATUS_REFUSED, RGFX_SURFACE_PAGES_ATTACH, RGFX_SURFACE_PAGES_CACHED, RGFX_SURFACE_PAGES_DEFERRED, RgfxMsgHeader, RgfxObjectDestroy, RgfxPageRun, RgfxQueueCreate, RgfxSurfacePages, }; - use reims_vgpu_core::testkit::FakePlatform; - use reims_vgpu_core::testkit::calllog::{Arg, Call}; - use reims_vgpu_core::testkit::objects::CompleteOn; use zerocopy::IntoBytes; use super::super::surface_pages::tests::{BLOCK, RAM, Rig, rig}; @@ -4060,7 +4060,7 @@ mod tests { /// surface again before the host's copy #[test] fn an_unheld_release_drops_a_written_cache_uncopied() { - use reims_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD; + use reims_vgpu_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD; let release_written = |flags: u32, clients: u32| { let mut r = cached(); let cache = cache_id(&r); @@ -4124,7 +4124,7 @@ mod tests { /// an attached cache's is, and counts among the drops and their bytes #[test] fn every_unheld_release_is_counted_and_every_written_one_dropped() { - use reims_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD; + use reims_vgpu_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD; let unheld = RGFX_BLOCK_RELEASE_NO_CLIENT | RGFX_BLOCK_RELEASE_UNHELD; let released = |r: &Rig| { let done = Arc::new(AtomicBool::new(false)); @@ -4286,7 +4286,7 @@ mod tests { }]; let m = RgfxSurfacePages { header: RgfxMsgHeader { - r#type: reims_graphics::wire::RGFX_CMD_SURFACE_PAGES, + r#type: reims_vgpu_graphics::wire::RGFX_CMD_SURFACE_PAGES, size: size_of::() as u32, seqno: 0, }, @@ -4330,7 +4330,7 @@ mod tests { /// waits for, so it reads the GPU's write; with none taken, nothing is copied #[test] fn an_unheld_release_copies_where_the_surface_is_taken_again_before_its_copy() { - use reims_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD; + use reims_vgpu_graphics::wire::RGFX_BLOCK_RELEASE_UNHELD; for taken in [true, false] { let mut r = cached(); let cache = cache_id(&r); @@ -5649,8 +5649,8 @@ mod tests { #[test] fn a_download_of_a_laid_out_cache_leaves_the_bytes_between_rows() { use super::super::surface_pages::tests::one_plane; - use reims_graphics::wire::RGFX_STATUS_CACHE; use reims_vgpu_core::platform::values::PagesInPlace; + use reims_vgpu_graphics::wire::RGFX_STATUS_CACHE; let mut r = rig(16); let page = r.page; r.dec.set_unified_memory(true); diff --git a/crates/reims-vgpu/src/graphics/decode/surface_order.rs b/crates/reims-vgpu/src/graphics/decode/surface_order.rs index 2c626ea65..23c966c39 100644 --- a/crates/reims-vgpu/src/graphics/decode/surface_order.rs +++ b/crates/reims-vgpu/src/graphics/decode/surface_order.rs @@ -49,19 +49,19 @@ //! A shared event's value only rises (docs/graphics-kext/design.md, "Shared events"), so a second //! signal of a value is harmless. //! -//! [`RGFX_OP_SURFACE_ORDER`]: reims_graphics::ops::RGFX_OP_SURFACE_ORDER +//! [`RGFX_OP_SURFACE_ORDER`]: reims_vgpu_graphics::ops::RGFX_OP_SURFACE_ORDER use std::collections::HashMap; use std::sync::Arc; use std::sync::atomic::{AtomicU64, Ordering}; -use reims_graphics::ops::RgfxSurfaceOrderWait; -use reims_graphics::wire::RGFX_CONTEXT_OBJ_ID_SHIFT; use reims_vgpu_core::platform::command::{CommandBuffer, CommandQueue, CompletedInfo}; use reims_vgpu_core::platform::device::GpuDevice; use reims_vgpu_core::platform::event::{EventRef, SharedEvent}; use reims_vgpu_core::platform::{Handle, Platform}; use reims_vgpu_core::raise::{OnFault, RaiseResult, refusals}; +use reims_vgpu_graphics::ops::RgfxSurfaceOrderWait; +use reims_vgpu_graphics::wire::RGFX_CONTEXT_OBJ_ID_SHIFT; use super::commit_order; @@ -716,19 +716,19 @@ mod tests { use std::sync::atomic::Ordering; - use reims_graphics::ops::{ - RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_SUBMITTED, RGFX_OP_SURFACE_ORDER, - RgfxCommandBuffer, RgfxOpHeader, - }; - use reims_graphics::wire::{ - RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_QUEUE_CREATE, - RGFX_CONTEXT_OBJ_ID_SHIFT, RGFX_EVT_CB_SUBMITTED, RgfxMsgHeader, RgfxObjectDestroy, - RgfxQueueCreate, - }; use reims_vgpu_core::sync::Mutex; use reims_vgpu_core::testkit::calllog::{Arg, Call}; use reims_vgpu_core::testkit::objects::CompleteOn; use reims_vgpu_core::testkit::{FakePlatform, Step}; + use reims_vgpu_graphics::ops::{ + RGFX_COMMAND_BUFFER_OPS_OFFSET, RGFX_OP_SUBMITTED, RGFX_OP_SURFACE_ORDER, + RgfxCommandBuffer, RgfxOpHeader, + }; + use reims_vgpu_graphics::wire::{ + RGFX_CMD_COMMAND_BUFFER, RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_QUEUE_CREATE, + RGFX_CONTEXT_OBJ_ID_SHIFT, RGFX_EVT_CB_SUBMITTED, RgfxMsgHeader, RgfxObjectDestroy, + RgfxQueueCreate, + }; use zerocopy::IntoBytes; use super::super::{DecodeError, GraphicsDecoder, refusing}; @@ -754,7 +754,7 @@ mod tests { let device = p.device(); let mut dec = GraphicsDecoder::::new( Arc::clone(&p), - Arc::new(reims_graphics::region::Region::new(0x10000).unwrap()), + Arc::new(reims_vgpu_graphics::region::Region::new(0x10000).unwrap()), ); for queue in [A, B] { let create = RgfxQueueCreate { @@ -1260,7 +1260,7 @@ mod tests { /// behind it on the platform #[test] fn an_order_on_the_gpu_holds_back_no_record() { - use reims_graphics::wire::{RGFX_EVT_CB_COMPLETE, RGFX_EVT_CB_SCHEDULED}; + use reims_vgpu_graphics::wire::{RGFX_EVT_CB_COMPLETE, RGFX_EVT_CB_SCHEDULED}; const SUB: u32 = RGFX_EVT_CB_SUBMITTED; const SCHED: u32 = RGFX_EVT_CB_SCHEDULED; const DONE: u32 = RGFX_EVT_CB_COMPLETE; @@ -1362,8 +1362,8 @@ mod tests { /// scheduling, not at its commit #[test] fn an_event_wait_still_holds_its_queue_beside_an_order() { - use reims_graphics::ops::{RGFX_OP_WAIT_EVENT, RgfxOpEvent}; - use reims_graphics::wire::{ + use reims_vgpu_graphics::ops::{RGFX_OP_WAIT_EVENT, RgfxOpEvent}; + use reims_vgpu_graphics::wire::{ RGFX_CMD_SHARED_EVENT_CREATE, RGFX_EVT_CB_SCHEDULED, RgfxSharedEventCreate, }; const SUB: u32 = RGFX_EVT_CB_SUBMITTED; @@ -1431,7 +1431,7 @@ mod tests { /// take or commit posts them again; once the platform takes both, nothing is posted again. #[test] fn a_doorbell_answer_behind_an_order_posts_each_record_once_in_order() { - use reims_graphics::wire::{RGFX_EVT_CB_COMPLETE, RGFX_EVT_CB_SCHEDULED}; + use reims_vgpu_graphics::wire::{RGFX_EVT_CB_COMPLETE, RGFX_EVT_CB_SCHEDULED}; const SUB: u32 = RGFX_EVT_CB_SUBMITTED; const SCHED: u32 = RGFX_EVT_CB_SCHEDULED; const DONE: u32 = RGFX_EVT_CB_COMPLETE; @@ -1459,7 +1459,7 @@ mod tests { .decoders() .answer_at_doorbell(context(B), &next, move |bytes| { // A CB_SUBMITTED or a CB_SCHEDULED, which share a layout. - let m = ::read_from_bytes( + let m = ::read_from_bytes( bytes, ) .unwrap(); diff --git a/crates/reims-vgpu/src/graphics/decode/surface_pages.rs b/crates/reims-vgpu/src/graphics/decode/surface_pages.rs index 42e2046d3..d64970e1b 100644 --- a/crates/reims-vgpu/src/graphics/decode/surface_pages.rs +++ b/crates/reims-vgpu/src/graphics/decode/surface_pages.rs @@ -118,10 +118,6 @@ use std::ops::Range; use std::ptr::NonNull; use std::sync::Arc; -use reims_graphics::wire::{ - RGFX_SURFACE_PAGES_PLANES, RgfxBufferOverPages, RgfxBufferOverSurfacePages, RgfxHeapOverPages, - RgfxPageRun, RgfxSurfacePages, RgfxSurfacePagesLayout, -}; use reims_vgpu_core::host::{HostPtr, PhysRange}; use reims_vgpu_core::memory::PAGE_SIZE as MAPPING_PAGE; use reims_vgpu_core::memory::map::MemoryMap; @@ -133,6 +129,10 @@ use reims_vgpu_core::platform::values::{BufferDesc, HeapDesc, OptionSet, PagesPl use reims_vgpu_core::platform::{Handle, HostRange, Platform}; use reims_vgpu_core::raise::{RaiseResult, refusals}; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::wire::{ + RGFX_SURFACE_PAGES_PLANES, RgfxBufferOverPages, RgfxBufferOverSurfacePages, RgfxHeapOverPages, + RgfxPageRun, RgfxSurfacePages, RgfxSurfacePagesLayout, +}; use reims_vgpu_video::core::device_memory::{DeviceMemory, HostView, MemoryIdentity, MemoryLife}; #[cfg(target_os = "linux")] use reims_vgpu_video::core::device_memory::{DmaBufError, SurfaceDmaBuf}; @@ -555,7 +555,7 @@ impl SurfaceViews

{ /// Whether views can be made: a memory map, and a host page the guest's runs are whole /// pages of ([`GUEST_PAGE`]); the device's [`RGFX_FEATURE_SURFACE_PAGES`] says so. /// - /// [`RGFX_FEATURE_SURFACE_PAGES`]: reims_graphics::wire::RGFX_FEATURE_SURFACE_PAGES + /// [`RGFX_FEATURE_SURFACE_PAGES`]: reims_vgpu_graphics::wire::RGFX_FEATURE_SURFACE_PAGES pub(crate) fn available(&self, platform: &P) -> bool { self.memory.is_some() && platform.vm().page_size() == GUEST_PAGE @@ -1462,8 +1462,12 @@ mod costs; #[cfg(test)] pub(super) mod tests { - use reims_graphics::region::Region; - use reims_graphics::wire::{ + use reims_vgpu_core::memory::descriptor::{GuestPhysicalRange, MemoryMapDescriptor}; + use reims_vgpu_core::platform::resource::Buffer as _; + use reims_vgpu_core::platform::values::PagesInPlace; + use reims_vgpu_core::testkit::{Arg, FakePlatform, GuestRam}; + use reims_vgpu_graphics::region::Region; + use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_AT_OFFSET, RGFX_CMD_BUFFER_OVER_HOST_MEMORY, RGFX_CMD_BUFFER_OVER_PAGES, RGFX_CMD_BUFFER_OVER_SURFACE_PAGES, RGFX_CMD_HEAP_OVER_PAGES, RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_SURFACE_PAGES, RGFX_CMD_TEXTURE_FROM_BUFFER, RGFX_CONTEXT_ALLOCATIONS_OFFSET, @@ -1474,10 +1478,6 @@ pub(super) mod tests { RgfxSurfacePagesLayout, RgfxSurfacePlaneLayout, RgfxTextureDescriptor, RgfxTextureFromBuffer, }; - use reims_vgpu_core::memory::descriptor::{GuestPhysicalRange, MemoryMapDescriptor}; - use reims_vgpu_core::platform::resource::Buffer as _; - use reims_vgpu_core::platform::values::PagesInPlace; - use reims_vgpu_core::testkit::{Arg, FakePlatform, GuestRam}; use zerocopy::IntoBytes; use super::super::{DecodeError, GraphicsDecoder, no_raise}; diff --git a/crates/reims-vgpu/src/graphics/decode/surface_pages/costs.rs b/crates/reims-vgpu/src/graphics/decode/surface_pages/costs.rs index 0b175bdea..69a165a3d 100644 --- a/crates/reims-vgpu/src/graphics/decode/surface_pages/costs.rs +++ b/crates/reims-vgpu/src/graphics/decode/surface_pages/costs.rs @@ -48,8 +48,11 @@ use std::sync::Arc; use std::time::{Duration, Instant}; -use reims_graphics::region::Region; -use reims_graphics::wire::{ +use reims_vgpu_core::host::PhysRange; +use reims_vgpu_core::memory::map::MemoryMap as CoreMemoryMap; +use reims_vgpu_core::num::{ToU64 as _, ToUsize as _}; +use reims_vgpu_graphics::region::Region; +use reims_vgpu_graphics::wire::{ RGFX_CMD_BUFFER_AT_OFFSET, RGFX_CMD_BUFFER_OVER_PAGES, RGFX_CMD_BUFFER_OVER_SURFACE_PAGES, RGFX_CMD_HEAP_OVER_PAGES, RGFX_CMD_OBJECT_DESTROY, RGFX_CMD_SURFACE_PAGES, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RGFX_STATUS_OK, RGFX_SURFACE_PAGES_CACHED, @@ -57,9 +60,6 @@ use reims_graphics::wire::{ RgfxBufferOverSurfacePages, RgfxHeapOverPages, RgfxMsgHeader, RgfxObjectDestroy, RgfxPageRun, RgfxSurfacePages, }; -use reims_vgpu_core::host::PhysRange; -use reims_vgpu_core::memory::map::MemoryMap as CoreMemoryMap; -use reims_vgpu_core::num::{ToU64 as _, ToUsize as _}; use zerocopy::IntoBytes; use super::super::{GraphicsDecoder, no_raise}; diff --git a/crates/reims-vgpu/src/graphics/decode/tables.rs b/crates/reims-vgpu/src/graphics/decode/tables.rs index 548e69297..2f8c83a11 100644 --- a/crates/reims-vgpu/src/graphics/decode/tables.rs +++ b/crates/reims-vgpu/src/graphics/decode/tables.rs @@ -12,7 +12,7 @@ //! named (a command buffer that names it fails at the op that names it first), one destroyed after //! it is named whole, and one made after it is not named. A command buffer's view is taken after //! ring 0 has carried out every message published before the buffer was taken off its ring -//! (`reims_graphics`'s order), so it sees every create its process posted before it. +//! (`reims_vgpu_graphics`'s order), so it sees every create its process posted before it. //! //! **What an entry is.** An object's handle, the region span it lies over, the CPU copy of a //! `Managed` one, where a texture over an IOSurface plane lies in its buffer, and a queue's counts: diff --git a/crates/reims-vgpu/src/graphics/decode/video.rs b/crates/reims-vgpu/src/graphics/decode/video.rs index ca7808fd4..d319189d2 100644 --- a/crates/reims-vgpu/src/graphics/decode/video.rs +++ b/crates/reims-vgpu/src/graphics/decode/video.rs @@ -1,7 +1,7 @@ //! The video encoders of the guest's command buffers (`tag >> 12 ==` -//! [`RGFX_OP_GROUP_VIDEO`](reims_graphics::ops::RGFX_OP_GROUP_VIDEO)): the hardware video work of +//! [`RGFX_OP_GROUP_VIDEO`](reims_vgpu_graphics::ops::RGFX_OP_GROUP_VIDEO)): the hardware video work of //! the guest's video driver, a picture a command buffer, on a session -//! ([`RGFX_CMD_VIDEO_SESSION_CREATE`](reims_graphics::wire::RGFX_CMD_VIDEO_SESSION_CREATE)) the +//! ([`RGFX_CMD_VIDEO_SESSION_CREATE`](reims_vgpu_graphics::wire::RGFX_CMD_VIDEO_SESSION_CREATE)) the //! platform's [`GraphicsVideo`] makes. The decoder resolves each op's objects (the bitstream's //! buffer, the buffers the output surface's planes lie in) and hands the work to the session, //! which starts it at once, as the host takes the committed buffer, after the session's earlier @@ -23,21 +23,21 @@ use std::ptr::NonNull; use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use reims_graphics::ops::video::{ - RGFX_OP_VIDEO_DECODE_H264, RGFX_OP_VIDEO_DECODE_H265, RGFX_OP_VIDEO_ENCODE_H264, - RGFX_OP_VIDEO_ENCODE_H265, RGFX_VIDEO_ENCODE_FORCE_KEYFRAME, RgfxVideoEncodeResult, - RgfxVideoEncodeSettings, RgfxVideoOpDecodeH264, RgfxVideoOpDecodeH265, RgfxVideoOpEncode, -}; -use reims_graphics::wire::{ - RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RgfxVideoCodecCaps, RgfxVideoEncodeCaps, - RgfxVideoOutputLayout, -}; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::command::CommandBuffer as _; use reims_vgpu_core::platform::event::EventRef; use reims_vgpu_core::platform::resource::Buffer as _; use reims_vgpu_core::platform::types::PixelFormatInfo; use reims_vgpu_core::raise::RaiseResult; +use reims_vgpu_graphics::ops::video::{ + RGFX_OP_VIDEO_DECODE_H264, RGFX_OP_VIDEO_DECODE_H265, RGFX_OP_VIDEO_ENCODE_H264, + RGFX_OP_VIDEO_ENCODE_H265, RGFX_VIDEO_ENCODE_FORCE_KEYFRAME, RgfxVideoEncodeResult, + RgfxVideoEncodeSettings, RgfxVideoOpDecodeH264, RgfxVideoOpDecodeH265, RgfxVideoOpEncode, +}; +use reims_vgpu_graphics::wire::{ + RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RgfxVideoCodecCaps, RgfxVideoEncodeCaps, + RgfxVideoOutputLayout, +}; use reims_vgpu_video::core::device_memory::{DeviceMemory, HostView, MemoryIdentity}; #[cfg(target_os = "linux")] use reims_vgpu_video::core::device_memory::{DmaBufError, SurfaceDmaBuf}; @@ -71,7 +71,7 @@ pub trait GraphicsVideo: Send + Sync { fn session(&self, codec: u32, direction: u32) -> Option>>; /// Whether a decode lands its picture in an output surface's device cache, where the /// surface's block has one, as well as in its pages - /// ([`RGFX_VIDEO_CAPS_OUTPUT_CACHED`](reims_graphics::wire::RGFX_VIDEO_CAPS_OUTPUT_CACHED)). + /// ([`RGFX_VIDEO_CAPS_OUTPUT_CACHED`](reims_vgpu_graphics::wire::RGFX_VIDEO_CAPS_OUTPUT_CACHED)). fn lands_in_device_caches(&self) -> bool { false } @@ -246,7 +246,7 @@ pub struct VideoPlane<'a, P: Platform> { /// Its height in pixels. pub height: u64, /// Whether the buffer is the surface's device cache, in the GPU's own memory - /// ([`RGFX_FEATURE_SURFACE_CACHE`](reims_graphics::wire::RGFX_FEATURE_SURFACE_CACHE)), rather + /// ([`RGFX_FEATURE_SURFACE_CACHE`](reims_vgpu_graphics::wire::RGFX_FEATURE_SURFACE_CACHE)), rather /// than a buffer over its pages. pub cached: bool, /// The memory the buffer lies in, as a device of the host's video reaches it in place: the @@ -331,14 +331,14 @@ struct RegionMemory { length: usize, /// The host's page. page: usize, - region: Arc, + region: Arc, } impl RegionMemory { /// The block of `size` bytes at `block` in `region`, of life `identity`, in host pages of /// `page` bytes; `None` past it. fn new( - region: &Arc, + region: &Arc, block: u64, size: u64, page: u64, @@ -453,7 +453,7 @@ fn encode_codec(tag: u16) -> Option { } /// Decodes one video-encoder op: `tag` its op, `payload` its body (the bytes after its -/// [`RgfxOpHeader`](reims_graphics::ops::RgfxOpHeader)), on `session`, and has `cb`'s later work +/// [`RgfxOpHeader`](reims_vgpu_graphics::ops::RgfxOpHeader)), on `session`, and has `cb`'s later work /// wait for it, and its completion read whether its picture landed, from `landings`. `Ok(false)` /// for a tag the host does not know. pub(super) fn decode_op( diff --git a/crates/reims-vgpu/src/graphics/decode/view.rs b/crates/reims-vgpu/src/graphics/decode/view.rs index 2e8897492..b7acba4b8 100644 --- a/crates/reims-vgpu/src/graphics/decode/view.rs +++ b/crates/reims-vgpu/src/graphics/decode/view.rs @@ -14,13 +14,13 @@ //! of any refused create does. A view of a pixel format the device describes none for is //! refused before the platform is asked, as Metal asserts there ([`super::described`]). -use reims_graphics::wire::{ - RGFX_TEXTURE_VIEW_SUBRANGE, RGFX_TEXTURE_VIEW_SWIZZLE, RgfxTextureView, -}; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::resource::Texture; use reims_vgpu_core::platform::types::{NsRange, Swizzle}; use reims_vgpu_core::raise::RaiseResult; +use reims_vgpu_graphics::wire::{ + RGFX_TEXTURE_VIEW_SUBRANGE, RGFX_TEXTURE_VIEW_SWIZZLE, RgfxTextureView, +}; use super::{DecodeError, GraphicsDecoder, ObjHandle, read}; @@ -99,12 +99,12 @@ fn swizzle(packed: u32) -> Swizzle { mod tests { use std::sync::Arc; - use reims_graphics::wire::{ + use reims_vgpu_core::testkit::{Arg, FakePlatform}; + use reims_vgpu_graphics::wire::{ RGFX_CMD_RESOURCE_ID_CHUNK, RGFX_CMD_TEXTURE_CREATE, RGFX_CMD_TEXTURE_VIEW, RGFX_CONTEXT_ALLOCATIONS_OFFSET, RGFX_CURSOR_SPAN, RgfxMsgHeader, RgfxResourceIdChunk, RgfxTextureCreate, RgfxTextureDescriptor, }; - use reims_vgpu_core::testkit::{Arg, FakePlatform}; use zerocopy::IntoBytes; use super::*; @@ -122,7 +122,7 @@ mod tests { fn decoder() -> (Arc, GraphicsDecoder) { let p = Arc::new(FakePlatform::new()); let size = RGFX_CONTEXT_ALLOCATIONS_OFFSET + 0x10_0000 + RGFX_CURSOR_SPAN; - let region = Arc::new(reims_graphics::region::Region::new(size as usize).unwrap()); + let region = Arc::new(reims_vgpu_graphics::region::Region::new(size as usize).unwrap()); let mut dec = GraphicsDecoder::::new(Arc::clone(&p), region); let device = p.device(); let chunk = RgfxResourceIdChunk { diff --git a/crates/reims-vgpu/src/graphics/decode/worker.rs b/crates/reims-vgpu/src/graphics/decode/worker.rs index 8ebd16970..04fb12864 100644 --- a/crates/reims-vgpu/src/graphics/decode/worker.rs +++ b/crates/reims-vgpu/src/graphics/decode/worker.rs @@ -18,7 +18,7 @@ //! `-`. A thread is started when a key's job finds none waiting, and ends once it has //! waited [`KEEP`] with nothing to do; a key's job wakes one waiting thread, never more, the one //! that went idle last, so the threads a steady load runs at once take its jobs and stay through -//! its pauses, and those only a burst ran wait longest and go (`reims_graphics::keep`). A key +//! its pauses, and those only a burst ran wait longest and go (`reims_vgpu_graphics::keep`). A key //! whose job finds every thread busy waits for the next free one, behind the keys that were //! waiting before it, and is counted (a cap hit, logged at debug); a thread runs a job of each //! waiting key in turn. Where no thread can be started, the job runs where it is handed over. @@ -61,9 +61,9 @@ use std::collections::{HashMap, VecDeque}; use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}; -use reims_graphics::keep::{KEEP, Keep}; use reims_vgpu_core::platform::os::MonoTime; use reims_vgpu_core::sync::{Condvar, Mutex}; +use reims_vgpu_graphics::keep::{KEEP, Keep}; /// The most threads a [`Worker`] runs. pub(crate) const POOL_THREADS: usize = 4; @@ -532,7 +532,7 @@ mod tests { use std::sync::mpsc; use std::time::Duration; - use reims_graphics::keep::TestClock; + use reims_vgpu_graphics::keep::TestClock; use super::*; diff --git a/crates/reims-vgpu/src/graphics/device_info.rs b/crates/reims-vgpu/src/graphics/device_info.rs index c4c59289c..6ee9297e9 100644 --- a/crates/reims-vgpu/src/graphics/device_info.rs +++ b/crates/reims-vgpu/src/graphics/device_info.rs @@ -9,21 +9,21 @@ //! //! The decoder does not touch this: [`super::GraphicsDevice`] writes it once at //! the device's init into the region at -//! [`RGFX_DEVICE_INFO_OFFSET`](reims_graphics::wire::RGFX_DEVICE_INFO_OFFSET), +//! [`RGFX_DEVICE_INFO_OFFSET`](reims_vgpu_graphics::wire::RGFX_DEVICE_INFO_OFFSET), //! and the guest bundle reads it there, not a guest command. -use reims_graphics::wire::{ - RGFX_DEVICE_ARCHITECTURE_NAME_LEN, RGFX_DEVICE_INFO_COUNTER_POINTS, RGFX_DEVICE_INFO_FAMILIES, - RGFX_DEVICE_INFO_FEATURE_SETS, RGFX_DEVICE_INFO_FORMATS, RGFX_DEVICE_INFO_IDENTITY_FLAGS, - RGFX_DEVICE_INFO_SIZES, RGFX_DEVICE_INFO_SPARSE_TILES, RGFX_DEVICE_INFO_VERSION, - RGFX_DEVICE_NAME_LEN, RgfxDeviceInfo, RgfxFormatAnswers, -}; use reims_vgpu_core::platform::caps::{ COUNTER_SAMPLING_POINTS, DeviceCaps, FAMILIES, FEATURE_SETS, Flags, FormatAnswers, IdentityCaps, Limits, SDK_FAMILIES, SDK_PIXEL_FORMATS, SPARSE_PAGE_SIZES, SPARSE_SAMPLE_COUNTS, feature_set_family, }; use reims_vgpu_core::raise::RaiseResult; +use reims_vgpu_graphics::wire::{ + RGFX_DEVICE_ARCHITECTURE_NAME_LEN, RGFX_DEVICE_INFO_COUNTER_POINTS, RGFX_DEVICE_INFO_FAMILIES, + RGFX_DEVICE_INFO_FEATURE_SETS, RGFX_DEVICE_INFO_FORMATS, RGFX_DEVICE_INFO_IDENTITY_FLAGS, + RGFX_DEVICE_INFO_SIZES, RGFX_DEVICE_INFO_SPARSE_TILES, RGFX_DEVICE_INFO_VERSION, + RGFX_DEVICE_NAME_LEN, RgfxDeviceInfo, RgfxFormatAnswers, +}; /// `MTLGPUFamilyMetal3`. const MTL_GPU_FAMILY_METAL3: i64 = 5001; @@ -822,7 +822,7 @@ mod tests { identity.sizes.recommended_max_working_set_size.unwrap() ); assert_eq!( - info.sizes[reims_graphics::wire::RGFX_DEVICE_INFO_MAX_BUFFER_LENGTH], + info.sizes[reims_vgpu_graphics::wire::RGFX_DEVICE_INFO_MAX_BUFFER_LENGTH], identity.sizes.max_buffer_length.unwrap() ); // maximum_concurrent_compilation_task_count is the device's compile threads. diff --git a/crates/reims-vgpu/src/graphics/nvidia.rs b/crates/reims-vgpu/src/graphics/nvidia.rs index c1a5fc67e..add0b85d8 100644 --- a/crates/reims-vgpu/src/graphics/nvidia.rs +++ b/crates/reims-vgpu/src/graphics/nvidia.rs @@ -42,17 +42,17 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, LazyLock, Weak}; -use reims_graphics::wire::{ - RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_DECODE, RGFX_VIDEO_ENCODE, - RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, - RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, RGFX_VIDEO_HEVC_MAIN_10, RgfxVideoCodecCaps, - RgfxVideoEncodeCaps, -}; use reims_vgpu_core::platform::Handle as _; use reims_vgpu_core::platform::device::GpuDevice as _; use reims_vgpu_core::platform::resource::Buffer as _; use reims_vgpu_core::raise::OnFault; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::wire::{ + RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_DECODE, RGFX_VIDEO_ENCODE, + RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, + RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, RGFX_VIDEO_HEVC_MAIN_10, RgfxVideoCodecCaps, + RgfxVideoEncodeCaps, +}; use reims_vgpu_video::core::device_memory::{DeviceImports, MemoryIdentity}; use reims_vgpu_video::core::runtime::Runtime; use reims_vgpu_video::nvidia::{ diff --git a/crates/reims-vgpu/src/graphics/nvidia/encode.rs b/crates/reims-vgpu/src/graphics/nvidia/encode.rs index 4e2694cde..2fda13df0 100644 --- a/crates/reims-vgpu/src/graphics/nvidia/encode.rs +++ b/crates/reims-vgpu/src/graphics/nvidia/encode.rs @@ -26,17 +26,17 @@ use std::sync::Arc; -use reims_graphics::ops::video::{ +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::ops::video::{ RGFX_VIDEO_ENTROPY_CABAC, RGFX_VIDEO_ENTROPY_CAVLC, RGFX_VIDEO_PICTURE_B, RGFX_VIDEO_PICTURE_I, RGFX_VIDEO_PICTURE_P, RGFX_VIDEO_RATE_CBR, RGFX_VIDEO_RATE_CQP, RGFX_VIDEO_RATE_VBR, RgfxVideoEncodeSettings, }; -use reims_graphics::wire::{ +use reims_vgpu_graphics::wire::{ RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_ENCODE, RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, RGFX_VIDEO_HEVC_MAIN_10, RgfxVideoCodecCaps, RgfxVideoEncodeCaps, }; -use reims_vgpu_core::sync::Mutex; use reims_vgpu_video::nvidia::{ EncodeParams, EncodeProfile, EncodeProfileSupport, EncodeRateControl, Gpu, NvencEncoder, PictureType, RawFrame, Tuning, diff --git a/crates/reims-vgpu/src/graphics/nvidia/encode/tests.rs b/crates/reims-vgpu/src/graphics/nvidia/encode/tests.rs index 21731b2d3..bc79d2786 100644 --- a/crates/reims-vgpu/src/graphics/nvidia/encode/tests.rs +++ b/crates/reims-vgpu/src/graphics/nvidia/encode/tests.rs @@ -1,14 +1,14 @@ -use reims_graphics::ops::video::{ - RGFX_VIDEO_ENCODE_OK, RGFX_VIDEO_ENCODE_OVERFLOW, RGFX_VIDEO_ENCODED_KEYFRAME, - RGFX_VIDEO_ENCODED_PARAMETER_SETS, RgfxVideoEncodeResult, -}; -use reims_graphics::wire::RGFX_VIDEO_DECODE; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::device::GpuDevice as _; use reims_vgpu_core::platform::event::{EventRef, SharedEvent as _}; use reims_vgpu_core::platform::resource::Buffer as _; use reims_vgpu_core::raise::OnFault; use reims_vgpu_core::testkit::FakePlatform; +use reims_vgpu_graphics::ops::video::{ + RGFX_VIDEO_ENCODE_OK, RGFX_VIDEO_ENCODE_OVERFLOW, RGFX_VIDEO_ENCODED_KEYFRAME, + RGFX_VIDEO_ENCODED_PARAMETER_SETS, RgfxVideoEncodeResult, +}; +use reims_vgpu_graphics::wire::RGFX_VIDEO_DECODE; use reims_vgpu_video::core::runtime::{Runtime, StdRuntime}; use reims_vgpu_video::nvidia::{AnnexBCodec, AnnexBDecoder, GpuSelector, encode_profiles}; use zerocopy::FromBytes; diff --git a/crates/reims-vgpu/src/graphics/present.rs b/crates/reims-vgpu/src/graphics/present.rs index 8a1948387..9957547df 100644 --- a/crates/reims-vgpu/src/graphics/present.rs +++ b/crates/reims-vgpu/src/graphics/present.rs @@ -32,7 +32,7 @@ //! A present of a surface whose device cache holds an older CPU generation than the present's //! waits too for the fill the host commits for it on taking the present (`decode/surface_cache.rs`): //! it is shown once that fill has finished, which tells the queue ([`PresentQueue::filled`]), so -//! the presents' lane that carries the present out (`reims-graphics`' device) waits for nothing on +//! the presents' lane that carries the present out (`reims-vgpu-graphics`' device) waits for nothing on //! the GPU. //! //! **What a present holds.** A present holds its surface's region block from its taking @@ -47,7 +47,7 @@ //! transaction on its answer, and holds at most two unanswered (the kext's `RgfxDisplayPipe`), //! so the answer says the frame is on the display, as a display's flip completes at the vblank //! that latches it: it is given at the first refresh of the device's display (the refresh thread, -//! [`reims_graphics::Host::refreshed`], after that refresh's `VBLANK`) once the window's draw of +//! [`reims_vgpu_graphics::Host::refreshed`], after that refresh's `VBLANK`) once the window's draw of //! it has finished on the host's GPU, the copy out of the surface done, so the guest may draw //! into the surface again. A draw the window drops before its commit, or one that shows the //! scanout in place of a surface it cannot draw, answers its presents at the next refresh too. @@ -73,18 +73,18 @@ //! or its draw done past the first refresh after its take) from one the guest's compositor //! sent late in the refresh, which a guest's present latency alone does not. //! -//! [`RgfxSurfaceWriters`]: reims_graphics::wire::RgfxSurfaceWriters +//! [`RgfxSurfaceWriters`]: reims_vgpu_graphics::wire::RgfxSurfaceWriters use std::collections::{BTreeSet, HashMap, VecDeque}; use std::sync::Arc; use std::time::Duration; -use reims_graphics::wire::{RGFX_CONTEXT_OBJ_ID_SHIFT, RGFX_STATUS_OK, RgfxSurfaceWriter}; -use reims_graphics::{CompletionPoster, PresentAnswer}; use reims_vgpu_core::num::{ToU64 as _, ToUsize as _}; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::os::clock::MonoTime; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::wire::{RGFX_CONTEXT_OBJ_ID_SHIFT, RGFX_STATUS_OK, RgfxSurfaceWriter}; +use reims_vgpu_graphics::{CompletionPoster, PresentAnswer}; use super::color::ColorChange; use super::compile::Now; diff --git a/crates/reims-vgpu/src/graphics/read.rs b/crates/reims-vgpu/src/graphics/read.rs index 928a787d0..3b7134c53 100644 --- a/crates/reims-vgpu/src/graphics/read.rs +++ b/crates/reims-vgpu/src/graphics/read.rs @@ -19,8 +19,6 @@ use std::sync::{Arc, OnceLock}; -use reims_graphics::Screen; -use reims_graphics::region::Region; use reims_vgpu_core::platform::Platform; use reims_vgpu_core::platform::command::CommandBuffer as _; use reims_vgpu_core::platform::descriptor::TextureDescriptor as _; @@ -28,6 +26,8 @@ use reims_vgpu_core::platform::device::GpuDevice as _; use reims_vgpu_core::platform::types::CommandBufferStatus; use reims_vgpu_core::raise::OnFault; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::Screen; +use reims_vgpu_graphics::region::Region; use reims_vgpu_window::PixelRect; use super::sink::ScanoutDraw; diff --git a/crates/reims-vgpu/src/graphics/sink.rs b/crates/reims-vgpu/src/graphics/sink.rs index 667cbb945..643ec3b10 100644 --- a/crates/reims-vgpu/src/graphics/sink.rs +++ b/crates/reims-vgpu/src/graphics/sink.rs @@ -69,8 +69,6 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; -use reims_graphics::Scanout; -use reims_graphics::region::Region; use reims_vgpu_core::host::HostPtr; use reims_vgpu_core::platform::blit::{BlitCmd, BlitEncoder as _}; use reims_vgpu_core::platform::command::{CommandBuffer as _, CommandQueue as _}; @@ -85,6 +83,8 @@ use reims_vgpu_core::platform::values::{ColorAttachmentSet, TextureDesc}; use reims_vgpu_core::platform::{Handle, HostRange, Platform}; use reims_vgpu_core::raise::{OnFault, RaiseResult, refusals}; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::Scanout; +use reims_vgpu_graphics::region::Region; use reims_vgpu_window::PixelRect; use reims_vgpu_core::display::pipeline::{DisplayPipelineCache, PipelineKey}; @@ -95,11 +95,11 @@ use super::color::DisplayColor; use super::{DisplayHold, DrawnPresents, Presented, Shown}; use crate::entry::no_catch; use crate::platform::ApiPlatform; -use reims_graphics::wire::{ - RGFX_COLOR_MATRIX, RGFX_COLOR_PLANE_GAMMA, RGFX_COLOR_POST_GAMMA, RGFX_COLOR_PRE_GAMMA, -}; use reims_vgpu_core::platform::resource::Library as _; use reims_vgpu_core::platform::values::RenderPipelineDesc; +use reims_vgpu_graphics::wire::{ + RGFX_COLOR_MATRIX, RGFX_COLOR_PLANE_GAMMA, RGFX_COLOR_POST_GAMMA, RGFX_COLOR_PRE_GAMMA, +}; /// `MTLLoadActionClear`. const LOAD_ACTION_CLEAR: u64 = 2; @@ -621,7 +621,7 @@ impl ScanoutDraw

{ let height = u64::from(scanout.height) .min(region.height) .min(texture_height - y); - // The scanout's offset and stride are multiples of 4 (`reims_graphics`'s `SET_SCANOUT`), + // The scanout's offset and stride are multiples of 4 (`reims_vgpu_graphics`'s `SET_SCANOUT`), // and its pages' import starts at a page. let read = ScanoutRead { buffer, @@ -1362,7 +1362,7 @@ mod tests { width: 64, height: 32, stride: 256, - offset: reims_graphics::wire::RGFX_ALLOCATIONS_OFFSET, + offset: reims_vgpu_graphics::wire::RGFX_ALLOCATIONS_OFFSET, }; /// A sink over a fresh region, showing a 64 × 32 scanout at the region's allocations, and a @@ -1374,7 +1374,7 @@ mod tests { ::Texture, ) { let platform = Arc::new(FakePlatform::new()); - let region = Arc::new(Region::new(reims_graphics::REGION_SIZE as usize).unwrap()); + let region = Arc::new(Region::new(reims_vgpu_graphics::REGION_SIZE as usize).unwrap()); let shown = Arc::new(Shown::default()); *shown.scanout.lock() = Some(SCANOUT); let presented = Arc::new(Presented::::default()); @@ -2006,11 +2006,11 @@ mod tests { /// [`the_table_draws_what_the_pass_draws`]'s body, inside the library's entry. fn table_draws_what_the_pass_draws(platform: &Arc

) { - use reims_graphics::wire::RGFX_ALLOCATIONS_OFFSET; + use reims_vgpu_graphics::wire::RGFX_ALLOCATIONS_OFFSET; const W: u32 = 3840; const H: u32 = 4; - let region = Arc::new(Region::new(reims_graphics::REGION_SIZE as usize).unwrap()); + let region = Arc::new(Region::new(reims_vgpu_graphics::REGION_SIZE as usize).unwrap()); // Channel c of pixel (x, y) at `n` values: each takes every value along a row. let value = |c: u32, x: u32, y: u32, n: u32| match c { 0 => x % n, diff --git a/crates/reims-vgpu/src/graphics/tests.rs b/crates/reims-vgpu/src/graphics/tests.rs index a8971d77d..2078f5869 100644 --- a/crates/reims-vgpu/src/graphics/tests.rs +++ b/crates/reims-vgpu/src/graphics/tests.rs @@ -1,8 +1,6 @@ use std::sync::atomic::{AtomicU32, AtomicU64, Ordering}; use std::time::Duration; -use reims_graphics::ops::{RGFX_COMMAND_BUFFER_OPS_OFFSET, RgfxCommandBuffer}; -use reims_graphics::wire::*; use reims_vgpu_core::platform::ObjId; use reims_vgpu_core::platform::device::GpuDevice; use reims_vgpu_core::platform::types::CommandBufferStatus; @@ -10,6 +8,8 @@ use reims_vgpu_core::testkit::faults::Fault; use reims_vgpu_core::testkit::impls::device::FAKE_LINEAR_ROW_ALIGNMENT; use reims_vgpu_core::testkit::objects::CompleteOn; use reims_vgpu_core::testkit::{Arg, FakePlatform, HeldCall}; +use reims_vgpu_graphics::ops::{RGFX_COMMAND_BUFFER_OPS_OFFSET, RgfxCommandBuffer}; +use reims_vgpu_graphics::wire::*; use zerocopy::{FromBytes, IntoBytes}; use super::*; @@ -38,12 +38,12 @@ fn headless(raised: &Arc) -> GraphicsDevice { fn a_headless_device_answers_its_guest() { let raised = Arc::new(AtomicU32::new(0)); let device = headless(&raised); - assert_eq!(device.region_size(), reims_graphics::REGION_SIZE); + assert_eq!(device.region_size(), reims_vgpu_graphics::REGION_SIZE); assert!(!device.region_base().is_null()); assert_eq!(device.mmio_read(RGFX_REG_MAGIC.into()), RGFX_MAGIC); assert_eq!( device.mmio_read(RGFX_REG_REGION_SIZE_LO.into()), - (reims_graphics::REGION_SIZE & 0xffff_ffff) as u32 + (reims_vgpu_graphics::REGION_SIZE & 0xffff_ffff) as u32 ); device.mmio_write(RGFX_REG_STATUS.into(), RGFX_STATUS_DRIVER_READY); // SAFETY: the region is the device's, mapped while it lives, and the rings' fields are at @@ -380,7 +380,7 @@ fn command_buffer(queue_obj_id: u64, cb_obj_id: u64) -> Vec { /// [`command_buffer`] with one op, `SUBMITTED`: a buffer that asks for its `CB_SUBMITTED`, as /// `commitAndWaitUntilSubmitted` commits it. fn asking(queue_obj_id: u64, cb_obj_id: u64) -> Vec { - use reims_graphics::ops::{RGFX_OP_SUBMITTED, RgfxOpHeader}; + use reims_vgpu_graphics::ops::{RGFX_OP_SUBMITTED, RgfxOpHeader}; let mut message = command_buffer(queue_obj_id, cb_obj_id); let submitted = RgfxOpHeader { @@ -1049,7 +1049,7 @@ fn a_per_queue_ring_decodes_and_completes_a_command_buffer() { /// its message's length on the way, and it completes as one from the ring does. #[test] fn an_out_of_line_command_buffer_is_carried_out_from_one_copy() { - use reims_graphics::ops::{RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END, RgfxOpHeader}; + use reims_vgpu_graphics::ops::{RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END, RgfxOpHeader}; let platform = Arc::new(FakePlatform::new()); let config = GraphicsConfig { @@ -1674,7 +1674,7 @@ fn an_asking_buffer_s_doorbell_to_its_cb_submitted_behind_a_walk() { #[ignore = "a measurement, run by hand"] #[allow(clippy::disallowed_methods)] // a measurement: the wall clock's time fn a_lone_buffer_s_doorbell_to_its_cb_scheduled() { - use reims_graphics::ops::{RGFX_OP_SUBMITTED, RgfxOpHeader}; + use reims_vgpu_graphics::ops::{RGFX_OP_SUBMITTED, RgfxOpHeader}; use std::time::Instant; const ROUNDS: usize = 2000; @@ -2062,7 +2062,7 @@ fn the_sink_imports_only_the_scanout_s_pages() { const IMPORT: &str = "newBufferWithBytesNoCopy:length:options:deallocator:"; let platform = Arc::new(FakePlatform::new()); - let region = Arc::new(Region::new(reims_graphics::REGION_SIZE as usize).unwrap()); + let region = Arc::new(Region::new(reims_vgpu_graphics::REGION_SIZE as usize).unwrap()); let shown = Arc::new(Shown::default()); let presented = Arc::new(Presented::::default()); let draw = sink::ScanoutDraw::new(Arc::clone(&platform), ®ion, &shown, &presented).unwrap(); @@ -2843,10 +2843,10 @@ fn compute_pipeline_create(obj_id: u64, library: u64) -> Vec { /// A `COMMAND_BUFFER` `cb_obj_id` on queue `queue_obj_id` whose one compute encoder sets compute /// pipeline `pipeline`. fn compute_command_buffer(queue_obj_id: u64, cb_obj_id: u64, pipeline: u64) -> Vec { - use reims_graphics::ops::compute::{ + use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_SET_COMPUTE_PIPELINE_STATE, RgfxComputeOpSetComputePipelineState, }; - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_COMPUTE, RGFX_OP_ENCODER_END, RgfxComputePassDesc, RgfxOpHeader, }; let op = |tag: u16, body: &[u8]| { @@ -3170,11 +3170,11 @@ fn sampler_answered(device: &GraphicsDevice, guest: &mut Guest, ob /// A command buffer whose compute pass binds the sampler `sampler` at index 0. fn sampler_command_buffer(queue_obj_id: u64, cb_obj_id: u64, sampler: u64) -> Vec { - use reims_graphics::ops::compute::{ + use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_SET_SAMPLER_STATES, RgfxComputeOpSetSamplerStates, RgfxComputeSamplerBinding, }; - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_COMPUTE, RGFX_OP_ENCODER_END, RgfxComputePassDesc, RgfxOpHeader, }; let op = |tag: u16, body: &[u8]| { @@ -3689,7 +3689,7 @@ fn a_queue_s_buffer_runs_beside_another_queue_s_walk() { /// `message`, a command buffer, with a `SUBMITTED` op after its ops: it asks for its /// `CB_SUBMITTED`, as `commitAndWaitUntilSubmitted` commits it. fn with_ask(mut message: Vec) -> Vec { - use reims_graphics::ops::{RGFX_OP_SUBMITTED, RgfxOpHeader}; + use reims_vgpu_graphics::ops::{RGFX_OP_SUBMITTED, RgfxOpHeader}; let submitted = RgfxOpHeader { tag: RGFX_OP_SUBMITTED, @@ -4038,7 +4038,7 @@ fn a_held_walk_answered_its_submitted_holds_only_its_process_s_later_commits() { /// whichever slot named it #[test] fn a_reader_in_another_process_waits_on_the_gpu_for_an_answered_writer() { - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END, RGFX_OP_SURFACE_ORDER, RgfxSurfaceOrderWait, }; @@ -4128,7 +4128,7 @@ fn a_reader_in_another_process_waits_on_the_gpu_for_an_answered_writer() { /// which signals what it waits for once the service thread goes on and the buffer is taken #[test] fn a_queue_s_buffers_are_waited_for_before_its_handle_is_made() { - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END, RGFX_OP_SURFACE_ORDER, RgfxSurfaceOrderWait, }; @@ -4227,7 +4227,7 @@ fn a_queue_s_buffers_are_waited_for_before_its_handle_is_made() { /// A command buffer with the ops `ops`, each a tag and its body, on queue `queue_obj_id`. fn command_buffer_of(queue_obj_id: u64, cb_obj_id: u64, ops: &[(u16, &[u8])]) -> Vec { - use reims_graphics::ops::RgfxOpHeader; + use reims_vgpu_graphics::ops::RgfxOpHeader; let mut stream = Vec::new(); for &(tag, body) in ops { @@ -4503,7 +4503,7 @@ const SIDE_ROUNDS: usize = 5; /// carried out whole first (the fake platform schedules each buffer at its commit) #[test] fn a_buffer_behind_one_that_waits_and_is_still_walked_is_answered_at_its_scheduling() { - use reims_graphics::ops::{RGFX_OP_WAIT_EVENT, RgfxOpEvent}; + use reims_vgpu_graphics::ops::{RGFX_OP_WAIT_EVENT, RgfxOpEvent}; let raised = Arc::new(AtomicU32::new(0)); let (device, platform, mut guest, mut ring) = one_queue(&raised); @@ -4543,7 +4543,7 @@ fn a_buffer_behind_one_that_waits_and_is_still_walked_is_answered_at_its_schedul /// and its failure comes after the first's completion #[test] fn a_video_buffer_is_walked_in_its_turn() { - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_BEGIN_VIDEO, RGFX_OP_ENCODER_END, RgfxOpVideoPass, }; @@ -4587,7 +4587,7 @@ fn a_video_buffer_is_walked_in_its_turn() { /// the lane ([`a_video_buffer_is_walked_in_its_turn`]) #[test] fn a_lone_video_buffer_is_walked_on_its_queue_s_service_thread() { - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_BEGIN_VIDEO, RGFX_OP_ENCODER_END, RgfxOpVideoPass, }; @@ -4662,7 +4662,7 @@ fn walk_threads( /// behind its process's buffer on another queue answered its `CB_SUBMITTED` and still walked #[test] fn a_short_buffer_that_waits_for_nothing_is_walked_on_its_queue_s_service_thread() { - use reims_graphics::ops::{RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END}; + use reims_vgpu_graphics::ops::{RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END}; let raised = Arc::new(AtomicU32::new(0)); let (device, platform, _guest, mut ring) = one_queue(&raised); @@ -4835,7 +4835,7 @@ fn a_buffer_that_asks_behind_a_walk_on_its_service_thread_is_answered_before_the /// buffer would wait for nothing #[test] fn a_buffer_named_while_its_queue_s_later_buffer_is_walked_first_is_waited_for() { - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_END, RGFX_OP_SURFACE_ORDER, RgfxSurfaceOrderWait, }; @@ -6515,11 +6515,11 @@ fn shared_event_create(obj_id: u64, initial_value: u64) -> Vec { /// A `COMMAND_BUFFER` `cb_obj_id` on queue `queue_obj_id` that signals shared event `event` to 4, /// draws with render pipeline `pipeline` in a pass of no attachments, and signals `event` to 5. fn render_command_buffer(queue_obj_id: u64, cb_obj_id: u64, pipeline: u64, event: u64) -> Vec { - use reims_graphics::ops::render::{ + use reims_vgpu_graphics::ops::render::{ RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RgfxOpDrawPrimitives, RgfxOpSetRenderPipelineState, }; - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_END, RGFX_OP_SIGNAL_EVENT, RGFX_PASS_FLAG_RT_SIZE, RgfxOpEvent, RgfxOpHeader, RgfxRenderPassDesc, }; @@ -6691,16 +6691,16 @@ fn op_of(tag: u16, body: &[u8]) -> (u16, Vec) { /// refused in turn, and its destroy lets the id go. #[test] fn what_names_a_refused_create_is_dropped_and_its_command_buffer_completes() { - use reims_graphics::ops::blit::{ + use reims_vgpu_graphics::ops::blit::{ RGFX_OP_BLIT_COPY_TEXTURE_TO_BUFFER, RGFX_OP_BLIT_FILL_BUFFER, RgfxBlitOpCopyTextureToBuffer, RgfxBlitOpFillBuffer, }; - use reims_graphics::ops::render::{ + use reims_vgpu_graphics::ops::render::{ RGFX_OP_RENDER_DRAW_PRIMITIVES, RGFX_OP_RENDER_SET_FRAGMENT_TEXTURE, RGFX_OP_RENDER_SET_RENDER_PIPELINE_STATE, RgfxOpDrawPrimitives, RgfxOpSetFragmentTexture, RgfxOpSetRenderPipelineState, }; - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_BLIT, RGFX_OP_ENCODER_BEGIN_RENDER, RGFX_OP_ENCODER_END, RGFX_OP_SIGNAL_EVENT, RGFX_OP_WAIT_EVENT, RGFX_PASS_FLAG_RT_SIZE, RGFX_RENDER_PASS_COLOR_OFFSET, RgfxOpEvent, RgfxRenderPassColorAttachment, @@ -8211,15 +8211,15 @@ fn an_icb_is_written_through_slots_and_executed_through_the_rings() { /// An indirect command buffer made, its command 1 written by the CPU (as slots where `slots`, as /// records else), and executed by a command buffer posted after. fn icb_through_the_rings(slots: bool) { - use reims_graphics::icb::{ + use reims_vgpu_graphics::icb::{ RGFX_ICB_OP_DISPATCH_THREADGROUPS, RGFX_ICB_OP_KERNEL_BUFFER, RGFX_ICB_SLOT_ACTION, RGFX_ICB_SLOT_BUFFER_0, RgfxIcbBuffer, RgfxIcbComputeSlot, RgfxIcbDispatch, RgfxIcbRecord, RgfxIcbSlotBuffer, }; - use reims_graphics::ops::compute::{ + use reims_vgpu_graphics::ops::compute::{ RGFX_OP_COMPUTE_EXECUTE_COMMANDS_IN_BUFFER, RgfxComputeOpExecuteCommandsInBuffer, }; - use reims_graphics::ops::{ + use reims_vgpu_graphics::ops::{ RGFX_OP_ENCODER_BEGIN_COMPUTE, RGFX_OP_ENCODER_END, RgfxComputePassDesc, RgfxOpHeader, }; let raised = Arc::new(AtomicU32::new(0)); @@ -9714,7 +9714,7 @@ fn on_vulkan_a_read_at_an_odd_width_gives_the_scanout_row_for_row() { }; let read = device .read - .at_screen(Arc::new(reims_graphics::FixedScreen(mode))); + .at_screen(Arc::new(reims_vgpu_graphics::FixedScreen(mode))); for (name, messages, want) in &colours { if !messages.is_empty() { for m in messages { @@ -9844,7 +9844,7 @@ fn on_vulkan_a_presented_surface_at_an_odd_width_reads_row_for_row() { }; let read = device .read - .at_screen(Arc::new(reims_graphics::FixedScreen(mode))); + .at_screen(Arc::new(reims_vgpu_graphics::FixedScreen(mode))); for (name, rows, swapped) in [ ("no colour", identity, false), ("red and blue swapped", swap, true), @@ -9926,7 +9926,7 @@ fn noting_raises( /// reach `value` and asks for its `CB_SUBMITTED`: its records go at its scheduling, from its /// submission handler. fn waiting_and_asking(queue_obj_id: u64, cb_obj_id: u64, event: u64, value: u64) -> Vec { - use reims_graphics::ops::{RGFX_OP_SUBMITTED, RGFX_OP_WAIT_EVENT, RgfxOpEvent}; + use reims_vgpu_graphics::ops::{RGFX_OP_SUBMITTED, RGFX_OP_WAIT_EVENT, RgfxOpEvent}; let wait = RgfxOpEvent { event_obj_id: event, @@ -10024,7 +10024,7 @@ fn a_foreign_commit_hands_a_decoder_buffer_s_records_to_its_queue_s_thread() { /// queue's service thread, which posts them, and raises, once the guest has made room #[test] fn a_read_of_the_display_calls_nothing_back_and_waits_for_no_full_ring() { - use reims_graphics::ops::{RGFX_OP_SIGNAL_EVENT, RgfxOpEvent}; + use reims_vgpu_graphics::ops::{RGFX_OP_SIGNAL_EVENT, RgfxOpEvent}; const DATA: u32 = 0x1000; const SIGNALS: u64 = 150; diff --git a/crates/reims-vgpu/src/graphics/vaapi.rs b/crates/reims-vgpu/src/graphics/vaapi.rs index e9f2a8157..ee6d9d216 100644 --- a/crates/reims-vgpu/src/graphics/vaapi.rs +++ b/crates/reims-vgpu/src/graphics/vaapi.rs @@ -34,15 +34,15 @@ use std::path::Path; use std::sync::{Arc, LazyLock, Weak}; -use reims_graphics::wire::{ +use reims_vgpu_core::platform::Handle as _; +use reims_vgpu_core::platform::Platform; +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::wire::{ RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_DECODE, RGFX_VIDEO_ENCODE, RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, RGFX_VIDEO_HEVC_MAIN_10, RgfxVideoCodecCaps, RgfxVideoEncodeCaps, RgfxVideoOutputLayout, }; -use reims_vgpu_core::platform::Handle as _; -use reims_vgpu_core::platform::Platform; -use reims_vgpu_core::sync::Mutex; use reims_vgpu_video::core::backend::DeviceWrite; use reims_vgpu_video::core::device_memory::GuestTarget; use reims_vgpu_video::core::fourcc::FourCc; diff --git a/crates/reims-vgpu/src/graphics/vaapi/encode.rs b/crates/reims-vgpu/src/graphics/vaapi/encode.rs index 8461dc55c..5ed46fcd2 100644 --- a/crates/reims-vgpu/src/graphics/vaapi/encode.rs +++ b/crates/reims-vgpu/src/graphics/vaapi/encode.rs @@ -21,17 +21,17 @@ use std::sync::Arc; -use reims_graphics::ops::video::{ +use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::ops::video::{ RGFX_VIDEO_ENCODE_HARD_LIMIT, RGFX_VIDEO_ENTROPY_CABAC, RGFX_VIDEO_ENTROPY_CAVLC, RGFX_VIDEO_PICTURE_B, RGFX_VIDEO_PICTURE_I, RGFX_VIDEO_PICTURE_P, RGFX_VIDEO_RATE_CBR, RGFX_VIDEO_RATE_CQP, RGFX_VIDEO_RATE_VBR, RgfxVideoEncodeSettings, }; -use reims_graphics::wire::{ +use reims_vgpu_graphics::wire::{ RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_ENCODE, RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, RGFX_VIDEO_HEVC_MAIN_10, RgfxVideoCodecCaps, RgfxVideoEncodeCaps, }; -use reims_vgpu_core::sync::Mutex; use reims_vgpu_video::codec::encode::{ ColourDescription, EncoderSettings, Entropy, FrameRate, FrameType, InputFrame, Plane, Profile as EncodeProfile, RateControl, diff --git a/crates/reims-vgpu/src/graphics/vaapi/encode/tests.rs b/crates/reims-vgpu/src/graphics/vaapi/encode/tests.rs index ef640ce57..7019cdca8 100644 --- a/crates/reims-vgpu/src/graphics/vaapi/encode/tests.rs +++ b/crates/reims-vgpu/src/graphics/vaapi/encode/tests.rs @@ -1,4 +1,4 @@ -use reims_graphics::wire::RGFX_VIDEO_DECODE; +use reims_vgpu_graphics::wire::RGFX_VIDEO_DECODE; use reims_vgpu_video::core::runtime::StdRuntime; use reims_vgpu_video::vaapi::{H264Decoder, HevcDecoder, encoder_support}; diff --git a/crates/reims-vgpu/src/graphics/video_host/encode.rs b/crates/reims-vgpu/src/graphics/video_host/encode.rs index 071104c6c..387951f2f 100644 --- a/crates/reims-vgpu/src/graphics/video_host/encode.rs +++ b/crates/reims-vgpu/src/graphics/video_host/encode.rs @@ -28,17 +28,6 @@ use std::sync::{Arc, mpsc}; -use reims_graphics::ops::video::{ - RGFX_VIDEO_ENCODE_FAILED, RGFX_VIDEO_ENCODE_OK, RGFX_VIDEO_ENCODE_OVERFLOW, - RGFX_VIDEO_ENCODED_KEYFRAME, RGFX_VIDEO_ENCODED_PARAMETER_SETS, RGFX_VIDEO_ENTROPY_CABAC, - RGFX_VIDEO_ENTROPY_CAVLC, RGFX_VIDEO_RATE_CBR, RGFX_VIDEO_RATE_CQP, RGFX_VIDEO_RATE_VBR, - RgfxVideoEncodeResult, RgfxVideoEncodeSettings, -}; -use reims_graphics::wire::{ - RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, - RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, - RGFX_VIDEO_HEVC_MAIN_10, -}; use reims_vgpu_core::host::HostPtr; use reims_vgpu_core::platform::Handle as _; use reims_vgpu_core::platform::Platform; @@ -47,6 +36,17 @@ use reims_vgpu_core::platform::event::{EventRef, SharedEvent as _}; use reims_vgpu_core::platform::resource::Buffer as _; use reims_vgpu_core::raise::{Raise, RaiseResult}; use reims_vgpu_core::sync::Mutex; +use reims_vgpu_graphics::ops::video::{ + RGFX_VIDEO_ENCODE_FAILED, RGFX_VIDEO_ENCODE_OK, RGFX_VIDEO_ENCODE_OVERFLOW, + RGFX_VIDEO_ENCODED_KEYFRAME, RGFX_VIDEO_ENCODED_PARAMETER_SETS, RGFX_VIDEO_ENTROPY_CABAC, + RGFX_VIDEO_ENTROPY_CAVLC, RGFX_VIDEO_RATE_CBR, RGFX_VIDEO_RATE_CQP, RGFX_VIDEO_RATE_VBR, + RgfxVideoEncodeResult, RgfxVideoEncodeSettings, +}; +use reims_vgpu_graphics::wire::{ + RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_FORMAT_NV12, RGFX_VIDEO_FORMAT_P010, + RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, + RGFX_VIDEO_HEVC_MAIN_10, +}; use zerocopy::IntoBytes; use super::super::decode::{Decoded, GraphicsVideoSession, VideoDecode, VideoEncode, op_fault}; diff --git a/crates/reims-vgpu/src/graphics/video_host/encode/tests.rs b/crates/reims-vgpu/src/graphics/video_host/encode/tests.rs index 1bfbc8141..27af393fe 100644 --- a/crates/reims-vgpu/src/graphics/video_host/encode/tests.rs +++ b/crates/reims-vgpu/src/graphics/video_host/encode/tests.rs @@ -1,11 +1,11 @@ use std::collections::VecDeque; -use reims_graphics::ops::video::{RGFX_VIDEO_PICTURE_I, RGFX_VIDEO_PICTURE_P}; -use reims_graphics::wire::RGFX_VIDEO_CODEC_H264; use reims_vgpu_core::raise::OnFault; use reims_vgpu_core::testkit::FakePlatform; use reims_vgpu_core::testkit::calllog::Arg; use reims_vgpu_core::testkit::objects::CompleteOn; +use reims_vgpu_graphics::ops::video::{RGFX_VIDEO_PICTURE_I, RGFX_VIDEO_PICTURE_P}; +use reims_vgpu_graphics::wire::RGFX_VIDEO_CODEC_H264; use zerocopy::FromBytes; use super::super::super::decode::VideoPlane; diff --git a/crates/reims-vgpu/src/graphics/video_host/tests.rs b/crates/reims-vgpu/src/graphics/video_host/tests.rs index 869b74bb6..e0fb13726 100644 --- a/crates/reims-vgpu/src/graphics/video_host/tests.rs +++ b/crates/reims-vgpu/src/graphics/video_host/tests.rs @@ -1,10 +1,10 @@ use std::collections::VecDeque; use std::time::Duration; -use reims_graphics::wire::RGFX_VIDEO_CODEC_H264; use reims_vgpu_core::testkit::FakePlatform; use reims_vgpu_core::testkit::calllog::Arg; use reims_vgpu_core::testkit::objects::CompleteOn; +use reims_vgpu_graphics::wire::RGFX_VIDEO_CODEC_H264; use super::*; diff --git a/crates/reims-vgpu/src/graphics/vulkan.rs b/crates/reims-vgpu/src/graphics/vulkan.rs index c692d05a1..92f4c2e4e 100644 --- a/crates/reims-vgpu/src/graphics/vulkan.rs +++ b/crates/reims-vgpu/src/graphics/vulkan.rs @@ -4,9 +4,9 @@ use std::sync::Arc; -use reims_graphics::region::Region; use reims_vgpu_core::platform::command::CommandBuffer as _; use reims_vgpu_core::raise::OnFault; +use reims_vgpu_graphics::region::Region; use reims_vgpu_vulkan::VulkanPlatform; use reims_vgpu_vulkan::swapchain::{Acquired, Swapchain}; use reims_vgpu_window::{Drawn, DrawnCursor, FrameSink, PixelRect, Presenter, VulkanTarget}; diff --git a/crates/reims-vgpu/src/platform.rs b/crates/reims-vgpu/src/platform.rs index 29bbe093e..184be1a90 100644 --- a/crates/reims-vgpu/src/platform.rs +++ b/crates/reims-vgpu/src/platform.rs @@ -41,10 +41,10 @@ pub trait ApiPlatform: Platform { Box::new(()) } - /// A graphics device's region of `len` bytes (BAR 2, `reims_graphics::region::Region`) in + /// A graphics device's region of `len` bytes (BAR 2, `reims_vgpu_graphics::region::Region`) in /// memory of the platform's own, where its GPUs import that better than private anonymous /// memory; `None` by default, and where the host gives none, for the region's own mapping. - fn graphics_region(&self, len: usize) -> Option { + fn graphics_region(&self, len: usize) -> Option { let _ = len; None } diff --git a/crates/reims-vgpu/src/platform/vulkan.rs b/crates/reims-vgpu/src/platform/vulkan.rs index 81a91ff44..3363c2e6b 100644 --- a/crates/reims-vgpu/src/platform/vulkan.rs +++ b/crates/reims-vgpu/src/platform/vulkan.rs @@ -35,13 +35,13 @@ impl ApiPlatform for VulkanPlatform { /// of its pages, which spares each of the device's submissions the walk of every page amdgpu /// makes of a userptr import; a device that takes the pointer imports it as before. None on /// macOS. - fn graphics_region(&self, len: usize) -> Option { + fn graphics_region(&self, len: usize) -> Option { let memory = reims_vgpu_vulkan::os::RegionMemory::new(u64::try_from(len).ok()?)?; let base = memory.base(); // SAFETY: the memory's `len` bytes from its page-aligned first byte are fresh zeros of a // mapping of its own, read and write, which nothing else reaches and which it unmaps only // as it drops, after the region's last use. - unsafe { reims_graphics::region::Region::over(base, len, Box::new(memory)) } + unsafe { reims_vgpu_graphics::region::Region::over(base, len, Box::new(memory)) } } /// The whole texture, through the runtime's `get_bytes` diff --git a/docs/api.md b/docs/api.md index 29519c44b..f9c049497 100644 --- a/docs/api.md +++ b/docs/api.md @@ -24,7 +24,7 @@ library's `reims-vgpu.ui` on Linux. | 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 | | 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-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 | +| 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 | | Rust API | `reims-vgpu` | the graphics device over the platform: its rings, decoder, display and window, and owned Rust types for its config and callbacks | | C API | `reims-vgpu-c` | a thin FFI layer over the Rust API; cbindgen writes `include/reims_vgpu.h` from it | diff --git a/docs/architecture.md b/docs/architecture.md index 06c996726..0f6f07ccc 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-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-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. | | 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. | @@ -117,7 +117,7 @@ crates/ 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-graphics/ the device's wire, its rings and control, and the C header the guest + reims-vgpu-graphics/ the device's wire, its rings and control, and the C header the guest compiles (include/reims_graphics_wire.h) reims-vgpu/ the Rust API: the graphics device over the platform, and its window reims-vgpu-c/ the C API (cdylib, staticlib, rlib) and include/reims_vgpu.h @@ -141,7 +141,7 @@ preferences domain and no entitlement: the device's options are its config's fie ``` reims-vgpu-core, metal2vulkan-runtime <- reims-vgpu-vulkan <- reims-vgpu-window <- reims-vgpu -reims-graphics, reims-vgpu-video-* <- reims-vgpu <- reims-vgpu-c <- QEMU +reims-vgpu-graphics, reims-vgpu-video-* <- reims-vgpu <- reims-vgpu-c <- QEMU ``` - **The Vulkan platform** (`reims-vgpu-vulkan`) is the library's `Platform`, over @@ -189,7 +189,7 @@ reims-graphics, reims-vgpu-video-* <- reims-vgpu <- reims-vgpu-c <- QEMU theirs (`msg::catch`) and go on. Every `define_class!` method and every block posted to the main thread starts in `BlockEnv::foreign`, which marks the thread as the library's, so a panic there aborts before it unwinds into AppKit. -- **The device** (`reims-graphics`) is the wire and the device's transport (9), with no platform: +- **The device** (`reims-vgpu-graphics`) is the wire and the device's transport (9), with no platform: `reims-vgpu` drives the platform from what it carries. - **The API** (`reims-vgpu`) is where the device meets the platform: its types are generic over an `ApiPlatform`, the OS's default platform by default, so its unit tests run its forwarding on the @@ -479,7 +479,7 @@ so a block that takes a recursive lock its caller holds would re-enter it. (`reims-vgpu.graphics-surfaces-`), ICB creation (`reims-vgpu.icb-create-`), a closed process's releases (`reims-vgpu.graphics-closes-`), video (`reims-vgpu.graphics-video-`) and event waits (`reims-vgpu.graphics-event-waits`). How long a pool keeps an idle thread is - `reims-graphics`'s `keep`. + `reims-vgpu-graphics`'s `keep`. - A worker per serial queue while it has work (it ends after 5 s idle), the process's display thread among them. - Metal's completion threads, and the host's own threads inside a call that may call back (both @@ -546,7 +546,7 @@ points inside or outside their locks. [graphics-kext/design.md](graphics-kext/design.md) is the device's design and wire protocol. In the code: -- **`reims-graphics`** is the wire and the transport, with no platform: `wire` (the registers, the +- **`reims-vgpu-graphics`** is the wire and the transport, with no platform: `wire` (the registers, the region's layout, the rings, the control commands and events, which cbindgen writes into `include/reims_graphics_wire.h` for the guest's kexts and the option ROM), `ops` (the command buffer op stream the guest's bundle serialises), `icb` (the CPU's encodes into an indirect @@ -693,7 +693,7 @@ device for its displays and offers one mode: the preferred mode of the first con 1920 × 1080 when there is none. The framebuffer is the region's memory from `RGFX_ALLOCATIONS_OFFSET`, and `SetMode` points the display at it with `SET_SCANOUT`. Firmware takes no interrupts: a command polls the completion ring for its answer. The registers, rings and -commands are the wire's, from `crates/reims-graphics/include/reims_graphics_wire.h`. +commands are the wire's, from `crates/reims-vgpu-graphics/include/reims_graphics_wire.h`. **The build.** `firmware/Makefile` compiles the C freestanding for `x86_64-unknown-windows`, whose default calling convention is the Microsoft x64 one UEFI uses, at `-Os` with `-Werror`; `lld-link` diff --git a/docs/development.md b/docs/development.md index 1f387b576..c6acea1b2 100644 --- a/docs/development.md +++ b/docs/development.md @@ -95,7 +95,7 @@ doc holds its area's ordering contracts and the measured platform facts it relie | `reims-vgpu-c` | `crates/reims-vgpu-c` | the C API (`rvg_*`, `include/reims_vgpu.h`), which QEMU links; `cdylib`, `staticlib` and `rlib` | | `reims-vgpu-video` | `crates/reims-vgpu-video` | the reims-graphics device's video on the host, independent of the library and QEMU: `core` (what the video arms share), `codec` (the codecs above the hardware, in plain Rust), and on Linux `vaapi` (VA-API through libva) and `nvidia` (NVDEC and NVENC over the CUDA driver API), their libraries loaded at run time | | `reims-vgpu-video-conformance` | `crates/reims-vgpu-video/conformance` | the test streams' readers and writers the video examples use: MP4 in and out, and frames hashed as ffmpeg's `framemd5` does | -| `reims-graphics` | `crates/reims-graphics` | the reims-graphics device (1234:5247, `docs/graphics-kext/design.md`): its wire format, whose C header (`include/reims_graphics_wire.h`) the guest's kext and option ROM include, and its host side | +| `reims-vgpu-graphics` | `crates/reims-vgpu-graphics` | the reims-graphics device (1234:5247, `docs/graphics-kext/design.md`): its wire format, whose C header (`include/reims_graphics_wire.h`) the guest's kext and option ROM include, and its host side | | `xtask` | `xtask` | `cargo xtask`, below | ### Build and test diff --git a/docs/graphics-kext/benchmark.md b/docs/graphics-kext/benchmark.md index c1b91ec8d..16560e337 100644 --- a/docs/graphics-kext/benchmark.md +++ b/docs/graphics-kext/benchmark.md @@ -150,7 +150,7 @@ post-ramp repetitions were few: ours 1748 fps (13), paravirt 1991 fps (6). - **Ours**: QEMU at 23-25%. But every drawable comes back with `presentedTime` 0, counted as dropped, and `nextDrawable` never throttles: the app submitted 254 and 320 frames a second at a 120 Hz display, with the GPU at 59-69% SM. - - With the present trace on (`REIMS_VGPU_LOG=info,reims_graphics=trace`), the host saw one + - With the present trace on (`REIMS_VGPU_LOG=info,reims_vgpu_graphics=trace`), the host saw one `PRESENT_SURFACE` in the 20 s window. So ours gives apps neither present feedback nor display-rate back pressure, and its displayed rate is unmeasured here. That is a lane bug, handed on to be fixed. diff --git a/docs/graphics-kext/design.md b/docs/graphics-kext/design.md index 2a3e79d72..95c981302 100644 --- a/docs/graphics-kext/design.md +++ b/docs/graphics-kext/design.md @@ -774,7 +774,7 @@ sit in BAR0 from 0x800. | 0x03c | `HOST_TIME_HI` | RO | its high 32 bits | **The wire's version.** `VERSION` reads `RGFX_VERSION` -(`crates/reims-graphics/src/wire.rs`), the version of the wire the host +(`crates/reims-vgpu-graphics/src/wire.rs`), the version of the wire the host speaks. The kext's framebuffer and accelerator, and the option ROM, each accept only the version they were built with. They read it right after `MAGIC`, before anything else of the device, and on any other version they @@ -1070,7 +1070,7 @@ before it, is among them, as one posted before it is: the guest writes a surface a CPU lock holds only racing the lock. Every buffer waits for a message of any other type, which the host refuses. The queues' threads read ring 0 ahead of the control thread, each message once, and keep the count -through each context's last message (`reims_graphics`'s `device::backlog`), so +through each context's last message (`reims_vgpu_graphics`'s `device::backlog`), so a buffer behind another process's backlog on ring 0 is decoded at once. Tested by `a_command_buffer_waits_for_no_other_process_s_creates`, `a_command_buffer_waits_for_no_other_process_s_later_object_messages`, @@ -1092,7 +1092,7 @@ at most in a boot on an RTX 5080 host) holds up only that process's later messages and command buffers. A message waits for another context's lane only where it reads what that lane's earlier messages change, and only for messages published before it -(`reims_graphics`'s `device::lanes`): +(`reims_vgpu_graphics`'s `device::lanes`): - a present waits for each lane's `TEXTURE_FROM_IOSURFACE` of its surface's plane 0, its destroy of a texture the host names the surface by, and the close of a context that holds one: the host shows the newest live texture @@ -1122,7 +1122,7 @@ messages change, and only for messages published before it it; a `SURFACE_DOWNLOAD` waits for no other lane, as on the control thread before. -`reims_graphics`'s `device::lanes` lists every message that names a block or +`reims_vgpu_graphics`'s `device::lanes` lists every message that names a block or its pages by offset, and what orders each against the block's lane. A close's job on its lane is its table work: it lets go of the context's @@ -1147,7 +1147,7 @@ Ring 0's threads (`reims-vgpu.graphics-ring0-`) serve the lanes. A lane handed a message while it has no thread is given the thread that went idle last, or one made for it where none waits, and keeps it until it has no message left; the thread then waits for the next lane, and goes once it has -waited 10 s for one (`reims_graphics`'s `keep`). So the device holds as many +waited 10 s for one (`reims_vgpu_graphics`'s `keep`). So the device holds as many threads as it had lanes busy at once in the last 10 s, whichever contexts and blocks they were. With a thread of each lane's own, made as a message came to a lane with none and gone after 1 s with none, every new block's first @@ -1188,7 +1188,7 @@ A queue's thread waiting for ring 0 before it hands a command buffer on is woken once the control thread has taken the messages the buffer waits for, and once its context's lane has carried out the context's among them, and by nothing else but a reset, its queue's end and the device's -(`reims_graphics`'s `device::gate`): no other process's message wakes it. +(`reims_vgpu_graphics`'s `device::gate`): no other process's message wakes it. Tested by `the_gate_wakes_each_waiter_once_what_it_waits_for_holds`, which moves the count and many contexts' lanes at random beside many waiting threads. Beside 75 other processes' queues each waiting on a held create, a @@ -1305,7 +1305,7 @@ fails) it resets it again on the way out; the OS then draws into the firmware's framebuffer, which the firmware's scanout, kept through both resets, still shows. Tested by `a_reset_keeps_the_scanout_and_what_the_guest_writes_there_shows` -(`reims-graphics`) and +(`reims-vgpu-graphics`) and `a_failure_after_the_take_keeps_the_firmware_s_scanout_in_the_window` (`graphics/tests.rs`). @@ -2074,7 +2074,7 @@ shares the CPU's memory: texel block of its format (bytes, width, height). The host reads the copy where the buffer's contents lie: its block, its heap's bytes at its offset (over a block or over a pages block's guest RAM), or a pages block's view. Both sides compute the - copy's linear layout from it (`crates/reims-graphics/src/managed.rs`, + copy's linear layout from it (`crates/reims-vgpu-graphics/src/managed.rs`, `guest/bundle/src/RgfxManagedLayout.hpp`): levels in order, then slices, images and rows of blocks, each row rounded up to 256 bytes. - In the guest, `replaceRegion:` and `getBytes:` are memcpys of the block, and @@ -2603,7 +2603,7 @@ answered guest-side; residency sets (`useResource`/`useHeap` are in); **Where the decoder lives.** In reims-vgpu-core, generic over `P: Platform`, beside the Apple-lane decode it mirrors (same handle machinery, descriptor -structs and `Platform` calls). The reims-graphics crate stays the transport +structs and `Platform` calls). The reims-vgpu-graphics crate stays the transport (rings, region, registers); the decoder consumes ring bytes and drives `Platform`. @@ -2629,7 +2629,7 @@ commit. Each outcome the new design allows is one of those two: keeps naming its objects; the buffer took its context's drain before its view, so the close is answered after the buffer's completion handler. The begin comes after ring 0 has carried out every message of its context's - published before the buffer was taken (`reims_graphics`'s queue gate, "A + published before the buffer was taken (`reims_vgpu_graphics`'s queue gate, "A buffer's wait on ring 0"), so a buffer finds every create its process sent before it. Tested by `a_walk_names_what_its_table_held_at_its_begin`, @@ -2875,7 +2875,7 @@ commit. Each outcome the new design allows is one of those two: finished (not for the fill itself: the fill is committed there, and the present waits for it in the present queue, shown at the fill's completion); and the device's reset, for every message in flight. A context's close waits for no - walk: `reims_graphics` fences each of its queues, which waits only for a take + walk: `reims_vgpu_graphics` fences each of its queues, which waits only for a take of the queue's submission ring or a post onto its completion ring under way, and the close is answered once its buffers have finished (`a_close_during_a_walk_holds_up_nothing_on_ring_0`). A doorbell's take tries @@ -2895,7 +2895,7 @@ commit. Each outcome the new design allows is one of those two: `reims-graphics-pci` sends that write through `_mmio_write_taking` too. - **The answer at the doorbell.** A queue's doorbell write, on the guest's vCPU, may answer `CB_SUBMITTED` to the buffer at the head of the queue's ring - before the queue's thread wakes to take it (`reims_graphics`'s + before the queue's thread wakes to take it (`reims_vgpu_graphics`'s `Device::mmio_write_taking`), where the buffer would get it at its take and nothing need be waited for or allocated: the vCPU copies the message onto its stack, reads its ops where they lie, and tries every lock it takes. It reads @@ -2938,7 +2938,7 @@ commit. Each outcome the new design allows is one of those two: A buffer the doorbell leaves to the queue's thread because ring 0 is behind (a create of its process's not yet carried out) is offered the same way on the lane's thread whose carrying out ends the queue's thread's wait, before - that thread is woken (`reims_graphics`'s queue gate, its offers), so its + that thread is woken (`reims_vgpu_graphics`'s queue gate, its offers), so its `CB_SUBMITTED` no longer waits for the queue's thread's wake (`a_buffer_behind_its_process_s_create_is_answered_on_the_lane_s_thread`). Tested by `a_doorbell_s_answer_allocates_nothing` and diff --git a/docs/lessons.md b/docs/lessons.md index 30cea1a2d..e64e77b6a 100644 --- a/docs/lessons.md +++ b/docs/lessons.md @@ -59,13 +59,13 @@ one. A new trap found the same way goes here. - An archived tree's files carry their commit's time, so cargo can take a dependency's new sources for its old build. `git archive` stamps each file with the commit's time and `tar -x` keeps it, and `rsync -a` keeps the source's times; cargo calls a path dependency fresh when none of its source files is newer than its last build. Exporting a newer metal2vulkan commit over a tree built after that commit's date left the runtime `Fresh`: one cargo command reported a new item missing while another, which rebuilt, compiled it. After every extract, stamp the files with the time of extraction (`tar -xm`, or `find

-type f -exec touch {} +`), and check that the next build's log shows `Compiling metal2vulkan`. When one cargo command sees a dependency's new item and another does not, or `cargo build -v` prints `Fresh` for a dependency whose sources just changed, look at the sources' times. - rustc's incremental state can fail a build that is sound. After an edit to `reims-vgpu-vulkan`, an incremental `cargo clippy --workspace --all-targets --all-features` failed in `reims-vgpu` with E0275, an overflow evaluating `metal2vulkan_runtime::heap::HeapShared: Send` for the window's Vulkan sink, whose auto-trait walk through the runtime's types runs near the recursion limit, or with an internal compiler error, "encountered incremental compilation error with evaluate_obligation". The incremental cache keeps the result of one order of that walk, and the edited crate's build takes another; a comment appended to a file of the crate reproduces it, and a build of `reims-vgpu` from nothing passes, as does one with `CARGO_INCREMENTAL=0`. The cure is `cargo clean -p reims-vgpu` before the check. How to spot the next one: an E0275 or an ICE naming `evaluate_obligation` in a crate the change did not touch, after an edit to a crate it depends on, that a clean build of that crate does not show. - A submodule shared by several worktrees has one `core.worktree`. When a superproject worktree's `vendor/qemu` is a linked worktree of the main checkout's module repository (`.git/modules/vendor/qemu/worktrees/`), `git submodule update` there writes that worktree's path into the module's config, which every worktree of it shares. From then on every git command in the main checkout's `vendor/qemu` acts on the other worktree's files: a fast-forward moves the main checkout's branch and writes the other directory, the main checkout's own files stay at the old commit, and `git status` and `git diff` report the other tree's state. `git -C vendor/qemu rev-parse --show-toplevel` must print the main checkout's `vendor/qemu`; restore it with `git config --file .git/modules/vendor/qemu/config core.worktree ../../../../vendor/qemu`, run from outside the submodule, since git reads the broken config before any flag. Give a worktree that builds QEMU its own clone of the submodule, or leave its submodule uninitialised, and remove a linked worktree of the module with `rm -rf` and `git worktree prune`, never `git worktree remove`. When a submodule's status contradicts its files (`git diff` shows a change `git hash-object` does not), suspect `core.worktree`. -- A test nextest calls leaky on macOS need leak nothing. nextest marks a test `LEAK` when its standard output or error is still open 100 ms after its process exits, which only another process holding the pipe can do. On macOS, std makes a child's pipes with `pipe()` and only then sets close-on-exec on them (`library/std/src/sys/pipe/unix.rs`: macOS has no `pipe2`), and nextest starts tests from several threads at once, so a test started in that window inherits the write end of the output of the test started beside it and holds it until it exits. **Measured** with cargo-nextest 0.9.140 on the M3 Max (macOS 27.0.1), with a probe whose tests only read their own descriptors and sleep: 14 of 1,440 test processes started holding a pipe's write end without `FD_CLOEXEC`, each that of a test started within 7 ms of it; with tests of 10 ms and 800 ms alternating, 3 of 720 short tests were reported leaky, each one whose output a long test started beside it held. reims-graphics' device tests, which spawn nothing, were leaky in car 12's and car 13's checks (they start among the first, beside the long Vulkan tests), and so was a test of a pure function there (`device::backlog::tests::a_message_is_its_context_s_by_its_id_or_its_field`, 1 of 2,440 runs). A leak is a pass, and the test cannot prevent it. How to spot the next one: a `LEAK` on a test that starts no process, at random among tests started together; a test that leaves a child holding its output leaks in every run. +- A test nextest calls leaky on macOS need leak nothing. nextest marks a test `LEAK` when its standard output or error is still open 100 ms after its process exits, which only another process holding the pipe can do. On macOS, std makes a child's pipes with `pipe()` and only then sets close-on-exec on them (`library/std/src/sys/pipe/unix.rs`: macOS has no `pipe2`), and nextest starts tests from several threads at once, so a test started in that window inherits the write end of the output of the test started beside it and holds it until it exits. **Measured** with cargo-nextest 0.9.140 on the M3 Max (macOS 27.0.1), with a probe whose tests only read their own descriptors and sleep: 14 of 1,440 test processes started holding a pipe's write end without `FD_CLOEXEC`, each that of a test started within 7 ms of it; with tests of 10 ms and 800 ms alternating, 3 of 720 short tests were reported leaky, each one whose output a long test started beside it held. reims-vgpu-graphics' device tests, which spawn nothing, were leaky in car 12's and car 13's checks (they start among the first, beside the long Vulkan tests), and so was a test of a pure function there (`device::backlog::tests::a_message_is_its_context_s_by_its_id_or_its_field`, 1 of 2,440 runs). A leak is a pass, and the test cannot prevent it. How to spot the next one: a `LEAK` on a test that starts no process, at random among tests started together; a test that leaves a child holding its output leaks in every run. - nextest's `--stress-count` with `--no-fail-fast` exits with the last iteration's status only. **Measured** with cargo-nextest 0.9.140: a test that failed in iteration 1 of 3 and passed in 2 and 3 exited 0, under the summary `3/3 stress run iterations: 2 passed, 1 failed`; without `--no-fail-fast` the first failure stops the run and it exits 100. Count failures from the summary line, never from the exit code. - kache shares nothing with a target directory built without it. kache keys a unit by the contents of its dependencies' outputs, and rustc under kache writes other bytes than rustc alone (kache remaps the build's paths), so in a target directory cloned from a build without kache every workspace crate's dependencies differ from those the store's entries were built on: each misses, compiles and is stored under a key no other tree uses. **Measured** on the M3 Max: a new worktree whose target directory was cloned from a seed built without kache missed all 72 of the workspace's units (the tests of `cargo xtask check`'s features, 410 s), where one with an empty target directory hit 11 of the workspace's 12 libraries and 119 of its 120 dependencies (170 to 232 s). Start a target directory empty, or from one built through kache. How to spot the next one: `kache explain CRATE` names `externs` among the key groups a workspace crate's miss differs in. - kache serves a build script's recorded run to a build whose environment the script reads differently. kache keys a run by the script binary, the variables Cargo itself sets and the script's `rerun-if-*` declarations (kache 2.0.0, `src/build_script.rs`), and SDL's script declares none of the C flags or `MACOSX_DEPLOYMENT_TARGET` that `cargo xtask dist` gives it, so dist's SDL, built again after `cargo clean -p sdl3-sys`, came from a run of a plain build on the host: its globals stayed common and its objects were built for the SDK's macOS, and the archive check failed (**measured** on the M3 Max). dist now turns the build-script cache off for its build (`KACHE_BUILD_SCRIPT_CACHE=0`). How to spot the next one: a build step that changes a dependency's build through the environment alone (an `[env]` entry, a variable the script never declares) and then sees no change in its output. - A link with LTO drops the standard library's `__isPlatformVersionAtLeast` from an executable. rustc links macOS binaries with no default libraries, so no compiler-rt; std's weak definition resolves the calls that C built for an older macOS makes for its `@available` checks, until LTO, which keeps only what Rust code reaches: `cargo nextest run --release` after `cargo xtask dist --release` in the same target directory failed to link SDL (built by dist for macOS 11.0) with the symbol undefined, where a dev build linked (**measured** with rustc 1.98.1 and 1.99.1). The window crate's build script links compiler-rt's builtins, unbundled. How to spot the next one: a native library that links in debug builds and not in release, its missing symbol one of compiler-rt's. - A test that faults the GPU fails the tests beside it, and they pass alone. Every process on a Mac shares its GPU: a fault there is a GPU recovery, and each command buffer another process has in flight fails as its victim ("Discarded (victim of GPU error/recovery)", `kIOGPUCommandBufferCallbackErrorInnocentVictim`), WindowServer's among them. `client_direction`'s `metal_drops_small_blits_into_the_texture` faults it on purpose, 84 GPU events in its 1.8 s, and every `cargo xtask check` on the M3 Max failed 9 to 14 tests that ran beside it: the YCbCr sweeps, the extended-range blends (whose Metal side then read zeros), the in-flight detaches, `new_images` (**measured**, macOS 27.0.1). The behaviour-lock suite's runner, since deleted, had long run such scenarios alone (`exclusive=True`); nextest ran them with the rest. `.config/nextest.toml` then ran it first, with nothing else in flight: five runs of the check's tests after that (three of them whole checks) failed no GPU test, where two runs without it, beside them, failed 10 and 7. The check's "Insufficient Memory" failures (the unreached-tiles and dont-care-load tests) were not pinned to one test: the largest, `a_reservation_of_2_31_minus_1_is_metals`, holds 16 GiB for about a second (its peak footprint, six times any other's) and runs alone too. Both are now opt-in (`#[ignore]`), run only for a change to what they test: a GPU recovery fails the work of every process on the Mac, WindowServer's and the terminal's included, so a stress loop of the fault test restarted the GPU under the owner's desktop (macOS 27.0.1, M3 Max, 2026-11-05: WindowServer's command buffers took GPU address faults and the display was flushed to recover). How to find the next one: macOS logs each GPU event (`log show --predicate 'eventMessage CONTAINS "Handling GPU event"'`, from ReportCrashService) and each failed command buffer with its process (`eventMessage CONTAINS "Execution of the command buffer"`); run the tests one at a time (`-j1`) under a test runner that logs each test's pid and start (`CARGO_TARGET__RUNNER`), and the test that started last before a burst of GPU events is the one that faults. `/usr/bin/time -l` as the runner gives each test's peak memory footprint, the GPU's memory included. - A busy kernel holds work in flight for its time on the device, and for nothing else. The Vulkan crate's tests sized `spin.metal`'s rounds for the M3 Max, about 60 µs a round, which an RTX 5080 Laptop GPU runs in about 0.28 µs: `an_unmap_in_a_deallocator_waits_for_the_import`'s fixed 1,000 rounds held about 0.3 ms there. The paging discard tests sized theirs to half a second from one run of 2,000 rounds, which on the 5080 is mostly the run's submission and completion (2.2 ms, about 0.6 ms of it the kernel's), so they held about 130 ms; and the steps the hold had to cover, two imports of host memory, waited in NVIDIA's driver lock while the other test processes made their devices, for up to 455 ms, past any kernel a test may run (a ring held past 2 s resets on an amdgpu host). Under the crate's whole run the paging tests failed in 7 and 3 of 9 runs, and every one passed alone (**measured**, 2026-10-26, NVIDIA 615.71.09). `gpu::spin` now sizes the kernel from a timed run of 50 ms or more, and the paging tests run alone on Linux (`.config/nextest.toml`), each checking that its hold outlasted its reads and running again where it did not. How to spot the next one: a test that holds the GPU with a fixed count of rounds, or that reads what the runtime holds while a kernel runs, after a call that enters the driver. -- A header the library shares with the option ROM is one of the ROM's sources. `crates/reims-graphics/include/reims_graphics_wire.h` is compiled into `firmware/prebuilt/ReimsGraphics.rom`, and the ROM's record, `firmware/prebuilt/ReimsGraphics.toml`, holds the header's sha256. A change that added a feature bit, a flag and a record to the wire for the GL renderer's private render state passed the library's checks, which build no firmware. It landed and left development failing reims-ctl's `cargo test` (`the_prebuilt_rom_is_built_from_the_trees_sources`) and `cargo xtask check`'s `make -C firmware prebuilt-check`. The ROM built again had the same bytes: only the record was stale. How to spot the next one: a diff that touches the wire header, or any other file the record names, runs `make -C firmware prebuilt` on a Mac in the same branch and commits the ROM and its record with it; `make -C firmware prebuilt-check` names each file that changed. +- A header the library shares with the option ROM is one of the ROM's sources. `crates/reims-vgpu-graphics/include/reims_graphics_wire.h` is compiled into `firmware/prebuilt/ReimsGraphics.rom`, and the ROM's record, `firmware/prebuilt/ReimsGraphics.toml`, holds the header's sha256. A change that added a feature bit, a flag and a record to the wire for the GL renderer's private render state passed the library's checks, which build no firmware. It landed and left development failing reims-ctl's `cargo test` (`the_prebuilt_rom_is_built_from_the_trees_sources`) and `cargo xtask check`'s `make -C firmware prebuilt-check`. The ROM built again had the same bytes: only the record was stale. How to spot the next one: a diff that touches the wire header, or any other file the record names, runs `make -C firmware prebuilt` on a Mac in the same branch and commits the ROM and its record with it; `make -C firmware prebuilt-check` names each file that changed. - A reference decoder can be the one that is wrong. The guest lane's HEVC check compared each frame the guest decoded with ffmpeg 9.0.2's software decode, and two streams coded with 16x16 CTBs (1366x766 and a 1280x720 bisect of it) differed on most frames. A bisect of x265's options pinned it to CTU 16 with SAO and deblocking both on, and the difference was first taken for a bug of NVIDIA's decoder, with a host self-check planned to refuse such streams. It was ffmpeg: x265's reconstruction (`--recon`) of the same streams equals NVIDIA's decode (through the core, ffmpeg's Vulkan hwaccel and NVDEC), VideoToolbox's on an M3 Max and the guest's on every frame, and ffmpeg's software decode differs from all four (**measured**, 2026-11-03; upstream report 98). `hevc-check.sh` had already found the same difference on AMD's decoders and checks against the reconstruction where the two differ; a check written later against ffmpeg alone met it again. How to spot the next one: when hardware decoders disagree with a software reference, compare each with the encoder's own reconstruction, and with a second vendor's hardware, before calling the hardware wrong; a check that has one software reference has none for the streams that reference gets wrong. - A test built from a model of a guest's struct checks the writer, never the model. The guest driver's HEVC writer read AppleGVA's short-term sets with the delta lists at `+0xe8` and the flags after them; at `+0xe8` a predicted set held bytes of 1, which was read as "AppleGVA keeps the prediction's syntax but not the pictures", and the writer gained a derivation of its own (7-61, 7-62). The unit tests built AppleGVA's form of the stream from the same layout, so they passed, and the guest refused the stream's SPS on every picture. A dump of AppleGVA's real struct, compared with the stream's own syntax at every field, showed the flags at `+0xe8` and `+0xf8` and the deltas at `+0x108` and `+0x148`, every set's pictures derived by AppleGVA itself (**measured**, 2026-11-03, `hevc-main-720p-sets-sps`, 25 sets). How to spot the next one: before reading meaning into a field of a guest-held record, dump the record for an input whose every value is known and match each field to it; where only one stream exercises a field, the tests that model it say nothing about the guest. diff --git a/docs/qemu.md b/docs/qemu.md index 0e0d857ab..9cb2d30be 100644 --- a/docs/qemu.md +++ b/docs/qemu.md @@ -180,7 +180,7 @@ is its transport: 4 GiB (`-machine q35,...,max-ram-below-4g=1G`): with q35's default of 2 GiB there, BAR 2 gets no address and the kext finds no region (docs/graphics-kext/design.md, the region; `REGION_SIZE` in - `crates/reims-graphics/src/device.rs`). `reims-ctl` gives its x86-64 VMs + `crates/reims-vgpu-graphics/src/device.rs`). `reims-ctl` gives its x86-64 VMs the device by default and adds the option with it (`crates/reims-ctl/src/qemu.rs`). Another host that adds the device adds the option too. Where it does not, the device's realize warns, naming the diff --git a/docs/testing.md b/docs/testing.md index 270f95b05..09c053873 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -19,7 +19,7 @@ How the code is tested, and how a claim about Metal or the hardware says where i so and [accuracy-ledger.md](accuracy-ledger.md) has the row. - **The C API's tests** (`crates/reims-vgpu-c/tests`): its exports, and a host in C built against the committed header and linked with the shared library. -- **The wire's header** (`crates/reims-graphics/tests/header.rs`) compiles as the guest's kext and +- **The wire's header** (`crates/reims-vgpu-graphics/tests/header.rs`) compiles as the guest's kext and option ROM compile it, as C11 and as C++17 with no warning, its records laid out as `wire`'s. - **The host video backends** have hardware tests and conformance runs of their own ([video/](video/)). diff --git a/docs/video/devices.md b/docs/video/devices.md index 912349baf..ed8a9d85a 100644 --- a/docs/video/devices.md +++ b/docs/video/devices.md @@ -5,8 +5,8 @@ host's hardware. The guest's video driver, in our Metal bundle, is AppleGVA's ve ([docs/graphics-kext/design.md](../graphics-kext/design.md), "Decided", 16); it decodes, and sends no encode op yet. This file is the host's side: what it answers the guest, and what a decode and an encode do. The wire's records and their -fields are documented where they are defined: `crates/reims-graphics/src/wire.rs` (the caps and -the session) and `crates/reims-graphics/src/ops/video.rs` (the ops). +fields are documented where they are defined: `crates/reims-vgpu-graphics/src/wire.rs` (the caps and +the session) and `crates/reims-vgpu-graphics/src/ops/video.rs` (the ops). ## Which hardware diff --git a/firmware/Makefile b/firmware/Makefile index 5c9fd4762..c1ebf689a 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -1,7 +1,7 @@ # The option ROM: the reims-graphics device's UEFI driver (src/), linked as an # x86-64 EFI boot-service driver and packaged as a PCI option ROM # (docs/graphics-kext/design.md), built on the host's wire protocol header in -# ../crates/reims-graphics/include. +# ../crates/reims-vgpu-graphics/include. # # make build/ReimsGraphics.{efi,rom} # make prebuilt on a Mac, also prebuilt/ReimsGraphics.rom, which reims-ctl carries, and @@ -36,7 +36,7 @@ LDFLAGS = /nologo /nodefaultlib /dll /driver /base:0 /machine:x64 \ /opt:ref /align:32 /filealign:32 /Brepro GNAME = ReimsGraphics -WIRE = ../crates/reims-graphics/include +WIRE = ../crates/reims-vgpu-graphics/include # The ROM's PCI identity is the host wire header's. It is generated C, not # assembler, so its macro values are read with the preprocessor and passed to diff --git a/firmware/ambrosia/Makefile b/firmware/ambrosia/Makefile index e27ba301f..84f948a80 100644 --- a/firmware/ambrosia/Makefile +++ b/firmware/ambrosia/Makefile @@ -1,7 +1,7 @@ # The reims-graphics device's driver module for Ambrosia, the boot firmware of # arm64 macOS guests on QEMU's vmapple machine (ReimsGraphicsModule.c, and # AmbrosiaGraphics.h for the interface), built on the host's wire protocol -# header in ../../crates/reims-graphics/include, and a configuration bundle +# header in ../../crates/reims-vgpu-graphics/include, and a configuration bundle # that starts it. # # make build/ReimsGraphics.elf, the module @@ -17,7 +17,7 @@ CC = clang LD = ld.lld BUILD = build -WIRE = ../../crates/reims-graphics/include +WIRE = ../../crates/reims-vgpu-graphics/include # Freestanding aarch64 code that runs at any address. The PCIe window, where # the device's BARs are, is device memory to the module, so no access may be diff --git a/firmware/prebuilt/ReimsGraphics.toml b/firmware/prebuilt/ReimsGraphics.toml index 133c15156..6e3ac068e 100644 --- a/firmware/prebuilt/ReimsGraphics.toml +++ b/firmware/prebuilt/ReimsGraphics.toml @@ -6,8 +6,8 @@ rom = "749434f87f562895548f60681cd4cd8bf6cc0d0e967ac2fea297674426709161" [sources] -"crates/reims-graphics/include/reims_graphics_wire.h" = "b342f13f123ac97a69974028d7d8930c4d550e90cc523506971e63247c78fcd7" -"firmware/Makefile" = "4801350156e36154dcc7bbb0e7c89e4e618cfc942b1e9ee499d284576d85ebb3" +"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "1e83cbe0717fbc77dc7633e04801cd6bf620be324991b15ca255d838eabda178" +"firmware/Makefile" = "d85b14a3b40cc59b7c07a9e3a3a273c257e81c5674963c70c3c45eb386e653d0" "firmware/src/OptionRom.S" = "b910fe61a880580996a81134fba75900d3a9f48ca266e76fe2d6b8eb5a011eb9" "firmware/src/ReimsGraphics.c" = "554751ff15edbdf69a038d5b2aefd8315b9c54610c090c0890d9c72b13dacdef" "firmware/src/ReimsGraphics.h" = "83e3439b9baf9c06ee75c57537792770efa7a5cb07e22bf1fb47f6ffef7af169" diff --git a/guest/bundle/Makefile b/guest/bundle/Makefile index cbbb2103d..ae12ef5c5 100644 --- a/guest/bundle/Makefile +++ b/guest/bundle/Makefile @@ -69,7 +69,7 @@ SDK ?= $(shell xcrun --sdk macosx --show-sdk-path) # the spaces before a `#`, and a trailing space breaks the object paths below. ARCH ?= x86_64 NATIVE ?= $(shell uname -m) -WIRE = ../../crates/reims-graphics/include +WIRE = ../../crates/reims-vgpu-graphics/include BUILD = build CXX = xcrun clang++ @@ -419,7 +419,7 @@ $(BUNDLEBIN): $(CORE_OBJ_ARCH) $(SHELL_OBJ_ARCH) $(VIDEO_OBJ_ARCH) Makefile PACKAGE = $(BUILD)/package/reims-graphics.bundle PACKAGETGZ = $(BUILD)/reims-graphics.bundle.tgz -WIRE_H = ../../crates/reims-graphics/include/reims_graphics_wire.h +WIRE_H = ../../crates/reims-vgpu-graphics/include/reims_graphics_wire.h WIRE_VERSION = $(shell sed -n 's/^\#define RGFX_VERSION \([0-9][0-9]*\)$$/\1/p' $(WIRE_H)) package: $(PACKAGETGZ) diff --git a/guest/bundle/src/RgfxEncoder.hpp b/guest/bundle/src/RgfxEncoder.hpp index 304b49711..501b85afe 100644 --- a/guest/bundle/src/RgfxEncoder.hpp +++ b/guest/bundle/src/RgfxEncoder.hpp @@ -23,7 +23,7 @@ * render-encoder op bodies (`RgfxOp*`), the compute-encoder op bodies * (`RgfxComputeOp*`) and the blit-encoder op bodies (`RgfxBlitOp*`), together with * the pass and element records, all come from the committed header - * (`reims_graphics_wire.h`), generated from the crates/reims-graphics/src/ops + * (`reims_graphics_wire.h`), generated from the crates/reims-vgpu-graphics/src/ops * modules. The * op structs carry a per-group prefix because several names (`UpdateFence`, * `WaitForFence`, `ExecuteCommandsInBuffer`, ...) recur across the render, compute diff --git a/guest/bundle/src/RgfxIcbSlotTable.hpp b/guest/bundle/src/RgfxIcbSlotTable.hpp index 843f17bdb..a25626bde 100644 --- a/guest/bundle/src/RgfxIcbSlotTable.hpp +++ b/guest/bundle/src/RgfxIcbSlotTable.hpp @@ -1,6 +1,6 @@ /* * RgfxIcbSlotTable: an indirect command buffer's CPU encodes as slots in a block of the process's - * region, where the host took ICB_SLOTS (crates/reims-graphics/src/icb.rs, "Slots"). Each command + * region, where the host took ICB_SLOTS (crates/reims-vgpu-graphics/src/icb.rs, "Slots"). Each command * has a slot of its own, `stride` bytes from the next; a setter writes its field there and sets * the field's bit in the slot's mask with an atomic OR, as a GPU's driver writes a command's * record into memory the GPU reads, and posts nothing. The flush (RgfxSerializer::flushIcbWrites) diff --git a/guest/bundle/src/RgfxIndirectCommandBuffer.h b/guest/bundle/src/RgfxIndirectCommandBuffer.h index c61e2d8cf..f9ec716d0 100644 --- a/guest/bundle/src/RgfxIndirectCommandBuffer.h +++ b/guest/bundle/src/RgfxIndirectCommandBuffer.h @@ -9,7 +9,7 @@ * encoding through one reaches it). The guest keeps no commands of its own: each CPU encode, a * setter or a draw on a command, reaches the host's buffer before the next command buffer the * process posts, so a command buffer sees every encode made before its commit, as on every Mac - * (measured: M3 Max, AMD 5300M, Intel 630; docs in crates/reims-graphics/src/icb.rs). Where the + * (measured: M3 Max, AMD 5300M, Intel 630; docs in crates/reims-vgpu-graphics/src/icb.rs). Where the * device took ICB_SLOTS, an encode is written into the command's slot in a block of the * process's region, as a GPU's driver writes a command's record, and the flush before a commit * names the commands written (RgfxIcbSlotTable.hpp); else, and for a buffer whose shape a slot does diff --git a/guest/bundle/src/RgfxManagedLayout.hpp b/guest/bundle/src/RgfxManagedLayout.hpp index ca8d2d6dc..cef84584f 100644 --- a/guest/bundle/src/RgfxManagedLayout.hpp +++ b/guest/bundle/src/RgfxManagedLayout.hpp @@ -8,7 +8,7 @@ * stencil, PVRTC and the three-component 8/16/32-bit formats have none: their textures keep * no CPU copy. * - RgfxManagedLayout: where each level and slice lies in the copy. The host computes the same - * layout from the create's fields (crates/reims-graphics/src/managed.rs, whose test holds the + * layout from the create's fields (crates/reims-vgpu-graphics/src/managed.rs, whose test holds the * cases tests/shell_tests.mm does): every level in order; each level its slices (the array's * elements, six faces a cube); each slice its images (the level's depth for a 3D texture, * else one); each image its rows of blocks, each row's bytes rounded up to diff --git a/guest/bundle/src/RgfxMetalDevice+CommandBuffer.mm b/guest/bundle/src/RgfxMetalDevice+CommandBuffer.mm index 25af49196..cabc220e0 100644 --- a/guest/bundle/src/RgfxMetalDevice+CommandBuffer.mm +++ b/guest/bundle/src/RgfxMetalDevice+CommandBuffer.mm @@ -18,7 +18,7 @@ namespace { // A queue's submission and completion ring byte-ring sizes (each a power of two). The -// host's ring loop (crates/reims-graphics/src/device.rs) posts this queue's command- +// host's ring loop (crates/reims-vgpu-graphics/src/device.rs) posts this queue's command- // buffer completions on its own completion ring, so the queue reads that ring (not the // device's control completion ring); see newCommandQueue. constexpr uint32_t kQueueSubmitDataSize = 32768; diff --git a/guest/bundle/src/RgfxReplyReader.cpp b/guest/bundle/src/RgfxReplyReader.cpp index 451d2de23..4b2a4334e 100644 --- a/guest/bundle/src/RgfxReplyReader.cpp +++ b/guest/bundle/src/RgfxReplyReader.cpp @@ -1,6 +1,6 @@ /* * RgfxReplyReader: the guest completion-ring consumer (RgfxReplyReader.hpp). Mirrors - * the host producer in crates/reims-graphics/src/ring.rs: the host writes a message, + * the host producer in crates/reims-vgpu-graphics/src/ring.rs: the host writes a message, * publishes `producer` with a release store and pads to the ring's end so a message * never wraps; this reads `producer` with an acquire load, walks whole messages from * its own `consumer` count skipping pads, and publishes `consumer` with a release diff --git a/guest/bundle/src/RgfxReplyReader.hpp b/guest/bundle/src/RgfxReplyReader.hpp index 7309d6ed7..448544b9a 100644 --- a/guest/bundle/src/RgfxReplyReader.hpp +++ b/guest/bundle/src/RgfxReplyReader.hpp @@ -1,7 +1,7 @@ /* * RgfxReplyReader: the guest's end of a host-to-guest completion ring — the consumer - * mirror of the host producer in crates/reims-graphics/src/ring.rs (Producer) and - * crates/reims-graphics/src/device.rs (ControlCompletionPoster). It reads the host's + * mirror of the host producer in crates/reims-vgpu-graphics/src/ring.rs (Producer) and + * crates/reims-vgpu-graphics/src/device.rs (ControlCompletionPoster). It reads the host's * reply messages off the ring and dispatches each to the wrapper that is waiting on * it: * - RGFX_EVT_CB_SUBMITTED (RgfxCbSubmitted) -> the command buffer whose submission diff --git a/guest/bundle/src/RgfxRingWriter.cpp b/guest/bundle/src/RgfxRingWriter.cpp index eb6b3302b..9f688ebb1 100644 --- a/guest/bundle/src/RgfxRingWriter.cpp +++ b/guest/bundle/src/RgfxRingWriter.cpp @@ -1,7 +1,7 @@ /* * RgfxRingWriter: the guest producer's reserve-write-publish-doorbell step * (RgfxRingWriter.hpp). Mirrors the host consumer in - * crates/reims-graphics/src/ring.rs. + * crates/reims-vgpu-graphics/src/ring.rs. */ #include "RgfxRingWriter.hpp" diff --git a/guest/bundle/src/RgfxRingWriter.hpp b/guest/bundle/src/RgfxRingWriter.hpp index b29b7bcd0..ed6790343 100644 --- a/guest/bundle/src/RgfxRingWriter.hpp +++ b/guest/bundle/src/RgfxRingWriter.hpp @@ -1,7 +1,7 @@ /* * RgfxRingWriter: the guest's end of a submission ring (guest -> host) in the * device's BAR 2 region (docs/graphics-kext/design.md, "Stage 2 wire protocol" - * and "Stage 3 wire protocol"; crates/reims-graphics/src/ring.rs is the host's + * and "Stage 3 wire protocol"; crates/reims-vgpu-graphics/src/ring.rs is the host's * mirror, whose test `Guest` is this write path). * * A ring is an RgfxRingHeader followed by a byte ring of `data_size` bytes (a diff --git a/guest/bundle/src/RgfxSerializer.hpp b/guest/bundle/src/RgfxSerializer.hpp index b7f79e0bf..8e65009cd 100644 --- a/guest/bundle/src/RgfxSerializer.hpp +++ b/guest/bundle/src/RgfxSerializer.hpp @@ -5,7 +5,7 @@ * the host decoder it mirrors is crates/reims-vgpu/src/graphics/decode.rs). * * This is the first serialiser slice: the object lifecycle whose wire structs are - * fixed in crates/reims-graphics/src/wire.rs (reims_graphics_wire.h) — command + * fixed in crates/reims-vgpu-graphics/src/wire.rs (reims_graphics_wire.h) — command * queue, heap, buffer, texture, sampler, depth/stencil, library, event, shared * event, fence, and OBJECT_DESTROY. The guest picks each ObjId, GPU address and * resource id (RgfxIdSpace); the host pins them. Lifecycle messages go on the diff --git a/guest/bundle/src/RgfxWireLayout.cpp b/guest/bundle/src/RgfxWireLayout.cpp index c16b963d1..a12aea86c 100644 --- a/guest/bundle/src/RgfxWireLayout.cpp +++ b/guest/bundle/src/RgfxWireLayout.cpp @@ -1,7 +1,7 @@ /* * RgfxWireLayout: the wire structs' sizes, asserted at the guest's own compile. * - * reims_graphics_wire.h is generated from crates/reims-graphics/src/wire.rs and + * reims_graphics_wire.h is generated from crates/reims-vgpu-graphics/src/wire.rs and * drift-checked against it by `cargo xtask header --check`. wire.rs asserts every * struct's size in a `const _` block; this is the same wall on the C side, so a C * header that ever disagrees with the sizes the guest and host both rely on fails @@ -128,7 +128,7 @@ static_assert(sizeof(RgfxOpUseResources) == 16, "RgfxOpUseResources render head" static_assert(sizeof(RgfxOpUseResourcesStages) == 24, "RgfxOpUseResourcesStages"); // The compute-encoder op bodies (`RgfxComputeOp*`) and element records, from the -// committed header (crates/reims-graphics/src/ops/compute.rs). These sizes are that +// committed header (crates/reims-vgpu-graphics/src/ops/compute.rs). These sizes are that // file's `const _` asserts. static_assert(sizeof(RgfxComputeOpSetComputePipelineState) == 8, "compute pipeline state"); static_assert(sizeof(RgfxComputeOpSetBufferOffset) == 16, "compute buffer offset"); @@ -177,7 +177,7 @@ static_assert(sizeof(RgfxComputeOpEncodeStartIf) == 32, "compute encode start if static_assert(sizeof(RgfxComputeOpEncodeStartWhile) == 32, "compute encode start while"); // The blit-encoder op bodies (`RgfxBlitOp*`), from the committed header -// (crates/reims-graphics/src/ops/blit.rs). These sizes are that file's asserts. +// (crates/reims-vgpu-graphics/src/ops/blit.rs). These sizes are that file's asserts. static_assert(sizeof(RgfxBlitOpCopyBufferToBuffer) == 40, "blit copy b2b"); static_assert(sizeof(RgfxBlitOpCopyBufferToTexture) == 104, "blit copy b2t"); static_assert(sizeof(RgfxBlitOpCopyBufferToTextureOptions) == 112, "blit copy b2t options"); diff --git a/guest/bundle/tests/peer_tests.mm b/guest/bundle/tests/peer_tests.mm index aa160497b..316e377a3 100644 --- a/guest/bundle/tests/peer_tests.mm +++ b/guest/bundle/tests/peer_tests.mm @@ -9,7 +9,7 @@ * the doorbells, and the wake of the completion thread when the device's vector shows a record on * one of its queues' rings. The host is the library itself, on this Mac's GPU, with no window. * - * It records what crosses the wire as lines of a trace, as crates/reims-graphics's FakeGuest does + * It records what crosses the wire as lines of a trace, as crates/reims-vgpu-graphics's FakeGuest does * (src/device/tests/peer.rs): * - every register read and write, doorbells among them; * - every record the guest publishes on the control ring and on a queue's submission ring; diff --git a/guest/bundle/tests/rgfx_test_ring.hpp b/guest/bundle/tests/rgfx_test_ring.hpp index e458e8827..6e239aca2 100644 --- a/guest/bundle/tests/rgfx_test_ring.hpp +++ b/guest/bundle/tests/rgfx_test_ring.hpp @@ -2,7 +2,7 @@ * rgfx_test_ring: the self-contained host-side consumer the bundle's user-space * checks read their wire bytes back through. It builds a ring in a plain buffer * (no BAR, no MMIO), counts doorbells, and walks messages back off the ring the - * way crates/reims-graphics/src/ring.rs does, so a test can post through the real + * way crates/reims-vgpu-graphics/src/ring.rs does, so a test can post through the real * RgfxRingWriter/RgfxSerializer and assert the exact bytes that landed. * * Shared by the serialiser check (tests/serializer_tests.cpp, the 387 wire-byte @@ -75,7 +75,7 @@ struct TestRing { // --- the host-producer side (host -> guest rings, for RgfxReplyReader) -------- // A completion ring the reader drains: the test plays the host here, writing a - // reply message and publishing `producer`, mirroring crates/reims-graphics/src/ + // reply message and publishing `producer`, mirroring crates/reims-vgpu-graphics/src/ // ring.rs Producer::post (pad to the end so a message never wraps). `msg` already // holds its header (type, size, seqno). Returns false with nothing written when the // ring has no room. diff --git a/guest/bundle/tests/serializer_tests.cpp b/guest/bundle/tests/serializer_tests.cpp index 4e9c11185..42a606e6b 100644 --- a/guest/bundle/tests/serializer_tests.cpp +++ b/guest/bundle/tests/serializer_tests.cpp @@ -3,7 +3,7 @@ * run on the Mac (guest/bundle/Makefile `test`). It builds a plain-buffer region, * a ring writer over it, and a serialiser, posts every message the slice covers, * and reads each back with a minimal host-side consumer (the mirror of - * crates/reims-graphics/src/ring.rs), asserting the type, size and fields on the + * crates/reims-vgpu-graphics/src/ring.rs), asserting the type, size and fields on the * wire. No Metal, no device: this validates the serialiser's bytes alone. * * Exits 0 and prints a one-line summary when every check passes; aborts on the diff --git a/guest/bundle/tests/shell_tests.mm b/guest/bundle/tests/shell_tests.mm index 777664146..c016b0791 100644 --- a/guest/bundle/tests/shell_tests.mm +++ b/guest/bundle/tests/shell_tests.mm @@ -8913,7 +8913,7 @@ void test_uncompleted_buffer_releases() } // namespace -// The layout of a Managed texture's CPU copy, for the cases crates/reims-graphics/src/managed.rs +// The layout of a Managed texture's CPU copy, for the cases crates/reims-vgpu-graphics/src/managed.rs // holds too: a 2D RGBA8 texture with three levels, a BC1 one whose sides are no multiple of its // blocks, a cube array, and a 3D one; and the blocks of a few formats. void test_managed_layout() diff --git a/guest/kext/Makefile b/guest/kext/Makefile index 9fd7a7507..3037f4b65 100644 --- a/guest/kext/Makefile +++ b/guest/kext/Makefile @@ -41,7 +41,7 @@ DTRACE ?= 0 ARCH = -arch x86_64 -isysroot $(SDK) -mmacosx-version-min=26.0 -FLAGS = $(ARCH) -mkernel -nostdinc -isystem $(KERNEL) -I../../crates/reims-graphics/include \ +FLAGS = $(ARCH) -mkernel -nostdinc -isystem $(KERNEL) -I../../crates/reims-vgpu-graphics/include \ -DKERNEL -DBUNDLE_VERSION='"$(VERSION)"' -DRGFX_FB_TRACE=$(TRACE) \ -Os -Wall -Wextra -Wshadow-all -Werror -Wno-unused-parameter \ -Wno-deprecated-declarations @@ -71,7 +71,7 @@ OBJECTS = $(BUILD)/obj/ReimsGraphics.o \ all: $(BINARY) -$(BUILD)/obj/%.o: src/%.cpp $(HEADERS) ../../crates/reims-graphics/include/reims_graphics_wire.h Makefile +$(BUILD)/obj/%.o: src/%.cpp $(HEADERS) ../../crates/reims-vgpu-graphics/include/reims_graphics_wire.h Makefile @mkdir -p $(@D) xcrun clang++ $(CXXFLAGS) -c $< -o $@ @@ -81,7 +81,7 @@ $(BUILD)/obj/%.o: src/%.c Makefile # The driver's source with its debug information, which check-layout.py reads # for the SDK's IOFramebuffer. -$(BUILD)/obj/layout.o: src/ReimsGraphics.cpp src/ReimsGraphics.hpp ../../crates/reims-graphics/include/reims_graphics_wire.h Makefile +$(BUILD)/obj/layout.o: src/ReimsGraphics.cpp src/ReimsGraphics.hpp ../../crates/reims-vgpu-graphics/include/reims_graphics_wire.h Makefile @mkdir -p $(@D) xcrun clang++ $(CXXFLAGS) -g -fstandalone-debug -c $< -o $@ @@ -115,9 +115,9 @@ TESTS = $(BUILD)/tests/spans_test $(BUILD)/tests/blocks_test $(BUILD)/tests/surf $(BUILD)/tests/shared_event_ports_test $(BUILD)/tests/gl_surfaces_test \ $(BUILD)/tests/surface_rows_test -$(BUILD)/tests/%: tests/%.cpp $(HEADERS) ../../crates/reims-graphics/include/reims_graphics_wire.h Makefile +$(BUILD)/tests/%: tests/%.cpp $(HEADERS) ../../crates/reims-vgpu-graphics/include/reims_graphics_wire.h Makefile @mkdir -p $(@D) - xcrun clang++ -std=c++17 -Wall -Wextra -Werror -Isrc -I../../crates/reims-graphics/include $< -o $@ + xcrun clang++ -std=c++17 -Wall -Wextra -Werror -Isrc -I../../crates/reims-vgpu-graphics/include $< -o $@ test: $(TESTS) @for t in $(TESTS); do $$t || exit 1; done diff --git a/guest/prebuilt/sources.toml b/guest/prebuilt/sources.toml index c51eef79f..114d94b6e 100644 --- a/guest/prebuilt/sources.toml +++ b/guest/prebuilt/sources.toml @@ -14,10 +14,10 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "../Kernels/kernel" = "7004ebc1020a5c7e3f075c631507f31fdc0ce3fe02e9f01f42dce1d178770a08" [sources] -"crates/reims-graphics/include/reims_graphics_wire.h" = "b342f13f123ac97a69974028d7d8930c4d550e90cc523506971e63247c78fcd7" +"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "1e83cbe0717fbc77dc7633e04801cd6bf620be324991b15ca255d838eabda178" "guest/Makefile" = "e5340a9656bdcdad8b166391634ea1a94b2b81af5f44726bb5cafb40eadf8f37" "guest/bundle/Info.plist" = "eb22780c5ed1da8871f709d31818af04c47cdb4c75fbe1c437e192dd1bc0956f" -"guest/bundle/Makefile" = "0b82a07c9b39077a2f3b73bc35b7cccc4d5a206615df345233c0ed8959e69e62" +"guest/bundle/Makefile" = "897ae4ae08f1b0855e1ec264e9f525f642d5f8372e82f023e9ea38e989c1b394" "guest/bundle/src/RgfxAirArguments.cpp" = "6adc5ef29d433ea77a4efc620e592258d69795015f5db06fe3c520c509fe9592" "guest/bundle/src/RgfxAirArguments.hpp" = "e8fd22df07e9dc8aa1e39c36596935f6206d3a89ae866ab1ef9915eb703af093" "guest/bundle/src/RgfxArgumentEncoder.h" = "1947973b39e011fa9d331ffb1824879df061142106269f46b09d9a1a24bc7c6d" @@ -45,7 +45,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "guest/bundle/src/RgfxDepthStencilState.h" = "22c1a163fa03d2f6bc712b3c17d5766c213ce7200fce99e75f9829f37e31f5fe" "guest/bundle/src/RgfxDepthStencilState.mm" = "593010e96179fc200758bd0ba08f1ab6263c68972b54d96377d62b19201f94e6" "guest/bundle/src/RgfxEncoder.cpp" = "c92e27b001c78a570835d573f7a69f0c8b705978587f4d2a4763053b628e53d9" -"guest/bundle/src/RgfxEncoder.hpp" = "885b2202b5397c8bb6d5ad01e4ebec4f0bc3321b65fe0d69afa88b37b0f9d546" +"guest/bundle/src/RgfxEncoder.hpp" = "d450e31ea8137580e9317f53db85422f7ed7acd2ba08ad1a2ba13d08aa983d53" "guest/bundle/src/RgfxEvent.h" = "afc9641c34466aaf7be351be78c3a9e07e75975f5f22838a55d6f6c93548bd4b" "guest/bundle/src/RgfxEvent.mm" = "aeadf488108efab9759769bb3d6ff61f4bd0dc07a76b33b0cd56c546f3d22ea4" "guest/bundle/src/RgfxFence.h" = "6f3c297d0ee00c3d1eb20d4351449883f21a1f37e0608796b5b7b93aa78f452e" @@ -65,8 +65,8 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "guest/bundle/src/RgfxIOSurface.h" = "0e2e3dcb869b01be99cc42d051ac1cd029927837c8c5163878dd34463d0a9c78" "guest/bundle/src/RgfxIOSurface.mm" = "1e101ad5101ae8d6d236cb38d65950bb7c5e9db4e1ee1190cabb158ec6c50b25" "guest/bundle/src/RgfxIcbSlotTable.cpp" = "aa1927594b5a3eeb9c0e0214ae0e57f26a851204f0f33af599d52c49bcf37b2e" -"guest/bundle/src/RgfxIcbSlotTable.hpp" = "2d3614679f0f2a56598a38fa26c6c4de12e59e14a9e2b000aaf90b8becf4f782" -"guest/bundle/src/RgfxIndirectCommandBuffer.h" = "e515089d443030903b88fa3396c6aff714655dc16cea51f16f30790fac8e35b0" +"guest/bundle/src/RgfxIcbSlotTable.hpp" = "744d2858231f274c2d7980e4d44c275626403a8af7bad6ec4b0fcbf0e40f8bc0" +"guest/bundle/src/RgfxIndirectCommandBuffer.h" = "163041e022ae9ba2098f822d5db1868b8f0cfb0712753402e4cd3df6f3b20e24" "guest/bundle/src/RgfxIndirectCommandBuffer.mm" = "75f9e740606274ec81c46bdd2ca051b5934730003995486fd403a1b69f8729bb" "guest/bundle/src/RgfxInterop.h" = "a824d020fcb8d8e730736cbe3d5c7d9a04b529d54d02d849be5513e80cfba923" "guest/bundle/src/RgfxInterop.mm" = "6abbac0e6fb44ff5b5d6a7048c572e34578a46a278411183462b4b111e5b0b6d" @@ -78,10 +78,10 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "guest/bundle/src/RgfxLibraryKey.hpp" = "12f8f1214a33be4741b97280ae7e620e8fa929997077ced68223667d92930040" "guest/bundle/src/RgfxLibraryStream.cpp" = "7a4ec2dbc3fcccb1bf9912161448603dcfba0dc36e32e5950d6e1f3e6e12ec7b" "guest/bundle/src/RgfxLibraryStream.hpp" = "6e201f25893d6dcff5e269ecbe2c6d6997af371aebe2bd506c86a8b0d1086a04" -"guest/bundle/src/RgfxManagedLayout.hpp" = "b3bd58ceec873a25a1dbbae258d4c6b54c672a63ac05959f70874d186075b601" +"guest/bundle/src/RgfxManagedLayout.hpp" = "56a6352297e97fca748c7a56520dd781f6f713109d5b3586f031f6d7594d3998" "guest/bundle/src/RgfxMemoryShadow.hpp" = "423fee80e03e7b0d8208a2f1df6e4d8a53ac98f995133b6db6985e8eb45c6e95" "guest/bundle/src/RgfxMetalDevice+CommandBuffer.h" = "1e494ca8b84c0282a1ce4804e2f6a7177764f48f203cc97386260f40187343eb" -"guest/bundle/src/RgfxMetalDevice+CommandBuffer.mm" = "4e7b560741b20d69e9a73b99f0c2e94c04364523078b49e29a8c6cb710800c45" +"guest/bundle/src/RgfxMetalDevice+CommandBuffer.mm" = "f4d3be05b76e92d09e99dc15189a2870e3bd1f5ac5ce41e367f0635fc9c9a66a" "guest/bundle/src/RgfxMetalDevice+GL.h" = "b8243a0919c82363705befc1e84de10f4f77447a7c150d89891b635c757e4fd8" "guest/bundle/src/RgfxMetalDevice+GL.mm" = "1f91b4f436cc4e0a9021e44a5684b7c472f948f852e937647d9b14598d31da43" "guest/bundle/src/RgfxMetalDevice+IO.h" = "9fe5795f718d6ea50cc4d7dcae582997b9327356822f585ea6998eec5f517963" @@ -114,17 +114,17 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "guest/bundle/src/RgfxRegion.hpp" = "0d988ad480d9f387ff1bcf8d56ce2cec332def5867759b3a5c3f250d33190401" "guest/bundle/src/RgfxRenderPipelineState.h" = "5e77aa6293e7cd61a9dcd9bf2a90f0b99ca1e6558e76e540740e4e102c55d900" "guest/bundle/src/RgfxRenderPipelineState.mm" = "ec305411ac6caadb3b94db3f8117cdc74c87b7fdaed8e112123ad6d0fa557a3c" -"guest/bundle/src/RgfxReplyReader.cpp" = "b1b71d5578757bd8366f071c52472a0c0396cfbebf719f52d6a5a900280bd905" -"guest/bundle/src/RgfxReplyReader.hpp" = "2efc353707428c4e00baf1376dc0164496124fb83106d462e38f5f2829509edb" +"guest/bundle/src/RgfxReplyReader.cpp" = "5fb622aca9fc674bce961957ab687a7cf0ebc589a4eeb1e7a5f0be8f7e429553" +"guest/bundle/src/RgfxReplyReader.hpp" = "4dd97104f3ba4fe609ea4a06c9e7b1936578438c03177e077b68c32d7b1e2e97" "guest/bundle/src/RgfxResource.h" = "13f47f39e31467d0434db290c9ef4bc6c0aa41e83e1158d3cc6b3b1e5247e703" "guest/bundle/src/RgfxResource.mm" = "88cdc571e2d2773dbe7528451ec7c09e71b3a76f36ad40f90e0a5ae548c68c36" "guest/bundle/src/RgfxRingRoomEvents.hpp" = "59f7968ea9ba6217ff955d75af9335565816f3e281442ead2fa91fdb11304f18" -"guest/bundle/src/RgfxRingWriter.cpp" = "a0bef2ab926ba1068b6f9e249bc02b91290a29093bd182755fa4b86541429bfb" -"guest/bundle/src/RgfxRingWriter.hpp" = "7df0a5c541d8fb725ca72a451c641942fb2b9f363cbbf56ea43788df84349bf1" +"guest/bundle/src/RgfxRingWriter.cpp" = "4bdd57e0090428df0bd9017fffadcb89238d64331a84506b4a563a5c1cc97ff3" +"guest/bundle/src/RgfxRingWriter.hpp" = "55e872415b2410681c1b6b80a7cf1ced76fa8784bbba906ead1c9a87cb3fca29" "guest/bundle/src/RgfxSampler.h" = "42a436bcd4b90e15b30a4c3e9a8e4c4ebbdd34545bf82c996d3ff6ecac27cf80" "guest/bundle/src/RgfxSampler.mm" = "4df102486fe053f1d40a0e18726a0952bd6d8c432049eaf8ba2279956dc8bba2" "guest/bundle/src/RgfxSerializer.cpp" = "6d5346727cbd1a77ae9f23624322252d9418dffb466b08e7fb86dcf052c13b47" -"guest/bundle/src/RgfxSerializer.hpp" = "0586b70e6cc9ba6ba71ee707f7cf256b401c6f940ce46a55462826de2463baed" +"guest/bundle/src/RgfxSerializer.hpp" = "5d228d236321abb7d42cefcbaa08ea6ecae2a775e0c0c7768a1313aeea05e64d" "guest/bundle/src/RgfxSharedEvent.h" = "2cd5b988511c7ece982bf22ae34156ecb0c40743f315cef2b3d6144c8a3c49af" "guest/bundle/src/RgfxSharedEvent.mm" = "8415ca63675e01589a4498b5676163c045630789b5fed04b77038296f519398d" "guest/bundle/src/RgfxSlabs.cpp" = "9745f028619b451a5673059de1e4eb2659d16f547621a94c8d886730769a30bc" @@ -147,8 +147,8 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "guest/bundle/src/RgfxVideoH265.cpp" = "89f7e0260e37b4d5ec761476f8b42b608fc5ac57e29d2d721288b62b136a3d16" "guest/bundle/src/RgfxVideoH265.hpp" = "ab380cd39cc028bb1b9bf060099748de191a18a7c0e7ae8e4bc45bf97fb4ab57" "guest/bundle/src/RgfxVideoStatus.hpp" = "b69820db673e4517dc776b5096cc9647930f5a0cda07c364146d890243ab0d5a" -"guest/bundle/src/RgfxWireLayout.cpp" = "f7661d11b7584fc80b00a862b5dd416040aab1bb373829467d30036546363de6" -"guest/kext/Makefile" = "28b803c8814d6cef78979998bec57bc93e64f2e24d595b49e60702a832027216" +"guest/bundle/src/RgfxWireLayout.cpp" = "0c72e7c3b9c28eeb708f523135b9f0e5d170012f3acbefb70323e987474e61fd" +"guest/kext/Makefile" = "14271ef3741fffa9b39056362290b1735149ccbd2d8545b74bee75dca50d21eb" "guest/kext/src/AppleGraphicsDeviceControl.hpp" = "2662c190f4d129534ad179fab8484265e0ff9eb46ea80826d0b03a9feb92b6a0" "guest/kext/src/Info.plist" = "a3a3c6c5dcf25d03df315e11731b15259613da999c8ced965985d1b473fd1f36" "guest/kext/src/ReimsGraphics.cpp" = "80d7d54e8a35da5592b5867e726581e0065b32126cfd6c55428a41000674118a" @@ -237,7 +237,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)" "guest/rgfxgate/src/rgfx_tree.h" = "68bfda47ac2e1e20c7fd65219a624b873564a6f11c71ab2fc0621789eb004ff1" "guest/rgfxgate/tools/fetch-lilu.sh" = "58ac00483ecf73a698b025a05b199025205b6a084d18c74b38408b820fa0d2bb" "guest/rgfxgate/tools/pack-payload.py" = "2aecf85b74db5cf33dc2196aa6b9bb69be218730233343a4923724ead7e7c54a" -"guest/tools/prebuilt.py" = "d64f54bceb040e50646860022c42c13d7b782b620f3f67f94764af4b18c39309" +"guest/tools/prebuilt.py" = "03a76f95c098c08d3e033319471a7a8e30f35cd48037e0936dc3956c6e0c8177" [outputs] "ReimsGraphics.kext/Contents/Info.plist" = "fa41cfda23f2ef7986dae3a2fa4929793b0a4ec193341dc9cb100f6189b4592f" diff --git a/guest/tools/prebuilt.py b/guest/tools/prebuilt.py index f272abcf9..f71eea69a 100644 --- a/guest/tools/prebuilt.py +++ b/guest/tools/prebuilt.py @@ -62,7 +62,7 @@ SET = ( # build reads (guest/kext, guest/bundle, guest/rgfxgate, guest/loader and the # wire header), and the files that build and stage it. INPUTS = ( - "crates/reims-graphics/include", + "crates/reims-vgpu-graphics/include", "guest/Makefile", "guest/tools/prebuilt.py", "guest/kext/Makefile", "guest/kext/src", diff --git a/scripts/internal/lane-gate.sh b/scripts/internal/lane-gate.sh index 345f10f3a..b34320774 100755 --- a/scripts/internal/lane-gate.sh +++ b/scripts/internal/lane-gate.sh @@ -35,7 +35,7 @@ # --boot-tag TAG the correctness boot's tag on the lane host (default gate-RUNID-boot): a tag the # host's gpu-urgent file names passes its turnstile ahead of the exclusive waiters # --host-log FILTER the correctness boot's host log filter (REIMS_VGPU_LOG, default info), as -# info,reims_graphics::room=debug to count a path's debug records +# info,reims_vgpu_graphics::room=debug to count a path's debug records # --bench-host-log FILTER the bench boot's host log filter (default info), as # info,reims_vgpu::work=debug for the runtime's work counts each second, which # report.py rates the drags and WebGL by; their logger costs the numbers it rates @@ -349,9 +349,9 @@ print(" ".join(sorted(out)))' "$changed" do_cargo() { cd "$TREE" . scripts/internal/dev-env.sh - local more expr pkgs=(-p reims-graphics -p reims-vgpu) + local more expr pkgs=(-p reims-vgpu-graphics -p reims-vgpu) more=$(reached) - expr="package(reims-graphics) | (package(reims-vgpu) & test(/graphics/))" + expr="package(reims-vgpu-graphics) | (package(reims-vgpu) & test(/graphics/))" for p in $more; do [[ $p == reims-ctl ]] && continue pkgs+=(-p "$p") diff --git a/scripts/internal/lane-gate/msi-boot.sh b/scripts/internal/lane-gate/msi-boot.sh index b4a5abeda..204f7a4f4 100755 --- a/scripts/internal/lane-gate/msi-boot.sh +++ b/scripts/internal/lane-gate/msi-boot.sh @@ -214,7 +214,7 @@ finish() { if [[ -f $B/launch.log ]]; then kv fatal_lines "$(grep -c 'reims-vgpu: fatal' "$B/launch.log")" # The host's records of paths a tip adds: queues made unshared (RGFX_QUEUE_UNSHARED), - # SUBMIT_ROOM records posted (reims_graphics::room at debug, HOST_LOG), and ICB_SLOTS messages + # SUBMIT_ROOM records posted (reims_vgpu_graphics::room at debug, HOST_LOG), and ICB_SLOTS messages # whose runs were not all carried out. kv queues_unshared "$(grep -c 'made unshared' "$B/launch.log")" kv submit_room_posted "$(grep -c 'SUBMIT_ROOM posted' "$B/launch.log")" diff --git a/scripts/internal/lane-gate/probe-batch.sh b/scripts/internal/lane-gate/probe-batch.sh index 04636cdba..c8c6123e1 100755 --- a/scripts/internal/lane-gate/probe-batch.sh +++ b/scripts/internal/lane-gate/probe-batch.sh @@ -61,7 +61,7 @@ # the host's load to settle under 4, runs them back to back and powers the guest off. --capture # also captures the boot as the gate's --capture-boot does (msi-boot.sh's CAPTURE: its scanout, # the guest's screenshots and the kext's log of the boot, in the round's capture/), the host's log -# at info,reims_graphics=trace,reims_vgpu::graphics=debug; a round with --capture runs with no +# at info,reims_vgpu_graphics=trace,reims_vgpu::graphics=debug; a round with --capture runs with no # probe too. --first NAME,... has the round consider those probes first, in that order, before the # others oldest first, and --only NAME,... takes those alone, in that order; --exclude NAME,... # leaves those in the queue (a probe that must come last in its own round); --catch-from-boot @@ -131,10 +131,10 @@ PUB=$(cat "$GH/published-last") SHORT=${PUB:0:9} WAIT_N=3 WAIT_S=2700 # The host's log filter in a probe boot: info, and the display's presents ("PRESENT_SURFACE of -# transaction", reims_graphics at trace, about 23 lines a second at 120 Hz), so a probe's host.log -# counts composites. reims_graphics has no other trace lines; at debug it logs SUBMIT_ROOM posts -# (reims_graphics::room). Gate and bench boots log at info. -PROBE_HOST_LOG=${host_log:-info,reims_graphics=trace} +# transaction", reims_vgpu_graphics at trace, about 23 lines a second at 120 Hz), so a probe's host.log +# counts composites. reims_vgpu_graphics has no other trace lines; at debug it logs SUBMIT_ROOM posts +# (reims_vgpu_graphics::room). Gate and bench boots log at info. +PROBE_HOST_LOG=${host_log:-info,reims_vgpu_graphics=trace} # The hold the probes get: the boot's own time to the desktop and the device check (about 90 s), # the longest load settle (180 s) and a margin come first. FIT_S=$(( HOLD_S - 90 - 180 - 60 )) diff --git a/xtask/src/header.rs b/xtask/src/header.rs index 2d1c047b6..ee1dcdda1 100644 --- a/xtask/src/header.rs +++ b/xtask/src/header.rs @@ -1,7 +1,7 @@ //! `cargo xtask header`: generate the C headers with cbindgen, each from its crate's //! `cbindgen.toml`, or, with `--check`, check that each committed header equals cbindgen's output: //! the C API's, `crates/reims-vgpu-c/include/reims_vgpu.h`, and the reims-graphics device's wire -//! format, `crates/reims-graphics/include/reims_graphics_wire.h`, which the guest's kext and option +//! format, `crates/reims-vgpu-graphics/include/reims_graphics_wire.h`, which the guest's kext and option //! ROM include. //! //! cbindgen is an external binary (`cargo install cbindgen --version 0.29.4`, or Homebrew's). @@ -19,7 +19,7 @@ pub const CBINDGEN_VERSION: &str = "0.29.4"; /// Each header's crate and file name. pub const HEADERS: [(&str, &str); 2] = [ ("reims-vgpu-c", "reims_vgpu.h"), - ("reims-graphics", "reims_graphics_wire.h"), + ("reims-vgpu-graphics", "reims_graphics_wire.h"), ]; /// A crate cbindgen reads. @@ -126,7 +126,7 @@ mod tests { assert!(header_path(api, api_h).ends_with("crates/reims-vgpu-c/include/reims_vgpu.h")); assert!( header_path(wire, wire_h) - .ends_with("crates/reims-graphics/include/reims_graphics_wire.h") + .ends_with("crates/reims-vgpu-graphics/include/reims_graphics_wire.h") ); } }