Blog

Headless Chrome with GPU on Linux: Playwright, Puppeteer

The right flags to make headless Chrome/Chromium actually use the GPU: ANGLE Vulkan or EGL, verification, Playwright, Puppeteer, Selenium, Docker. 20× faster.

Running Chrome with the GPU on a Linux server

By default, headless Chrome does not use the GPU, even when the server has one. It renders WebGL with SwiftShader, a GPU emulated on the CPU: slow, and it eats the cores your tests need. Two flags are enough to change that.

Tested on 2026-10-29 on a Linux GPU server (Intel UHD 770, Debian 13, 4 vCPU) with Chromium 156, and Playwright 1.64 in Docker.

1. Prerequisites

apt install chromium        # or google-chrome-stable: same flags
ls /dev/dri                 # should list renderD128

As a non-root user, add the user to the render group so it can open the GPU: usermod -aG render,video myuser.

2. The command

chromium --headless=new \
  --use-angle=vulkan \
  --ignore-gpu-blocklist \
  https://example.com
  • --use-angle=vulkan: Chrome renders through Vulkan on the GPU. Alternative: --use-gl=angle --use-angle=gl-egl (OpenGL ES via EGL), just as fast;
  • --ignore-gpu-blocklist: with no display, Chrome often considers the GPU “unreliable” and falls back to the CPU. This flag prevents that;
  • when running as root (common on a server or in Docker), add --no-sandbox.

These flags also work under Xvfb, if your tool needs a real X display (see our Xvfb guide).

3. Check that the GPU is used

chrome://gpu isn’t practical without a screen. This small file prints the WebGL renderer:

cat > /tmp/gl.html <<'EOF'
<script>
const g = document.createElement('canvas').getContext('webgl2');
const e = g && g.getExtension('WEBGL_debug_renderer_info');
document.write(g ? g.getParameter(e.UNMASKED_RENDERER_WEBGL) : 'NO WEBGL');
</script>
EOF
chromium --headless=new --use-angle=vulkan --ignore-gpu-blocklist \
  --no-sandbox --dump-dom file:///tmp/gl.html

Expected output: ANGLE (Intel, Vulkan … Intel(R) UHD Graphics 770 …). If you see SwiftShader, the GPU is not being used.

4. The gain, measured

Same WebGL page (full-screen shader at 1920×1080), frames per second:

ConfigurationRendererFrames/s
--headless=new (default)SwiftShader, CPU13
--use-angle=vulkanUHD 770~260
--use-gl=angle --use-angle=gl-eglUHD 770~230

Measured with no frame-rate cap (--disable-gpu-vsync --disable-frame-rate-limit), 10 full-screen renders per frame, with one pixel read back on every frame to guarantee the rendering actually happened. During this test, SwiftShader keeps 3.9 of 4 vCPUs busy; the GPU, 0.6 vCPU. The script is public: webgl-bench.html. In normal use, Chrome locks to 60 frames/s, which the GPU sustains effortlessly.

5. Playwright

// playwright.config.ts
export default defineConfig({
  use: {
    launchOptions: {
      args: ['--use-angle=vulkan', '--ignore-gpu-blocklist'],
    },
  },
});

6. Puppeteer

const browser = await puppeteer.launch({
  headless: true,
  args: ['--use-angle=vulkan', '--ignore-gpu-blocklist', '--no-sandbox'],
});

7. Selenium (Python)

from selenium import webdriver
o = webdriver.ChromeOptions()
for a in ['--headless=new', '--use-angle=vulkan',
          '--ignore-gpu-blocklist', '--no-sandbox']:
    o.add_argument(a)
driver = webdriver.Chrome(options=o)

8. In Docker

A common trap: the official Playwright image does not include the Intel Vulkan driver. Even with the right flags and /dev/dri mounted, Chrome falls back to SwiftShader there (verified with Playwright 1.64). Add the driver:

FROM mcr.microsoft.com/playwright:v1.64.1-noble
RUN apt-get update && apt-get install -y mesa-vulkan-drivers \
 && rm -rf /var/lib/apt/lists/*

Then give the container access to the GPU:

docker run --device /dev/dri \
  --group-add "$(stat -c %g /dev/dri/renderD128)" \
  -e ANV_SPARSE=0 \
  my-playwright-image npx playwright test

ANV_SPARSE=0 disables a Vulkan feature (“sparse”) that causes GPU hangs with the Mesa Intel driver inside a VM. Our VMs already disable it; a container has its own environment, so you need to pass it again.

FAQ

What about the --disable-gpu flag I see everywhere? It does the opposite of what you want: remove it.

Do I need --enable-features=Vulkan? No, --use-angle=vulkan is enough with recent Chrome versions.

WebGPU? Out of scope for this guide: the flags above cover WebGL, Canvas and page compositing.

Try it

Linux GPU servers have an Intel UHD 770 GPU inside the VM, with Mesa and Vulkan already installed. From €14.99 excl. VAT/month, root access, dedicated IPv6, optional k3s cluster to parallelize your tests.