Skip to content

feat(wallpaper): add wallpaper-prefetch IPC to warm cache - #4216

Open
landerbro wants to merge 1 commit into
noctalia-dev:mainfrom
landerbro:feat/wallpaper-prefetch
Open

feat(wallpaper): add wallpaper-prefetch IPC to warm cache#4216
landerbro wants to merge 1 commit into
noctalia-dev:mainfrom
landerbro:feat/wallpaper-prefetch

Conversation

@landerbro

@landerbro landerbro commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Add wallpaper-prefetch [connector] <path> IPC to warm SharedTextureCache without displaying. Prefetch decodes and uploads wallpaper in background so next wallpaper-set is a cache hit.

  • Uses m_textureCache->peek to avoid refCount leak on hit
  • acquire keeps refCount 1 until eviction or next set
  • Logs prefetched / prefetch hit
  • Additive IPC only, no change to existing wallpaper-set / wallpaper-next / wallpaper-random behavior

Motivation

Fast workspace/blur toggles (active_window_id -> blur/original) and Mod+W prewarm of next wallpapers. Currently each wallpaper-set cold decodes + uploads.

Cold path for 2560x1440 q95: ~130-150ms (95ms warm same-file). With prefetch of next orig+blur (2 textures, ~29MB VRAM) next set becomes hit (~28-90ms). Reduces visible flicker on niri workspace switch.

Fixes slow wallpaper switch when cycling wallpapers quickly or toggling blur.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Build / packaging

Related Issue

None.

Testing

  • Bench (5 different 2560x1440 q95, niri ws toggle, 5 runs):
    • cold direct 136ms avg
    • warm same-file hit 28ms
    • warm next different file after prefetch 89ms vs 130ms cold (-30%)
  • Manual: noctalia wallpaper-prefetch <path> then noctalia wallpaper-set <same path> -> logs prefetch hit, visually instant
  • Manual: wall-lib.sh prewarm next wallpaper after each set -> Mod+W instant
  • just format with clang-format 22+ - no diff
  • just build - clean, no new warnings

Manual Coverage

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors

Screenshots / Videos

N/A - IPC only, no UI change. Effect is reduced latency on wallpaper switch (bench above).

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format with clang-format v22+ installed, or this PR has no code changes.
  • I ran the relevant build or test commands, or explained why they were not run.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I updated user-facing documentation in docs/user/ when this PR changes documented behavior or configuration, or this PR does not require documentation changes.
  • I added or updated assets/translations/en.json, or this PR adds no new user-facing strings.
  • I did not edit non-English translation files unless this PR is explicitly for translation tooling, an import/export sync, or a maintainer-requested locale change.
  • I used the existing canonical names for config keys, IPC names, paths, and identifiers.

Additional Notes

VRAM cost: ~14.5MB per 2560x1440 texture, ~29MB for orig+blur pair. Evicted via LRU / next set.

Use case: wall-lib.sh calls wallpaper-prefetch for next wallpaper after each wallpaper-set for instant Mod+W / blur toggle.

Commit: f962950 - single commit, additive.

Prefetch decodes and uploads wallpaper into SharedTextureCache
without displaying it. Useful for fast workspace/blur toggles
and Mod+W prewarm of next wallpapers.

- wallpaper-prefetch [connector] <path> IPC
- uses m_textureCache->peek to avoid refCount leak on hit
- acquire keeps refCount 1 until eviction or next set

Bench: cold set 130-150ms -> warm hit 28-90ms after prefetch
@ItsLemmy

ItsLemmy commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

No PR template body = no cookies

@ItsLemmy ItsLemmy closed this Sep 2, 2026
@landerbro

landerbro commented Sep 2, 2026

Copy link
Copy Markdown
Author

Updated PR body to follow PULL_REQUEST_TEMPLATE.md (Summary / Motivation / Type of Change / Testing / Manual Coverage / Checklist). PTAL @ItsLemmy - please reopen if prefetch IPC still relevant. Branch feat/wallpaper-prefetch f962950 is intact, body now passes template check. Bench: cold 136ms -> warm hit 28-89ms after prefetch.

@ItsLemmy ItsLemmy reopened this Sep 2, 2026
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.

2 participants