Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a21294e6 | ||
|
|
2373afdd01 | ||
|
|
e68e3ce939 | ||
|
|
9324949b55 | ||
|
|
48dd6d2fad | ||
|
|
2df30ffea9 | ||
|
|
0427583422 |
No files matched your search
Generated
+3
@@ -213,6 +213,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "metal2vulkan"
|
name = "metal2vulkan"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
source = "git+https://github.com/reims-go/metal2vulkan?rev=19090d5f2e60185359200046e0b72e96ce60099a#19090d5f2e60185359200046e0b72e96ce60099a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash",
|
"ash",
|
||||||
"metal2vulkan-air",
|
"metal2vulkan-air",
|
||||||
@@ -223,6 +224,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "metal2vulkan-air"
|
name = "metal2vulkan-air"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
source = "git+https://github.com/reims-go/metal2vulkan?rev=19090d5f2e60185359200046e0b72e96ce60099a#19090d5f2e60185359200046e0b72e96ce60099a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sha2 0.11.1",
|
"sha2 0.11.1",
|
||||||
]
|
]
|
||||||
@@ -230,6 +232,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "metal2vulkan-runtime"
|
name = "metal2vulkan-runtime"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
source = "git+https://github.com/reims-go/metal2vulkan?rev=19090d5f2e60185359200046e0b72e96ce60099a#19090d5f2e60185359200046e0b72e96ce60099a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ash",
|
"ash",
|
||||||
"libc",
|
"libc",
|
||||||
|
|||||||
+2
-2
@@ -33,11 +33,11 @@ reims-vgpu-graphics = { path = "crates/reims-vgpu-graphics" }
|
|||||||
reims-vgpu-video = { path = "crates/reims-vgpu-video" }
|
reims-vgpu-video = { path = "crates/reims-vgpu-video" }
|
||||||
# metal2vulkan's Metal types, for the Metal enums and descriptor values the runtime's calls take,
|
# metal2vulkan's Metal types, for the Metal enums and descriptor values the runtime's calls take,
|
||||||
# from metal2vulkan's public repository at the commit both name.
|
# from metal2vulkan's public repository at the commit both name.
|
||||||
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "0b0ac58eb0f69ed3b37007fbdf3b135a46f90699" }
|
metal2vulkan = { git = "https://github.com/reims-go/metal2vulkan", rev = "19090d5f2e60185359200046e0b72e96ce60099a" }
|
||||||
# The Vulkan platform's runtime (architecture D1), metal2vulkan-runtime: a Metal-shaped API on
|
# The Vulkan platform's runtime (architecture D1), metal2vulkan-runtime: a Metal-shaped API on
|
||||||
# Vulkan, one path for every device, under reims-vgpu-vulkan's `rt_platform` and `seam` and
|
# Vulkan, one path for every device, under reims-vgpu-vulkan's `rt_platform` and `seam` and
|
||||||
# reims-vgpu's `pool::rt_blocks`.
|
# reims-vgpu's `pool::rt_blocks`.
|
||||||
metal2vulkan-runtime = { git = "https://github.com/steelbrain/metal2vulkan", rev = "0b0ac58eb0f69ed3b37007fbdf3b135a46f90699" }
|
metal2vulkan-runtime = { git = "https://github.com/reims-go/metal2vulkan", rev = "19090d5f2e60185359200046e0b72e96ce60099a" }
|
||||||
# The hashes of the Vulkan platform's metallib sources (reims-vgpu-vulkan/build.rs).
|
# The hashes of the Vulkan platform's metallib sources (reims-vgpu-vulkan/build.rs).
|
||||||
sha2 = "0.10.9"
|
sha2 = "0.10.9"
|
||||||
# A display window's swapchain on Linux (reims-vgpu-vulkan/src/swapchain.rs), at the runtime's
|
# A display window's swapchain on Linux (reims-vgpu-vulkan/src/swapchain.rs), at the runtime's
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ mod opencore;
|
|||||||
mod os;
|
mod os;
|
||||||
mod paths;
|
mod paths;
|
||||||
mod prebuilt;
|
mod prebuilt;
|
||||||
|
mod processor;
|
||||||
mod qemu;
|
mod qemu;
|
||||||
mod qmp;
|
mod qmp;
|
||||||
mod reims_util;
|
mod reims_util;
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ use crate::vm::{Graphics, ImageFormat, Vm};
|
|||||||
use crate::{paths, prebuilt, reims_util, runtime};
|
use crate::{paths, prebuilt, reims_util, runtime};
|
||||||
use anyhow::{Context, Result, bail, ensure};
|
use anyhow::{Context, Result, bail, ensure};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::fs::File;
|
use std::fs::{self, File, OpenOptions};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
use std::sync::{Mutex, PoisonError};
|
use std::sync::{Mutex, PoisonError};
|
||||||
use std::time::{Duration, SystemTime};
|
use std::time::{Duration, SystemTime};
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ pub struct Config(plist::Dictionary);
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn read(path: &Path, format: ImageFormat) -> Result<Config> {
|
pub fn read(path: &Path, format: ImageFormat) -> Result<Config> {
|
||||||
let bytes = read_file(path, format, "EFI/OC/config.plist")?
|
let bytes = read_file(path, format, CONFIG_PLIST)?
|
||||||
.context("its EFI system partition has no EFI/OC/config.plist")?;
|
.context("its EFI system partition has no EFI/OC/config.plist")?;
|
||||||
Config::parse(&bytes)
|
Config::parse(&bytes)
|
||||||
}
|
}
|
||||||
@@ -132,6 +133,171 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CONFIG_PLIST: &str = "EFI/OC/config.plist";
|
||||||
|
|
||||||
|
/// Update the type used by macOS's About This Mac when OpenCore is set to automatic.
|
||||||
|
pub fn match_processor_type(vm: &Vm, value: u16) -> Result<bool> {
|
||||||
|
let Some(q) = vm.config.q35.as_ref() else {
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
let image = vm.path(&q.opencore);
|
||||||
|
if !fs::symlink_metadata(&image)?.is_file() {
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
let format = q.opencore_format;
|
||||||
|
let stamp = Stamp::of(&image).context("read OpenCore image metadata")?;
|
||||||
|
let Some(bytes) = read_file(&image, format, CONFIG_PLIST)? else {
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
let Some(edited) = with_processor_type(&bytes, value)? else {
|
||||||
|
return Ok(false);
|
||||||
|
};
|
||||||
|
ensure_opencore_unused(vm, &image)?;
|
||||||
|
|
||||||
|
// Keep the original until the candidate is synced and read back. Each caller owns its copy.
|
||||||
|
static NEXT: AtomicU64 = AtomicU64::new(0);
|
||||||
|
let part = image.with_extension(format!(
|
||||||
|
"cpu-{}-{}-{}.part",
|
||||||
|
std::process::id(),
|
||||||
|
SystemTime::now()
|
||||||
|
.duration_since(SystemTime::UNIX_EPOCH)?
|
||||||
|
.as_nanos(),
|
||||||
|
NEXT.fetch_add(1, Ordering::Relaxed),
|
||||||
|
));
|
||||||
|
let file = OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.write(true)
|
||||||
|
.create_new(true)
|
||||||
|
.open(&part)?;
|
||||||
|
let result = (|| -> Result<()> {
|
||||||
|
let mut source = File::open(&image)?;
|
||||||
|
file.set_permissions(source.metadata()?.permissions())?;
|
||||||
|
std::io::copy(&mut source, &mut &file)?;
|
||||||
|
drop(source);
|
||||||
|
let disk = Disk::from_file(file, format)?;
|
||||||
|
let fat = Fat32::open(&disk, esp_start(&disk)?)?;
|
||||||
|
ensure!(
|
||||||
|
fat.holds(CONFIG_PLIST, &bytes)? == Some(true),
|
||||||
|
"OpenCore config changed while copying"
|
||||||
|
);
|
||||||
|
fat.overwrite(CONFIG_PLIST, &edited)?;
|
||||||
|
disk.file().sync_all()?;
|
||||||
|
drop(disk);
|
||||||
|
ensure!(
|
||||||
|
read_file(&part, format, CONFIG_PLIST)?.as_deref() == Some(&edited),
|
||||||
|
"the new OpenCore config did not read back"
|
||||||
|
);
|
||||||
|
|
||||||
|
ensure_opencore_unused(vm, &image)?;
|
||||||
|
ensure!(
|
||||||
|
Stamp::of(&image) == Some(stamp),
|
||||||
|
"OpenCore image changed while copying"
|
||||||
|
);
|
||||||
|
fs::rename(&part, &image).with_context(|| format!("replace {}", image.display()))
|
||||||
|
})();
|
||||||
|
if let Err(error) = result {
|
||||||
|
let _ = fs::remove_file(&part);
|
||||||
|
return Err(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
KEPT.lock()
|
||||||
|
.unwrap_or_else(PoisonError::into_inner)
|
||||||
|
.remove(&image);
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ensure_opencore_unused(vm: &Vm, image: &Path) -> Result<()> {
|
||||||
|
ensure!(!runtime::running(vm), "{} is running", vm.name());
|
||||||
|
let image = fs::canonicalize(image)?;
|
||||||
|
for entry in crate::vm::Registry::load()?.vms {
|
||||||
|
if runtime::pid_at(&crate::vm::pidfile_in(&entry.dir)).is_none() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let other = Vm::load(&entry.dir)
|
||||||
|
.with_context(|| format!("read settings of running VM {}", entry.name))?;
|
||||||
|
if let Some(q) = &other.config.q35 {
|
||||||
|
let other_image = fs::canonicalize(other.path(&q.opencore))?;
|
||||||
|
ensure!(
|
||||||
|
other_image != image,
|
||||||
|
"{} is running on this OpenCore image",
|
||||||
|
entry.name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Replace the integer in the plist without resizing the FAT file. The parsed comparison
|
||||||
|
/// guards against editing a similarly named key elsewhere in the XML.
|
||||||
|
fn with_processor_type(bytes: &[u8], value: u16) -> Result<Option<Vec<u8>>> {
|
||||||
|
let mut expected = Config::parse(bytes)?.0;
|
||||||
|
let vault = expected
|
||||||
|
.get("Misc")
|
||||||
|
.and_then(plist::Value::as_dictionary)
|
||||||
|
.and_then(|misc| misc.get("Security"))
|
||||||
|
.and_then(plist::Value::as_dictionary)
|
||||||
|
.and_then(|security| security.get("Vault"))
|
||||||
|
.and_then(plist::Value::as_string);
|
||||||
|
if vault != Some("Optional") {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let Some(platform) = expected
|
||||||
|
.get_mut("PlatformInfo")
|
||||||
|
.and_then(plist::Value::as_dictionary_mut)
|
||||||
|
else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
if platform.get("Automatic").and_then(plist::Value::as_boolean) != Some(true)
|
||||||
|
|| platform
|
||||||
|
.get("UpdateSMBIOS")
|
||||||
|
.and_then(plist::Value::as_boolean)
|
||||||
|
!= Some(true)
|
||||||
|
|| platform
|
||||||
|
.get("UpdateSMBIOSMode")
|
||||||
|
.and_then(plist::Value::as_string)
|
||||||
|
!= Some("Create")
|
||||||
|
{
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let Some(processor) = platform
|
||||||
|
.get_mut("Generic")
|
||||||
|
.and_then(plist::Value::as_dictionary_mut)
|
||||||
|
.and_then(|generic| generic.get_mut("ProcessorType"))
|
||||||
|
else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
if value == 0 || processor.as_unsigned_integer() != Some(0) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
*processor = plist::Value::Integer(value.into());
|
||||||
|
|
||||||
|
const KEY: &[u8] = b"<key>ProcessorType</key>";
|
||||||
|
let start = bytes
|
||||||
|
.windows(KEY.len())
|
||||||
|
.position(|w| w == KEY)
|
||||||
|
.context("OpenCore config has no XML ProcessorType key")?
|
||||||
|
+ KEY.len();
|
||||||
|
let whitespace = bytes[start..]
|
||||||
|
.iter()
|
||||||
|
.take_while(|b| b.is_ascii_whitespace())
|
||||||
|
.count();
|
||||||
|
const ZERO: &[u8] = b"<integer>0</integer>";
|
||||||
|
let integer = start + whitespace;
|
||||||
|
let replacement = format!("<integer>{value}</integer>");
|
||||||
|
let growth = replacement.len() - ZERO.len();
|
||||||
|
ensure!(
|
||||||
|
bytes[integer..].starts_with(ZERO) && whitespace >= growth,
|
||||||
|
"OpenCore ProcessorType cannot be replaced at its original length"
|
||||||
|
);
|
||||||
|
let mut edited = bytes.to_vec();
|
||||||
|
edited[integer - growth..integer + ZERO.len()].copy_from_slice(replacement.as_bytes());
|
||||||
|
ensure!(
|
||||||
|
Config::parse(&edited)?.0 == expected,
|
||||||
|
"OpenCore config would change beyond ProcessorType"
|
||||||
|
);
|
||||||
|
Ok(Some(edited))
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether a VM's OpenCore image shows its boot picker; `None` for an image reims-ctl cannot
|
/// Whether a VM's OpenCore image shows its boot picker; `None` for an image reims-ctl cannot
|
||||||
/// read, or a VM with no OpenCore.
|
/// read, or a VM with no OpenCore.
|
||||||
pub fn shows_picker(vm: &Vm) -> Option<bool> {
|
pub fn shows_picker(vm: &Vm) -> Option<bool> {
|
||||||
@@ -545,6 +711,10 @@ pub(crate) enum Disk {
|
|||||||
impl Disk {
|
impl Disk {
|
||||||
pub(crate) fn open(path: &Path, format: ImageFormat) -> Result<Disk> {
|
pub(crate) fn open(path: &Path, format: ImageFormat) -> Result<Disk> {
|
||||||
let file = File::open(path).with_context(|| format!("open {}", path.display()))?;
|
let file = File::open(path).with_context(|| format!("open {}", path.display()))?;
|
||||||
|
Self::from_file(file, format)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_file(file: File, format: ImageFormat) -> Result<Disk> {
|
||||||
Ok(match format {
|
Ok(match format {
|
||||||
ImageFormat::Raw => Disk::Raw {
|
ImageFormat::Raw => Disk::Raw {
|
||||||
size: file.metadata()?.len(),
|
size: file.metadata()?.len(),
|
||||||
@@ -554,6 +724,29 @@ impl Disk {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn file(&self) -> &File {
|
||||||
|
match self {
|
||||||
|
Disk::Raw { file, .. } => file,
|
||||||
|
Disk::Qcow2(q) => &q.file,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&self, offset: u64, buf: &[u8]) -> Result<()> {
|
||||||
|
let size = match self {
|
||||||
|
Disk::Raw { size, .. } => *size,
|
||||||
|
Disk::Qcow2(q) => q.size,
|
||||||
|
};
|
||||||
|
ensure!(
|
||||||
|
offset.saturating_add(buf.len() as u64) <= size,
|
||||||
|
"write past image end"
|
||||||
|
);
|
||||||
|
match self {
|
||||||
|
Disk::Raw { file, .. } => file.write_all_at(buf, offset)?,
|
||||||
|
Disk::Qcow2(q) => q.write(offset, buf)?,
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn read(&self, offset: u64, buf: &mut [u8]) -> Result<()> {
|
pub(crate) fn read(&self, offset: u64, buf: &mut [u8]) -> Result<()> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
{
|
{
|
||||||
@@ -619,8 +812,8 @@ impl Qcow2 {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Where guest cluster `index` is in the file; None where it reads as zeros.
|
/// Host offset and whether the cluster is exclusively owned.
|
||||||
fn cluster(&self, index: u64) -> Result<Option<u64>> {
|
fn cluster(&self, index: u64) -> Result<Option<(u64, bool)>> {
|
||||||
let per_table = 1u64 << (self.cluster_bits - 3);
|
let per_table = 1u64 << (self.cluster_bits - 3);
|
||||||
let l1 = self
|
let l1 = self
|
||||||
.l1
|
.l1
|
||||||
@@ -636,7 +829,32 @@ impl Qcow2 {
|
|||||||
let e = u64::from_be_bytes(e);
|
let e = u64::from_be_bytes(e);
|
||||||
ensure!(e & 1 << 62 == 0, "a qcow2 image with compressed clusters");
|
ensure!(e & 1 << 62 == 0, "a qcow2 image with compressed clusters");
|
||||||
// Bit 0: a zero cluster.
|
// Bit 0: a zero cluster.
|
||||||
Ok((e & 1 == 0 && e & QCOW2_OFFSET != 0).then_some(e & QCOW2_OFFSET))
|
let exclusive = l1 & e & (1 << 63) != 0;
|
||||||
|
Ok((e & 1 == 0 && e & QCOW2_OFFSET != 0).then_some((e & QCOW2_OFFSET, exclusive)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&self, offset: u64, buf: &[u8]) -> Result<()> {
|
||||||
|
let mut snapshots = [0; 4];
|
||||||
|
self.file.read_exact_at(&mut snapshots, 60)?;
|
||||||
|
ensure!(snapshots == [0; 4], "OpenCore image has internal snapshots");
|
||||||
|
|
||||||
|
let cluster = 1u64 << self.cluster_bits;
|
||||||
|
let mut done = 0;
|
||||||
|
while done < buf.len() {
|
||||||
|
let at = offset + done as u64;
|
||||||
|
let within = at & (cluster - 1);
|
||||||
|
let n = ((cluster - within) as usize).min(buf.len() - done);
|
||||||
|
let (host, true) = self
|
||||||
|
.cluster(at >> self.cluster_bits)?
|
||||||
|
.context("OpenCore QCOW2 cluster is unallocated")?
|
||||||
|
else {
|
||||||
|
bail!("OpenCore QCOW2 cluster is shared");
|
||||||
|
};
|
||||||
|
self.file
|
||||||
|
.write_all_at(&buf[done..done + n], host + within)?;
|
||||||
|
done += n;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read(&self, offset: u64, buf: &mut [u8]) -> Result<()> {
|
fn read(&self, offset: u64, buf: &mut [u8]) -> Result<()> {
|
||||||
@@ -648,7 +866,7 @@ impl Qcow2 {
|
|||||||
let n = ((cluster - within) as usize).min(buf.len() - done);
|
let n = ((cluster - within) as usize).min(buf.len() - done);
|
||||||
let part = &mut buf[done..done + n];
|
let part = &mut buf[done..done + n];
|
||||||
match self.cluster(at >> self.cluster_bits)? {
|
match self.cluster(at >> self.cluster_bits)? {
|
||||||
Some(c) => self.file.read_exact_at(part, c + within)?,
|
Some((c, _)) => self.file.read_exact_at(part, c + within)?,
|
||||||
None => part.fill(0),
|
None => part.fill(0),
|
||||||
}
|
}
|
||||||
done += n;
|
done += n;
|
||||||
@@ -732,6 +950,29 @@ impl<'a> Fat32<'a> {
|
|||||||
Ok(Some(bytes))
|
Ok(Some(bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Overwrite only changed clusters of a file whose size stays the same.
|
||||||
|
fn overwrite(&self, path: &str, bytes: &[u8]) -> Result<()> {
|
||||||
|
let entry = self
|
||||||
|
.find(path)?
|
||||||
|
.with_context(|| format!("missing {path}"))?;
|
||||||
|
ensure!(entry.size as usize == bytes.len(), "{path} changed size");
|
||||||
|
let mut rest = bytes;
|
||||||
|
self.chain(
|
||||||
|
entry.cluster,
|
||||||
|
bytes.len() as u64,
|
||||||
|
&mut |offset, original| {
|
||||||
|
let (new, remaining) = rest.split_at(original.len());
|
||||||
|
if new != original {
|
||||||
|
self.disk.write(offset, new)?;
|
||||||
|
}
|
||||||
|
rest = remaining;
|
||||||
|
Ok(true)
|
||||||
|
},
|
||||||
|
)?;
|
||||||
|
ensure!(rest.is_empty(), "{path} is cut short");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether the file at `path` (as [`Fat32::find`] takes it) holds `bytes`, however many: its
|
/// Whether the file at `path` (as [`Fat32::find`] takes it) holds `bytes`, however many: its
|
||||||
/// entry's size first, then its clusters, a cluster at a time, to the first that differs, so
|
/// entry's size first, then its clusters, a cluster at a time, to the first that differs, so
|
||||||
/// none of it is read where its size differs, and no more than `bytes` holds where it does;
|
/// none of it is read where its size differs, and no more than `bytes` holds where it does;
|
||||||
@@ -744,12 +985,12 @@ impl<'a> Fat32<'a> {
|
|||||||
return Ok(Some(false));
|
return Ok(Some(false));
|
||||||
}
|
}
|
||||||
let mut rest = bytes;
|
let mut rest = bytes;
|
||||||
self.chain(e.cluster, bytes.len() as u64, &mut |part| {
|
self.chain(e.cluster, bytes.len() as u64, &mut |_, part| {
|
||||||
let same = rest.starts_with(part);
|
let same = rest.starts_with(part);
|
||||||
if same {
|
if same {
|
||||||
rest = &rest[part.len()..];
|
rest = &rest[part.len()..];
|
||||||
}
|
}
|
||||||
same
|
Ok(same)
|
||||||
})?;
|
})?;
|
||||||
// A chain that ends before the file's size does not hold the rest.
|
// A chain that ends before the file's size does not hold the rest.
|
||||||
Ok(Some(rest.is_empty()))
|
Ok(Some(rest.is_empty()))
|
||||||
@@ -758,16 +999,21 @@ impl<'a> Fat32<'a> {
|
|||||||
/// The bytes of the clusters from `first`, at most `most`.
|
/// The bytes of the clusters from `first`, at most `most`.
|
||||||
fn read_chain(&self, first: u32, most: u64) -> Result<Vec<u8>> {
|
fn read_chain(&self, first: u32, most: u64) -> Result<Vec<u8>> {
|
||||||
let mut out = Vec::new();
|
let mut out = Vec::new();
|
||||||
self.chain(first, most, &mut |part| {
|
self.chain(first, most, &mut |_, part| {
|
||||||
out.extend_from_slice(part);
|
out.extend_from_slice(part);
|
||||||
true
|
Ok(true)
|
||||||
})?;
|
})?;
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gives `part` the bytes of the clusters from `first`, a cluster at a time, until the chain
|
/// Gives `part` the bytes of the clusters from `first`, a cluster at a time, until the chain
|
||||||
/// ends, `most` bytes are given (the last cluster's cut to them), or `part` returns false.
|
/// ends, `most` bytes are given (the last cluster's cut to them), or `part` returns false.
|
||||||
fn chain(&self, first: u32, most: u64, part: &mut dyn FnMut(&[u8]) -> bool) -> Result<()> {
|
fn chain(
|
||||||
|
&self,
|
||||||
|
first: u32,
|
||||||
|
most: u64,
|
||||||
|
part: &mut impl FnMut(u64, &[u8]) -> Result<bool>,
|
||||||
|
) -> Result<()> {
|
||||||
let mut buf = vec![0u8; self.cluster_size as usize];
|
let mut buf = vec![0u8; self.cluster_size as usize];
|
||||||
let mut c = first;
|
let mut c = first;
|
||||||
let mut given = 0;
|
let mut given = 0;
|
||||||
@@ -775,7 +1021,7 @@ impl<'a> Fat32<'a> {
|
|||||||
let n = (most - given).min(self.cluster_size) as usize;
|
let n = (most - given).min(self.cluster_size) as usize;
|
||||||
let offset = self.data + u64::from(c - 2) * self.cluster_size;
|
let offset = self.data + u64::from(c - 2) * self.cluster_size;
|
||||||
self.disk.read(offset, &mut buf[..n])?;
|
self.disk.read(offset, &mut buf[..n])?;
|
||||||
if !part(&buf[..n]) {
|
if !part(offset, &buf[..n])? {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
given += n as u64;
|
given += n as u64;
|
||||||
@@ -1760,4 +2006,152 @@ pub(crate) mod tests {
|
|||||||
assert!(!with("<key>ShowPicker</key><false/>").shows_picker());
|
assert!(!with("<key>ShowPicker</key><false/>").shows_picker());
|
||||||
assert!(with("<key>ShowPicker</key><true/>").shows_picker());
|
assert!(with("<key>ShowPicker</key><true/>").shows_picker());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn plist_with_processor_type(processor_type: u16) -> String {
|
||||||
|
plist(&enabled("Example.kext"))
|
||||||
|
.replacen(
|
||||||
|
" <key>PlatformInfo</key>",
|
||||||
|
concat!(
|
||||||
|
" <key>Misc</key><dict><key>Security</key><dict>",
|
||||||
|
"<key>Vault</key><string>Optional</string></dict></dict>\n",
|
||||||
|
" <key>PlatformInfo</key>",
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
.replacen(
|
||||||
|
" <key>Automatic</key><true/>",
|
||||||
|
concat!(
|
||||||
|
" <key>Automatic</key><true/>\n",
|
||||||
|
" <key>UpdateSMBIOS</key><true/>\n",
|
||||||
|
" <key>UpdateSMBIOSMode</key><string>Create</string>",
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
.replacen(
|
||||||
|
" <key>ROM</key>",
|
||||||
|
&format!(
|
||||||
|
" <key>ProcessorType</key>\n <integer>{processor_type}</integer>\n <key>ROM</key>"
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn processor_type_updates_only_the_generated_config() {
|
||||||
|
let env = crate::testenv::Env::new("processor-type");
|
||||||
|
let original = plist_with_processor_type(0);
|
||||||
|
let expected = plist_with_processor_type(0x0609);
|
||||||
|
let unrelated = b"unrelated EFI payload";
|
||||||
|
let raw = image_of(&[
|
||||||
|
("EFI/OC/config.plist", original.as_bytes()),
|
||||||
|
("EFI/OC/Other.txt", unrelated),
|
||||||
|
]);
|
||||||
|
|
||||||
|
for format in [ImageFormat::Raw, ImageFormat::Qcow2] {
|
||||||
|
let dir = env.root.join(format!("{format:?}"));
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
let source = match format {
|
||||||
|
ImageFormat::Raw => raw.clone(),
|
||||||
|
ImageFormat::Qcow2 => qcow2(&raw),
|
||||||
|
};
|
||||||
|
let vm = on_reims_vgpu(&dir, &source, format);
|
||||||
|
let path = vm.path(&vm.config.q35.as_ref().unwrap().opencore);
|
||||||
|
|
||||||
|
assert!(match_processor_type(&vm, 0x0609).unwrap(), "{format:?}");
|
||||||
|
let written = std::fs::read(&path).unwrap();
|
||||||
|
assert_eq!(written.len(), source.len(), "{format:?}");
|
||||||
|
assert_eq!(
|
||||||
|
Config::read(&path, format).unwrap().0,
|
||||||
|
Config::parse(expected.as_bytes()).unwrap().0,
|
||||||
|
"{format:?}"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
read_file(&path, format, "EFI/OC/Other.txt")
|
||||||
|
.unwrap()
|
||||||
|
.as_deref(),
|
||||||
|
Some(unrelated.as_slice()),
|
||||||
|
"{format:?}"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert!(!match_processor_type(&vm, 0x0609).unwrap(), "{format:?}");
|
||||||
|
assert!(!match_processor_type(&vm, 0x0709).unwrap(), "{format:?}");
|
||||||
|
assert_eq!(std::fs::read(&path).unwrap(), written, "{format:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn processor_type_preserves_explicit_or_unsupported_configs() {
|
||||||
|
let env = crate::testenv::Env::new("processor-type-custom");
|
||||||
|
let baseline = plist_with_processor_type(0);
|
||||||
|
for (label, config) in [
|
||||||
|
("explicit", plist_with_processor_type(0x0709)),
|
||||||
|
(
|
||||||
|
"manual",
|
||||||
|
baseline.replace(
|
||||||
|
"<key>Automatic</key><true/>",
|
||||||
|
"<key>Automatic</key><false/>",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"no-smbios-update",
|
||||||
|
baseline.replace(
|
||||||
|
"<key>UpdateSMBIOS</key><true/>",
|
||||||
|
"<key>UpdateSMBIOS</key><false/>",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"other-mode",
|
||||||
|
baseline.replace("<string>Create</string>", "<string>Custom</string>"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"secure",
|
||||||
|
baseline.replace("<string>Optional</string>", "<string>Secure</string>"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"basic",
|
||||||
|
baseline.replace("<string>Optional</string>", "<string>Basic</string>"),
|
||||||
|
),
|
||||||
|
] {
|
||||||
|
let dir = env.root.join(label);
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
let source = image(config.as_bytes());
|
||||||
|
let vm = on_reims_vgpu(&dir, &source, ImageFormat::Raw);
|
||||||
|
let path = vm.path(&vm.config.q35.as_ref().unwrap().opencore);
|
||||||
|
|
||||||
|
assert!(!match_processor_type(&vm, 0x0609).unwrap(), "{label}");
|
||||||
|
assert_eq!(std::fs::read(&path).unwrap(), source, "{label}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn processor_type_preserves_qcow2_with_shared_or_snapshotted_clusters() {
|
||||||
|
let env = crate::testenv::Env::new("processor-type-shared-clusters");
|
||||||
|
let config = plist_with_processor_type(0);
|
||||||
|
let generated = qcow2(&image(config.as_bytes()));
|
||||||
|
let mut shared = generated.clone();
|
||||||
|
let l1 = be64(&shared, 40) as usize;
|
||||||
|
let l1_size = be32(&shared, 36) as usize * 8;
|
||||||
|
for entry in shared[l1..l1 + l1_size].chunks_exact_mut(8) {
|
||||||
|
entry[0] &= 0x7f;
|
||||||
|
}
|
||||||
|
let mut snapshot = generated;
|
||||||
|
snapshot[60..64].copy_from_slice(&1u32.to_be_bytes());
|
||||||
|
|
||||||
|
for (label, source) in [("shared", shared), ("snapshots", snapshot)] {
|
||||||
|
let dir = env.root.join(label);
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
let vm = on_reims_vgpu(&dir, &source, ImageFormat::Qcow2);
|
||||||
|
let path = vm.path(&vm.config.q35.as_ref().unwrap().opencore);
|
||||||
|
|
||||||
|
let error = match_processor_type(&vm, 0x0609).unwrap_err().to_string();
|
||||||
|
assert!(error.contains(label), "{error}");
|
||||||
|
assert_eq!(std::fs::read(&path).unwrap(), source, "{label}");
|
||||||
|
assert!(std::fs::read_dir(&dir).unwrap().all(|file| {
|
||||||
|
file.unwrap()
|
||||||
|
.path()
|
||||||
|
.extension()
|
||||||
|
.is_none_or(|ext| ext != "part")
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
//! Apple SMBIOS processor types for the host CPU family shown in an x86-64 macOS guest.
|
||||||
|
|
||||||
|
/// Returns the OpenCore ProcessorType for this host's CPU family and the guest's vCPU count.
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
pub fn for_host(cpus: u32) -> Option<u16> {
|
||||||
|
use std::arch::x86_64::__cpuid;
|
||||||
|
|
||||||
|
if __cpuid(0x8000_0000).eax < 0x8000_0004 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let bytes: Vec<u8> = (0x8000_0002..=0x8000_0004)
|
||||||
|
.flat_map(|leaf| {
|
||||||
|
let registers = __cpuid(leaf);
|
||||||
|
[registers.eax, registers.ebx, registers.ecx, registers.edx]
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(u32::to_le_bytes)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let brand = String::from_utf8_lossy(&bytes);
|
||||||
|
for_brand(
|
||||||
|
brand.trim_matches(|c: char| c == '\0' || c.is_whitespace()),
|
||||||
|
cpus,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Other host architectures do not expose an x86 CPU brand.
|
||||||
|
#[cfg(not(target_arch = "x86_64"))]
|
||||||
|
pub fn for_host(_cpus: u32) -> Option<u16> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(target_arch = "x86_64", test))]
|
||||||
|
fn for_brand(brand: &str, cpus: u32) -> Option<u16> {
|
||||||
|
let normalized = brand
|
||||||
|
.to_ascii_lowercase()
|
||||||
|
.replace("(r)", " ")
|
||||||
|
.replace("(tm)", " ");
|
||||||
|
let words: Vec<_> = normalized
|
||||||
|
.split(|c: char| c.is_whitespace() || c == '-')
|
||||||
|
.filter(|word| !word.is_empty())
|
||||||
|
.collect();
|
||||||
|
if words
|
||||||
|
.iter()
|
||||||
|
.any(|word| matches!(*word, "xeon" | "threadripper" | "epyc"))
|
||||||
|
{
|
||||||
|
// macOS counts 5–8 vCPUs as eight cores, which has a name in the Xeon W family.
|
||||||
|
return match cpus {
|
||||||
|
1..=4 => Some(0x0501),
|
||||||
|
5..=16 => Some(0x0F01),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apple's name table is keyed by family and the core count reported by the guest.
|
||||||
|
// Keep automatic detection where this family has no label for the VM's topology.
|
||||||
|
let processor_type = |rank: &str| match (rank, cpus) {
|
||||||
|
("3", 2..=4) => Some(0x0909),
|
||||||
|
("5", 2..=8) => Some(0x0609),
|
||||||
|
("7", 2..=8) => Some(0x0709),
|
||||||
|
("9", 5..=8) => Some(0x1009),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
if let Some(value) = words
|
||||||
|
.iter()
|
||||||
|
.find_map(|word| word.strip_prefix('i').and_then(processor_type))
|
||||||
|
{
|
||||||
|
return Some(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intel Core and AMD Ryzen ranks share Apple's corresponding display families.
|
||||||
|
words.iter().enumerate().find_map(|(index, word)| {
|
||||||
|
let qualifiers: &[&str] = match *word {
|
||||||
|
"core" => &["ultra"],
|
||||||
|
"ryzen" => &["ai", "pro"],
|
||||||
|
_ => return None,
|
||||||
|
};
|
||||||
|
let rank = words[index + 1..]
|
||||||
|
.iter()
|
||||||
|
.find(|word| !qualifiers.contains(word))?;
|
||||||
|
processor_type(rank)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn host_brand_maps_to_an_apple_processor_type() {
|
||||||
|
for (brand, cpus, expected) in [
|
||||||
|
("Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz", 4, 0x0709),
|
||||||
|
("Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz", 4, 0x0909),
|
||||||
|
("Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz", 4, 0x0609),
|
||||||
|
("12th Gen Intel(R) Core(TM) i5-12400", 8, 0x0609),
|
||||||
|
("12th Gen Intel(R) Core(TM) i7-12700H", 8, 0x0709),
|
||||||
|
("13th Gen Intel(R) Core(TM) i9-13900H", 8, 0x1009),
|
||||||
|
("Intel(R) Core(TM) Ultra 5 125H", 6, 0x0609),
|
||||||
|
("Intel(R) Core(TM) Ultra 7 155H", 8, 0x0709),
|
||||||
|
("Intel(R) Core(TM) Ultra 9 275HX", 8, 0x1009),
|
||||||
|
("Intel(R) Core(TM) 3 100U", 4, 0x0909),
|
||||||
|
("Intel(R) Core(TM) 7 150U", 8, 0x0709),
|
||||||
|
("Intel(R) Xeon(R) W-2145 CPU @ 3.70GHz", 4, 0x0501),
|
||||||
|
("Intel(R) Xeon(R) W-2145 CPU @ 3.70GHz", 5, 0x0F01),
|
||||||
|
("Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz", 6, 0x0F01),
|
||||||
|
("Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz", 8, 0x0F01),
|
||||||
|
("AMD Ryzen 3 3200G with Radeon Vega Graphics", 4, 0x0909),
|
||||||
|
("AMD Ryzen 5 5600X 6-Core Processor", 6, 0x0609),
|
||||||
|
("AMD Ryzen 5 PRO 4650G with Radeon Graphics", 8, 0x0609),
|
||||||
|
("AMD Ryzen 7 7840HS w/ Radeon 780M Graphics", 4, 0x0709),
|
||||||
|
("AMD Ryzen 7 7840HS w/ Radeon 780M Graphics", 8, 0x0709),
|
||||||
|
("AMD Ryzen 7 8745H w/ Radeon 780M Graphics", 8, 0x0709),
|
||||||
|
("AMD Ryzen 9 7950X 16-Core Processor", 8, 0x1009),
|
||||||
|
("AMD Ryzen AI 9 HX 370 w/ Radeon 890M Graphics", 8, 0x1009),
|
||||||
|
("AMD Ryzen AI 7 PRO 360 w/ Radeon 880M Graphics", 8, 0x0709),
|
||||||
|
("AMD Ryzen Threadripper PRO 5995WX 64-Cores", 1, 0x0501),
|
||||||
|
("AMD EPYC 7763 64-Core Processor", 8, 0x0F01),
|
||||||
|
] {
|
||||||
|
assert_eq!(for_brand(brand, cpus), Some(expected), "{brand}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_family_without_a_label_for_the_core_count_keeps_automatic_detection() {
|
||||||
|
for (brand, cpus) in [
|
||||||
|
("Intel Core i3-8100B", 8),
|
||||||
|
("Intel Core i5-12400", 1),
|
||||||
|
("Intel Core i7-12700", 10),
|
||||||
|
("Intel Core i9-13900H", 4),
|
||||||
|
("Intel Xeon E5-2680", 17),
|
||||||
|
] {
|
||||||
|
assert_eq!(for_brand(brand, cpus), None, "{brand}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn an_unrecognized_host_leaves_processor_type_to_opencore() {
|
||||||
|
for brand in [
|
||||||
|
"Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz",
|
||||||
|
"Intel(R) Core(TM) m3-7Y30 CPU @ 1.00GHz",
|
||||||
|
"Intel(R) Pentium(R) Gold 7505 @ 2.00GHz",
|
||||||
|
"Intel(R) Celeron(R) N4020 CPU @ 1.10GHz",
|
||||||
|
"Intel(R) N100",
|
||||||
|
"AMD Athlon Silver 3050U with Radeon Graphics",
|
||||||
|
"AMD Ryzen AI Max+ 395 w/ Radeon 8060S",
|
||||||
|
"AMD Ryzen Z1 Extreme",
|
||||||
|
"Intel Core Processor (Skylake, IBRS, no TSX)",
|
||||||
|
"",
|
||||||
|
] {
|
||||||
|
assert_eq!(for_brand(brand, 8), None, "{brand}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//! reims-util (<https://github.com/steelbrain/reims-util>) makes what a new x86-64 VM boots from:
|
//! reims-util (<https://github.com/reims-go/reims-util>) makes what a new x86-64 VM boots from:
|
||||||
//! an OpenCore image, with OVMF's code and variables beside it, and a macOS installer, downloaded
|
//! an OpenCore image, with OVMF's code and variables beside it, and a macOS installer, downloaded
|
||||||
//! from Apple and checked against Apple's chunklists. It also makes an existing VM a new OpenCore
|
//! from Apple and checked against Apple's chunklists. It also makes an existing VM a new OpenCore
|
||||||
//! image presenting the same Mac (opencore.rs). For a VM on reims-vgpu's own device, an image
|
//! image presenting the same Mac (opencore.rs). For a VM on reims-vgpu's own device, an image
|
||||||
@@ -43,9 +43,9 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
pub const REPO: &str = "https://github.com/steelbrain/reims-util";
|
pub const REPO: &str = "https://github.com/reims-go/reims-util";
|
||||||
/// The commit [`install`] installs.
|
/// The commit [`install`] installs.
|
||||||
pub const REV: &str = "7867384c0ab703b4c6aae36cbbb1a35fcffc8321";
|
pub const REV: &str = "573d4a5ffacfc31430ff7372727fce287fef89e1";
|
||||||
|
|
||||||
/// The reims-util binary: `REIMS_CTL_UTIL`, else the one beside reims-ctl, where both are
|
/// The reims-util binary: `REIMS_CTL_UTIL`, else the one beside reims-ctl, where both are
|
||||||
/// installed, else the first on PATH.
|
/// installed, else the first on PATH.
|
||||||
|
|||||||
@@ -725,6 +725,22 @@ pub fn prepare(vm: &mut Vm, progress: &mut dyn FnMut(&str)) -> Vec<String> {
|
|||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if vm.config.profile == Profile::Q35X86_64
|
||||||
|
&& !vm
|
||||||
|
.config
|
||||||
|
.extra_args
|
||||||
|
.iter()
|
||||||
|
.any(|arg| arg == "-incoming" || arg.starts_with("-incoming="))
|
||||||
|
&& let Some(value) = crate::processor::for_host(vm.config.cpus)
|
||||||
|
{
|
||||||
|
match crate::opencore::match_processor_type(vm, value) {
|
||||||
|
Ok(true) => progress("updated the OpenCore processor type for About This Mac"),
|
||||||
|
Ok(false) => {}
|
||||||
|
Err(error) => w.push(format!(
|
||||||
|
"{name}: could not update the OpenCore processor type ({error:#})"
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
w
|
w
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ use reims_vgpu_vulkan::core::platform::os::clock::MonoTime;
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use reims_vgpu_vulkan::core::platform::resource::SurfaceHandle;
|
use reims_vgpu_vulkan::core::platform::resource::SurfaceHandle;
|
||||||
use reims_vgpu_vulkan::core::platform::resource::{Buffer as _, MemoryFor};
|
use reims_vgpu_vulkan::core::platform::resource::{Buffer as _, MemoryFor};
|
||||||
use reims_vgpu_vulkan::core::platform::types::NsRange;
|
use reims_vgpu_vulkan::core::platform::types::{CommandBufferStatus, NsRange};
|
||||||
use reims_vgpu_vulkan::core::platform::values::{PagesPlane, TextureDesc};
|
use reims_vgpu_vulkan::core::platform::values::{PagesPlane, TextureDesc};
|
||||||
use reims_vgpu_vulkan::core::platform::{Handle, Platform};
|
use reims_vgpu_vulkan::core::platform::{Handle, Platform};
|
||||||
use reims_vgpu_vulkan::core::raise::{OnFault, Raise, RaiseResult, refusals};
|
use reims_vgpu_vulkan::core::raise::{OnFault, Raise, RaiseResult, refusals};
|
||||||
@@ -8366,6 +8366,25 @@ impl<P: Platform> Caches<P> {
|
|||||||
pub(crate) fn export_unattached(
|
pub(crate) fn export_unattached(
|
||||||
&self,
|
&self,
|
||||||
device: &P::Device,
|
device: &P::Device,
|
||||||
|
) -> Result<Vec<(u64, Vec<u8>)>, &'static str> {
|
||||||
|
self.export_unattached_with(
|
||||||
|
device,
|
||||||
|
|queue| queue.command_buffer(ON),
|
||||||
|
|cb| cb.commit(ON),
|
||||||
|
|| device.wait_idle(),
|
||||||
|
|cb| cb.wait_until_completed(ON),
|
||||||
|
|buffer| device.read_standalone_buffer(buffer),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn export_unattached_with(
|
||||||
|
&self,
|
||||||
|
device: &P::Device,
|
||||||
|
mut command_buffer: impl FnMut(&P::CommandQueue) -> RaiseResult<Option<P::CommandBuffer>>,
|
||||||
|
mut commit: impl FnMut(&P::CommandBuffer) -> RaiseResult<()>,
|
||||||
|
mut wait_idle: impl FnMut(),
|
||||||
|
mut wait_completed: impl FnMut(&P::CommandBuffer) -> RaiseResult<()>,
|
||||||
|
mut read_buffer: impl FnMut(&P::Buffer) -> Result<Option<Vec<u8>>, &'static str>,
|
||||||
) -> Result<Vec<(u64, Vec<u8>)>, &'static str> {
|
) -> Result<Vec<(u64, Vec<u8>)>, &'static str> {
|
||||||
let need_mem: Vec<P::Buffer> = {
|
let need_mem: Vec<P::Buffer> = {
|
||||||
let state = self.lock();
|
let state = self.lock();
|
||||||
@@ -8373,17 +8392,14 @@ impl<P: Platform> Caches<P> {
|
|||||||
.by_block
|
.by_block
|
||||||
.values()
|
.values()
|
||||||
.filter(|c| {
|
.filter(|c| {
|
||||||
c.pages.is_none()
|
c.pages.is_none() && !c.device.memory_made() && c.shapes.iter().any(|s| s.dirty)
|
||||||
&& !c.device.memory_made()
|
|
||||||
&& c.shapes.iter().any(|s| s.dirty)
|
|
||||||
})
|
})
|
||||||
.map(|c| c.device.clone_ref())
|
.map(|c| c.device.clone_ref())
|
||||||
.collect()
|
.collect()
|
||||||
};
|
};
|
||||||
self.make_memory(need_mem, MemoryFor::WriteBack);
|
self.make_memory(need_mem, MemoryFor::WriteBack);
|
||||||
|
|
||||||
let mut flushed_any = false;
|
let (dirty_blocks, queue) = {
|
||||||
{
|
|
||||||
let mut state = self.lock();
|
let mut state = self.lock();
|
||||||
let dirty_blocks: Vec<u64> = state
|
let dirty_blocks: Vec<u64> = state
|
||||||
.by_block
|
.by_block
|
||||||
@@ -8391,45 +8407,85 @@ impl<P: Platform> Caches<P> {
|
|||||||
.filter(|(_, c)| c.pages.is_none() && c.shapes.iter().any(|s| s.dirty))
|
.filter(|(_, c)| c.pages.is_none() && c.shapes.iter().any(|s| s.dirty))
|
||||||
.map(|(&b, _)| b)
|
.map(|(&b, _)| b)
|
||||||
.collect();
|
.collect();
|
||||||
if !dirty_blocks.is_empty() {
|
let queue = if dirty_blocks.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
if !state
|
if !state
|
||||||
.make_transfer(device)
|
.make_transfer(device)
|
||||||
.map_err(|_| "snapshot_save: surface cache transfer init failed")?
|
.map_err(|_| "snapshot_save: surface cache transfer init failed")?
|
||||||
{
|
{
|
||||||
return Err("snapshot_save: surface cache transfer queue unavailable");
|
return Err("snapshot_save: surface cache transfer queue unavailable");
|
||||||
}
|
}
|
||||||
|
state
|
||||||
|
.transfer
|
||||||
|
.as_ref()
|
||||||
|
.map(|transfer| transfer.queue.clone_ref())
|
||||||
|
};
|
||||||
|
(dirty_blocks, queue)
|
||||||
|
};
|
||||||
|
if let Some(queue) = queue {
|
||||||
|
let mut submitted = Vec::new();
|
||||||
|
let flushed = (|| {
|
||||||
for block in dirty_blocks {
|
for block in dirty_blocks {
|
||||||
let cb_opt = {
|
let cb = command_buffer(&queue)
|
||||||
let transfer = state
|
.map_err(|_| "snapshot_save: surface cache command buffer failed")?
|
||||||
.transfer
|
.ok_or("snapshot_save: surface cache command buffer unavailable")?;
|
||||||
.as_mut()
|
let mut state = self.lock();
|
||||||
.ok_or("snapshot_save: surface cache transfer missing")?;
|
let Some(cache) = state.by_block.get_mut(&block).filter(|cache| {
|
||||||
transfer
|
cache.pages.is_none() && cache.shapes.iter().any(|s| s.dirty)
|
||||||
.queue
|
}) else {
|
||||||
.command_buffer(ON)
|
|
||||||
.map_err(|_| "snapshot_save: surface cache command buffer failed")?
|
|
||||||
};
|
|
||||||
let Some(cb) = cb_opt else {
|
|
||||||
return Err("snapshot_save: surface cache command buffer unavailable");
|
|
||||||
};
|
|
||||||
let Some(cache) = state.by_block.get_mut(&block) else {
|
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if !cache.copy_through(MemoryFor::WriteBack) {
|
if !cache.copy_through(MemoryFor::WriteBack) {
|
||||||
return Err("snapshot_save: deferred surface cache allocation failed");
|
return Err("snapshot_save: deferred surface cache allocation failed");
|
||||||
}
|
}
|
||||||
let back = shapes::write_back::<P>(&cb, &cache.device, &cache.shapes, |s| {
|
let back =
|
||||||
s.dirty
|
shapes::write_back::<P>(&cb, &cache.device, &cache.shapes, |s| s.dirty)
|
||||||
})
|
.map_err(|_| "snapshot_save: surface cache shape write_back failed")?;
|
||||||
.map_err(|_| "snapshot_save: surface cache shape write_back failed")?;
|
if back.is_empty() {
|
||||||
cache.wrote_shapes(&back);
|
return Err("snapshot_save: surface cache blit encoder unavailable");
|
||||||
state.owed_commits.push(cb);
|
}
|
||||||
flushed_any = true;
|
// Retirement frees the queue slot even while we keep the handle for status.
|
||||||
|
let commit_failed = "snapshot_save: surface cache command buffer commit failed";
|
||||||
|
state.unlocked(|| commit(&cb)).map_err(|_| commit_failed)?;
|
||||||
|
let status = cb.status();
|
||||||
|
if status.raw() < CommandBufferStatus::COMMITTED.raw()
|
||||||
|
|| status == CommandBufferStatus::ERROR
|
||||||
|
{
|
||||||
|
return Err(commit_failed);
|
||||||
|
}
|
||||||
|
drop(state);
|
||||||
|
submitted.push((block, back, cb));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})();
|
||||||
|
let mut wait_failed = false;
|
||||||
|
if !submitted.is_empty() {
|
||||||
|
wait_idle();
|
||||||
|
for (_, _, cb) in &submitted {
|
||||||
|
if wait_completed(cb).is_err() {
|
||||||
|
wait_failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flushed?;
|
||||||
|
if wait_failed
|
||||||
|
|| submitted
|
||||||
|
.iter()
|
||||||
|
.any(|(_, _, cb)| cb.status() != CommandBufferStatus::COMPLETED)
|
||||||
|
{
|
||||||
|
return Err(
|
||||||
|
"snapshot_save: surface cache command buffer did not complete successfully",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let mut state = self.lock();
|
||||||
|
let state = &mut *state;
|
||||||
|
for (block, back, _) in &submitted {
|
||||||
|
if let Some(cache) = state.by_block.get_mut(block) {
|
||||||
|
cache.wrote_shapes(back);
|
||||||
|
cache.shapes.written_back(back, &mut state.counts.shapes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if flushed_any {
|
|
||||||
device.wait_idle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut to_read: Vec<(u64, P::Buffer)> = {
|
let mut to_read: Vec<(u64, P::Buffer)> = {
|
||||||
@@ -8445,7 +8501,7 @@ impl<P: Platform> Caches<P> {
|
|||||||
|
|
||||||
let mut out = Vec::with_capacity(to_read.len());
|
let mut out = Vec::with_capacity(to_read.len());
|
||||||
for (block, buf) in to_read {
|
for (block, buf) in to_read {
|
||||||
match device.read_standalone_buffer(&buf)? {
|
match read_buffer(&buf)? {
|
||||||
Some(bytes) => out.push((block, bytes)),
|
Some(bytes) => out.push((block, bytes)),
|
||||||
None => return Err("snapshot_save: unattached surface cache buffer unreadable"),
|
None => return Err("snapshot_save: unattached surface cache buffer unreadable"),
|
||||||
}
|
}
|
||||||
@@ -16385,6 +16441,325 @@ pub(super) mod tests {
|
|||||||
r.pages_flagged(block, 0, &[], length, flags)
|
r.pages_flagged(block, 0, &[], length, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SNAPSHOT_CACHE_LENGTH: u64 = 0x1000;
|
||||||
|
|
||||||
|
fn snapshot_rig(blocks: u64) -> Rig {
|
||||||
|
let r = rig(8);
|
||||||
|
r.dec.set_deferred_budget(blocks * SNAPSHOT_CACHE_LENGTH);
|
||||||
|
r.dec.caches().shaped = true;
|
||||||
|
r
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dirty_unattached_cache(r: &mut Rig, block: u64) -> reims_vgpu_vulkan::core::platform::ObjId {
|
||||||
|
assert_eq!(defer(r, block, SNAPSHOT_CACHE_LENGTH), RGFX_STATUS_OK);
|
||||||
|
let key = ShapeKey {
|
||||||
|
plane: 0,
|
||||||
|
offset: 128,
|
||||||
|
bytes_per_row: 128,
|
||||||
|
width: 16,
|
||||||
|
height: 2,
|
||||||
|
texel_bytes: 4,
|
||||||
|
storage: false,
|
||||||
|
};
|
||||||
|
let desc = r.p.texture_descriptor(&TextureDesc {
|
||||||
|
pixel_format: 80,
|
||||||
|
width: key.width,
|
||||||
|
height: key.height,
|
||||||
|
..TextureDesc::default()
|
||||||
|
});
|
||||||
|
let image = r.device.new_texture(ON, &desc).unwrap().unwrap();
|
||||||
|
let id = image.id();
|
||||||
|
let mut state = r.dec.caches();
|
||||||
|
let cache = state.by_block.get_mut(&block).unwrap();
|
||||||
|
assert!(cache.pages.is_none());
|
||||||
|
assert!(!cache.device.memory_made());
|
||||||
|
let (reference, _) = cache.shapes.insert(key, image, false, 0);
|
||||||
|
assert!(cache.shapes.mark_dirty(reference.id()));
|
||||||
|
id
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn snapshot_exports_more_dirty_unattached_caches_than_the_transfer_queue_holds() {
|
||||||
|
use reims_vgpu_vulkan::core::platform::types::MtlSize;
|
||||||
|
|
||||||
|
const BLOCKS: u64 = 80;
|
||||||
|
const CAPACITY: usize = 64;
|
||||||
|
let mut r = snapshot_rig(BLOCKS + 1);
|
||||||
|
let mut textures = HashMap::default();
|
||||||
|
let mut expected = Vec::new();
|
||||||
|
for i in 0..BLOCKS {
|
||||||
|
let block = BLOCK + i * 0x2000;
|
||||||
|
let texture = dirty_unattached_cache(&mut r, block);
|
||||||
|
let texels = [[i as u8; 64], [255 - i as u8; 64]];
|
||||||
|
let mut bytes = vec![0; SNAPSHOT_CACHE_LENGTH.to_usize()];
|
||||||
|
for (row, texels) in bytes[128..].chunks_mut(128).zip(&texels) {
|
||||||
|
row[..64].copy_from_slice(texels);
|
||||||
|
}
|
||||||
|
textures.insert(texture, texels);
|
||||||
|
expected.push((block, bytes));
|
||||||
|
}
|
||||||
|
assert_eq!(
|
||||||
|
defer(&mut r, BLOCK + BLOCKS * 0x2000, SNAPSHOT_CACHE_LENGTH),
|
||||||
|
RGFX_STATUS_OK
|
||||||
|
);
|
||||||
|
|
||||||
|
let mark = r.p.call_log().mark();
|
||||||
|
let world = r.p.world();
|
||||||
|
let mut acquired = 0;
|
||||||
|
let retired = Cell::new(0);
|
||||||
|
let caches = &r.dec.surface_caches;
|
||||||
|
let exported = caches.export_unattached_with(
|
||||||
|
&r.device,
|
||||||
|
|queue| {
|
||||||
|
assert!(
|
||||||
|
caches.try_lock().is_some(),
|
||||||
|
"queue acquisition holds the cache lock"
|
||||||
|
);
|
||||||
|
let in_flight = world.committed().len();
|
||||||
|
assert_eq!(
|
||||||
|
world.live("MTLCommandBuffer").len(),
|
||||||
|
in_flight + retired.get(),
|
||||||
|
"a previous buffer is uncommitted"
|
||||||
|
);
|
||||||
|
if in_flight == CAPACITY {
|
||||||
|
retired.set(retired.get() + world.complete_all(CompleteOn::Caller));
|
||||||
|
}
|
||||||
|
assert!(world.committed().len() < CAPACITY);
|
||||||
|
acquired += 1;
|
||||||
|
queue.command_buffer(ON)
|
||||||
|
},
|
||||||
|
|cb| cb.commit(ON),
|
||||||
|
|| {
|
||||||
|
assert_eq!(caches.try_lock().unwrap().counts.shapes.written_back, 0);
|
||||||
|
retired.set(retired.get() + world.complete_all(CompleteOn::Caller));
|
||||||
|
},
|
||||||
|
|cb| cb.wait_until_completed(ON),
|
||||||
|
|buffer| {
|
||||||
|
assert!(world.live("MTLCommandBuffer").is_empty());
|
||||||
|
// The fake logs blits without executing them. Reproduce each logged GPU copy.
|
||||||
|
let calls = r.p.call_log().since(mark);
|
||||||
|
let mut copies = calls.iter().filter(|call| {
|
||||||
|
call.sel.starts_with("copyFromTexture:")
|
||||||
|
&& call.args[5].as_obj() == Some(buffer.id())
|
||||||
|
});
|
||||||
|
let copy = copies.next().expect("a copy into this cache");
|
||||||
|
assert!(copies.next().is_none());
|
||||||
|
assert_eq!(copy.args[4], Arg::val(&MtlSize::new(16, 2, 1)));
|
||||||
|
let source = &textures[©.args[0].as_obj().unwrap()];
|
||||||
|
let offset = copy.args[6].as_u64().unwrap().to_usize();
|
||||||
|
let pitch = copy.args[7].as_u64().unwrap().to_usize();
|
||||||
|
let mut bytes = vec![0; buffer.length().to_usize()];
|
||||||
|
for (row, texels) in source.iter().enumerate() {
|
||||||
|
let at = offset + row * pitch;
|
||||||
|
bytes[at..at + 64].copy_from_slice(texels);
|
||||||
|
}
|
||||||
|
Ok(Some(bytes))
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(acquired, BLOCKS);
|
||||||
|
assert_eq!(retired.get(), BLOCKS.to_usize());
|
||||||
|
assert_eq!(exported.unwrap(), expected);
|
||||||
|
let state = r.dec.caches();
|
||||||
|
assert_eq!(state.counts.shapes.written_back, BLOCKS);
|
||||||
|
assert!(
|
||||||
|
state
|
||||||
|
.by_block
|
||||||
|
.values()
|
||||||
|
.all(|cache| cache.shapes.iter().all(|s| !s.dirty))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn snapshot_drops_uncommitted_unattached_writebacks_on_error() {
|
||||||
|
use reims_vgpu_vulkan::core::testkit::Step;
|
||||||
|
use reims_vgpu_vulkan::core::testkit::impls::resource::MAKE_MEMORY;
|
||||||
|
|
||||||
|
for (selector, steps, error) in [
|
||||||
|
(
|
||||||
|
"commandBuffer",
|
||||||
|
vec![Step::Nil],
|
||||||
|
"snapshot_save: surface cache command buffer unavailable",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
MAKE_MEMORY,
|
||||||
|
vec![Step::value(false); 2],
|
||||||
|
"snapshot_save: deferred surface cache allocation failed",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"blitCommandEncoder",
|
||||||
|
vec![Step::Nil],
|
||||||
|
"snapshot_save: surface cache blit encoder unavailable",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"endEncoding",
|
||||||
|
vec![Step::unrecognized("endEncoding")],
|
||||||
|
"snapshot_save: surface cache shape write_back failed",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"commit",
|
||||||
|
vec![Step::unrecognized("commit")],
|
||||||
|
"snapshot_save: surface cache command buffer commit failed",
|
||||||
|
),
|
||||||
|
] {
|
||||||
|
let mut r = snapshot_rig(1);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK);
|
||||||
|
for step in steps {
|
||||||
|
r.p.script().push(selector, step);
|
||||||
|
}
|
||||||
|
let caches = &r.dec.surface_caches;
|
||||||
|
assert_eq!(caches.export_unattached(&r.device), Err(error));
|
||||||
|
assert!(r.p.world().live("MTLCommandBuffer").is_empty());
|
||||||
|
assert!(
|
||||||
|
r.dec.caches().by_block[&BLOCK]
|
||||||
|
.shapes
|
||||||
|
.iter()
|
||||||
|
.all(|s| s.dirty)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn snapshot_stops_before_readback_if_a_later_writeback_fails() {
|
||||||
|
let mut r = snapshot_rig(2);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK + 0x2000);
|
||||||
|
r.p.faults()
|
||||||
|
.at("MTLCommandQueue", "commandBuffer", 1, Fault::Nil);
|
||||||
|
|
||||||
|
let caches = &r.dec.surface_caches;
|
||||||
|
let world = r.p.world();
|
||||||
|
let mut retired = 0;
|
||||||
|
let exported = caches.export_unattached_with(
|
||||||
|
&r.device,
|
||||||
|
|queue| queue.command_buffer(ON),
|
||||||
|
|cb| cb.commit(ON),
|
||||||
|
|| retired += world.complete_all(CompleteOn::Caller),
|
||||||
|
|cb| cb.wait_until_completed(ON),
|
||||||
|
|_| panic!("a failed writeback must stop the snapshot before readback"),
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
exported,
|
||||||
|
Err("snapshot_save: surface cache command buffer unavailable")
|
||||||
|
);
|
||||||
|
assert_eq!(retired, 1);
|
||||||
|
assert!(world.live("MTLCommandBuffer").is_empty());
|
||||||
|
let state = r.dec.caches();
|
||||||
|
assert_eq!(state.counts.shapes.written_back, 0);
|
||||||
|
assert_eq!(
|
||||||
|
state
|
||||||
|
.by_block
|
||||||
|
.values()
|
||||||
|
.filter(|c| c.shapes.iter().any(|s| s.dirty))
|
||||||
|
.count(),
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn snapshot_preserves_dirty_shapes_if_writeback_commit_is_silently_refused() {
|
||||||
|
let mut r = snapshot_rig(1);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK);
|
||||||
|
|
||||||
|
let exported = r.dec.surface_caches.export_unattached_with(
|
||||||
|
&r.device,
|
||||||
|
|queue| queue.command_buffer(ON),
|
||||||
|
|_| Ok(()),
|
||||||
|
|| panic!("a refused commit leaves no submitted work to wait for"),
|
||||||
|
|_| panic!("a refused commit leaves no submitted work to wait for"),
|
||||||
|
|_| panic!("a refused commit must stop the snapshot before readback"),
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
exported,
|
||||||
|
Err("snapshot_save: surface cache command buffer commit failed")
|
||||||
|
);
|
||||||
|
assert!(r.p.world().live("MTLCommandBuffer").is_empty());
|
||||||
|
let state = r.dec.caches();
|
||||||
|
assert_eq!(state.counts.shapes.written_back, 0);
|
||||||
|
assert!(state.by_block[&BLOCK].shapes.iter().all(|s| s.dirty));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn snapshot_preserves_dirty_shapes_if_a_submitted_writeback_fails() {
|
||||||
|
let mut r = snapshot_rig(2);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK + 0x2000);
|
||||||
|
|
||||||
|
let world = r.p.world();
|
||||||
|
let exported = r.dec.surface_caches.export_unattached_with(
|
||||||
|
&r.device,
|
||||||
|
|queue| queue.command_buffer(ON),
|
||||||
|
|cb| cb.commit(ON),
|
||||||
|
|| {
|
||||||
|
let [first, second] = world.committed().try_into().unwrap();
|
||||||
|
assert!(world.complete(
|
||||||
|
first,
|
||||||
|
CommandBufferStatus::COMPLETED,
|
||||||
|
None,
|
||||||
|
CompleteOn::Caller
|
||||||
|
));
|
||||||
|
assert!(world.complete(
|
||||||
|
second,
|
||||||
|
CommandBufferStatus::ERROR,
|
||||||
|
None,
|
||||||
|
CompleteOn::Caller
|
||||||
|
));
|
||||||
|
},
|
||||||
|
|cb| cb.wait_until_completed(ON),
|
||||||
|
|_| panic!("a failed writeback must stop the snapshot before readback"),
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
exported,
|
||||||
|
Err("snapshot_save: surface cache command buffer did not complete successfully")
|
||||||
|
);
|
||||||
|
assert!(world.live("MTLCommandBuffer").is_empty());
|
||||||
|
let state = r.dec.caches();
|
||||||
|
assert_eq!(state.counts.shapes.written_back, 0);
|
||||||
|
assert!(
|
||||||
|
state
|
||||||
|
.by_block
|
||||||
|
.values()
|
||||||
|
.all(|cache| cache.shapes.iter().all(|s| s.dirty))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn snapshot_waits_for_each_submitted_writeback_status_after_wait_idle() {
|
||||||
|
let mut r = snapshot_rig(1);
|
||||||
|
dirty_unattached_cache(&mut r, BLOCK);
|
||||||
|
|
||||||
|
let world = r.p.world();
|
||||||
|
let mut waited_completed = 0;
|
||||||
|
let exported = r.dec.surface_caches.export_unattached_with(
|
||||||
|
&r.device,
|
||||||
|
|queue| queue.command_buffer(ON),
|
||||||
|
|cb| cb.commit(ON),
|
||||||
|
|| {
|
||||||
|
// Simulate wait_idle returning before the completion worker has
|
||||||
|
// published the command buffer's final COMPLETED status.
|
||||||
|
assert_eq!(world.committed().len(), 1);
|
||||||
|
},
|
||||||
|
|cb| {
|
||||||
|
waited_completed += 1;
|
||||||
|
assert_eq!(cb.status(), CommandBufferStatus::SCHEDULED);
|
||||||
|
assert_eq!(world.complete_all(CompleteOn::Caller), 1);
|
||||||
|
cb.wait_until_completed(ON)
|
||||||
|
},
|
||||||
|
|buffer| {
|
||||||
|
assert!(world.live("MTLCommandBuffer").is_empty());
|
||||||
|
Ok(Some(vec![0xAB; buffer.length().to_usize()]))
|
||||||
|
},
|
||||||
|
);
|
||||||
|
assert_eq!(waited_completed, 1);
|
||||||
|
assert_eq!(
|
||||||
|
exported,
|
||||||
|
Ok(vec![(BLOCK, vec![0xAB; SNAPSHOT_CACHE_LENGTH.to_usize()])])
|
||||||
|
);
|
||||||
|
let state = r.dec.caches();
|
||||||
|
assert_eq!(state.counts.shapes.written_back, 1);
|
||||||
|
assert!(state.by_block[&BLOCK].shapes.iter().all(|s| !s.dirty));
|
||||||
|
}
|
||||||
|
|
||||||
/// A `SURFACE_PAGES` naming the pages of the deferred block at `block`, `runs` as
|
/// A `SURFACE_PAGES` naming the pages of the deferred block at `block`, `runs` as
|
||||||
/// [`Rig::pages`]'s, from context `context`; its answer.
|
/// [`Rig::pages`]'s, from context `context`; its answer.
|
||||||
fn attach(r: &mut Rig, block: u64, context: u32, runs: &[(u64, u64)], length: u64) -> u32 {
|
fn attach(r: &mut Rig, block: u64, context: u32, runs: &[(u64, u64)], length: u64) -> u32 {
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
* moved the cursor yet: the latest is where the host's pointer is.
|
* moved the cursor yet: the latest is where the host's pointer is.
|
||||||
*
|
*
|
||||||
* Where the point lies, and the rectangles the host is told:
|
* Where the point lies, and the rectangles the host is told:
|
||||||
* - on x86-64, each framebuffer holds its display's rectangle as WindowServer placed it
|
* - on x86-64, each framebuffer holds its display's virtual desktop rectangle as WindowServer
|
||||||
* (getBoundingRect), and a move of the cursor on any display tells the host each display's
|
* placed it (getBoundingRect), and a move of the cursor on any display tells the host each
|
||||||
* that changed (tellBounds);
|
* virtual rectangle that changed (tellBounds);
|
||||||
* - on arm64, WindowServer tells the displays nothing of where it placed them, so the kext
|
* - on arm64, WindowServer tells the displays nothing of where it placed them, so the kext
|
||||||
* learns it from its own posts: a crossing posts at the display's pixel of the rectangle held
|
* learns it from its own posts: a crossing posts at the display's pixel of the rectangle held
|
||||||
* for it, and again beside the other displays where the cursor did not reach it, at most
|
* for it, and again beside the other displays where the cursor did not reach it, at most
|
||||||
@@ -185,7 +185,7 @@ void ReimsGraphics::movePointer(thread_call_param_t self, thread_call_param_t)
|
|||||||
IOSimpleLockUnlock(me->interruptLock);
|
IOSimpleLockUnlock(me->interruptLock);
|
||||||
if (!me->hasStarted())
|
if (!me->hasStarted())
|
||||||
return;
|
return;
|
||||||
// The display's mode and its rectangle in the global space.
|
// The display's scanout size and its virtual desktop rectangle.
|
||||||
ReimsGraphics *fb = me->copyDisplay(me->drivenIndex(at.display));
|
ReimsGraphics *fb = me->copyDisplay(me->drivenIndex(at.display));
|
||||||
if (!fb)
|
if (!fb)
|
||||||
return;
|
return;
|
||||||
@@ -221,7 +221,7 @@ void ReimsGraphics::movePointer(thread_call_param_t self, thread_call_param_t)
|
|||||||
move == RgfxPointerMove::moved ? "moves" : "is dragged", globalX, globalY, posted);
|
move == RgfxPointerMove::moved ? "moves" : "is dragged", globalX, globalY, posted);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Each framebuffer holds its display's rectangle as WindowServer placed it (getBoundingRect).
|
// The virtual rectangles used for both IOHIDSystem posts and DISPLAY_BOUNDS.
|
||||||
void ReimsGraphics::displayPlaces(RgfxGlobalRect *rects, bool *placed)
|
void ReimsGraphics::displayPlaces(RgfxGlobalRect *rects, bool *placed)
|
||||||
{
|
{
|
||||||
ReimsGraphics *fbs[RGFX_DISPLAYS_MAX];
|
ReimsGraphics *fbs[RGFX_DISPLAYS_MAX];
|
||||||
@@ -232,7 +232,7 @@ void ReimsGraphics::displayPlaces(RgfxGlobalRect *rects, bool *placed)
|
|||||||
fbs[i]->getBoundingRect(&bounds);
|
fbs[i]->getBoundingRect(&bounds);
|
||||||
if (!bounds || display >= RGFX_DISPLAYS_MAX)
|
if (!bounds || display >= RGFX_DISPLAYS_MAX)
|
||||||
continue;
|
continue;
|
||||||
rects[display] = {bounds->minx, bounds->miny, bounds->maxx, bounds->maxy};
|
rects[display] = rgfxFramebufferDesktopBounds(bounds);
|
||||||
placed[display] = true;
|
placed[display] = true;
|
||||||
}
|
}
|
||||||
releaseDisplays(fbs, n);
|
releaseDisplays(fbs, n);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// RgfxDisplayBounds: which displays' rectangles the kext tells the host in DISPLAY_BOUNDS
|
// RgfxDisplayBounds: which displays' rectangles the kext tells the host in DISPLAY_BOUNDS
|
||||||
// (design.md, "Multiple displays", "A drag across displays"). On x86-64 each framebuffer holds its
|
// (design.md, "Multiple displays", "A drag across displays"). On x86-64 each framebuffer holds its
|
||||||
// display's rectangle in WindowServer's global space as WindowServer placed it (IOFBSetBounds,
|
// display's virtual desktop rectangle as WindowServer placed it (IOFBSetBounds, which
|
||||||
// which IOFramebuffer::getBoundingRect reads; RgfxPointerOver.hpp), and on arm64 the kext holds
|
// IOFramebuffer::getBoundingRect reads; RgfxPointerOver.hpp), and on arm64 the kext holds
|
||||||
// each one a landing of its own moves of the cursor confirmed (RgfxDisplayPlaces.hpp); the host
|
// each one a landing of its own moves of the cursor confirmed (RgfxDisplayPlaces.hpp); the host
|
||||||
// carries its captured pointer past one display's edge onto the display whose rectangle meets it
|
// carries its captured pointer past one display's edge onto the display whose rectangle meets it
|
||||||
// there. Each move of the cursor, on any display, tells the host every display's rectangle that
|
// there. Each move of the cursor, on any display, tells the host every display's rectangle that
|
||||||
@@ -21,6 +21,15 @@
|
|||||||
#include "RgfxPointerOver.hpp"
|
#include "RgfxPointerOver.hpp"
|
||||||
#include "reims_graphics_wire.h"
|
#include "reims_graphics_wire.h"
|
||||||
|
|
||||||
|
// IOFramebuffer's getBoundingRect returns its physical and virtual rectangles in order.
|
||||||
|
// IOFBSetBounds supplies both, or IOFramebuffer uses the sole rectangle for both.
|
||||||
|
template <class Bounds>
|
||||||
|
inline RgfxGlobalRect rgfxFramebufferDesktopBounds(const Bounds *bounds)
|
||||||
|
{
|
||||||
|
const Bounds &rect = bounds[1];
|
||||||
|
return {rect.minx, rect.miny, rect.maxx, rect.maxy};
|
||||||
|
}
|
||||||
|
|
||||||
// The rectangle the host was last told of each display, by id, where it was told one.
|
// The rectangle the host was last told of each display, by id, where it was told one.
|
||||||
struct RgfxBoundsTold {
|
struct RgfxBoundsTold {
|
||||||
RgfxGlobalRect rects[RGFX_DISPLAYS_MAX];
|
RgfxGlobalRect rects[RGFX_DISPLAYS_MAX];
|
||||||
|
|||||||
@@ -4,16 +4,12 @@
|
|||||||
// the display its cursor is on, so the kext moves the cursor onto that display, at that point,
|
// the display its cursor is on, so the kext moves the cursor onto that display, at that point,
|
||||||
// before the tablet's next position comes (ReimsGraphicsPointer.cpp).
|
// before the tablet's next position comes (ReimsGraphicsPointer.cpp).
|
||||||
//
|
//
|
||||||
// The point is in WindowServer's global space, in which it placed each display: on x86-64 each
|
// IOHIDSystem's post takes a point in WindowServer's virtual desktop. On x86-64 the framebuffer
|
||||||
// framebuffer holds its display's rectangle there as WindowServer gave it (IOFBSetBounds, which
|
// holds the virtual rectangle WindowServer gave it (IOFBSetBounds); on arm64 the kext learns
|
||||||
// IOFramebuffer::getBoundingRect reads), the space the cursor's moves arrive in
|
// each rectangle from its own moves (RgfxDisplayPlaces.hpp). Scale the scanout pixels into that
|
||||||
// (IOFramebuffer::extSetCursorPosition); on arm64 the kext learns each one from its own moves
|
// rectangle. Measured on x86-64 macOS 11.7.11, 15.8.2 and 26.7.2 with two 1920 x 1080 displays
|
||||||
// (RgfxDisplayPlaces.hpp). The display's pixel lies in that rectangle as the pixel
|
// side by side: a mouse-moved posted at a point in display 1's CGDisplayBounds puts the cursor
|
||||||
// lies in the display's mode, scaled from the mode's pixels to the rectangle's size. Measured on
|
// there (lane ptrcross, potluck jobs m3-max-34583 to 34585).
|
||||||
// x86-64 macOS 11.7.11, 15.8.2 and 26.7.2 with two 1920 x 1080 displays side by side: each
|
|
||||||
// framebuffer's rectangle is the display's CGDisplayBounds, and IOHIDSystem's mouse-moved posted
|
|
||||||
// at a point of display 1's rectangle puts the cursor there (lane ptrcross, potluck jobs
|
|
||||||
// m3-max-34583 to 34585).
|
|
||||||
//
|
//
|
||||||
// The move is a mouse-moved where no button is held, and the drag of the button held where one is,
|
// The move is a mouse-moved where no button is held, and the drag of the button held where one is,
|
||||||
// as IOHIDSystem's own moves are (the left button's before the right's, the right's before any
|
// as IOHIDSystem's own moves are (the left button's before the right's, the right's before any
|
||||||
|
|||||||
@@ -19,10 +19,38 @@ void check(bool ok, const char *what)
|
|||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mixedScaleDesktop()
|
||||||
|
{
|
||||||
|
// IOFramebuffer keeps the physical and virtual desktop rectangles, in that order.
|
||||||
|
const RgfxGlobalRect framebuffers[2][2] = {
|
||||||
|
{{0, 0, 3840, 2160}, {0, 0, 1920, 1080}},
|
||||||
|
{{3840, 0, 6400, 1440}, {1920, 0, 4480, 1440}},
|
||||||
|
};
|
||||||
|
const RgfxGlobalRect left = rgfxFramebufferDesktopBounds(framebuffers[0]);
|
||||||
|
const RgfxGlobalRect right = rgfxFramebufferDesktopBounds(framebuffers[1]);
|
||||||
|
int32_t x = 0, y = 0;
|
||||||
|
check(rgfxPointerGlobal(right, 2560, 1440, 2, 653, &x, &y) && x == 1922 && y == 653,
|
||||||
|
"crossing onto the native display uses its virtual origin");
|
||||||
|
check(rgfxPointerGlobal(left, 3840, 2160, 3834, 943, &x, &y) && x == 1917 && y == 471,
|
||||||
|
"crossing back scales scanout pixels into the HiDPI desktop rectangle");
|
||||||
|
|
||||||
|
// Both displays were native before the switch. Their physical rectangles stay the same.
|
||||||
|
RgfxBoundsTold told = {};
|
||||||
|
rgfxBoundsWereTold(&told, 0, framebuffers[0][0]);
|
||||||
|
rgfxBoundsWereTold(&told, 1, framebuffers[1][0]);
|
||||||
|
check(rgfxBoundsToTell(told, 0, left) && rgfxBoundsToTell(told, 1, right),
|
||||||
|
"a HiDPI switch reports the resized display and the moved neighbor");
|
||||||
|
const RgfxDisplayBounds command = rgfxBoundsCommand(1, right);
|
||||||
|
check(command.min_x == 1920 && command.max_x == 4480 && command.max_y == 1440,
|
||||||
|
"DISPLAY_BOUNDS uses the same desktop rectangle as the pointer post");
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
mixedScaleDesktop();
|
||||||
|
|
||||||
// The wire's command: 40 bytes, the display then the rectangle past the 16-byte header.
|
// The wire's command: 40 bytes, the display then the rectangle past the 16-byte header.
|
||||||
check(sizeof(RgfxDisplayBounds) == 40 && RGFX_CMD_DISPLAY_BOUNDS == 9, "the wire's");
|
check(sizeof(RgfxDisplayBounds) == 40 && RGFX_CMD_DISPLAY_BOUNDS == 9, "the wire's");
|
||||||
check(offsetof(RgfxDisplayBounds, display) == 16 && offsetof(RgfxDisplayBounds, min_x) == 20 &&
|
check(offsetof(RgfxDisplayBounds, display) == 16 && offsetof(RgfxDisplayBounds, min_x) == 20 &&
|
||||||
|
|||||||
Binary file not shown.
@@ -34,4 +34,4 @@ Arch = "arm64e"
|
|||||||
MinKernel = "23.0.0"
|
MinKernel = "23.0.0"
|
||||||
MaxKernel = ""
|
MaxKernel = ""
|
||||||
Comment = "Installs the reims-graphics Metal bundle and admits it"
|
Comment = "Installs the reims-graphics Metal bundle and admits it"
|
||||||
sha256 = "deb1696453b7d754547abc24e3fa30e5affea059bd19d2d732bee243054a300e"
|
sha256 = "969de78746515a49078709af17268af29ee398262dd45911e897c8ce2e806792"
|
||||||
@@ -331,7 +331,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"guest/kext/src/ReimsGraphics.cpp" = "7ea4b22d26781eb7f673968cf77e33b65cd09042f4a949f600d27d1f9024ebec"
|
"guest/kext/src/ReimsGraphics.cpp" = "7ea4b22d26781eb7f673968cf77e33b65cd09042f4a949f600d27d1f9024ebec"
|
||||||
"guest/kext/src/ReimsGraphics.hpp" = "e4162466ced71dd89ca50a38dcdf26c874765aab471bd96375fcb99f0766f20d"
|
"guest/kext/src/ReimsGraphics.hpp" = "e4162466ced71dd89ca50a38dcdf26c874765aab471bd96375fcb99f0766f20d"
|
||||||
"guest/kext/src/ReimsGraphicsMobile.cpp" = "b73a2e5f5b061453817c5d0b18211a2d0782f5971f02d90b0fb7f930365086de"
|
"guest/kext/src/ReimsGraphicsMobile.cpp" = "b73a2e5f5b061453817c5d0b18211a2d0782f5971f02d90b0fb7f930365086de"
|
||||||
"guest/kext/src/ReimsGraphicsPointer.cpp" = "255f049c3a5244a148d80fd25ef3388001ba180c58901e3620451c3158908f0e"
|
"guest/kext/src/ReimsGraphicsPointer.cpp" = "7b3482545b8e5e459327ab31648e32d83fd8317587b453b4133a5974fa44e35d"
|
||||||
"guest/kext/src/RgfxAccelTypes.hpp" = "c65e032a617cda503b2534c68bec87947d7856accda676f35a1affa145998259"
|
"guest/kext/src/RgfxAccelTypes.hpp" = "c65e032a617cda503b2534c68bec87947d7856accda676f35a1affa145998259"
|
||||||
"guest/kext/src/RgfxAccelerator.cpp" = "319e1148d2644e922ed2c30859019392764c9e64328594c1f593c5c4fe890030"
|
"guest/kext/src/RgfxAccelerator.cpp" = "319e1148d2644e922ed2c30859019392764c9e64328594c1f593c5c4fe890030"
|
||||||
"guest/kext/src/RgfxAccelerator.hpp" = "2711b9225040feae3e45bb8057a60b30f5d17d83d953eadc82c2db91e83e28c5"
|
"guest/kext/src/RgfxAccelerator.hpp" = "2711b9225040feae3e45bb8057a60b30f5d17d83d953eadc82c2db91e83e28c5"
|
||||||
@@ -359,7 +359,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"guest/kext/src/RgfxDeviceControl.cpp" = "53c7c6a722ef4d7edeb5756eb04091d4a56f397dc5aef83c3637b1c0f129b934"
|
"guest/kext/src/RgfxDeviceControl.cpp" = "53c7c6a722ef4d7edeb5756eb04091d4a56f397dc5aef83c3637b1c0f129b934"
|
||||||
"guest/kext/src/RgfxDeviceControl.hpp" = "c1357b80ee2141e1e2fd57213f3c9361cb497b8c6490a0b6aff8c64649be48c6"
|
"guest/kext/src/RgfxDeviceControl.hpp" = "c1357b80ee2141e1e2fd57213f3c9361cb497b8c6490a0b6aff8c64649be48c6"
|
||||||
"guest/kext/src/RgfxDeviceName.hpp" = "b242e0ccdce31c3c454bc3a4d64b13c30e574b25379a0833973dcecbbb1146d3"
|
"guest/kext/src/RgfxDeviceName.hpp" = "b242e0ccdce31c3c454bc3a4d64b13c30e574b25379a0833973dcecbbb1146d3"
|
||||||
"guest/kext/src/RgfxDisplayBounds.hpp" = "c1e8fe52f89bcb25ee178f4e0ea4ac53396109fd934348408692d21d1931ecf7"
|
"guest/kext/src/RgfxDisplayBounds.hpp" = "7aafbc6d1c2bb28e50c973f77d21c1aa00b322fb5fc934d4b1238b50f3aa89db"
|
||||||
"guest/kext/src/RgfxDisplayIdentity.hpp" = "ce4328b8e255f942aea0f0dc097e2e80eb4a8d7e126ea0f342fd116252357731"
|
"guest/kext/src/RgfxDisplayIdentity.hpp" = "ce4328b8e255f942aea0f0dc097e2e80eb4a8d7e126ea0f342fd116252357731"
|
||||||
"guest/kext/src/RgfxDisplayModes.hpp" = "62026ac6fa3febe5ce403fbfe026760f0434b70cc47e5d74c191fa5509ae12cd"
|
"guest/kext/src/RgfxDisplayModes.hpp" = "62026ac6fa3febe5ce403fbfe026760f0434b70cc47e5d74c191fa5509ae12cd"
|
||||||
"guest/kext/src/RgfxDisplayPipeUserClient.cpp" = "460c7d61a305d7d145b3318bb4fbe940c0d2d48d63afbbfeb6f273cd929aa3af"
|
"guest/kext/src/RgfxDisplayPipeUserClient.cpp" = "460c7d61a305d7d145b3318bb4fbe940c0d2d48d63afbbfeb6f273cd929aa3af"
|
||||||
@@ -397,7 +397,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"guest/kext/src/RgfxPointerDevice.cpp" = "a4f88cc9b272259c3a85325b2295feea6a22221f52035fc5130d72f52cb88891"
|
"guest/kext/src/RgfxPointerDevice.cpp" = "a4f88cc9b272259c3a85325b2295feea6a22221f52035fc5130d72f52cb88891"
|
||||||
"guest/kext/src/RgfxPointerDevice.hpp" = "a393c90bed65528495868778e4130851e98aeafcb11401aef05d2d41d5b90d3f"
|
"guest/kext/src/RgfxPointerDevice.hpp" = "a393c90bed65528495868778e4130851e98aeafcb11401aef05d2d41d5b90d3f"
|
||||||
"guest/kext/src/RgfxPointerMotion.hpp" = "d5cbe1a09db996980319d0b907782675fa82b5a03fd84a51f7c7d12c5dada926"
|
"guest/kext/src/RgfxPointerMotion.hpp" = "d5cbe1a09db996980319d0b907782675fa82b5a03fd84a51f7c7d12c5dada926"
|
||||||
"guest/kext/src/RgfxPointerOver.hpp" = "c2c38dbd101b1f59400bb159bd8cb44ed8c937bf25b93e9d62a03d6c2fd9ae50"
|
"guest/kext/src/RgfxPointerOver.hpp" = "757946b2332ba278201f4c2f44ec1ee2bb21ca10b017a7c7933f696d8ee8f10c"
|
||||||
"guest/kext/src/RgfxPointerReporting.cpp" = "c9f33023f3acea2e638353e8943c65f28f8befa984989ae88e7abc24858b961e"
|
"guest/kext/src/RgfxPointerReporting.cpp" = "c9f33023f3acea2e638353e8943c65f28f8befa984989ae88e7abc24858b961e"
|
||||||
"guest/kext/src/RgfxPoolBlocks.hpp" = "a657b67922b04b75ccef6f12e10d775867f4037e50b89a8cf0d4972af43747fe"
|
"guest/kext/src/RgfxPoolBlocks.hpp" = "a657b67922b04b75ccef6f12e10d775867f4037e50b89a8cf0d4972af43747fe"
|
||||||
"guest/kext/src/RgfxQueueLimits.hpp" = "13f8ecd60e8d19f438b8ddc1cf3a0273fba1028bc049110776b637fa2097173c"
|
"guest/kext/src/RgfxQueueLimits.hpp" = "13f8ecd60e8d19f438b8ddc1cf3a0273fba1028bc049110776b637fa2097173c"
|
||||||
@@ -466,5 +466,5 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"ReimsGraphics.kext/Contents/Info.plist" = "9683153587659c4bd4d5c52167eff1f3d2ae51dae575f60c15a27d89240f46c5"
|
"ReimsGraphics.kext/Contents/Info.plist" = "9683153587659c4bd4d5c52167eff1f3d2ae51dae575f60c15a27d89240f46c5"
|
||||||
"ReimsGraphics.kext/Contents/MacOS/ReimsGraphics" = "33a086b90fa116b3cf0c6bb826c27f8a55cd83f15522ee794e20186d469bdbc7"
|
"ReimsGraphics.kext/Contents/MacOS/ReimsGraphics" = "33a086b90fa116b3cf0c6bb826c27f8a55cd83f15522ee794e20186d469bdbc7"
|
||||||
"RgfxGate.kext/Contents/Info.plist" = "7b78d915fab4d36e6cdb3f40aa2a6c1e7224f30158ee879af23451d2e6969992"
|
"RgfxGate.kext/Contents/Info.plist" = "7b78d915fab4d36e6cdb3f40aa2a6c1e7224f30158ee879af23451d2e6969992"
|
||||||
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "deb1696453b7d754547abc24e3fa30e5affea059bd19d2d732bee243054a300e"
|
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "969de78746515a49078709af17268af29ee398262dd45911e897c8ce2e806792"
|
||||||
"set.toml" = "a4da2409f25dd7bf12260de752c38c474b60d4b2d993810a44de0f4b07cb6dfd"
|
"set.toml" = "934935a19dea7d19f09c411552120e3290f2f534bf12d97c8b4900e140aa4140"
|
||||||
Binary file not shown.
Binary file not shown.
@@ -24,7 +24,7 @@ Arch = "x86_64"
|
|||||||
MinKernel = "20.0.0"
|
MinKernel = "20.0.0"
|
||||||
MaxKernel = ""
|
MaxKernel = ""
|
||||||
Comment = "The reims-graphics display, accelerator and device control"
|
Comment = "The reims-graphics display, accelerator and device control"
|
||||||
sha256 = "d0277f202173dcecc35bce8aa2ec84cd9d53759a0fd34c26e913bcd65a191d50"
|
sha256 = "2f15b6a13b44e98d4af81240c44720c0004f3c7d5c9dfecfde3b39f069930349"
|
||||||
|
|
||||||
[[kext]]
|
[[kext]]
|
||||||
BundlePath = "RgfxGate.kext"
|
BundlePath = "RgfxGate.kext"
|
||||||
@@ -34,4 +34,4 @@ Arch = "x86_64"
|
|||||||
MinKernel = "20.0.0"
|
MinKernel = "20.0.0"
|
||||||
MaxKernel = ""
|
MaxKernel = ""
|
||||||
Comment = "Installs the reims-graphics Metal bundle and admits it"
|
Comment = "Installs the reims-graphics Metal bundle and admits it"
|
||||||
sha256 = "90d8327eb2243b820dd90ce29e4be79a80516f3e6341137b76e9b575ea3d10eb"
|
sha256 = "534ab7e2f0b39ce9f6403b8988e89419889893b68ea91687b5aaeff38f5a9be6"
|
||||||
@@ -331,7 +331,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"guest/kext/src/ReimsGraphics.cpp" = "7ea4b22d26781eb7f673968cf77e33b65cd09042f4a949f600d27d1f9024ebec"
|
"guest/kext/src/ReimsGraphics.cpp" = "7ea4b22d26781eb7f673968cf77e33b65cd09042f4a949f600d27d1f9024ebec"
|
||||||
"guest/kext/src/ReimsGraphics.hpp" = "e4162466ced71dd89ca50a38dcdf26c874765aab471bd96375fcb99f0766f20d"
|
"guest/kext/src/ReimsGraphics.hpp" = "e4162466ced71dd89ca50a38dcdf26c874765aab471bd96375fcb99f0766f20d"
|
||||||
"guest/kext/src/ReimsGraphicsMobile.cpp" = "b73a2e5f5b061453817c5d0b18211a2d0782f5971f02d90b0fb7f930365086de"
|
"guest/kext/src/ReimsGraphicsMobile.cpp" = "b73a2e5f5b061453817c5d0b18211a2d0782f5971f02d90b0fb7f930365086de"
|
||||||
"guest/kext/src/ReimsGraphicsPointer.cpp" = "255f049c3a5244a148d80fd25ef3388001ba180c58901e3620451c3158908f0e"
|
"guest/kext/src/ReimsGraphicsPointer.cpp" = "7b3482545b8e5e459327ab31648e32d83fd8317587b453b4133a5974fa44e35d"
|
||||||
"guest/kext/src/RgfxAccelTypes.hpp" = "c65e032a617cda503b2534c68bec87947d7856accda676f35a1affa145998259"
|
"guest/kext/src/RgfxAccelTypes.hpp" = "c65e032a617cda503b2534c68bec87947d7856accda676f35a1affa145998259"
|
||||||
"guest/kext/src/RgfxAccelerator.cpp" = "319e1148d2644e922ed2c30859019392764c9e64328594c1f593c5c4fe890030"
|
"guest/kext/src/RgfxAccelerator.cpp" = "319e1148d2644e922ed2c30859019392764c9e64328594c1f593c5c4fe890030"
|
||||||
"guest/kext/src/RgfxAccelerator.hpp" = "2711b9225040feae3e45bb8057a60b30f5d17d83d953eadc82c2db91e83e28c5"
|
"guest/kext/src/RgfxAccelerator.hpp" = "2711b9225040feae3e45bb8057a60b30f5d17d83d953eadc82c2db91e83e28c5"
|
||||||
@@ -359,7 +359,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"guest/kext/src/RgfxDeviceControl.cpp" = "53c7c6a722ef4d7edeb5756eb04091d4a56f397dc5aef83c3637b1c0f129b934"
|
"guest/kext/src/RgfxDeviceControl.cpp" = "53c7c6a722ef4d7edeb5756eb04091d4a56f397dc5aef83c3637b1c0f129b934"
|
||||||
"guest/kext/src/RgfxDeviceControl.hpp" = "c1357b80ee2141e1e2fd57213f3c9361cb497b8c6490a0b6aff8c64649be48c6"
|
"guest/kext/src/RgfxDeviceControl.hpp" = "c1357b80ee2141e1e2fd57213f3c9361cb497b8c6490a0b6aff8c64649be48c6"
|
||||||
"guest/kext/src/RgfxDeviceName.hpp" = "b242e0ccdce31c3c454bc3a4d64b13c30e574b25379a0833973dcecbbb1146d3"
|
"guest/kext/src/RgfxDeviceName.hpp" = "b242e0ccdce31c3c454bc3a4d64b13c30e574b25379a0833973dcecbbb1146d3"
|
||||||
"guest/kext/src/RgfxDisplayBounds.hpp" = "c1e8fe52f89bcb25ee178f4e0ea4ac53396109fd934348408692d21d1931ecf7"
|
"guest/kext/src/RgfxDisplayBounds.hpp" = "7aafbc6d1c2bb28e50c973f77d21c1aa00b322fb5fc934d4b1238b50f3aa89db"
|
||||||
"guest/kext/src/RgfxDisplayIdentity.hpp" = "ce4328b8e255f942aea0f0dc097e2e80eb4a8d7e126ea0f342fd116252357731"
|
"guest/kext/src/RgfxDisplayIdentity.hpp" = "ce4328b8e255f942aea0f0dc097e2e80eb4a8d7e126ea0f342fd116252357731"
|
||||||
"guest/kext/src/RgfxDisplayModes.hpp" = "62026ac6fa3febe5ce403fbfe026760f0434b70cc47e5d74c191fa5509ae12cd"
|
"guest/kext/src/RgfxDisplayModes.hpp" = "62026ac6fa3febe5ce403fbfe026760f0434b70cc47e5d74c191fa5509ae12cd"
|
||||||
"guest/kext/src/RgfxDisplayPipeUserClient.cpp" = "460c7d61a305d7d145b3318bb4fbe940c0d2d48d63afbbfeb6f273cd929aa3af"
|
"guest/kext/src/RgfxDisplayPipeUserClient.cpp" = "460c7d61a305d7d145b3318bb4fbe940c0d2d48d63afbbfeb6f273cd929aa3af"
|
||||||
@@ -397,7 +397,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"guest/kext/src/RgfxPointerDevice.cpp" = "a4f88cc9b272259c3a85325b2295feea6a22221f52035fc5130d72f52cb88891"
|
"guest/kext/src/RgfxPointerDevice.cpp" = "a4f88cc9b272259c3a85325b2295feea6a22221f52035fc5130d72f52cb88891"
|
||||||
"guest/kext/src/RgfxPointerDevice.hpp" = "a393c90bed65528495868778e4130851e98aeafcb11401aef05d2d41d5b90d3f"
|
"guest/kext/src/RgfxPointerDevice.hpp" = "a393c90bed65528495868778e4130851e98aeafcb11401aef05d2d41d5b90d3f"
|
||||||
"guest/kext/src/RgfxPointerMotion.hpp" = "d5cbe1a09db996980319d0b907782675fa82b5a03fd84a51f7c7d12c5dada926"
|
"guest/kext/src/RgfxPointerMotion.hpp" = "d5cbe1a09db996980319d0b907782675fa82b5a03fd84a51f7c7d12c5dada926"
|
||||||
"guest/kext/src/RgfxPointerOver.hpp" = "c2c38dbd101b1f59400bb159bd8cb44ed8c937bf25b93e9d62a03d6c2fd9ae50"
|
"guest/kext/src/RgfxPointerOver.hpp" = "757946b2332ba278201f4c2f44ec1ee2bb21ca10b017a7c7933f696d8ee8f10c"
|
||||||
"guest/kext/src/RgfxPointerReporting.cpp" = "c9f33023f3acea2e638353e8943c65f28f8befa984989ae88e7abc24858b961e"
|
"guest/kext/src/RgfxPointerReporting.cpp" = "c9f33023f3acea2e638353e8943c65f28f8befa984989ae88e7abc24858b961e"
|
||||||
"guest/kext/src/RgfxPoolBlocks.hpp" = "a657b67922b04b75ccef6f12e10d775867f4037e50b89a8cf0d4972af43747fe"
|
"guest/kext/src/RgfxPoolBlocks.hpp" = "a657b67922b04b75ccef6f12e10d775867f4037e50b89a8cf0d4972af43747fe"
|
||||||
"guest/kext/src/RgfxQueueLimits.hpp" = "13f8ecd60e8d19f438b8ddc1cf3a0273fba1028bc049110776b637fa2097173c"
|
"guest/kext/src/RgfxQueueLimits.hpp" = "13f8ecd60e8d19f438b8ddc1cf3a0273fba1028bc049110776b637fa2097173c"
|
||||||
@@ -464,7 +464,7 @@ clang = "Apple clang version 21.0.0 (clang-2100.4.1.1)"
|
|||||||
"Graft.kext/Contents/Info.plist" = "fa8533d5ec06430f3ede502e6f9e739e9c8c3f6b6909c46d854effe6028cbc7f"
|
"Graft.kext/Contents/Info.plist" = "fa8533d5ec06430f3ede502e6f9e739e9c8c3f6b6909c46d854effe6028cbc7f"
|
||||||
"Graft.kext/Contents/MacOS/Graft" = "04a1d44c0c80c20a71f3a662c46b56a1732b8134f095fb2ac57ec790f72baf72"
|
"Graft.kext/Contents/MacOS/Graft" = "04a1d44c0c80c20a71f3a662c46b56a1732b8134f095fb2ac57ec790f72baf72"
|
||||||
"ReimsGraphics.kext/Contents/Info.plist" = "ae0dafd3b6c36c24d1c92467d8203d76360eb6e4f6ad5c496167a21033b2c209"
|
"ReimsGraphics.kext/Contents/Info.plist" = "ae0dafd3b6c36c24d1c92467d8203d76360eb6e4f6ad5c496167a21033b2c209"
|
||||||
"ReimsGraphics.kext/Contents/MacOS/ReimsGraphics" = "d0277f202173dcecc35bce8aa2ec84cd9d53759a0fd34c26e913bcd65a191d50"
|
"ReimsGraphics.kext/Contents/MacOS/ReimsGraphics" = "2f15b6a13b44e98d4af81240c44720c0004f3c7d5c9dfecfde3b39f069930349"
|
||||||
"RgfxGate.kext/Contents/Info.plist" = "7b78d915fab4d36e6cdb3f40aa2a6c1e7224f30158ee879af23451d2e6969992"
|
"RgfxGate.kext/Contents/Info.plist" = "7b78d915fab4d36e6cdb3f40aa2a6c1e7224f30158ee879af23451d2e6969992"
|
||||||
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "90d8327eb2243b820dd90ce29e4be79a80516f3e6341137b76e9b575ea3d10eb"
|
"RgfxGate.kext/Contents/MacOS/RgfxGate" = "534ab7e2f0b39ce9f6403b8988e89419889893b68ea91687b5aaeff38f5a9be6"
|
||||||
"set.toml" = "49182c19c3d961b251901e19a09016df684f1f102527a0d3274697eaaf3dbab5"
|
"set.toml" = "c2f6659892f049da4bc81ec2854915cdb5cd1c4de8b15728582264b64f166131"
|
||||||
Reference in new issue
Block a user