🎨 Rename the reims-graphics crate to reims-vgpu-graphics
The crate that holds the reims-graphics device's wire and transport now carries the library's prefix, as reims-vgpu-video does: its directory is crates/reims-vgpu-graphics, its package reims-vgpu-graphics, and its Rust path and log target reims_vgpu_graphics. The guest's, the option ROM's and Ambrosia's Makefiles include the wire header from the new directory, and the prebuilt records name it there. Nothing changes for the guest or the host. The device keeps its name (reims-graphics, QEMU's reims-graphics-pci, PCI 1234:5247), and the wire header keeps its file name and RGFX_ symbols. The C API header is unchanged, and the prebuilt kexts and option ROM are byte-identical; only the records' paths and source hashes move. A log filter names the crate's lines by its new target (REIMS_VGPU_LOG=info,reims_vgpu_graphics=trace), a diagnostic.
This commit is contained in:
1 parent
2d81f67e1e
commit
6fb33ecd27
122 files changed
+667
-652
No files matched your search
@@ -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=<KDK Extensions dir>`, 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 |
|
||||
|
||||
Generated
+12
-12
@@ -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"
|
||||
|
||||
+2
-2
@@ -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`).
|
||||
|
||||
@@ -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 <vm> --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 <vm> --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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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.
|
||||
+3
-3
@@ -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 <stdint.h>
|
||||
@@ -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;
|
||||
@@ -340,7 +340,7 @@ fn present(shared: &Shared, message: &Message, epoch: u64) -> Option<Vec<u8>> {
|
||||
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<Vec<u8>> {
|
||||
/// names, or naming more than [`RGFX_COLOR_PART_ENTRIES`], is logged and dropped.
|
||||
fn display_color(shared: &Shared, message: &Message) {
|
||||
let Some(color) = read::<RgfxDisplayColor>(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::<RgfxDisplayColor>();
|
||||
@@ -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
|
||||
@@ -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<u32> {
|
||||
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",
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -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:
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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,
|
||||
File renamed without changes.
@@ -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
|
||||
|
||||
@@ -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<GraphicsRaiseFn>,
|
||||
/// 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<CursorGlyphFn>,
|
||||
/// 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<P: ApiPlatform = DefaultPlatform> {
|
||||
/// The window, which closes when the link drops: before the device.
|
||||
window: Option<WindowLink>,
|
||||
/// The device.
|
||||
device: reims_graphics::Device,
|
||||
device: reims_vgpu_graphics::Device,
|
||||
/// The guest's cursor as the host is told it.
|
||||
cursor: Arc<HostCursor>,
|
||||
/// The stage-3 decoder and the device handle it drives, shared with the device's [`Host`],
|
||||
@@ -250,8 +250,8 @@ impl<P: ApiPlatform> GraphicsDevice<P> {
|
||||
/// refuses the region's memory, a pipe or a thread.
|
||||
pub fn with_platform(platform: Arc<P>, config: GraphicsConfig) -> Result<Self, Error> {
|
||||
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<P: ApiPlatform> GraphicsDevice<P> {
|
||||
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<P: ApiPlatform> GraphicsDevice<P> {
|
||||
|
||||
/// [`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<P: ApiPlatform> GraphicsDevice<P> {
|
||||
}
|
||||
|
||||
impl<P: ApiPlatform> Drop for GraphicsDevice<P> {
|
||||
/// 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<P: ApiPlatform> Drop for GraphicsDevice<P> {
|
||||
}
|
||||
|
||||
/// 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
|
||||
|
||||
@@ -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::*;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<P: Platform> GraphicsDecoder<P> {
|
||||
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::*;
|
||||
|
||||
@@ -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::<FakePlatform>::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] {
|
||||
|
||||
@@ -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<P: ApiPlatform>(kind: Kind, n: u64) -> (GraphicsDecoder<P>, 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::<P>::new(Arc::clone(&platform), Arc::new(region));
|
||||
let o = OnFault::Die;
|
||||
let pipeline_functions = match kind {
|
||||
|
||||
@@ -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<P: Platform> Decoders<P> {
|
||||
/// 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<P: Platform> GraphicsDecoder<P> {
|
||||
/// 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::<FakePlatform>::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<FakePlatform> for FakeVideo {
|
||||
fn caps(&self) -> Vec<reims_graphics::wire::RgfxVideoCodecCaps> {
|
||||
fn caps(&self) -> Vec<reims_vgpu_graphics::wire::RgfxVideoCodecCaps> {
|
||||
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<VideoSeen>) {
|
||||
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<u8> {
|
||||
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<P: crate::platform::ApiPlatform>() -> (bool, Vec<u8>) {
|
||||
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::<P>::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<P: crate::platform::ApiPlatform>() -> (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::<P>::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<u8> {
|
||||
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::<P>::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<u32>, bool, Vec<u64>, Vec<u8>) {
|
||||
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::<P>::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::<P>::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 {
|
||||
<reims_vgpu_vulkan::VulkanPlatform as Platform>::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<u8> {
|
||||
reims_graphics::wire::RgfxObjectDestroy {
|
||||
reims_vgpu_graphics::wire::RgfxObjectDestroy {
|
||||
header: RgfxMsgHeader {
|
||||
r#type: reims_graphics::wire::RGFX_CMD_OBJECT_DESTROY,
|
||||
size: size_of::<reims_graphics::wire::RgfxObjectDestroy>() as u32,
|
||||
r#type: reims_vgpu_graphics::wire::RGFX_CMD_OBJECT_DESTROY,
|
||||
size: size_of::<reims_vgpu_graphics::wire::RgfxObjectDestroy>() 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::<reims_graphics::wire::RgfxBufferDidModifyRange>() as u32,
|
||||
r#type: reims_vgpu_graphics::wire::RGFX_CMD_BUFFER_DID_MODIFY_RANGE,
|
||||
size: size_of::<reims_vgpu_graphics::wire::RgfxBufferDidModifyRange>() 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!(
|
||||
|
||||
@@ -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::<FakePlatform>::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);
|
||||
|
||||
@@ -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<P: ApiPlatform> Bench<P> {
|
||||
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()));
|
||||
|
||||
@@ -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<P: Platform>(
|
||||
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::<FakePlatform>::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 {
|
||||
|
||||
@@ -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<P: ApiPlatform> Bench<P> {
|
||||
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::<P>::new(Arc::clone(&platform), Arc::new(region));
|
||||
let (tx, completed) = mpsc::channel();
|
||||
let tx = reims_vgpu_core::sync::Mutex::new(tx);
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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<Budget>,
|
||||
/// 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<State>,
|
||||
/// 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<Budget>) -> Arc<Lane> {
|
||||
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<Budget>, idle_for: Duration) -> Arc<Lane> {
|
||||
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<Budget>, keep: reims_graphics::keep::Keep) -> Arc<Lane> {
|
||||
fn with_keep(
|
||||
queue: u64,
|
||||
budget: Arc<Budget>,
|
||||
keep: reims_vgpu_graphics::keep::Keep,
|
||||
) -> Arc<Lane> {
|
||||
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::*;
|
||||
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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<P: Platform> GraphicsDecoder<P> {
|
||||
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(()));
|
||||
|
||||
@@ -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<dyn Fn(PipelineReply) + Send + Sync>;
|
||||
/// 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<P: Platform> GraphicsDecoder<P> {
|
||||
|
||||
/// 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<P: Platform> GraphicsDecoder<P> {
|
||||
/// 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<P: Platform> GraphicsDecoder<P> {
|
||||
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<P: Platform> GraphicsDecoder<P> {
|
||||
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::<RgfxQueueCreate>(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::<FakePlatform>::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<u8> = (0..0x2345u32).map(|i| (i * 7) as u8).collect();
|
||||
let mut dec = GraphicsDecoder::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::new(Arc::clone(&p), Arc::clone(®ion));
|
||||
let create = |obj_id: u64, flags: Option<u32>| {
|
||||
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::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::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::<FakePlatform>::new(
|
||||
@@ -7530,13 +7530,13 @@ mod tests {
|
||||
Arc<reims_vgpu_core::sync::Mutex<Vec<RgfxPipelineReflection>>>,
|
||||
) {
|
||||
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<reims_graphics::region::Region>,
|
||||
region: Arc<reims_vgpu_graphics::region::Region>,
|
||||
) -> (
|
||||
Arc<FakePlatform>,
|
||||
GraphicsDecoder<FakePlatform>,
|
||||
@@ -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::<P>::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::<P>::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::<P>::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<RgfxFunctionConstant>; 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<u8> {
|
||||
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<P: crate::platform::ApiPlatform>() -> Vec<[TextureAnswer; 2]>
|
||||
{
|
||||
use reims_graphics::wire::RgfxSurfaceFacts;
|
||||
use reims_vgpu_graphics::wire::RgfxSurfaceFacts;
|
||||
let (mut dec, device) = surface_decoder::<P>();
|
||||
buffer_holding(&mut dec, &device, 10, &pin_bytes());
|
||||
let answer = |dec: &GraphicsDecoder<P>, 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<P: crate::platform::ApiPlatform>() -> Option<Vec<[f32; 4]>> {
|
||||
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::<P>();
|
||||
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::<FakePlatform>::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::<RgfxPipelineReflection>::new()));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<T: FromBytes>(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<P: Platform>(
|
||||
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::<Fp>::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] {
|
||||
|
||||
@@ -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::<FakePlatform>::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 {
|
||||
|
||||
@@ -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<P: Platform>(
|
||||
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::<RgfxSurfacePages>() 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);
|
||||
|
||||
@@ -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::<FakePlatform>::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 = <reims_graphics::wire::RgfxCbScheduled as zerocopy::FromBytes>::read_from_bytes(
|
||||
let m = <reims_vgpu_graphics::wire::RgfxCbScheduled as zerocopy::FromBytes>::read_from_bytes(
|
||||
bytes,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -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<P: Platform> SurfaceViews<P> {
|
||||
/// 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};
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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<P: Platform>: Send + Sync {
|
||||
fn session(&self, codec: u32, direction: u32) -> Option<Arc<dyn GraphicsVideoSession<P>>>;
|
||||
/// 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<reims_graphics::region::Region>,
|
||||
region: Arc<reims_vgpu_graphics::region::Region>,
|
||||
}
|
||||
|
||||
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<reims_graphics::region::Region>,
|
||||
region: &Arc<reims_vgpu_graphics::region::Region>,
|
||||
block: u64,
|
||||
size: u64,
|
||||
page: u64,
|
||||
@@ -453,7 +453,7 @@ fn encode_codec(tag: u16) -> Option<u32> {
|
||||
}
|
||||
|
||||
/// 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<P: Platform>(
|
||||
|
||||
@@ -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<FakePlatform>, GraphicsDecoder<FakePlatform>) {
|
||||
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::<FakePlatform>::new(Arc::clone(&p), region);
|
||||
let device = p.device();
|
||||
let chunk = RgfxResourceIdChunk {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//! `<name>-<i>`. 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::*;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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::{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<P: ApiPlatform> ScanoutDraw<P> {
|
||||
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 {
|
||||
<FakePlatform as Platform>::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::<FakePlatform>::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<P: ApiPlatform>(platform: &Arc<P>) {
|
||||
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,
|
||||
|
||||
@@ -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<AtomicU32>) -> GraphicsDevice<FakePlatform> {
|
||||
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<u8> {
|
||||
/// [`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<u8> {
|
||||
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::<FakePlatform>::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<u8> {
|
||||
/// 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<u8> {
|
||||
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<FakePlatform>, 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<u8> {
|
||||
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<u8>) -> Vec<u8> {
|
||||
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<u8> {
|
||||
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<u8> {
|
||||
/// 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<u8> {
|
||||
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<u8>) {
|
||||
/// 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<u8> {
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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};
|
||||
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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::*;
|
||||
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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<reims_graphics::region::Region> {
|
||||
fn graphics_region(&self, len: usize) -> Option<reims_vgpu_graphics::region::Region> {
|
||||
let _ = len;
|
||||
None
|
||||
}
|
||||
|
||||
@@ -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<reims_graphics::region::Region> {
|
||||
fn graphics_region(&self, len: usize) -> Option<reims_vgpu_graphics::region::Region> {
|
||||
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`
|
||||
|
||||
+1
-1
@@ -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 |
|
||||
|
||||
|
||||
@@ -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-<i>`), ICB creation (`reims-vgpu.icb-create-<i>`), a closed
|
||||
process's releases (`reims-vgpu.graphics-closes-<i>`), video (`reims-vgpu.graphics-video-<i>`)
|
||||
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`
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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-<i>`) 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
|
||||
|
||||
+2
-2
@@ -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 <dir> -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/<name>`), `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_<TRIPLE>_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.
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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/)).
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user