YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
perf(macos): cap SCK capture width at 1280, let GPU downscale at source
Louis Beaumont08d07d7b98d8
diff --git a/Cargo.lock b/Cargo.lockindex e70172360..1508fefba 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -260,7 +260,7 @@ version = "1.1.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -271,7 +271,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"dependencies = ["anstyle","once_cell_polyfill",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -2437,7 +2437,7 @@ dependencies = ["libc","option-ext","redox_users 0.5.2",- "windows-sys 0.61.2",+ "windows-sys 0.59.0",][[package]]@@ -2818,7 +2818,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"dependencies = ["libc",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -4074,7 +4074,7 @@ dependencies = ["libc","percent-encoding","pin-project-lite",- "socket2 0.6.3",+ "socket2 0.5.10","system-configuration","tokio","tower-service",@@ -4460,7 +4460,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"dependencies = ["hermit-abi","libc",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -5527,7 +5527,7 @@ version = "0.50.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.59.0",][[package]]@@ -6877,7 +6877,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"dependencies = ["anyhow",- "itertools 0.14.0",+ "itertools 0.10.5","proc-macro2","quote","syn 2.0.117",@@ -6982,7 +6982,7 @@ dependencies = ["quinn-udp","rustc-hash 2.1.2","rustls 0.23.40",- "socket2 0.6.3",+ "socket2 0.5.10","thiserror 2.0.18","tokio","tracing",@@ -7020,7 +7020,7 @@ dependencies = ["cfg_aliases","libc","once_cell",- "socket2 0.6.3",+ "socket2 0.5.10","tracing","windows-sys 0.60.2",]@@ -7770,7 +7770,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.12.1",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -7849,7 +7849,7 @@ dependencies = ["security-framework","security-framework-sys","webpki-root-certs",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -7996,7 +7996,7 @@ dependencies = [[[package]]name = "sck-rs"version = "0.1.0"-source = "git+https://github.com/screenpipe/sck-rs#c0658125fe6e3d2c8e724cbda270d786df61af2d"+source = "git+https://github.com/screenpipe/sck-rs#a581b6a61c59c7c10258631f57fd837657f27380"dependencies = ["cidre 0.15.1","image",@@ -9127,7 +9127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"dependencies = ["libc",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -9874,7 +9874,7 @@ dependencies = ["getrandom 0.4.2","once_cell","rustix 1.1.4",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -10624,7 +10624,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"dependencies = ["memoffset","tempfile",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -11369,7 +11369,7 @@ version = "0.1.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.48.0",][[package]]diff --git a/crates/screenpipe-screen/src/monitor.rs b/crates/screenpipe-screen/src/monitor.rsindex 2d9010391..e6e53e069 100644--- a/crates/screenpipe-screen/src/monitor.rs+++ b/crates/screenpipe-screen/src/monitor.rs@@ -58,6 +58,15 @@ use sck_rs::Monitor as SckMonitor;// xcap is used on non-macOS platforms, and as fallback on older macOSuse xcap::Monitor as XcapMonitor;+/// Maximum capture width handed to the macOS SCK stream. The GPU downscales+/// to fit before `replayd` delivers the framebuffer, so WindowServer+/// composites a smaller surface. 1280 keeps OCR text legible while saving+/// substantial WindowServer CPU on HiDPI / large displays (measured ~50%+/// reduction on a 1512px display capped to 768px; bigger ratios → bigger+/// savings). No-op when the monitor's native width is at or below this cap.+#[cfg(target_os = "macos")]+const SCK_CAPTURE_MAX_WIDTH: u32 = 1280;+#[derive(Clone)]pub struct SafeMonitor {monitor_id: u32,@@ -257,8 +266,14 @@ impl SafeMonitor {return Err("Invalid monitor dimensions".to_string());}+ // Cap capture width — GPU downscales before replayd hands the+ // frame back, so WindowServer composites a smaller surface.+ // Measured ~50% WindowServer CPU reduction at 768px on a+ // 1512px display; bigger wins on HiDPI. 1280 keeps OCR-quality+ // text legible while still moving the needle on most modern+ // displays. No-op when native_width <= cap.monitor- .capture_image()+ .capture_image_scaled(SCK_CAPTURE_MAX_WIDTH).map_err(|e| format!("{}", e)).map(DynamicImage::ImageRgba8)} else {@@ -328,7 +343,7 @@ impl SafeMonitor {}monitor- .capture_image_excluding(&ids)+ .capture_image_scaled_excluding(SCK_CAPTURE_MAX_WIDTH, &ids).map_err(|e| format!("{}", e)).map(DynamicImage::ImageRgba8)} else {