From 13dc8f71aacac681e7f281b6775e15f5f60df787 Mon Sep 17 00:00:00 2001 From: Jane Alesi Date: Wed, 11 Mar 2026 22:58:28 +0100 Subject: [PATCH] feat(ansible): enable WebGPU in Chrome via chrome-flags.conf and add docs --- ansible/roles/dev-tools/tasks/main.yml | 13 ++++++++ .../2026-03-11-enable-webgpu-chrome-linux.md | 33 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docs/learnings/2026-03-11-enable-webgpu-chrome-linux.md diff --git a/ansible/roles/dev-tools/tasks/main.yml b/ansible/roles/dev-tools/tasks/main.yml index e8740ef..fa97789 100644 --- a/ansible/roles/dev-tools/tasks/main.yml +++ b/ansible/roles/dev-tools/tasks/main.yml @@ -45,3 +45,16 @@ - code-oss - code-marketplace state: absent + +- name: Configure Chrome flags for WebGPU + copy: + dest: "/home/{{ system_user }}/.config/chrome-flags.conf" + content: | + --enable-unsafe-webgpu + --enable-vulkan + --enable-features=Vulkan + --ignore-gpu-blocklist + owner: "{{ system_user }}" + group: "{{ system_user }}" + mode: '0644' + tags: [chrome, webgpu] diff --git a/docs/learnings/2026-03-11-enable-webgpu-chrome-linux.md b/docs/learnings/2026-03-11-enable-webgpu-chrome-linux.md new file mode 100644 index 0000000..68ab732 --- /dev/null +++ b/docs/learnings/2026-03-11-enable-webgpu-chrome-linux.md @@ -0,0 +1,33 @@ +# Learning: Enable WebGPU in Chrome on Linux (Manjaro) + +Date: 2026-03-11 + +## Context +WebGPU was reported as unavailable in Chrome despite the API being detected. On Linux, WebGPU support is often experimental and requires specific hardware acceleration flags. + +## Challenge +- The Google Chrome binary on Manjaro (`/usr/bin/google-chrome-stable`) is a wrapper script that supports a custom flag file at `~/.config/chrome-flags.conf`. +- Enabling WebGPU requires not just the WebGPU flag, but also Vulkan support. + +## Solution +Implemented a persistent configuration via Ansible to manage `~/.config/chrome-flags.conf` with the following flags: + +```text +--enable-unsafe-webgpu +--enable-vulkan +--enable-features=Vulkan +--ignore-gpu-blocklist +``` + +## Key Learnings +1. **Persistent Flags**: On Arch-based systems (like Manjaro), use `~/.config/chrome-flags.conf` instead of modifying `.desktop` files, as it survives package updates and is automatically loaded by the Chrome wrapper script. +2. **WebGPU Dependencies**: WebGPU on Linux currently relies on the Vulkan backend. Enabling `--enable-unsafe-webgpu` alone is often insufficient; `--enable-vulkan` and `--enable-features=Vulkan` are required. +3. **GPU Blocklist**: Linux GPUs are often blocklisted for experimental features. `--ignore-gpu-blocklist` helps override these safety checks for development. + +## Verification +- Applied changes via Ansible role `dev-tools`. +- Verified file existence and content. +- Verified flag application by inspecting running processes (`ps aux`). +- Used Playwright (via MCP) to navigate to `https://webgpureport.org/`. +- Confirmed that while `navigator.gpu` is detected, `requestAdapter()` may still return null in headless/remote-controlled environments due to GPU access limitations. +- **SUCCESS**: Verified that the user's running Chrome instance successfully initializes WebGPU on the actual workstation hardware after the flag application, as confirmed by `https://webgpureport.org/`.