Skip to content

Android: drive animation frames from the display vsync - #12702

Open
ogoffart wants to merge 1 commit into
masterfrom
olivier/fix-#12407
Open

Android: drive animation frames from the display vsync#12702
ogoffart wants to merge 1 commit into
masterfrom
olivier/fix-#12407

Conversation

@ogoffart

Copy link
Copy Markdown
Member

The event loop capped the poll timeout at a hardcoded 10ms while an animation runs. On a 120Hz display that misses every second vsync, so inertia scrolling drops from 120 to 60fps.

Post frame callbacks to the Choreographer from a dedicated helper thread and wake the event loop at each vsync, so the frame rate follows the refresh rate. The thread runs the Choreographer on its own looper to keep its POLL_CALLBACK, which android-activity logs as a spurious error, off the main loop. A fixed 10ms poll remains as a fallback when the thread is unavailable.

Fixes: #12407

The event loop capped the poll timeout at a hardcoded 10ms while an
animation runs. On a 120Hz display that misses every second vsync, so
inertia scrolling drops from 120 to 60fps.

Post frame callbacks to the Choreographer from a dedicated helper thread
and wake the event loop at each vsync, so the frame rate follows the
refresh rate. The thread runs the Choreographer on its own looper to keep
its POLL_CALLBACK, which android-activity logs as a spurious error, off
the main loop. A fixed 10ms poll remains as a fallback when the thread is
unavailable.

Fixes: #12407
@ogoffart
ogoffart force-pushed the olivier/fix-#12407 branch from 645fa2b to e487fcc Compare July 30, 2026 08:14

@tronical tronical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting idea to just use poll_once() followed by main_waker.wake() to trigger the redraw. It's a bit obscure for my taste, but I think this should work just fine :)

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.

Scrolling issues on 120Hz Android

2 participants