← Back to PRs

#20845: feat(browser): Add GPU configuration support for headless Chrome

by mekenthompson open 2026-02-19 10:45 View on GitHub →
agents size: XS
## Summary Adds `browser.gpuEnabled` configuration option to enable GPU hardware acceleration in headless Chrome for improved browser automation performance. ## Problem OpenClaw currently hardcodes `--disable-gpu` when running Chrome in headless mode, forcing all rendering to CPU-only software mode. This prevents GPU acceleration even when GPU devices (`/dev/dri/*`) are available in the container. **Impact:** - Slower screenshot/page rendering (especially charts, SVG, Canvas) - Higher CPU usage during browser automation - Poor performance for WebGL/WebGPU content - No hardware video decode **Use cases blocked:** - Autonomous testing of React/Vue components with complex rendering - Screenshot-based UI validation workflows - Browser automation of data visualization tools (charts, dashboards) - Testing WebGL/Canvas-heavy applications ## Solution Add a new config option `browser.gpuEnabled` (default: `false`) that when set to `true`: - Prevents the `--disable-gpu` flag - Adds `--enable-gpu`, `--use-angle=vulkan`, and `--enable-features=Vulkan` flags - Enables hardware-accelerated rendering in headless mode **Benefits:** - **Faster rendering:** Hardware-accelerated canvas, compositing, and rasterization - **Lower CPU usage:** Offload rendering work to GPU - **Better compatibility:** WebGL/WebGPU content works properly - **Autonomous testing:** Enable GPU-dependent UI tests in agent workflows - **Screenshot quality:** Improved rendering of complex visualizations ## Use Case: Autonomous Testing This feature is particularly valuable for agent-driven browser automation: ```json { "browser": { "headless": true, "gpuEnabled": true } } ``` **Example scenarios:** - Agent takes screenshots of data visualizations and validates chart rendering - Autonomous testing of React component libraries with complex animations - Browser-based UI regression testing in CI/CD pipelines - Testing WebGL-based data exploration tools ## Changes - Added `gpuEnabled?: boolean` to `BrowserConfig` type - Updated Zod schema to include the new field - Modified browser launch logic in `chrome.ts` to conditionally add GPU flags - Updated `ResolvedBrowserConfig` type and resolution logic - Fixed test mocks and sandbox config to include `gpuEnabled: false` ## Configuration Example ```json { "browser": { "headless": true, "gpuEnabled": true } } ``` **Requirements:** - GPU devices must be available in the container (e.g., `/dev/dri/renderD128`) - Mesa drivers or equivalent GPU drivers installed - Not recommended for environments without GPU access (will fail or fall back) ## Testing Verified on: - **Platform:** Home Assistant OS (Debian container) - **Hardware:** Intel NUC i7-1360P with Intel Iris Xe Graphics - **GPU device:** `/dev/dri/renderD128` exposed to container - **Result:** Hardware acceleration confirmed via `chrome://gpu` **Before (gpuEnabled: false):** - Canvas: Software only - Compositing: Software only - OpenGL: Disabled **After (gpuEnabled: true):** - Canvas: Hardware accelerated - Compositing: Hardware accelerated - OpenGL: Enabled - Rasterization: Hardware accelerated on all pages - WebGL: Hardware accelerated - WebGPU: Hardware accelerated ## Backward Compatibility Default is `false` to maintain existing behavior. No breaking changes.

Most Similar PRs