fix: improve autohide animation responsiveness#521
Open
misterclayt0n wants to merge 2 commits into
Open
Conversation
Instead of rendering content with a client-side offset during autohide animations, request the compositor to move the surface by adjusting layer-shell margins. This delegates the animation movement to the compositor which may be able to optimize surface repositioning. Changes: - Add set_margin_with_offset() for animation-aware margin setting - Update TransitionToHidden/TransitionToVisible to set margins each frame - Remove render offset (anim_gap_translation) from render.rs - Remove anchor_gap from background and input region calculations in layout.rs
misterclayt0n
added a commit
to misterclayt0n/cosmic-epoch
that referenced
this pull request
Dec 15, 2025
Points to misterclayt0n/cosmic-panel@fix/autohide-animation-stutter which includes: - Improved event loop timing during animations - Immediate surface commits during margin animation - Exclusive zone optimization PR: pop-os/cosmic-panel#521
|
I installed this fork locally and it seems to make it a bit smoother. Thanks! |
|
would this fix this issue? pop-os/cosmic-epoch#2677 |
wash2
requested changes
Apr 14, 2026
Collaborator
wash2
left a comment
There was a problem hiding this comment.
Instead of rendering content with a client-side offset during autohide
animations, request the compositor to move the surface by adjusting
layer-shell margins. This delegates the animation movement to the
compositor which may be able to optimize surface repositioning.
We did use this method in the past, but I don't believe this kind of method will interact properly with overlap notify protocol
| /// `anchor_offset` is negative to push the panel off-screen (hiding), | ||
| /// and zero when fully visible. | ||
| /// | ||
| /// If `commit_immediately` is true, commits the surface right away without |
Collaborator
There was a problem hiding this comment.
Is this really necessary? I don't think we want to render without waiting for frame callbacks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes stuttering in the panel autohide animation, especially noticeable at 60Hz refresh rates.
Problem
The autohide animation was dropping frames, causing visible stutter. Profiling revealed two issues:
Event loop timing: When the panel was hidden, the main loop used a 300ms dispatch timeout. The
prev_durbackoff variable could accumulate up to 100ms and carry into the animation, causing slow polling during transitions.Delayed surface commits: Margin changes during animation were batched with rendering and only committed when the next frame callback arrived, adding unnecessary latency.
Solution
Event loop timing (
xdg_shell_wrapper/mod.rs)TransitionToHidden/TransitionToVisible)Immediate commits during animation (
panel_space.rs)commit_immediatelyparameter toset_margin_with_offset()Exclusive zone optimization (
panel_space.rs)Profiling
The timing metrics were collected using Tracy (https://github.com/wolfpld/tracy) instrumentation temporarily added to cosmic-panel. The profiling code was used only for diagnosis and has not been included in this PR to keep the changes minimal and focused on the fix itself. However, if deemed appropriate, I have these tracy changes in my local machine, and I can upstream them as well in another PR.
Metrics
Demo
2025-12-15.18-26-41.mp4
Animation feels overall snappier.
Testing
Tested on 60Hz display with autohide panel. Animation feels smooth with no latency.