🆕 Offer VP9 decode to arm64 guests

The hosts' drivers list VP9 decode at profiles 0 and 2, and an arm64 macOS
26 guest has no VP9 decoder of its own: every VP9 session fails -12906
without one from the host. The previous commit gave the host VA-API
and NVDEC decoders; this one offers them to the guest.

What the guest sees: the device's video caps gain a VP9 entry, codec 3
(RGFX_VIDEO_CODEC_VP9), where the host's arm decodes VP9, listing profile 0
into NV12 and profile 2 into P010 as the driver answers them, at the arm's
sizes up to 16384 a side, and level 62 (6.2, as vpcC numbers it). On the
paravirtual route (RGFX_FEATURE_VT_MESSAGES) the host then lists a vp09
decoder, reims-vgpu-video.videodecoder.vp9, with those profiles; once a
process registers VP9 (VTRegisterSupplementalVideoDecoderIfAvailable, as on
a Mac) the guest's VideoToolbox decodes VP9 on the host's hardware. A sample
is a frame or a superframe whole, which the host splits. A stream the host
does not decode (profiles 1 and 3, 12 bits) is refused at its session's
start, as an HEVC format the arm lacks is, and the guest has no VP9 decoder
of its own to fall back on: known-issues.md says so. No encoder of VP9 is
listed.

The guest's pictures of the two libvpx streams equal vpxdec's, frame by
frame, on an RX 7900 XTX, an Iris Xe and an RTX 3090 under macOS 26.6.2 and
on the 3090 under macOS 14.6.1, and VP9 decodes as fast as HEVC on the same
route at 1080p and at 8192x4352 (devices.md, with the guest's CPU emulated).

The wire change is additive. An x86-64 guest's kexts read no caps entry past
HEVC's, and the device takes no session of codec 3. An older host's caps
have no VP9 entry, so a newer guest's VideoToolbox lists no vp09; a newer
host's caps list H.264's and HEVC's entries as before, beside VP9's
(vt_decoders_list_vp9_beside_the_others_where_the_caps_decode_it). The
header's hash moves in the option ROM's and both kext sets' source records;
their bytes are unchanged.
This commit is contained in:
Anees Iqbal committed 2026-11-27 14:57:30 -08:00
1 parent 4b8d51d09e
commit 132868d988
23 files changed
+694 -67

No files matched your search

@@ -3381,6 +3381,10 @@
// [`RgfxVideoCodecCaps::codec`] and [`RgfxVideoSessionCreate::codec`]: HEVC.
#define RGFX_VIDEO_CODEC_HEVC 2
// [`RgfxVideoCodecCaps::codec`]: VP9, which an arm64 guest's VideoToolbox decodes through its
// paravirtual decoders (`RGFX_FEATURE_VT_MESSAGES`); no session of the device takes it.
#define RGFX_VIDEO_CODEC_VP9 3
// [`RgfxVideoCodecCaps::direction`] and [`RgfxVideoSessionCreate::direction`]: decode.
#define RGFX_VIDEO_DECODE 1
@@ -3404,6 +3408,12 @@
// [`RgfxVideoCodecCaps::profiles`] of HEVC: Main 10 (2).
#define RGFX_VIDEO_HEVC_MAIN_10 (1 << 1)
// [`RgfxVideoCodecCaps::profiles`] of VP9: profile 0, 4:2:0 at 8 bits.
#define RGFX_VIDEO_VP9_PROFILE_0 (1 << 0)
// [`RgfxVideoCodecCaps::profiles`] of VP9: profile 2 at 10 bits, 4:2:0.
#define RGFX_VIDEO_VP9_PROFILE_2 (1 << 1)
// [`RgfxVideoCodecCaps::formats`]: 8-bit 4:2:0 in two planes, NV12 (`'420v'`, `'420f'`).
#define RGFX_VIDEO_FORMAT_NV12 (1 << 0)
@@ -8544,7 +8554,8 @@ typedef struct {
// The profiles taken, `RGFX_VIDEO_<codec>_*` bits.
uint32_t profiles;
// The highest level taken, as the codec numbers it (H.264's `level_idc`, 52 for 5.2; HEVC's
// `general_level_idc`, 153 for 5.1).
// `general_level_idc`, 153 for 5.1; VP9's ten times the level, as `vpcC` numbers it, 62 for
// 6.2).
uint32_t max_level;
// The smallest coded picture: width, height.
uint32_t min_size[2];
+10 -1
View File
@@ -5021,6 +5021,9 @@ pub const RGFX_VIDEO_CAPS_CODECS: usize = 16;
pub const RGFX_VIDEO_CODEC_H264: u32 = 1;
/// [`RgfxVideoCodecCaps::codec`] and [`RgfxVideoSessionCreate::codec`]: HEVC.
pub const RGFX_VIDEO_CODEC_HEVC: u32 = 2;
/// [`RgfxVideoCodecCaps::codec`]: VP9, which an arm64 guest's VideoToolbox decodes through its
/// paravirtual decoders (`RGFX_FEATURE_VT_MESSAGES`); no session of the device takes it.
pub const RGFX_VIDEO_CODEC_VP9: u32 = 3;
/// [`RgfxVideoCodecCaps::direction`] and [`RgfxVideoSessionCreate::direction`]: decode.
pub const RGFX_VIDEO_DECODE: u32 = 1;
@@ -5041,6 +5044,11 @@ pub const RGFX_VIDEO_HEVC_MAIN: u32 = 1 << 0;
/// [`RgfxVideoCodecCaps::profiles`] of HEVC: Main 10 (2).
pub const RGFX_VIDEO_HEVC_MAIN_10: u32 = 1 << 1;
/// [`RgfxVideoCodecCaps::profiles`] of VP9: profile 0, 4:2:0 at 8 bits.
pub const RGFX_VIDEO_VP9_PROFILE_0: u32 = 1 << 0;
/// [`RgfxVideoCodecCaps::profiles`] of VP9: profile 2 at 10 bits, 4:2:0.
pub const RGFX_VIDEO_VP9_PROFILE_2: u32 = 1 << 1;
/// [`RgfxVideoCodecCaps::formats`]: 8-bit 4:2:0 in two planes, NV12 (`'420v'`, `'420f'`).
pub const RGFX_VIDEO_FORMAT_NV12: u32 = 1 << 0;
/// [`RgfxVideoCodecCaps::formats`]: 10-bit 4:2:0 in two planes, P010 (`'x420'`, `'xf20'`).
@@ -5065,7 +5073,8 @@ pub struct RgfxVideoCodecCaps {
/// The profiles taken, `RGFX_VIDEO_<codec>_*` bits.
pub profiles: u32,
/// The highest level taken, as the codec numbers it (H.264's `level_idc`, 52 for 5.2; HEVC's
/// `general_level_idc`, 153 for 5.1).
/// `general_level_idc`, 153 for 5.1; VP9's ten times the level, as `vpcC` numbers it, 62 for
/// 6.2).
pub max_level: u32,
/// The smallest coded picture: width, height.
pub min_size: [u32; 2],
+65 -14
View File
@@ -9,7 +9,8 @@
//! session's queue.
//!
//! - **`dsta`** starts the session once: its format description (`,fds`) names the codec, the
//! size and the configuration record (`avcC`, `hvcC`, `av1C`). A record of 3-byte NAL unit lengths, and
//! size and the configuration record (`avcC`, `hvcC`, `av1C`, `vpcC`). A record of 3-byte NAL
//! unit lengths, a `vpcC` record that does not read, and
//! a stream whose pictures the host decodes none of, are refused with
//! `kVTVideoDecoderUnsupportedDataFormatErr`, an H.264 SPS that lets pictures be fields with
//! `kVTVideoDecoderMalfunctionErr`, and the backend refuses what it does not decode, each with
@@ -33,7 +34,9 @@
//! access unit into it and returns once the picture is there; the host emits the frame
//! (`Demt`, waiting [`EMIT_REPLY_WAIT`]) and lets go of the surface (`rels`). A frame that does
//! not decode is emitted with the backend's status and no buffer, and its buffer named unused
//! (`Dfub`). Frames come out in decode order, one a `dfrm`. The `dfrm` reply says noErr, with
//! (`Dfub`). Frames come out in decode order, one a `dfrm`. A VP9 sample goes to the backend
//! whole, as the guest sent it: a frame, or a superframe of hidden frames and the one it shows,
//! which the backend splits itself (`crate::codec::vp9::superframe`). The `dfrm` reply says noErr, with
//! `kVTDecodeInfo_Asynchronous` for a frame sent with the asynchronous flag, whose reply goes
//! as soon as its buffer is in hand. With no decoder (before `dsta`, after one refused, after
//! `dinv`) it answers [`NO_DECODER`] and sends nothing else.
@@ -72,13 +75,14 @@ use crate::codec::h264::{self, avcc};
use crate::codec::hevc::nal::nal_type;
use crate::codec::hevc::sps::Sps as HevcSps;
use crate::codec::hevc::{self, hvcc};
use crate::codec::vp9::{self, config::VpCodecConfiguration};
use crate::core::backend::{Chroma, PixelFormat};
use crate::core::fourcc::FourCc;
use crate::core::runtime::Runtime;
use crate::paravirt::WireError;
use crate::paravirt::host::Codec;
use crate::paravirt::image_description::{
AV1_CONFIGURATION, AVC_CONFIGURATION, HEVC_CONFIGURATION, ImageDescription,
AV1_CONFIGURATION, AVC_CONFIGURATION, HEVC_CONFIGURATION, ImageDescription, VP_CONFIGURATION,
};
use crate::paravirt::message::{
GuestUuid, Message, MessageFlags, MessageHeader, MessageWriter, ValueType,
@@ -134,6 +138,10 @@ const THREAD_NAME: &str = "reims-vgpu-video.vt-decoder";
/// The four-byte start code an Annex-B NAL unit follows.
const START_CODE: [u8; 4] = [0, 0, 0, 1];
/// A record's [`Record::length_size`] for a codec whose samples go to the backend whole, as the
/// guest sent them: AV1's, temporal units of OBUs, and VP9's, which has no NAL units.
const WHOLE_SAMPLES: u8 = 0;
/// A decoder's configuration, from a `dsta`'s format description or a sample's.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DecoderConfig {
@@ -143,7 +151,7 @@ pub struct DecoderConfig {
pub width: u32,
/// The height the description gives.
pub height: u32,
/// The configuration record (`avcC`, `hvcC`).
/// The configuration record (`avcC`, `hvcC`, `vpcC`).
pub record: Vec<u8>,
}
@@ -206,14 +214,15 @@ pub trait Backend: Send + Sync {
}
}
/// What a stream's SPS says it is: what a refusal of it names ([`Backend::declines`]).
/// What a stream's SPS, or VP9's `vpcC`, says it is: what a refusal of it names
/// ([`Backend::declines`]).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Stream {
/// The stream's codec.
pub codec: Codec,
/// HEVC's `general_profile_idc`, H.264's `profile_idc`.
/// HEVC's `general_profile_idc`, H.264's `profile_idc`, VP9's `profile` (its `vpcC`'s).
pub profile: u8,
/// `chroma_format_idc`.
/// `chroma_format_idc`; for VP9, its `vpcC`'s chroma subsampling so numbered.
pub chroma_format_idc: u8,
/// `BitDepthY`.
pub luma_bits: u8,
@@ -230,9 +239,10 @@ pub struct Stream {
/// One open decoder, called on its session's thread, one call at a time.
pub trait BackendDecoder: Send {
/// Decodes `access_unit`, NAL units in Annex-B form, after `parameter_sets` (the record's,
/// Annex-B, at the first decode of a configuration; else empty), into `output`, and returns
/// once the picture is there, or the status the guest sees for a sample that does not decode.
/// Decodes `access_unit`, NAL units in Annex-B form, or a VP9 sample whole, after
/// `parameter_sets` (the record's, Annex-B, at the first decode of a configuration; else, and
/// for VP9, empty), into `output`, and returns once the picture is there, or the status the
/// guest sees for a sample that does not decode.
fn decode(
&mut self,
parameter_sets: &[u8],
@@ -1006,6 +1016,7 @@ fn config_from_description(description: &ImageDescription) -> Option<DecoderConf
Codec::H264 => AVC_CONFIGURATION,
Codec::Hevc => HEVC_CONFIGURATION,
Codec::Av1 => AV1_CONFIGURATION,
Codec::Vp9 => VP_CONFIGURATION,
};
Some(DecoderConfig {
codec,
@@ -1022,6 +1033,7 @@ fn config_from_format(format: &SerializedFormatDescription) -> Option<DecoderCon
Codec::H264 => "avcC",
Codec::Hevc => "hvcC",
Codec::Av1 => "av1C",
Codec::Vp9 => "vpcC",
};
Some(DecoderConfig {
codec,
@@ -1064,7 +1076,7 @@ fn tile_region(origin: (i32, i32), size: (i32, i32), at: (i32, i32)) -> Option<T
/// What the host reads of a configuration record.
struct Record {
/// The bytes before each NAL unit of a sample; 0 for AV1's, whose samples go whole.
/// The bytes before each NAL unit of its samples, or [`WHOLE_SAMPLES`] (AV1's and VP9's).
length_size: u8,
/// Its parameter sets, Annex B; AV1's `configOBUs`.
parameter_sets: Vec<u8>,
@@ -1129,6 +1141,7 @@ impl Undecoded {
Codec::H264 => "AVC",
Codec::Hevc => "HEVC",
Codec::Av1 => "AV1",
Codec::Vp9 => "VP9",
};
format!(
"{codec} profile {} chroma format {}, luma {} bits, chroma {} bits",
@@ -1147,6 +1160,7 @@ impl std::fmt::Display for Undecoded {
Codec::H264 => ("H.264", "profile_idc"),
Codec::Hevc => ("HEVC", "general_profile_idc"),
Codec::Av1 => ("AV1", "seq_profile"),
Codec::Vp9 => ("VP9", "profile"),
};
write!(
f,
@@ -1249,6 +1263,7 @@ fn read_record(config: &DecoderConfig) -> Result<Record, OsStatus> {
undecoded,
)
}
Codec::Vp9 => return read_vp9_record(config),
};
if length_size == 3 || !matches!(length_size, 1 | 2 | 4) {
return Err(unsupported);
@@ -1267,11 +1282,47 @@ fn read_record(config: &DecoderConfig) -> Result<Record, OsStatus> {
})
}
/// A VP9 stream's record, from its `vpcC` (the VP codec ISO media file format binding's): the
/// profile, bit depth, chroma subsampling and range it names, which a session is refused on as an
/// SPS's are, at the description's size. VP9 has no parameter sets, and its samples go to the
/// backend whole ([`WHOLE_SAMPLES`]). A record that does not read, or is not there,
/// `kVTVideoDecoderUnsupportedDataFormatErr`.
fn read_vp9_record(config: &DecoderConfig) -> Result<Record, OsStatus> {
let vpcc = VpCodecConfiguration::parse(&config.record)
.map_err(|_| status::VIDEO_DECODER_UNSUPPORTED_DATA_FORMAT)?;
let stream = Stream {
codec: Codec::Vp9,
profile: vpcc.profile,
// `chromaSubsampling` 2 is 4:2:2 and 3 is 4:4:4, as `chroma_format_idc` numbers them.
chroma_format_idc: if vpcc.is_4_2_0() {
1
} else {
vpcc.chroma_subsampling
},
luma_bits: vpcc.bit_depth,
chroma_bits: vpcc.bit_depth,
width: config.width,
height: config.height,
range_extensions: false,
};
let undecoded = (vp9::check_supported(&vpcc).err()).map(|error| Undecoded {
why: error.to_string(),
stream,
});
Ok(Record {
length_size: WHOLE_SAMPLES,
parameter_sets: Vec::new(),
format: pixel_format(&stream, vpcc.full_range),
stream,
undecoded,
})
}
/// A sample's NAL units, each after a `length_size`-byte length, in Annex-B form; a sample whose
/// lengths run past it is `kVTVideoDecoderBadDataErr`. An AV1 sample (`length_size` 0) is taken
/// as it is.
/// lengths run past it is `kVTVideoDecoderBadDataErr`. A sample of a codec whose samples go whole
/// ([`WHOLE_SAMPLES`], AV1's and VP9's) is itself.
fn annex_b(data: &[u8], length_size: u8) -> Result<Vec<u8>, OsStatus> {
if length_size == 0 {
if length_size == WHOLE_SAMPLES {
return Ok(data.to_vec());
}
let mut out = Vec::with_capacity(data.len() + 16);
@@ -198,6 +198,7 @@ impl Guest {
Codec::H264 => (*b"avc1", vec![66, 77, 100], 52),
Codec::Hevc => (*b"hvc1", vec![1, 2, 3], 156),
Codec::Av1 => (*b"av01", vec![0], 19),
Codec::Vp9 => (*b"vp09", vec![0, 2], 62),
};
let decoders = vec![Decoder {
codec,
@@ -1286,4 +1287,90 @@ fn a_tile_that_does_not_decode_is_emitted_with_its_status_and_the_next_gets_the_
assert!(calls.iter().all(|(sets, _, _)| *sets == annex_b_sets()));
}
/// A `vpcC` record's payload, version 1: `profile`, level 3.1, `bit_depth`, `chroma`
/// subsampling, `full_range`, BT.709.
fn vpcc(profile: u8, bit_depth: u8, chroma: u8, full_range: bool) -> Vec<u8> {
let packed = (bit_depth << 4) | (chroma << 1) | u8::from(full_range);
vec![1, 0, 0, 0, profile, 31, packed, 1, 1, 1, 0, 0]
}
#[test]
fn each_vp9_stream_lands_in_its_format_or_is_refused_at_its_start() {
// profile, bit depth, chroma subsampling, range, and the format its frames land in.
for (profile, depth, chroma, full_range, format) in [
(0, 8, 1, false, Some(b"420v")),
(0, 8, 0, true, Some(b"420f")),
(2, 10, 1, false, Some(b"x420")),
(2, 10, 1, true, Some(b"xf20")),
(2, 12, 1, false, None),
(1, 8, 3, false, None),
(1, 8, 2, false, None),
(3, 10, 3, false, None),
] {
let what = format!("profile {profile}, {depth} bits, chroma {chroma}, {full_range}");
let record = vpcc(profile, depth, chroma, full_range);
starts_in(Codec::Vp9, &record, false, format, &what);
}
// A record that does not read, or is not there, or is of version 0, refuses the session.
let mut version_0 = vpcc(0, 8, 1, false);
version_0[0] = 0;
for record in [Vec::new(), vec![1; 11], version_0] {
let config = DecoderConfig {
codec: Codec::Vp9,
width: 64,
height: 48,
record,
};
assert_eq!(
read_record(&config).err(),
Some(status::VIDEO_DECODER_UNSUPPORTED_DATA_FORMAT)
);
}
}
#[test]
fn a_vp9_sample_goes_to_the_backend_whole_with_no_parameter_sets() {
let guest = Guest::of(Codec::Vp9, Ok(Decoded::Landed), None);
guest.start(&vpcc(0, 8, 1, false));
guest.next_of(b"Dpba");
guest.next_of(b"dsta");
let buffer = GuestUuid([0xb0; 16]);
// A frame's first bytes in a superframe of one, its index's sizes two bytes each, as a
// container holds it: the host neither splits nor converts it.
let superframe = [0x82, 0x49, 0x83, 0x86, 0x40, 0xc8, 0x05, 0x00, 0xc8];
for frame in 0..2 {
guest.frame(frame, 0, &one_sample(&superframe, None, false));
let (dbuf, _) = guest.next_of(b"Dbuf");
guest.answer(&dbuf, 0, Some((buffer, 7)));
let (demt, emitted) = guest.next_of(b"Demt");
assert_eq!(status_of(&emitted), Some(0));
guest.answer(&demt, 0, None);
assert_eq!(guest.next(), surface_release(&[7]), "the surface goes back");
guest.next_of(b"dfrm");
}
let calls = guest.calls.lock();
assert_eq!(calls.len(), 2);
for call in calls.iter() {
assert_eq!(*call, (Vec::new(), superframe.to_vec(), 7));
}
}
#[test]
fn a_refused_vp9_stream_is_named_by_its_profile_chroma_depths_and_size() {
let arm = FakeBackend::landing();
let refused = undecoded_on(&arm, Codec::Vp9, vpcc(1, 8, 3, false)).expect("refused");
assert_eq!(
refused.to_string(),
"unsupported: VP9 other than 4:2:0 (VP9 profile 1, chroma_format_idc 3, luma 8 bits, \
chroma 8 bits, 64x48)"
);
assert_eq!(
refused.kind(),
"VP9 profile one chroma format three, luma eight bits, chroma eight bits"
);
let twelve = undecoded_on(&arm, Codec::Vp9, vpcc(2, 12, 1, false)).expect("refused");
assert_eq!(twelve.why, "unsupported: VP9 at 12 bits");
assert_eq!(undecoded_on(&arm, Codec::Vp9, vpcc(2, 10, 0, false)), None);
}
mod av1;
@@ -912,6 +912,7 @@ fn configuration_atom(codec: Codec) -> &'static str {
Codec::Hevc => "hvcC",
// No arm encodes AV1: its encoder is never listed, nor its session started.
Codec::Av1 => "av1C",
Codec::Vp9 => "vpcC",
}
}
@@ -921,6 +922,7 @@ fn codec_name(codec: Codec) -> &'static str {
Codec::H264 => "H.264",
Codec::Hevc => "HEVC",
Codec::Av1 => "AV1",
Codec::Vp9 => "VP9",
}
}
+71 -1
View File
@@ -25,6 +25,8 @@ pub enum Codec {
Hevc,
/// AV1, `av01`.
Av1,
/// VP9, `vp09`: decoded alone, as the host has no VP9 encoder.
Vp9,
}
impl Codec {
@@ -34,12 +36,13 @@ impl Codec {
Self::H264 => *b"avc1",
Self::Hevc => *b"hvc1",
Self::Av1 => *b"av01",
Self::Vp9 => *b"vp09",
})
}
/// The codec the CoreMedia codec type `fourcc` names, where the host decodes it.
pub fn from_fourcc(fourcc: FourCc) -> Option<Self> {
[Self::H264, Self::Hevc, Self::Av1]
[Self::H264, Self::Hevc, Self::Av1, Self::Vp9]
.into_iter()
.find(|codec| codec.fourcc() == fourcc)
}
@@ -539,6 +542,73 @@ mod tests {
);
}
/// A host that decodes VP9 lists `vp09` beside the others, its profiles and level as `vpcC`
/// numbers them, and answers its capabilities; a create of it opens a session.
#[test]
fn a_vp9_decoder_is_listed_and_answers_its_capabilities() {
let mut list = decoders();
list.push(Decoder {
codec: Codec::Vp9,
profiles: vec![0, 2],
max_level: 62,
});
let host = Host::new(list);
let mut decs = request(b"decs");
decs.u32(names::VERSION, 6);
let reply = one_reply(&host.deliver(&decs.finish()), b"decs");
let message = Message::parse(&reply).unwrap();
let listed = plist::decode(
message
.property_list_bytes(names::DECODERS)
.unwrap()
.unwrap(),
)
.unwrap();
let Value::Array(entries) = listed else {
panic!("a list")
};
assert_eq!(entries.len(), 3, "H.264, HEVC and VP9");
let details = ["0", "2"]
.map(|p| (p.to_owned(), levels(62, &["VTMaxDecodeLevel"])))
.to_vec();
let expected = Value::dictionary([
(
"CMClassImplementationID",
Value::string("reims-vgpu-video.videodecoder.vp9"),
),
(
"CMClassImplementationName",
Value::string("reims-vgpu-video Decoder - VP9"),
),
("IsPreferredInternalPlugin", Value::Boolean(false)),
("VTCodecType", Value::Array(vec![Value::string("vp09")])),
("VTRating", Value::Integer(400)),
(
"VTDecoderCapabilities",
Value::dictionary([
("VTPerProfileDetails", Value::Dictionary(details)),
("VTSupportedProfileArray", integers(&[0, 2])),
]),
),
]);
assert_eq!(entries[2], expected);
let mut dcap = request(b"dcap");
dcap.s32(names::CODEC, FourCc::new(*b"vp09").0.cast_signed());
let reply = one_reply(&host.deliver(&dcap.finish()), b"dcap");
let message = Message::parse(&reply).unwrap();
let capabilities = plist::decode(
message
.property_list_bytes(names::DECODER_CAPABILITIES)
.unwrap()
.unwrap(),
)
.unwrap();
assert_eq!(
capabilities.get("VTSupportedProfiles"),
Some(&integers(&[0, 2]))
);
}
/// `encs` and `meps` list nothing; `meps` from a guest older than protocol 6 is refused with
/// no reply.
#[test]
@@ -15,6 +15,8 @@ pub const AVC_CONFIGURATION: FourCc = FourCc::new(*b"avcC");
pub const HEVC_CONFIGURATION: FourCc = FourCc::new(*b"hvcC");
/// The `av1C` extension: an AV1CodecConfigurationRecord.
pub const AV1_CONFIGURATION: FourCc = FourCc::new(*b"av1C");
/// The `vpcC` extension: a VP codec configuration record, version and flags first.
pub const VP_CONFIGURATION: FourCc = FourCc::new(*b"vpcC");
/// A video format description, as far as the host reads it.
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -105,6 +107,7 @@ pub(crate) mod tests {
bytes.extend_from_slice(match codec {
b"hvc1" => b"hvcC",
b"av01" => b"av1C",
b"vp09" => b"vpcC",
_ => b"avcC",
});
bytes.extend_from_slice(record);
@@ -42,6 +42,7 @@ fn decoder_id(codec: Codec) -> &'static str {
Codec::H264 => "reims-vgpu-video.videodecoder.avc",
Codec::Hevc => "reims-vgpu-video.videodecoder.hevc",
Codec::Av1 => "reims-vgpu-video.videodecoder.av1",
Codec::Vp9 => "reims-vgpu-video.videodecoder.vp9",
}
}
@@ -50,6 +51,7 @@ fn decoder_name(codec: Codec) -> &'static str {
Codec::H264 => "reims-vgpu-video Decoder - AVC",
Codec::Hevc => "reims-vgpu-video Decoder - HEVC",
Codec::Av1 => "reims-vgpu-video Decoder - AV1",
Codec::Vp9 => "reims-vgpu-video Decoder - VP9",
}
}
@@ -171,12 +173,14 @@ pub(crate) fn decoder_capabilities(
/// VideoToolbox of macOS 27, 2026-11-16; seen on a macOS 26.6.2 guest: a session that requires
/// a hardware encoder fails so, and one that allows one is given a software encoder, while the
/// list names this host's encoders by IDs of its own).
/// No arm encodes AV1, so no AV1 encoder is listed: its ID is ours, and never sent.
/// No arm encodes AV1 or VP9, so no encoder of either is listed: their IDs are ours, and never
/// sent.
pub(crate) fn apple_encoder_id(codec: Codec) -> &'static str {
match codec {
Codec::H264 => "com.apple.videotoolbox.videoencoder.ave.avc",
Codec::Hevc => "com.apple.videotoolbox.videoencoder.ave.hevc",
Codec::Av1 => "reims-vgpu-video.videoencoder.av1",
Codec::Vp9 => "reims-vgpu-video.videoencoder.vp9",
}
}
@@ -185,6 +189,7 @@ fn encoder_name(codec: Codec) -> &'static str {
Codec::H264 => "reims-vgpu-video Encoder - AVC",
Codec::Hevc => "reims-vgpu-video Encoder - HEVC",
Codec::Av1 => "reims-vgpu-video Encoder - AV1",
Codec::Vp9 => "reims-vgpu-video Encoder - VP9",
}
}
@@ -202,6 +207,7 @@ fn encoder_entry(encoder: &Encoder) -> Value {
Codec::H264 => "H.264",
Codec::Hevc => "HEVC",
Codec::Av1 => "AV1",
Codec::Vp9 => "VP9",
}),
),
(
+12 -4
View File
@@ -95,8 +95,9 @@ use reims_vgpu_graphics::wire::{
RGFX_RESOURCE_ID_CHUNK, RGFX_RESOURCE_ID_CHUNKS, RGFX_STATUS_INVALID_ARGUMENT,
RGFX_STATUS_NOT_FOUND, RGFX_STATUS_OK, RGFX_STATUS_REFUSED, RGFX_VIDEO_CAPS_CODECS,
RGFX_VIDEO_CAPS_OFFSET, RGFX_VIDEO_CAPS_OUTPUT_CACHED, RGFX_VIDEO_CAPS_VERSION,
RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_DECODE, RGFX_VIDEO_H264_BASELINE,
RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN, RGFX_VIDEO_HEVC_MAIN_10,
RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_CODEC_VP9, RGFX_VIDEO_DECODE,
RGFX_VIDEO_H264_BASELINE, RGFX_VIDEO_H264_HIGH, RGFX_VIDEO_H264_MAIN, RGFX_VIDEO_HEVC_MAIN,
RGFX_VIDEO_HEVC_MAIN_10, RGFX_VIDEO_VP9_PROFILE_0, RGFX_VIDEO_VP9_PROFILE_2,
RGFX_VT_STATUS_MALFORMED, RgfxBlockGrant, RgfxBlockRelease, RgfxBufferOverPages,
RgfxCbComplete, RgfxCbScheduled, RgfxCbSubmitted, RgfxColorEntry, RgfxDisplayColor,
RgfxEventSignalled, RgfxFunctionPointerState, RgfxHeapOverPages, RgfxIcbState,
@@ -4721,9 +4722,9 @@ fn vt_features(vt: &paravirt::Host) -> u64 {
}
/// The decoders VideoToolbox's paravirtual path lists ([`paravirt::Host`]): one for each decode
/// entry of `caps` of H.264 or HEVC with a profile, its profiles as VideoToolbox numbers them
/// entry of `caps` of H.264, HEVC or VP9 with a profile, its profiles as VideoToolbox numbers them
/// (H.264's `profile_idc`; HEVC's `general_profile_idc`, Main Still Picture where Main is, whose
/// decoder takes its streams) and its level the caps'.
/// decoder takes its streams; VP9's profile, as `vpcC` numbers it) and its level the caps'.
fn vt_decoders(caps: &RgfxVideoCaps) -> Vec<paravirt::Decoder> {
let count = usize::try_from(caps.codec_count)
.unwrap_or(usize::MAX)
@@ -4763,6 +4764,13 @@ fn vt_decoders(caps: &RgfxVideoCaps) -> Vec<paravirt::Decoder> {
],
),
),
RGFX_VIDEO_CODEC_VP9 => (
paravirt::Codec::Vp9,
numbered(
c.profiles,
&[(RGFX_VIDEO_VP9_PROFILE_0, 0), (RGFX_VIDEO_VP9_PROFILE_2, 2)],
),
),
_ => return None,
};
(!profiles.is_empty()).then_some(paravirt::Decoder {
+93 -10
View File
@@ -56,6 +56,10 @@
//! output's pages above, else read back and copied by the CPU, each reason logged once a
//! decoder. So every decode codec of the caps has one, and the device offers `VT_MESSAGES`
//! where NVDEC decodes H.264 or HEVC.
//! - **VP9** decodes there alone, profile 0 where NVDEC decodes VP9 at 8 bits and profile 2
//! where it does at 10 ([`vp9_caps`]), each sample a frame or a superframe whole, and lands as
//! H.264's and HEVC's 4:2:0 pictures do. Its caps entry, codec 3, is skipped by an x86
//! guest's kexts, and no device session takes it.
//! - **HEVC's range extensions**, the codec crate's 4:2:0 and 4:4:4 at 8, 10 and 12 bits, have a
//! paravirtual session where NVDEC's caps say it decodes HEVC at the stream's chroma format
//! and depth into the output the decoder makes (NV12 or P016; 4:4:4's three planes, 8-bit or
@@ -87,12 +91,12 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, LazyLock, Weak};
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,
RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_CODEC_VP9, 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,
RGFX_VIDEO_VP9_PROFILE_0, RGFX_VIDEO_VP9_PROFILE_2, RgfxVideoCodecCaps, RgfxVideoEncodeCaps,
};
use reims_vgpu_video::codec::PictureStart;
use reims_vgpu_video::codec::{PictureStart, vp9};
use reims_vgpu_video::core::backend::{BackendError as VideoError, Chroma};
use reims_vgpu_video::core::device_memory::{
DeviceImports, GuestTarget, MemoryIdentity, TargetPlane,
@@ -211,6 +215,9 @@ struct NvidiaVideo<P: Platform> {
/// What NVDEC decodes of AV1 for VideoToolbox's decoders (`super::av1`); `None` where its
/// caps list no AV1 at 8 bits.
av1: Option<GuestAv1>,
/// The caps of VP9's decode, for VideoToolbox's paravirtual decoders alone; `None` where
/// NVDEC has none.
vp9: Option<RgfxVideoCodecCaps>,
/// The profiles NVENC encodes, and the encode entries they give (`encode`'s module doc).
encoders: Vec<EncodeProfileSupport>,
encode: Vec<RgfxVideoCodecCaps>,
@@ -306,6 +313,7 @@ impl<P: Platform> NvidiaVideo<P> {
min_width: caps.min_width,
min_height: caps.min_height,
});
let vp9 = vp9_caps(asked(NvdecCodec::Vp9, 8), asked(NvdecCodec::Vp9, 10));
let encoders = match encode_profiles(Arc::clone(&gpu)) {
Ok(encoders) => encoders,
Err(error) => {
@@ -322,7 +330,7 @@ impl<P: Platform> NvidiaVideo<P> {
return None;
}
log::info!(
"hardware video: {NAME} on {} at {address}: H.264 {}, HEVC {}",
"hardware video: {NAME} on {} at {address}: H.264 {}, HEVC {}, VP9 {}",
gpu.info().name,
if h264.is_some() { "yes" } else { "no" },
match &hevc {
@@ -330,6 +338,12 @@ impl<P: Platform> NvidiaVideo<P> {
Some(_) => "Main",
None => "no",
},
match vp9.map(|caps| caps.profiles) {
Some(RGFX_VIDEO_VP9_PROFILE_0) => "profile 0",
Some(RGFX_VIDEO_VP9_PROFILE_2) => "profile 2",
Some(_) => "profiles 0 and 2",
None => "no",
},
);
let encodes = |codec| {
(encode.iter()).find(|c| c.codec == codec).map_or_else(
@@ -367,6 +381,7 @@ impl<P: Platform> NvidiaVideo<P> {
h264,
hevc,
av1,
vp9,
encoders,
encode,
runtime: Arc::clone(runtime),
@@ -533,6 +548,67 @@ fn declines_range_extensions(gpu: &Gpu, stream: &Stream) -> Option<String> {
}
}
/// VP9's decode, for VideoToolbox's paravirtual decoders alone (module doc): profile 0 where
/// NVDEC decodes VP9 at 8 bits (`eight`), into NV12, and profile 2 where it does at 10 (`ten`),
/// into P010, at the least of their sizes and the codec crate's bound (`vp9::MAX_SIDE`). NVDEC
/// answers no level, so VP9's top one. A frame references three of the eight slots, which with
/// the frame itself the DPB holds.
fn vp9_caps(
eight: Option<DecodeCapabilities>,
ten: Option<DecodeCapabilities>,
) -> Option<RgfxVideoCodecCaps> {
let answered: Vec<DecodeCapabilities> = [&eight, &ten].into_iter().flatten().cloned().collect();
if answered.is_empty() {
return None;
}
let mut entry = RgfxVideoCodecCaps {
max_level: vp9::TOP_LEVEL,
max_dpb_pictures: 9,
max_references: 3,
..decode_caps(RGFX_VIDEO_CODEC_VP9, &answered)
};
if eight.is_some() {
entry.profiles |= RGFX_VIDEO_VP9_PROFILE_0;
entry.formats |= RGFX_VIDEO_FORMAT_NV12;
}
if ten.is_some() {
entry.profiles |= RGFX_VIDEO_VP9_PROFILE_2;
entry.formats |= RGFX_VIDEO_FORMAT_P010;
}
entry.max_size = entry.max_size.map(|side| side.min(vp9::MAX_SIDE));
Some(entry)
}
/// Why NVDEC's decoders take none of `stream`'s pictures, a VP9 stream at 4:2:0, by VP9's `caps`
/// ([`vp9_caps`]): a profile and depth they lack, or a size outside theirs; `None` where they
/// take it.
fn declines_vp9(caps: Option<&RgfxVideoCodecCaps>, stream: &Stream) -> Option<String> {
let Some(caps) = caps else {
return Some(format!("{NAME} does not decode VP9"));
};
let profile = match (stream.profile, stream.luma_bits) {
(0, 8) => RGFX_VIDEO_VP9_PROFILE_0,
(2, 10) => RGFX_VIDEO_VP9_PROFILE_2,
_ => 0,
};
let (width, height) = (stream.width, stream.height);
let [min_width, min_height] = caps.min_size;
let [max_width, max_height] = caps.max_size;
if caps.profiles & profile == 0 {
Some(format!(
"{NAME} does not decode VP9 profile {} at {} bits",
stream.profile, stream.luma_bits
))
} else if width < min_width || height < min_height || width > max_width || height > max_height {
Some(format!(
"{NAME} decodes VP9 from {min_width}x{min_height} up to {max_width}x{max_height}, \
not {width}x{height}"
))
} else {
None
}
}
/// The caps of `codec`'s decode at the least of the sizes NVDEC answers in `answered`, at least
/// one; its profiles, formats, level and DPB are the caller's.
fn decode_caps(codec: u32, answered: &[DecodeCapabilities]) -> RgfxVideoCodecCaps {
@@ -550,7 +626,9 @@ fn decode_caps(codec: u32, answered: &[DecodeCapabilities]) -> RgfxVideoCodecCap
impl<P: Platform> GraphicsVideo<P> for Shared<P> {
fn caps(&self) -> Vec<RgfxVideoCodecCaps> {
let decode = self.0.h264.into_iter().chain(self.0.hevc);
let decode = (self.0.h264.into_iter())
.chain(self.0.hevc)
.chain(self.0.vp9);
decode.chain(self.0.encode.iter().copied()).collect()
}
@@ -638,6 +716,7 @@ impl<P: Platform> GraphicsVideo<P> for Shared<P> {
let av1 = video.av1?;
AnnexBCodec::Av1(av1.limits())
}
RGFX_VIDEO_CODEC_VP9 if video.vp9.is_some() => AnnexBCodec::Vp9,
_ => return None,
};
let mut decoder = AnnexBDecoder::new(&video.gpu, annex_b, &video.runtime);
@@ -658,9 +737,10 @@ impl<P: Platform> GraphicsVideo<P> for Shared<P> {
}))
}
/// 4:2:0 streams of Main and Main 10, and HEVC's range extensions where NVDEC decodes them
/// ([`declines_range_extensions`]); AV1's at the depths and sizes its caps list
/// (`super::av1::declines`).
/// 4:2:0 streams of Main and Main 10, HEVC's range extensions where NVDEC decodes them
/// ([`declines_range_extensions`]), AV1's at the depths and sizes its caps list
/// (`super::av1::declines`), and VP9's where NVDEC decodes the stream's profile at its depth
/// and size ([`declines_vp9`]).
fn guest_declines(&self, codec: u32, stream: &Stream) -> Option<String> {
if codec == HOST_VIDEO_CODEC_AV1 {
return super::av1::declines(NAME, self.0.av1, stream);
@@ -668,6 +748,9 @@ impl<P: Platform> GraphicsVideo<P> for Shared<P> {
if codec == RGFX_VIDEO_CODEC_HEVC && stream.range_extensions {
return declines_range_extensions(&self.0.gpu, stream);
}
if codec == RGFX_VIDEO_CODEC_VP9 && stream.chroma_format_idc == 1 {
return declines_vp9(self.0.vp9.as_ref(), stream);
}
(stream.chroma_format_idc != 1 || stream.range_extensions).then(|| {
format!(
"{NAME}'s decoders land 4:2:0 pictures, and HEVC's range extensions where NVDEC \
@@ -534,7 +534,7 @@ fn a_guest_encoders_frames_code_alike_from_the_cpu_and_the_gpu_and_decode_back()
match encoder.codec {
Codec::H264 => AnnexBCodec::H264,
Codec::Hevc => AnnexBCodec::Hevc,
Codec::Av1 => unreachable!("no arm encodes AV1"),
Codec::Av1 | Codec::Vp9 => unreachable!("no arm encodes AV1 or VP9"),
},
&runtime,
);
+82 -2
View File
@@ -143,6 +143,18 @@ fn the_rt_platforms_caps_name_what_nvdec_decodes_and_nvenc_encodes() {
if hevc_profiles != 0 {
expected.push((RGFX_VIDEO_CODEC_HEVC, hevc_profiles));
}
let vp9_profiles = (if decodes(NvdecCodec::Vp9, 8) {
RGFX_VIDEO_VP9_PROFILE_0
} else {
0
}) | (if decodes(NvdecCodec::Vp9, 10) {
RGFX_VIDEO_VP9_PROFILE_2
} else {
0
});
if vp9_profiles != 0 {
expected.push((RGFX_VIDEO_CODEC_VP9, vp9_profiles));
}
assert!(!expected.is_empty(), "NVDEC decodes neither codec");
let encodes: Vec<(u32, u32)> = (nvdec.encode.iter())
.map(|caps| (caps.codec, caps.profiles))
@@ -161,8 +173,8 @@ fn the_rt_platforms_caps_name_what_nvdec_decodes_and_nvenc_encodes() {
for (caps, (codec, profiles)) in decodes.iter().zip(&expected) {
assert_eq!((caps.codec, caps.direction), (*codec, RGFX_VIDEO_DECODE));
assert_eq!(caps.profiles & profiles, *profiles, "codec {codec:#x}");
if *codec == RGFX_VIDEO_CODEC_HEVC {
assert_eq!(caps.profiles, *profiles, "HEVC's profiles");
if *codec != RGFX_VIDEO_CODEC_H264 {
assert_eq!(caps.profiles, *profiles, "codec {codec:#x}'s profiles");
}
}
for (caps, (codec, profiles)) in encoded.iter().zip(&encodes) {
@@ -757,6 +769,74 @@ fn a_4_4_4_pictures_cb_and_cr_are_interleaved_into_the_surfaces_chroma_plane() {
);
}
/// What NVDEC answers of VP9 at `bit_depth`, up to `max` from `min`.
fn vp9_answer(bit_depth: u32, max: (u32, u32), min: (u32, u32)) -> DecodeCapabilities {
DecodeCapabilities {
codec: NvdecCodec::Vp9,
chroma: ChromaFormat::Yuv420,
bit_depth,
supported: true,
engines: 1,
output_formats: vec![SurfaceFormat::Nv12, SurfaceFormat::P016],
max_width: max.0,
max_height: max.1,
max_macroblocks: (max.0 / 16) * (max.1 / 16),
min_width: min.0,
min_height: min.1,
}
}
/// VP9's entry is profile 0 where NVDEC decodes VP9 at 8 bits and profile 2 where it does at 10,
/// each into its format, at the least of their sizes, VP9's top level, and the eight slots and
/// the frame; a stream is declined by the profile and depth it lacks and by its size.
#[test]
fn vp9_s_caps_are_nvdec_s_answers_and_decline_what_they_lack() {
assert_eq!(vp9_caps(None, None), None);
let both = vp9_caps(
Some(vp9_answer(8, (8192, 8192), (128, 128))),
Some(vp9_answer(10, (8192, 4096), (144, 128))),
)
.expect("an entry");
assert_eq!(
(both.codec, both.direction),
(RGFX_VIDEO_CODEC_VP9, RGFX_VIDEO_DECODE)
);
assert_eq!(
both.profiles,
RGFX_VIDEO_VP9_PROFILE_0 | RGFX_VIDEO_VP9_PROFILE_2
);
assert_eq!(
both.formats,
RGFX_VIDEO_FORMAT_NV12 | RGFX_VIDEO_FORMAT_P010
);
assert_eq!((both.min_size, both.max_size), ([144, 128], [8192, 4096]));
assert_eq!(
(both.max_level, both.max_dpb_pictures, both.max_references),
(62, 9, 3)
);
let eight = vp9_caps(Some(vp9_answer(8, (32768, 32768), (128, 128))), None).expect("an entry");
assert_eq!(eight.profiles, RGFX_VIDEO_VP9_PROFILE_0);
assert_eq!(eight.max_size, [16384, 16384], "the codec crate's bound");
let stream = |profile: u8, luma_bits: u8, width: u32, height: u32| Stream {
codec: reims_vgpu_video::paravirt::Codec::Vp9,
profile,
chroma_format_idc: 1,
luma_bits,
chroma_bits: luma_bits,
width,
height,
range_extensions: false,
};
assert_eq!(declines_vp9(Some(&both), &stream(0, 8, 1920, 1080)), None);
assert_eq!(declines_vp9(Some(&both), &stream(2, 10, 3840, 2160)), None);
assert!(declines_vp9(Some(&eight), &stream(2, 10, 640, 360)).is_some());
assert!(declines_vp9(Some(&both), &stream(2, 12, 640, 360)).is_some());
assert!(declines_vp9(Some(&both), &stream(0, 8, 64, 64)).is_some());
assert!(declines_vp9(Some(&both), &stream(0, 8, 8192, 8192)).is_some());
assert!(declines_vp9(None, &stream(0, 8, 640, 360)).is_some());
}
/// A VideoToolbox decoder sees a stream that does not decode, or a picture NVDEC failed, as bad
/// data; what NVDEC does not decode as unsupported; a skipped leading picture as skipped; and the
/// rest, a picture too small among them, as its malfunction.
+48
View File
@@ -13583,6 +13583,54 @@ fn vt_decoders_are_the_caps_decode_entries() {
assert_eq!(vt_decoders(&main10)[0].profiles, vec![2]);
}
/// A newer host's caps list VP9 decode beside H.264 and HEVC, as codec 3, an added entry: the
/// paravirtual path lists `vp09` with its profiles as `vpcC` numbers them, and the H.264 and
/// HEVC decoders as an older host's caps give them. Caps with no VP9 entry, an older host's, list
/// no `vp09`, so a newer guest's VideoToolbox finds none there.
#[test]
fn vt_decoders_list_vp9_beside_the_others_where_the_caps_decode_it() {
let entry = |codec, profiles, max_level| RgfxVideoCodecCaps {
codec,
direction: RGFX_VIDEO_DECODE,
profiles,
max_level,
..RgfxVideoCodecCaps::default()
};
let mut older = RgfxVideoCaps {
version: RGFX_VIDEO_CAPS_VERSION,
codec_count: 2,
..RgfxVideoCaps::default()
};
older.codecs[0] = entry(RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_H264_HIGH, 62);
older.codecs[1] = entry(RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_HEVC_MAIN_10, 186);
let mut newer = older;
newer.codec_count = 3;
newer.codecs[2] = entry(
RGFX_VIDEO_CODEC_VP9,
RGFX_VIDEO_VP9_PROFILE_0 | RGFX_VIDEO_VP9_PROFILE_2,
62,
);
let listed = vt_decoders(&newer);
assert_eq!(listed[..2], vt_decoders(&older)[..]);
assert_eq!(
listed[2],
paravirt::Decoder {
codec: paravirt::Codec::Vp9,
profiles: vec![0, 2],
max_level: 62,
}
);
assert!(
(vt_decoders(&older).iter()).all(|d| d.codec != paravirt::Codec::Vp9),
"an older host's caps list no vp09"
);
// Profile 2 alone lists 2; no profile lists nothing.
newer.codecs[2].profiles = RGFX_VIDEO_VP9_PROFILE_2;
assert_eq!(vt_decoders(&newer)[2].profiles, vec![2]);
newer.codecs[2].profiles = 0;
assert_eq!(vt_decoders(&newer).len(), 2);
}
/// The pool takes as many of the addresses its config gives as the GPU's memory heaps hold,
/// every heap summed, rounded up to 2 MiB, from their start, and stops at their end where they
/// hold less; a device with no pool answers no range
+63 -13
View File
@@ -92,6 +92,9 @@
//! GPU where the import check passed XYUV (`xyuv`). The rest are read back and split by the
//! CPU, each picture counted (`video-pictures-cpu-converted`). Every other stream that is not
//! 4:2:0 Main or Main 10 is refused at its session's start, naming why.
//! VP9 decodes there alone, profile 0 and profile 2 at 10 bits where the driver lists them
//! (`Vp9Decoder`, each sample a frame or a superframe whole), and lands as H.264's and HEVC's
//! 4:2:0 pictures do.
//! - **VideoToolbox's paravirtual encoders** (`encode::VaGuestEncoder`, `super::vt`): an arm64
//! guest's encoder reads each source frame from the IOSurface its kext lent: written by the
//! runtime device's GPU from a buffer over its pages into an input of the encoder's, as an x86
@@ -108,14 +111,15 @@ use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Arc, LazyLock, Weak};
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,
RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_CODEC_VP9, 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,
RGFX_VIDEO_VP9_PROFILE_0, RGFX_VIDEO_VP9_PROFILE_2, RgfxVideoCodecCaps, RgfxVideoEncodeCaps,
RgfxVideoOutputLayout,
};
#[cfg(unix)]
use reims_vgpu_video::codec::PictureRole;
use reims_vgpu_video::codec::PictureStart;
use reims_vgpu_video::codec::{PictureStart, vp9};
use reims_vgpu_video::core::backend::{BackendError as VideoError, DeviceWrite, PixelFormat};
#[cfg(unix)]
use reims_vgpu_video::core::device_memory::{
@@ -131,7 +135,7 @@ use reims_vgpu_video::vaapi::{AV1_PROFILE0, Av1Decoder, av1_decodes_ten_bit, av1
use reims_vgpu_video::vaapi::{
Capabilities, ConfigCapabilities, Display, EncoderSupport, Entrypoint, Frame, GuestWrites,
H264_MAX_MACROBLOCKS, H264Decoder, HevcDecoder, ImportWrites, PlaneRows, Profile, Target,
TargetCodec, TargetFor, VideoEncoder, encoder_support,
TargetCodec, TargetFor, VideoEncoder, Vp9Decoder, encoder_support,
};
#[cfg(unix)]
use reims_vgpu_video::vaapi::{TARGET_ALIGNMENT, TargetChecks, TargetPlane, TargetShape};
@@ -577,9 +581,10 @@ impl<P: Platform> GraphicsVideo<P> for VaapiVideo<P> {
true
}
/// 4:2:0 streams of Main and Main 10, and HEVC's range extensions where the driver's
/// decoder of their chroma format and depth decodes them ([`declines_range_extensions`]);
/// AV1's at the depths and sizes the driver lists (`super::av1::declines`).
/// 4:2:0 streams of Main and Main 10, HEVC's range extensions where the driver's decoder of
/// their chroma format and depth decodes them ([`declines_range_extensions`]), AV1's at the
/// depths and sizes the driver lists (`super::av1::declines`), and VP9's where the driver's
/// config of the stream's profile takes its depth and size.
fn guest_declines(&self, codec: u32, stream: &Stream) -> Option<String> {
if codec == HOST_VIDEO_CODEC_AV1 {
return super::av1::declines(NAME, self.av1, stream);
@@ -587,6 +592,16 @@ impl<P: Platform> GraphicsVideo<P> for VaapiVideo<P> {
if codec == RGFX_VIDEO_CODEC_HEVC && stream.range_extensions {
return declines_range_extensions(&self.hevc_range_extensions, stream);
}
if codec == RGFX_VIDEO_CODEC_VP9 && stream.chroma_format_idc == 1 {
return Vp9Decoder::supports(
&self.display,
stream.profile,
stream.luma_bits,
(stream.width, stream.height),
)
.err()
.map(|error| format!("{NAME}: {error}"));
}
(stream.chroma_format_idc != 1 || stream.range_extensions).then(|| {
format!(
"{NAME}'s decoders land 4:2:0 pictures, and HEVC's range extensions where the \
@@ -639,6 +654,7 @@ impl<P: Platform> GraphicsVideo<P> for VaapiVideo<P> {
decoder.lands_range_extensions();
Codec::Hevc(decoder)
}
RGFX_VIDEO_CODEC_VP9 => Codec::Vp9(Vp9Decoder::new(&self.display)),
_ => return None,
};
Some(Box::new(VaGuestDecoder {
@@ -719,10 +735,13 @@ fn declines_range_extensions(configs: &[ConfigCapabilities], stream: &Stream) ->
}
}
/// The caps of H.264 and HEVC decode the driver's answers give (module doc); an entry for each
/// codec of which it lists a profile it decodes.
/// The caps of H.264, HEVC and VP9 decode the driver's answers give (module doc); an entry for
/// each codec of which it lists a profile it decodes.
pub(crate) fn caps_of(caps: &Capabilities) -> Vec<RgfxVideoCodecCaps> {
h264_caps(caps).into_iter().chain(hevc_caps(caps)).collect()
(h264_caps(caps).into_iter())
.chain(hevc_caps(caps))
.chain(vp9_caps(caps))
.collect()
}
/// `profile`'s VLD config where the driver lists one that decodes `rt_format` (or names no
@@ -824,6 +843,30 @@ fn hevc_caps(caps: &Capabilities) -> Option<RgfxVideoCodecCaps> {
Some(entry)
}
/// VP9 decode, for VideoToolbox's paravirtual decoders alone: profile 0 where its config decodes
/// 8-bit 4:2:0, into NV12, and profile 2 where its config decodes 10-bit 4:2:0, into P010, at
/// sizes up to the codec crate's bound (`vp9::MAX_SIDE`). A frame references three of the eight
/// slots, which with the frame itself the DPB holds.
fn vp9_caps(caps: &Capabilities) -> Option<RgfxVideoCodecCaps> {
let zero = vld(caps, Profile::VP9_PROFILE0, RT_YUV420);
let two = vld(caps, Profile::VP9_PROFILE2, RT_YUV420_10);
let configs: Vec<&ConfigCapabilities> = [zero, two].into_iter().flatten().collect();
let mut entry = decode_caps(RGFX_VIDEO_CODEC_VP9, &configs)?;
if zero.is_some() {
entry.profiles |= RGFX_VIDEO_VP9_PROFILE_0;
entry.formats |= RGFX_VIDEO_FORMAT_NV12;
}
if two.is_some() {
entry.profiles |= RGFX_VIDEO_VP9_PROFILE_2;
entry.formats |= RGFX_VIDEO_FORMAT_P010;
}
entry.max_size = entry.max_size.map(|side| side.min(vp9::MAX_SIDE));
entry.max_level = vp9::TOP_LEVEL;
entry.max_dpb_pictures = 9;
entry.max_references = 3;
Some(entry)
}
/// How `codec`'s decode lands in place (module doc): granularity [2, 2], at the largest of the
/// alignments the import check found for the codec's formats; all zero where it found none, and
/// for an encode, whose sources the CPU reads.
@@ -1303,13 +1346,15 @@ fn say(said: &Mutex<Vec<String>>, why: String) {
}
}
/// A session's decoder.
/// A session's decoder: VP9's VideoToolbox's alone (`VaGuestDecoder`), as no session of the
/// device takes VP9.
enum Codec {
H264(H264Decoder),
Hevc(HevcDecoder),
/// AV1's, which VideoToolbox's decoders alone make, its frames decoded into no cache; boxed,
/// as its eight slots' state is far larger than the other decoders.
Av1(Box<Av1Decoder>),
Vp9(Vp9Decoder),
}
/// A session's decoder, and what its pictures land through.
@@ -1350,6 +1395,7 @@ impl<P: Platform> VaDecoder<P> {
Codec::H264(decoder) => decoder.decode_into(au, id, target_for),
Codec::Hevc(decoder) => decoder.decode_into(au, id, target_for),
Codec::Av1(decoder) => decoder.decode(au, id),
Codec::Vp9(decoder) => decoder.decode(au, id),
}
}
}
@@ -1371,6 +1417,7 @@ impl<P: Platform> HostDecoder<P> for VaDecoder<P> {
Codec::H264(_) => Some(TargetCodec::H264),
Codec::Hevc(_) => Some(TargetCodec::Hevc),
Codec::Av1(_) => None,
Codec::Vp9(_) => None,
};
let target_for = (self.targets.as_ref())
.zip(codec)
@@ -1405,6 +1452,7 @@ impl<P: Platform> HostDecoder<P> for VaDecoder<P> {
Codec::H264(_) => H264Decoder::SPARE_FRAMES,
Codec::Hevc(_) => HevcDecoder::SPARE_FRAMES,
Codec::Av1(_) => Av1Decoder::SPARE_FRAMES,
Codec::Vp9(_) => Vp9Decoder::SPARE_FRAMES,
}
}
@@ -1413,6 +1461,7 @@ impl<P: Platform> HostDecoder<P> for VaDecoder<P> {
Codec::H264(decoder) => decoder.last_picture(),
Codec::Hevc(decoder) => decoder.last_picture(),
Codec::Av1(_) => None,
Codec::Vp9(_) => None,
}
}
}
@@ -1446,6 +1495,7 @@ impl<P: Platform> VaGuestDecoder<P> {
Codec::H264(decoder) => decoder.decode_into(bytes, id, None),
Codec::Hevc(decoder) => decoder.decode_into(bytes, id, None),
Codec::Av1(decoder) => decoder.decode(bytes, id),
Codec::Vp9(decoder) => decoder.decode(bytes, id),
};
frames.map_err(video_error)
}
@@ -818,7 +818,7 @@ fn a_guest_encoder_encodes_the_frames_of_the_surfaces_it_is_lent() {
let codec = match encoder.codec {
Codec::H264 => RGFX_VIDEO_CODEC_H264,
Codec::Hevc => RGFX_VIDEO_CODEC_HEVC,
Codec::Av1 => unreachable!("no arm encodes AV1"),
Codec::Av1 | Codec::Vp9 => unreachable!("no arm encodes AV1 or VP9"),
};
let units: Vec<Vec<u8>> = (samples.iter())
.map(|s| annex_b(codec, s.configuration.as_deref(), &s.data).unwrap())
@@ -94,6 +94,49 @@ fn the_caps_are_the_driver_s_answers() {
);
}
/// VP9's entry, for VideoToolbox's paravirtual decoders, is profile 0 where its config decodes
/// 8-bit 4:2:0 and profile 2 where its config decodes 10-bit, each into its format, at the least
/// of their sizes held to the codec crate's bound, VP9's top level, and the eight slots and the
/// frame; a profile 2 config of 8-bit surfaces alone gives no profile 2
#[test]
fn vp9_s_caps_are_its_profiles_configs_within_the_codec_s_bound() {
let caps = caps_of(&driver(vec![
config(Profile::VP9_PROFILE0, RT_YUV420, (16384, 16384), None),
config(Profile::VP9_PROFILE2, RT_YUV420_10, (32768, 16384), None),
]));
assert_eq!(caps.len(), 1);
let vp9 = caps[0];
assert_eq!(
(vp9.codec, vp9.direction),
(RGFX_VIDEO_CODEC_VP9, RGFX_VIDEO_DECODE)
);
assert_eq!(
vp9.profiles,
RGFX_VIDEO_VP9_PROFILE_0 | RGFX_VIDEO_VP9_PROFILE_2
);
assert_eq!(vp9.formats, RGFX_VIDEO_FORMAT_NV12 | RGFX_VIDEO_FORMAT_P010);
assert_eq!(vp9.max_size, [16384, 16384]);
assert_eq!(
(vp9.max_level, vp9.max_dpb_pictures, vp9.max_references),
(62, 9, 3)
);
let eight_bit_only = caps_of(&driver(vec![
config(Profile::VP9_PROFILE0, RT_YUV420, (8192, 8192), None),
config(Profile::VP9_PROFILE2, RT_YUV420, (8192, 8192), None),
]));
assert_eq!(eight_bit_only[0].profiles, RGFX_VIDEO_VP9_PROFILE_0);
assert_eq!(eight_bit_only[0].formats, RGFX_VIDEO_FORMAT_NV12);
assert!(
caps_of(&driver(vec![config(
Profile::VP9_PROFILE2,
RT_YUV420,
(8192, 8192),
None
)]))
.is_empty()
);
}
/// H.264's largest size keeps its pictures to `H264_MAX_MACROBLOCKS`: radeonsi's 4096x4096, which
/// it decodes nothing at (bugs.md, U28), and iHD's 8192x8192, whose pictures past 4096 wide it
/// refuses, are both answered 4096x4080, which holds 3840x2160 and 4096x2160; sizes within the
@@ -921,6 +964,7 @@ pub(super) fn each_picture(
Codec::H264(d) => d.decode(unit, id),
Codec::Hevc(d) => d.decode(unit, id),
Codec::Av1(d) => d.decode(unit, id),
Codec::Vp9(_) => panic!("an Annex B stream decoded as VP9"),
};
let frames = match frames {
Ok(frames) => frames,
+3 -2
View File
@@ -26,8 +26,8 @@ use std::collections::VecDeque;
use std::sync::Arc;
use reims_vgpu_graphics::wire::{
RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_DECODE, RGFX_VT_SURFACE_PLANES,
RgfxVtSurface,
RGFX_VIDEO_CODEC_H264, RGFX_VIDEO_CODEC_HEVC, RGFX_VIDEO_CODEC_VP9, RGFX_VIDEO_DECODE,
RGFX_VT_SURFACE_PLANES, RgfxVtSurface,
};
use reims_vgpu_video::codec::encode::{Coded, FailedSample};
use reims_vgpu_video::core::backend::{BackendError as VideoError, Chroma, PixelFormat};
@@ -79,6 +79,7 @@ fn codec_of(codec: Codec) -> u32 {
Codec::H264 => RGFX_VIDEO_CODEC_H264,
Codec::Hevc => RGFX_VIDEO_CODEC_HEVC,
Codec::Av1 => super::av1::HOST_VIDEO_CODEC_AV1,
Codec::Vp9 => RGFX_VIDEO_CODEC_VP9,
}
}
+27
View File
@@ -1940,6 +1940,33 @@ Stages:
refusal in its reply's `,err`, as for a codec the host lacks.
A host with no arm offers no caps and the kext publishes no service:
the guest's VideoToolbox is then not a guest's.
- **VP9 is this route's alone.** Its caps entry is codec 3
(`RGFX_VIDEO_CODEC_VP9`), with `RGFX_VIDEO_VP9_PROFILE_0` (4:2:0 at 8
bits) and `RGFX_VIDEO_VP9_PROFILE_2` (4:2:0 at 10) as the arm decodes
them, and its level as `vpcC` numbers it, ten times VP9's: 62, level
6.2, the top one, as the arms answer no level. Apple numbers its own
levels so: the M3's AV1 decoder answers `VTMaxDecodeLevel` 63 for
level 6.3, and lists no capabilities of VP9's, whose decoder is
supplemental (read from AppleAVD's registry on the M3, macOS 27.0.1,
potluck job m3-max-77311). The x86-64 kexts read no entry past
HEVC's, so an older guest skips it and a newer one on an older host
finds none, and the device makes no session of codec 3. `decs` lists
VP9's decoder as `reims-vgpu-video.videodecoder.vp9`, `dcap` its two
profiles as 0 and 2; `encs` lists no VP9 encoder. A session's samples
come one container sample a `dfrm`, a superframe whole, hidden altref
frames inside it (measured: libvpx's streams on arm64 macOS 26.6.2
under TCG on an RX 7900 XTX host, 2026-11-27, potluck job
m3-max-77263), and `dsta` carries the stream's `vpcC`. The host splits
each superframe by its index and decodes every frame, after checking
each size against the bytes it holds (`reims_vgpu_video::codec::vp9`).
`dsta` refuses with `kVTVideoDecoderUnsupportedDataFormatErr` a
stream of profile 1 or 3, of 12 bits, or one the arm declines (a
profile or size its driver lacks), and arm64 macOS then has no VP9
decoder for it (devices.md, "Which hardware"). The guest's
VideoToolbox, on macOS 14.6.1 as on 26.6.2, lists the decoder once a
process registers VP9, and hands it every VP9 stream, a Profile 1
stream too, which the host then refuses at `dsta` (measured under
TCG, 2026-11-27, potluck jobs m3-max-77373 and m3-max-77382).
- **The host offers `VT_MESSAGES` where its arm lands decodes in the
guest's surfaces**: on VA-API and on NVDEC, each where it decodes
H.264 or HEVC. The arm64e kext publishes the service on macOS 14
+7 -3
View File
@@ -57,9 +57,9 @@ NVIDIA or AMD card on a Windows host.
## Some video formats don't use your GPU
Your GPU may decode or encode video formats that the guest doesn't get from it. For these, we
found no way in macOS to hand the work to our virtual GPU, so the guest uses its own software, or
has no player for them at all:
Your GPU may decode or encode video formats that the guest doesn't get from it. For most of these,
we found no way in macOS to hand the work to our virtual GPU, so the guest uses its own software,
or has no player for them at all:
- **VP9 decoding on Intel Mac guests.** macOS 26.7.2 sends VP9 to a GPU driver like ours, but
never tells it where to put each decoded picture.
@@ -85,6 +85,10 @@ has no player for them at all:
hardware by name before they hand a photo or a Motion JPEG video to a GPU. Our virtual
machines have neither, so they decode JPEG in software. Our virtual GPU decodes JPEG when
asked directly, but no app's route asks it.
- **VP9 at 4:2:2 or 4:4:4, or at 12 bits, on arm64 guests.** On a Linux host whose GPU decodes
VP9, arm64 guests decode it there at 4:2:0 in 8 and 10 bits. macOS hands the other VP9 formats
to our virtual GPU too, but our virtual GPU doesn't take them yet, and arm64 macOS has no VP9
decoding of its own, so the guest has no player for them.
- **MPEG-1, MPEG-2, MPEG-4 Part 2, VC-1 and VP8 decoding, and VP9 and AV1 encoding.** We found no
way in macOS for a GPU to take these.
+53 -10
View File
@@ -43,15 +43,56 @@ arm64e kext ([design.md](../graphics-kext/design.md), "Decided", 17). The arm64e
AppleGVA no video driver; where the guest took `RGFX_FEATURE_VT_MESSAGES` and the caps list a
decoder, it publishes VideoToolbox's paravirtualization service, and the guest's VideoToolbox
registers each decoder and encoder the host lists, running each session as `VT_MESSAGE`s on
ring 0. The host lists a decoder for each H.264 or HEVC decode entry of the caps (`vt_features`
and the decoder list beside it in `graphics.rs`), an AV1 decoder where the arm decodes AV1
("AV1 on arm64 guests", below), and an encoder for each codec its arm encodes a profile of
(`guest_encoders` in `graphics/vaapi.rs` and `graphics/nvidia.rs`). So on a Linux host
an arm64 guest decodes H.264 and HEVC and encodes H.264 and HEVC Main and Main 10 in hardware; on
a Windows host it decodes alone, as the Windows arm answers no encoder. Its decoders land 4:2:0
pictures, and HEVC's range extensions, 4:2:0, 4:2:2 and 4:4:4 at 8, 10 and 12 bits, where the
arm's own query lists a decoder of the stream (`guest_declines`; "HEVC's range extensions on arm64
guests", below).
ring 0. The host lists a decoder for each H.264, HEVC or VP9 decode entry of the caps
(`vt_features` and the decoder list beside it in `graphics.rs`), an AV1 decoder where the arm
decodes AV1 ("AV1 on arm64 guests", below), and an encoder for each codec its arm encodes a
profile of (`guest_encoders` in `graphics/vaapi.rs` and `graphics/nvidia.rs`). So on a Linux host
an arm64 guest decodes H.264, HEVC and VP9 and encodes H.264 and HEVC Main and Main 10 in
hardware; on a Windows host it decodes alone, as the Windows arm answers no encoder. Its decoders
land 4:2:0 pictures, and HEVC's range extensions, 4:2:0, 4:2:2 and 4:4:4 at 8, 10 and 12 bits,
where the arm's own query lists a decoder of the stream (`guest_declines`; "HEVC's range
extensions on arm64 guests", below).
VP9 reaches the host by this route alone. Its caps entry (codec 3, `RGFX_VIDEO_CODEC_VP9`) lists
profile 0, into NV12, where the arm decodes VP9 at 8 bits, and profile 2, into P010, where it
decodes VP9 at 10 (`vp9_caps` in `graphics/vaapi.rs` and `graphics/nvidia.rs`), at the arm's sizes
up to 16384 a side, and VP9's top level as `vpcC` numbers it (62, level 6.2). An x86-64 guest's
kexts read no entry past HEVC's, and the device takes no session of codec 3 ("A decode"). The
guest's VideoToolbox lists the VP9 decoder only once a process calls
`VTRegisterSupplementalVideoDecoderIfAvailable` for `vp09`, as on a Mac, and as browsers do: before
that every VP9 session's create fails −12906 (`kVTCouldNotFindVideoDecoderErr`) in the guest and
none reaches the host; after it a session decodes on the host. arm64 macOS 26.6.2 has no VP9
decoder of its own, and the M3's macOS 27.0.1 none in software: a session that allows no hardware
fails −12906 before and after (**measured** under TCG on an RX 7900 XTX host, and on the M3,
2026-11-27, potluck jobs m3-max-77263 and m3-max-77262). So a VP9 stream the host does not decode,
a Profile 1 or 3 stream or one at 12 bits, or any VP9 on a host whose driver lists none, is not
decoded in the guest at all. The guest's VideoToolbox does hand such a stream to the host's
decoder, though its profiles name 0 and 2 alone: an 8-bit 4:4:4 Profile 1 stream's session reached
the host, whose `dsta` refused it (−12910, `kVTVideoDecoderUnsupportedDataFormatErr`, whether the
session required hardware or allowed it), and a session that allowed no hardware failed −12906
(**measured** on the Iris Xe host, whose driver lists profiles 1 and 3, 2026-11-27, potluck job
m3-max-77382). Each sample, a frame or a superframe whole, is split into its frames on the host,
which decodes them all and lands the one it shows. The guest's pictures of our two libvpx streams
equal vpxdec's, frame by frame, by the IVF route (the probe's own `vpcC`) and the MP4 route
(AVFoundation's), in sessions that require hardware: on an RX 7900 XTX (radeonsi), an Iris Xe
(iHD) and an RTX 3090 (NVDEC) under arm64 macOS 26.6.2, and on the RTX 3090 under macOS 14.6.1,
all under TCG (**measured** 2026-11-27, potluck jobs m3-max-77354, m3-max-77382, m3-max-77355
and m3-max-77373). A VP9 decode runs as fast as HEVC's on the same route, measured with the guest's
CPU emulated (TCG, 4 CPUs): the rates are the emulated guest's, not the GPU's, and at 1080p the
three proof cards' VP9 rates lie within 5% of each other (one run each: 89.1, 90.7 and 93.2 frames
a second on the RX 7900 XTX, the Iris Xe and the RTX 3090, against HEVC's 79.9, 90.9 and 94.2, in
jobs m3-max-77354, m3-max-77382 and m3-max-77355). Each measure took
sessions that require hardware, VP9's and HEVC's in turns, four runs each, at 1920x1080 (60
frames) and at 8192x4352 (8 frames): the largest picture both codecs' entries take, as the drivers
answer up to 8192x4352 on the AMD cards and 16384x16384 on the Iris Xe for both, and both
entries' level, 6.2, bounds a picture at 35,651,584 luma samples, which 8192x4352 fills. As
medians, VP9's frames a second and seconds of guest CPU against HEVC's: on the RX 7900 XTX, with
the node to itself (potluck job m3-max-77411), 84.4 and 2.85 s against 78.6 and 3.14 s at 1080p,
and 21.2 and 1.55 s against 20.7 and 1.56 s at 8192x4352, the guest CPU's medians there leaving
out one run of each codec that read 0.00 s, as the guest's tick count did not move in its 0.3 s;
and on the Radeon 780M, beside a job of another card's (m3-max-77433), 92.7 and 2.58 s against 94.4
and 2.55 s at 1080p, and 22.6 and 1.43 s against 20.6 and 1.57 s at 8192x4352, leaving out one
HEVC run there that read 0.00 s likewise (**measured** 2026-11-27).
Where the host lists no decoder, the kext publishes no service, and the guest's VideoToolbox
answers as above for decoders. Its encoders are then the OS's own: arm64 macOS 27.0.1 lists no
@@ -220,7 +261,9 @@ direction. Each session has a shared event, which the host signals.
## A decode
A decode is an op (`DECODE_H264` 0x4000, `DECODE_H265` 0x4001) in a video encoder of a
command buffer of the session's process (`graphics/decode/video.rs`):
command buffer of the session's process (`graphics/decode/video.rs`). VP9 has no op: its caps
entry serves VideoToolbox's paravirtual decoders alone ("Which hardware"), and a
`VIDEO_SESSION_CREATE` of codec 3 is refused as any codec without a session.
- **The op's objects** are resolved as the command buffer is taken: the bitstream buffer, and
the buffers the output surface's planes lie in. An op faults the command buffer where it is
+1 -1
View File
@@ -6,7 +6,7 @@
rom = "749434f87f562895548f60681cd4cd8bf6cc0d0e967ac2fea297674426709161"
[sources]
"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "6c5133b9ad70641bee038226423d525a34967fd67eb2f88b33cfaaf73e630b89"
"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "5610b5f5d97103324028a1ca65ee8c4820eebab7ea6286f76904319bbd3f9e5d"
"firmware/Makefile" = "d85b14a3b40cc59b7c07a9e3a3a273c257e81c5674963c70c3c45eb386e653d0"
"firmware/src/OptionRom.S" = "b910fe61a880580996a81134fba75900d3a9f48ca266e76fe2d6b8eb5a011eb9"
"firmware/src/ReimsGraphics.c" = "554751ff15edbdf69a038d5b2aefd8315b9c54610c090c0890d9c72b13dacdef"
+1 -1
View File
@@ -8,7 +8,7 @@ sdk = "MacOSX27.2.sdk"
clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
[sources]
"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "6c5133b9ad70641bee038226423d525a34967fd67eb2f88b33cfaaf73e630b89"
"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "5610b5f5d97103324028a1ca65ee8c4820eebab7ea6286f76904319bbd3f9e5d"
"guest/Makefile" = "1cc954452fc507a44b4e55dc828d6acbd061fc65df6d9091320f6f50d5f08d1b"
"guest/bundle/Info.plist" = "573c1f2fca18f70c3311818493247c3a6843cee92554a6ceffce042e476c1a97"
"guest/bundle/Makefile" = "a2bbf6a4bcacb7b04045365a384956ddd940d3526349c4d18f29a6779fd31475"
+1 -1
View File
@@ -8,7 +8,7 @@ sdk = "MacOSX27.2.sdk"
clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
[sources]
"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "6c5133b9ad70641bee038226423d525a34967fd67eb2f88b33cfaaf73e630b89"
"crates/reims-vgpu-graphics/include/reims_graphics_wire.h" = "5610b5f5d97103324028a1ca65ee8c4820eebab7ea6286f76904319bbd3f9e5d"
"guest/Makefile" = "1cc954452fc507a44b4e55dc828d6acbd061fc65df6d9091320f6f50d5f08d1b"
"guest/bundle/Info.plist" = "573c1f2fca18f70c3311818493247c3a6843cee92554a6ceffce042e476c1a97"
"guest/bundle/Makefile" = "a2bbf6a4bcacb7b04045365a384956ddd940d3526349c4d18f29a6779fd31475"