feat(ansible): enable WebGPU in Chrome via chrome-flags.conf and add docs

This commit is contained in:
ja
2026-03-11 22:58:28 +01:00
parent 532e45acba
commit 13dc8f71aa
2 changed files with 46 additions and 0 deletions
+13
View File
@@ -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]
@@ -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/`.