Site Tools


x220-gpu-rendering-with-hyprland

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

x220-gpu-rendering-with-hyprland [May 25, 2026 at 19:22] – created Ivan Janevskix220-gpu-rendering-with-hyprland [August 26, 2026 at 16:02] (current) – external edit 127.0.0.1
Line 1: Line 1:
-# GPU Rendering Artifacts on ThinkPad X220 with Hyprland — Diagnosis Fix+# GPU rendering artifacts on thinkpad X220 with hyprland — diagnosis fix
  
-## Hardware & Software Context+## Hardware & software context
  
 | | | | | |
Line 20: Line 20:
 - **Dropdown/popup artifacts in browsers** (Firefox, Librewolf): bookmark menus, context menus, and form dropdowns show flickering garbage pixels or appear partially rendered. - **Dropdown/popup artifacts in browsers** (Firefox, Librewolf): bookmark menus, context menus, and form dropdowns show flickering garbage pixels or appear partially rendered.
 - **Waybar icon artifacts**: hovering over status bar icons produces visual corruption in the hover region. - **Waybar icon artifacts**: hovering over status bar icons produces visual corruption in the hover region.
-- **VS Code fonts completely garbled**: all text in VS Code is illegible — random pixel patterns instead of glyphs.+- **VS Code fonts completely garbled**: all text in VS Code is illegiblerandom pixel patterns instead of glyphs.
 - **System-wide nature**: the artifacts are not confined to one application; any GPU-composited surface can show corruption. - **System-wide nature**: the artifacts are not confined to one application; any GPU-composited surface can show corruption.
  
 --- ---
  
-## How to Investigate This Class of Issue+## How to investigate this class of issue
  
 The following steps, taken in order, efficiently isolate the cause of system-wide GPU rendering corruption on a Hyprland/Wayland system. The following steps, taken in order, efficiently isolate the cause of system-wide GPU rendering corruption on a Hyprland/Wayland system.
  
-### Step 1 — Gather system context+### Step 1 — gather system context
  
 ```bash ```bash
Line 37: Line 37:
 Note the GPU, Mesa version, Hyprland version, and kernel version. On a Sandy Bridge machine: confirm the driver is `crocus` and the DRI path is `/usr/lib/dri/crocus_dri.so`. Note the GPU, Mesa version, Hyprland version, and kernel version. On a Sandy Bridge machine: confirm the driver is `crocus` and the DRI path is `/usr/lib/dri/crocus_dri.so`.
  
-### Step 2 — Check recent package updates+### Step 2 — check recent package updates
  
 ```bash ```bash
Line 45: Line 45:
 The most relevant packages for Wayland compositor rendering are: `mesa`, `hyprland`, `xorg-xwayland`, and `libdrm`. Note which versions were installed and when symptoms began. The most relevant packages for Wayland compositor rendering are: `mesa`, `hyprland`, `xorg-xwayland`, and `libdrm`. Note which versions were installed and when symptoms began.
  
-### Step 3 — Read the live Hyprland log+### Step 3 — read the live hyprland log
  
 ```bash ```bash
Line 52: Line 52:
  
 Look for: Look for:
-- **EGL context creation errors** — `eglCreateContext errored out with EGL_BAD_MATCH`: Sandy Bridge only supports GLES 3.0; any code path requesting GLES 3.2 will fail. A failed context without a successful fallback means a renderer is degraded or absent. +- **EGL context creation errors**`eglCreateContext errored out with EGL_BAD_MATCH`: Sandy Bridge only supports GLES 3.0; any code path requesting GLES 3.2 will fail. A failed context without a successful fallback means a renderer is degraded or absent. 
-- **GBM buffer format** — `format XR24 with modifier 0x...`: the modifier field shows whether buffers are `LINEAR` (modifier `0x0`) or tiled (e.g. `X_TILED`, modifier `0x100000000000001`). Tiled formats on Sandy Bridge can corrupt popup surfaces. +- **GBM buffer format**`format XR24 with modifier 0x...`: the modifier field shows whether buffers are `LINEAR` (modifier `0x0`) or tiled (e.g. `X_TILED`, modifier `0x100000000000001`). Tiled formats on Sandy Bridge can corrupt popup surfaces. 
-- **DRM commit errors** — `drm: Cannot commit when a page-flip is awaiting`: frame timing failures; indicates Hyprland is submitting frames faster than the display can flip. +- **DRM commit errors**`drm: Cannot commit when a page-flip is awaiting`: frame timing failures; indicates Hyprland is submitting frames faster than the display can flip. 
-- **Renderer selected** — confirms which GPU and GLES version are active.+- **Renderer selected**confirms which GPU and GLES version are active.
  
-### Step 4 — Check Aquamarine environment variable support+### Step 4 — check aquamarine environment variable support
  
 Hyprland's DRM backend (Aquamarine) respects specific environment variables. Extract the ones it knows about: Hyprland's DRM backend (Aquamarine) respects specific environment variables. Extract the ones it knows about:
Line 67: Line 67:
 Key variables: `AQ_NO_MODIFIERS`, `AQ_NO_ATOMIC`, `AQ_FORCE_LINEAR_BLIT`, `AQ_DRM_DEVICES`. Key variables: `AQ_NO_MODIFIERS`, `AQ_NO_ATOMIC`, `AQ_FORCE_LINEAR_BLIT`, `AQ_DRM_DEVICES`.
  
-### Step 5 — Inspect the Mesa driver architecture+### Step 5 — inspect the mesa driver architecture
  
 ```bash ```bash
Line 73: Line 73:
 file /usr/lib/dri/crocus_dri.so file /usr/lib/dri/crocus_dri.so
  
-# Check for a shared libgallium — if present, ALL Gallium drivers live here+# Check for a shared libgallium — if present, ALL gallium drivers live here
 ls -lh /usr/lib/libgallium*.so ls -lh /usr/lib/libgallium*.so
 ``` ```
Line 79: Line 79:
 In Mesa 26.0.x, `crocus_dri.so` was a standalone self-contained shared library. In Mesa 26.1.x, all Gallium3D drivers were consolidated into `libgallium-<version>.so`, with `crocus_dri.so` becoming a thin stub (`crocus_dri.so → libdril_dri.so`, ~95 KB loader). This architectural change is a common regression vector for older hardware. In Mesa 26.0.x, `crocus_dri.so` was a standalone self-contained shared library. In Mesa 26.1.x, all Gallium3D drivers were consolidated into `libgallium-<version>.so`, with `crocus_dri.so` becoming a thin stub (`crocus_dri.so → libdril_dri.so`, ~95 KB loader). This architectural change is a common regression vector for older hardware.
  
-### Step 6 — Check i915 kernel module parameters+### Step 6 — check i915 kernel module parameters
  
 ```bash ```bash
Line 94: Line 94:
 | `enable_dc` | `0` | Display power-saving can interfere with DRM commits | | `enable_dc` | `0` | Display power-saving can interfere with DRM commits |
  
-### Step 7 — Check Mesa shader cache+### Step 7 — check mesa shader cache
  
 ```bash ```bash
Line 106: Line 106:
 ``` ```
  
-### Step 8 — Confirm the fix candidate by checking cached packages+### Step 8 — confirm the fix candidate by checking cached packages
  
 ```bash ```bash
Line 116: Line 116:
 --- ---
  
-## Root Causes Found (This SystemMesa 26.1.1 / Hyprland 0.55.2)+## Root causes found (this systemmesa 26.1.1 / hyprland 0.55.2)
  
-### Root Cause 1 — Mesa 26.1.1 crocus regression (primary, system-wide)+### Root cause 1 — mesa 26.1.1 crocus regression (primary, system-wide)
  
 **Mesa 26.1.0** introduced a major architectural refactor: all Gallium3D drivers were merged from individual shared libraries into a single `libgallium-<version>.so`. The `crocus_dri.so` driver became a ~95 KB stub loader (`libdril_dri.so`) that dispatches into the 52 MB monolithic library. **Mesa 26.1.0** introduced a major architectural refactor: all Gallium3D drivers were merged from individual shared libraries into a single `libgallium-<version>.so`. The `crocus_dri.so` driver became a ~95 KB stub loader (`libdril_dri.so`) that dispatches into the 52 MB monolithic library.
Line 131: Line 131:
 This is **confirmed** by: (a) artifacts appearing immediately after the Mesa 26.0.6 → 26.1.1 upgrade, (b) artifacts disappearing after downgrading back to 26.0.6. This is **confirmed** by: (a) artifacts appearing immediately after the Mesa 26.0.6 → 26.1.1 upgrade, (b) artifacts disappearing after downgrading back to 26.0.6.
  
-### Root Cause 2 — GBM buffer modifiers not disabled (popup artifacts)+### Root cause 2 — GBM buffer modifiers not disabled (popup artifacts)
  
 Hyprland's Aquamarine backend, by default, allocates GBM display buffers using hardware-optimal tiled formats (e.g. `X_TILED`, modifier `0x100000000000001`) for better GPU scan-out performance. On Sandy Bridge, the crocus driver can corrupt new popup surfaces (dropdowns, tooltips) when they first appear in a tiled buffer — the compositor reads back the buffer before the GPU has flushed the tile swizzle. Hyprland's Aquamarine backend, by default, allocates GBM display buffers using hardware-optimal tiled formats (e.g. `X_TILED`, modifier `0x100000000000001`) for better GPU scan-out performance. On Sandy Bridge, the crocus driver can corrupt new popup surfaces (dropdowns, tooltips) when they first appear in a tiled buffer — the compositor reads back the buffer before the GPU has flushed the tile swizzle.
Line 139: Line 139:
 **Verification**: after setting this variable, the Hyprland log should show `modifier 0x0 : LINEAR` for all GBM buffer allocations. **Verification**: after setting this variable, the Hyprland log should show `modifier 0x0 : LINEAR` for all GBM buffer allocations.
  
-### Root Cause 3 — VS Code Electron GPU rendering on Wayland+### Root cause 3 — VS code electron GPU rendering on wayland
  
 Omarchy sets `ELECTRON_OZONE_PLATFORM_HINT=wayland` globally, causing VS Code (Electron) to run natively on Wayland and use the GPU for font rendering. Combined with the crocus regression and Sandy Bridge's GLES 3.0 limitation, Electron's GPU text rendering pipeline produces garbled glyphs. Omarchy sets `ELECTRON_OZONE_PLATFORM_HINT=wayland` globally, causing VS Code (Electron) to run natively on Wayland and use the GPU for font rendering. Combined with the crocus regression and Sandy Bridge's GLES 3.0 limitation, Electron's GPU text rendering pipeline produces garbled glyphs.
Line 147: Line 147:
 --- ---
  
-## Fix Applied+## Fix applied
  
-### 1. Downgrade Mesa 26.1.1 → 26.0.6+### 1. downgrade mesa 26.1.1 → 26.0.6
  
 The old package was still in the pacman cache: The old package was still in the pacman cache:
Line 159: Line 159:
 ``` ```
  
-### 2. Pin Mesa in pacman.conf+### 2. pin mesa in pacman.conf
  
 Add to `/etc/pacman.conf` under `[options]`: Add to `/etc/pacman.conf` under `[options]`:
Line 169: Line 169:
 This prevents `omarchy update` / `pacman -Syu` from re-upgrading Mesa until a release that fixes the crocus regression is confirmed working. This prevents `omarchy update` / `pacman -Syu` from re-upgrading Mesa until a release that fixes the crocus regression is confirmed working.
  
-### 3. Force linear GBM buffer allocation+### 3. force linear GBM buffer allocation
  
 In `~/.config/hypr/hyprland.conf`: In `~/.config/hypr/hyprland.conf`:
  
 ```ini ```ini
-# Force Aquamarine to allocate GBM buffers in linear format. +# Force aquamarine to allocate GBM buffers in linear format. 
-# Sandy Bridge (crocus) corrupts popup surfaces with tiled modifiers.+# Sandy bridge (crocus) corrupts popup surfaces with tiled modifiers.
 env = AQ_NO_MODIFIERS,1 env = AQ_NO_MODIFIERS,1
  
-# Force linear blit path in Aquamarine's renderer (belt-and-suspenders).+# Force linear blit path in aquamarine's renderer (belt-and-suspenders).
 env = AQ_FORCE_LINEAR_BLIT,1 env = AQ_FORCE_LINEAR_BLIT,1
 ``` ```
  
-### 4. Disable hardware cursor+### 4. disable hardware cursor
  
 In `~/.config/hypr/looknfeel.conf`: In `~/.config/hypr/looknfeel.conf`:
Line 194: Line 194:
 Sandy Bridge's i915 hardware cursor has known glitches with the crocus Wayland stack. Sandy Bridge's i915 hardware cursor has known glitches with the crocus Wayland stack.
  
-### 5. Disable VS Code GPU acceleration+### 5. disable VS code GPU acceleration
  
 Create `~/.config/code-flags.conf`: Create `~/.config/code-flags.conf`:
Line 202: Line 202:
 ``` ```
  
-### 6. Kernel module parameters for i915+### 6. kernel module parameters for i915
  
 In `/etc/modprobe.d/i915.conf`: In `/etc/modprobe.d/i915.conf`:
Line 214: Line 214:
 Requires a reboot to take effect (or `modprobe -r i915 && modprobe i915`, which is only possible when Hyprland is not running). Requires a reboot to take effect (or `modprobe -r i915 && modprobe i915`, which is only possible when Hyprland is not running).
  
-### 7. Clear Mesa shader cache+### 7. clear mesa shader cache
  
 ```bash ```bash
Line 222: Line 222:
 Run this after any Mesa version change. Run this after any Mesa version change.
  
-### 8. Restart Hyprland session+### 8. restart hyprland session
  
 A full session restart (log out → log back in) is required after a Mesa downgrade. Running processes retain the old Mesa shared library (`libgallium-26.1.1.so`) in memory; only a fresh Hyprland process loads the downgraded version. A full session restart (log out → log back in) is required after a Mesa downgrade. Running processes retain the old Mesa shared library (`libgallium-26.1.1.so`) in memory; only a fresh Hyprland process loads the downgraded version.
Line 228: Line 228:
 --- ---
  
-## What to Monitor Going Forward+## What to monitor going forward
  
 - **Mesa 26.1.x patch releases**: Check the [Mesa changelog](https://docs.mesa3d.org/relnotes.html) for crocus/Sandy Bridge fixes. When a release notes a crocus fix, remove the `IgnorePkg` line from `/etc/pacman.conf` and upgrade. - **Mesa 26.1.x patch releases**: Check the [Mesa changelog](https://docs.mesa3d.org/relnotes.html) for crocus/Sandy Bridge fixes. When a release notes a crocus fix, remove the `IgnorePkg` line from `/etc/pacman.conf` and upgrade.
-- **Mesa bug tracker**: The regression can be reported/tracked at [gitlab.freedesktop.org/mesa/mesa](https://gitlab.freedesktop.org/mesa/mesa) — search for issues tagged `crocus` or `Gen6`.+- **Mesa bug tracker**: The regression can be reported/tracked at [gitlab.freedesktop.org/mesa/mesa](https://gitlab.freedesktop.org/mesa/mesa)search for issues tagged `crocus` or `Gen6`.
 - **Hyprland 0.55.x atomicity**: The `AQ_NO_ATOMIC=1` flag in Aquamarine was tested and found to cause additional errors on Sandy Bridge (Aquamarine's legacy DRM mode reports missing CRTC/encoder IDs for all disconnected ports). It should **not** be set on this hardware. - **Hyprland 0.55.x atomicity**: The `AQ_NO_ATOMIC=1` flag in Aquamarine was tested and found to cause additional errors on Sandy Bridge (Aquamarine's legacy DRM mode reports missing CRTC/encoder IDs for all disconnected ports). It should **not** be set on this hardware.
  
 --- ---
  
-## Quick Diagnostic Checklist for the Same Issue+## Quick diagnostic checklist for the same issue
  
 If you are on a ThinkPad X220 (or any Sandy Bridge machine) with Hyprland and see system-wide rendering artifacts after a system update, run through this in order: If you are on a ThinkPad X220 (or any Sandy Bridge machine) with Hyprland and see system-wide rendering artifacts after a system update, run through this in order:
x220-gpu-rendering-with-hyprland.1779736963.md.gz · Last modified: by Ivan Janevski