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 /// Environment variable that lets the user pick the rendering context
/// kind used by the spawned sidecar. Accepted values: `software` /// kind used by the spawned sidecar. Accepted values: `software`
/// and `hardware`. The default stays on the software context because /// and `hardware`. macOS defaults to the hardware path and receives
/// the live sidecar talks to the app over stdio; the hardware path /// IOSurface mach send rights over a side Mach channel.
/// requires a transport that moves the IOSurface mach send right into
/// the receiver process.
use ely_domain::SitePermissionDecision; use ely_domain::SitePermissionDecision;
use serde::Serialize; use serde::Serialize;
use thiserror::Error; use thiserror::Error;
@@ -139,7 +139,11 @@ fn rendering_context_selection(raw: Option<&str>) -> SidecarRenderingContext {
} }
fn default_rendering_context() -> SidecarRenderingContext { fn default_rendering_context() -> SidecarRenderingContext {
if cfg!(target_os = "macos") {
SidecarRenderingContext::Hardware
} else {
SidecarRenderingContext::Software SidecarRenderingContext::Software
}
} }
fn workspace_target_sidecar_path(manifest_path: &Path) -> Option<PathBuf> { fn workspace_target_sidecar_path(manifest_path: &Path) -> Option<PathBuf> {
@@ -176,8 +180,16 @@ mod tests {
assert_eq!(context.sidecar_features(), SOFTWARE_SIDECAR_FEATURES); assert_eq!(context.sidecar_features(), SOFTWARE_SIDECAR_FEATURES);
} }
#[cfg(target_os = "macos")]
#[test] #[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(None), SidecarRenderingContext::Software);
assert_eq!(rendering_context_selection(Some("garbage")), SidecarRenderingContext::Software); assert_eq!(rendering_context_selection(Some("garbage")), SidecarRenderingContext::Software);
} }