Skip to content

feat: sweep every GPU's released textures while idle - #13

Merged
Fi3w0 merged 1 commit into
masterfrom
feat/idle-texture-cleanup
Oct 28, 2026
Merged

Fi3w0 merged 1 commit into
masterfrom
feat/idle-texture-cleanup

Conversation

@Fi3w0

@Fi3w0 Fi3w0 commented Oct 28, 2026

Copy link
Copy Markdown
Owner

0.90.200 adds the idle cleanup_texture_cache call site that plan §3 deferred until after the Smithay migration.

Why: Smithay frees dropped GL textures, EGL images and buffers only after a rendered frame (GlesRenderer::cleanup on unbind, or a no-damage render_frame), and only for the renderer that drew. That leaves two gaps:

  • Anything released after an idle desktop's last frame waits for the next frame.
  • Render-only GPU nodes, which hold cross-GPU imports, are never swept, because ImportBridge::cleanup_texture_cache only reaches the primary renderer.

Change: the udev maintenance timer now calls GpuManager::cleanup_texture_cache (upstream 347b2b30).

  • Rate-limited to once every 5 s, never per frame or per output.
  • Skipped while the DRM device is paused (VT switched away).
  • Takes the manager with try_borrow_mut, so it can never collide with a render.
  • Upstream 79bbed5e makes a context current only when its destruction queue is non-empty, so an idle node isn't woken from runtime suspend (Smithay #2178/#2180).

Validation:

  • Formatting, 708 locked all-feature/all-target serial tests, strict Clippy and the locked release build pass.
  • Tested on a native install of .200, NVIDIA only (AMD excluded by config).
    • Idle for 2 min: flat at 75 MiB GPU, PSS about 100 MB.
    • Three rounds of 7–8 kitty windows on a hidden workspace, killed while hidden: GPU and PSS went back to baseline, and fds went 264 → 187.
    • 200 grim captures: no errors.
  • Not run: VT switch, DPMS, OBS with the sweep active.

Separate finding, not caused by this change: the first capture of each output grows the NVIDIA driver's /dev/nvidiactl mapping (+44 MiB on 2560×1440), and it stays at that level. It's bounded, and the sweep can't release it. Tracked separately.

Smithay frees dropped GL textures, images and buffers only after a
rendered frame, and only on the renderer that drew it. Anything released
after an idle desktop's last frame waited for the next one, and
render-only GPU nodes holding cross-GPU imports were never swept.

The udev maintenance timer now calls GpuManager::cleanup_texture_cache
at most every 5 s, skipped while the DRM device is paused. Upstream
only makes a context current when its destruction queue is non-empty,
so an idle GPU is not woken from runtime suspend.
@Fi3w0
Fi3w0 merged commit ae14c63 into master Oct 28, 2026
1 check passed
@Fi3w0
Fi3w0 deleted the feat/idle-texture-cleanup branch October 28, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant