Skip to content

Fix Wayland overlay flicker by honoring SHM buffer lifetimes - #334

Merged
devmobasa merged 2 commits into
mainfrom
fix/issue-318-main-surface-buffer-release
Aug 12, 2026
Merged

Fix Wayland overlay flicker by honoring SHM buffer lifetimes#334
devmobasa merged 2 commits into
mainfrom
fix/issue-318-main-surface-buffer-release

Conversation

@devmobasa

Copy link
Copy Markdown
Owner

Summary

Fixes #318

  • Attach the main overlay and About window buffers through SCTK’s Buffer::attach_to() so SHM slots remain active until wl_buffer.release.
  • Retain a fixed-size overlay swapchain and defer rendering when every configured buffer is compositor-owned, preventing unbounded pool growth.
  • Track buffer-exhaustion deferrals without counting them as presented frames.
  • Scope inline-toolbar hover damage instead of falling back to full-surface repainting.
  • Preserve the asymmetric file-dialog policy: entry requires a committed transparent frame, while
    restoration accepts a deferred repaint so a selected file is never discarded.

Root cause

The main overlay attached the raw wl_buffer directly to the Wayland surface. This bypassed SCTK’s slot activation.

When the inactive Buffer was dropped, its SHM memory returned to the pool’s free list before the compositor sent wl_buffer.release. With vsync disabled, the next frame could immediately repaint the same memory while the compositor was still presenting it, producing toolbar and annotation flicker.

This also meant the configured buffer count was ineffective and prevented the existing per-slot damage tracking from operating over a real swapchain.

Keep the configured swapchain slots alive and defer renders while all buffers remain compositor-owned. Track those deferrals separately, scope inline hover damage, and preserve dialog entry/restoration semantics.
@devmobasa
devmobasa merged commit 652d755 into main Aug 12, 2026
2 checks passed
@devmobasa
devmobasa deleted the fix/issue-318-main-surface-buffer-release branch August 12, 2026 21:07
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.

[BUG] The UI and annotations flickering on hover to the menu

1 participant