Default Servo live rendering to hardware on macOS

This commit is contained in:
2026-05-13 04:14:18 -04:00
parent a743435ea1
commit d4046ca4e7
2 changed files with 16 additions and 6 deletions
+2 -4
View File
@@ -7,10 +7,8 @@ use std::{
/// Environment variable that lets the user pick the rendering context
/// kind used by the spawned sidecar. Accepted values: `software`
/// and `hardware`. The default stays on the software context because
/// the live sidecar talks to the app over stdio; the hardware path
/// requires a transport that moves the IOSurface mach send right into
/// the receiver process.
/// and `hardware`. macOS defaults to the hardware path and receives
/// IOSurface mach send rights over a side Mach channel.
use ely_domain::SitePermissionDecision;
use serde::Serialize;
use thiserror::Error;
@@ -139,8 +139,12 @@ fn rendering_context_selection(raw: Option<&str>) -> SidecarRenderingContext {
}
fn default_rendering_context() -> SidecarRenderingContext {
if cfg!(target_os = "macos") {
SidecarRenderingContext::Hardware
} else {
SidecarRenderingContext::Software
}
}
fn workspace_target_sidecar_path(manifest_path: &Path) -> Option<PathBuf> {
let profile = if cfg!(debug_assertions) { "debug" } else { "release" };
@@ -176,8 +180,16 @@ mod tests {
assert_eq!(context.sidecar_features(), SOFTWARE_SIDECAR_FEATURES);
}
#[cfg(target_os = "macos")]
#[test]
fn defaults_to_software_rendering_context() {
fn defaults_to_hardware_rendering_context_on_macos() {
assert_eq!(rendering_context_selection(None), SidecarRenderingContext::Hardware);
assert_eq!(rendering_context_selection(Some("garbage")), SidecarRenderingContext::Hardware);
}
#[cfg(not(target_os = "macos"))]
#[test]
fn defaults_to_software_rendering_context_off_macos() {
assert_eq!(rendering_context_selection(None), SidecarRenderingContext::Software);
assert_eq!(rendering_context_selection(Some("garbage")), SidecarRenderingContext::Software);
}