Files
reims-vgpu/Cargo.toml
T
Anees Iqbal 1b7eda226c 🆕 Decode the reims-graphics device's video on VA-API
The owner's call: host video runs on VA-API on AMD and Intel GPUs, and
on NVDEC on NVIDIA's, not on Vulkan Video. The device's video chooser
had NVDEC and Vulkan Video alone, so on every GPU but NVIDIA's the
guest's H.264 and HEVC went to Vulkan Video.

The chooser now tries VA-API second, on the render node of the runtime
device's own GPU (host_gpus::render_node_of), whatever its vendor. The
arm answers the driver's VLD profiles, formats and sizes, decodes each
access unit through the VA crate's H264Decoder and HevcDecoder in a
host-signalled session, and lands each picture one of two ways. The
first is the driver's video processing writing the output's pages in
place, where they lie in one memory a dma-buf is made of and the
driver's import check takes their layout. Otherwise the picture is read
back and copied by the CPU, the first reason logged once a session. A
session holds no more pictures unlanded than the decoder's spare
surfaces, and the display's open logs its driver, its time and thread,
and its import answers.

Measured in cold boots of an x86-64 macOS guest (decode_md5, H.264 and
HEVC 8 and 10 bits up to 4K, odd sizes, a soak), 2026-11-07:
- Radeon 780M (radeonsi, Mesa 26.2.6): 843 and 440 stream decodes
  right, none wrong; H.264 1080p 1164 to 1173 fps and HEVC 1080p 984 to
  985;
- Iris Xe (iHD 26.3.5): 688 stream decodes right, none wrong; H.264
  1080p 332 fps and HEVC 1080p 384;
- no 'reims-vgpu: fatal' line in either.
Every picture was copied by the CPU there: the frames VideoToolbox
hands the decoder have CoreVideo's own layout, each plane 32 bytes into
its page and rows of the width rounded up a little (1376 bytes at
1366), which neither driver's video processing writes: radeonsi wants
rows and planes 256 bytes apart, iHD the luma at a page's first byte.
2026-11-07 19:03:06 -08:00

151 lines
6.6 KiB
TOML

# ReimsVGPU: the framework and its tooling (architecture.md).
[workspace]
resolver = "3"
members = [
"crates/reims-vgpu-core",
"crates/reims-vgpu-metal",
"crates/reims-vgpu-window",
"crates/reims-vgpu",
"crates/reims-vgpu-c",
"crates/reims-vgpu-vulkan",
"crates/reims-vgpu-video-core",
"crates/reims-vgpu-video-codec",
"crates/reims-vgpu-video-vaapi",
"crates/reims-vgpu-video-nvidia",
"crates/reims-vgpu-video-vulkan",
"crates/reims-vgpu-video-conformance",
"crates/reims-graphics",
"xtask",
]
[workspace.package]
version = "0.1.0"
edition = "2024"
rust-version = "1.98.1"
publish = false
license = "GPL-2.0-or-later OR LGPL-3.0-or-later"
[workspace.dependencies]
reims-vgpu-core = { path = "crates/reims-vgpu-core" }
reims-vgpu-metal = { path = "crates/reims-vgpu-metal" }
# Without their default features: each member that wants SDL3's macOS window asks for it
# (`macos-sdl`), so `reims-vgpu-c`'s default decides whether the library has it.
reims-vgpu-window = { path = "crates/reims-vgpu-window", default-features = false }
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" }
# The video crates' runtime and memory, which the reims-graphics device's video arms share
# (`crate::video` of `reims-vgpu`).
reims-vgpu-video-core = { path = "crates/reims-vgpu-video-core" }
# The reims-graphics device's hardware video on the host's GPU through libva, on Linux
# (`graphics::vaapi` of `reims-vgpu`).
reims-vgpu-video-vaapi = { path = "crates/reims-vgpu-video-vaapi" }
# Its hardware video on an NVIDIA GPU through NVDEC, on Linux, its libraries loaded at run time
# (`graphics::nvidia` of `reims-vgpu`).
reims-vgpu-video-nvidia = { path = "crates/reims-vgpu-video-nvidia" }
# The reims-graphics device's hardware video on the Vulkan platform: Vulkan Video on the runtime's
# device.
reims-vgpu-video-vulkan = { path = "crates/reims-vgpu-video-vulkan" }
# The Vulkan platform's proof of concept (architecture D1): a Metal-shaped API on Vulkan, from
# metal2vulkan's public repository at the commit both name.
metal2vulkan-runtime = { git = "https://github.com/steelbrain/metal2vulkan", rev = "eac9da30c7e6df2cddec724643546c1f2a401c87" }
# Its translator, for the Metal enums and descriptor values the runtime's calls take.
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "eac9da30c7e6df2cddec724643546c1f2a401c87" }
# The hashes of the Vulkan platform's metallib sources (reims-vgpu-vulkan/build.rs).
sha2 = "0.10.9"
# A display window's swapchain on Linux (reims-vgpu-vulkan/src/swapchain.rs), at the runtime's
# version: `loaded` opens the Vulkan loader at run time, as the runtime does.
ash = { version = "0.38", default-features = false, features = ["std", "loaded"] }
# A display's window on Linux, and on macOS with REIMS_VGPU_WINDOW_IMPL=sdl
# (reims-vgpu-window/src/sdl): SDL3, built from its pinned source release (sdl3-src 3.4.18) and
# linked statically, with its video subsystem alone; its Vulkan types are ash's.
sdl3-sys = { version = "=0.7.2", default-features = false, features = [
"build-from-source-static",
"no-default-subsystems",
"sdl-video",
"use-ash-v0-38",
] }
# core (architecture 2.2)
parking_lot = "0.12.5"
zerocopy = { version = "0.8.27", features = ["derive"] }
# every crate's lines, and the default stderr logger (core::logging)
log = "0.4.34"
# metal and the public crate. objc2 `exception` is always on; `catch-all` is never enabled
# (architecture 2.3). objc2's checks (a message to nil, a missing method, the encodings) are
# debug assertions: on in dev, off in `checked` (the objc2 profile override below).
objc2 = { version = "0.6.4", features = ["exception"] }
objc2-foundation = "0.3.2"
objc2-metal = "0.3.2"
objc2-io-surface = "0.3.2"
block2 = "0.6.2"
dispatch2 = "0.3.1"
# the window crate (AppKit, Core Animation, CoreGraphics). Default features off: their defaults
# pull in every framework the crates cover (objc2-open-gl among them).
objc2-core-foundation = { version = "0.3.2", default-features = false, features = ["std"] }
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std"] }
objc2-quartz-core = { version = "0.3.2", default-features = false, features = ["std"] }
objc2-core-graphics = { version = "0.3.2", default-features = false, features = ["std"] }
mach2 = "0.7"
libc = "0.2.180"
# The codecs' Annex B start-code scan (reims-vgpu-video-codec's h264::nal), at the version the
# lock already holds for the regex crates.
memchr = "2.8.3"
# The Vulkan driver manifests the video devices' GPUs are read through
# (reims-vgpu-vulkan/src/host_gpus.rs), at the version the runtime's translator takes.
serde_json = "1.0.151"
# The library's allocator on the targets that ship (reims-vgpu-c's global allocator): jemalloc,
# built from the crate's bundled source, with its symbols prefixed.
tikv-jemallocator = "0.7.0"
# Architecture 17.4. reims-vgpu-core adds its stricter set in lib.rs.
[workspace.lints.rust]
unsafe_op_in_unsafe_fn = "deny"
missing_docs = "warn"
# The workspace's docs are its developers', built with its private items (`cargo doc
# --document-private-items`), where a public item's links to the private items its docs name
# resolve, and are checked as every other link is.
[workspace.lints.rustdoc]
private_intra_doc_links = "allow"
[workspace.lints.clippy]
unwrap_used = "deny"
expect_used = "deny"
panic = "deny"
todo = "deny"
# Architecture 2.3.
[profile.release]
panic = "unwind" # D9: objc2 exception::catch unwinds through its closure frame
overflow-checks = false # wrapping is explicit (D19); release is the product
debug = "line-tables-only"
lto = "thin"
[profile.dev]
panic = "unwind"
overflow-checks = true # an unannotated arithmetic slip dies in tests
debug = "line-tables-only" # backtraces keep file and line; full DWARF is `debugging`'s
[profile.dev.package."*"] # dependencies: no debuginfo
debug = false
[profile.debugging] # a debugger's build: dev with full debuginfo everywhere
inherits = "dev"
debug = true
[profile.debugging.package."*"]
debug = true
[profile.checked] # the suite's second pass (13.6)
inherits = "release"
overflow-checks = true
debug-assertions = true
# objc2's debug_assertions checks panic on a message to nil, on a missing
# method and on an encoding the runtime disagrees with. Dev builds keep them,
# so the tests that send to real Metal check every send they make; the
# suite's `checked` pass leaves them off, and release has none at all (D36).
[profile.checked.package.objc2]
debug-assertions = false