Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #3027: [Android] Fix CPU spinning of StarboardMain. #3046

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

cobalt-github-releaser-bot
Copy link
Collaborator

Refer to the original PR: #3027

An integer overflow in a downconversion resulted in a negative timeout being used for the ALooper_pollAll call.

This fixes that, and adds a ALooper_wake when a non-system event is injectet.

Change handle_system_events_ from bool to atomic_bool to make it thread safe. Replace deprecated ALooper_pollAll with the suggested ALooper_pollOnce (*1) to avoid swallowing of ALooper_wake calls.

Left the kMaxPollingTimeMillisecond workaround for swallowed wake calls in place, but increased the timeout to one second to minimize CPU usage.

*1: https://developer.android.com/ndk/reference/group/looper#group___looper_1gab2585652f8ae2e2444979194ebe32aaf

b/335901937

An integer overflow in a downconversion resulted in a negative timeout
being used for the ALooper_pollAll call.

This fixes that, and adds a ALooper_wake when a non-system event is
injectet.

b/335901937

(cherry picked from commit ed27e83)
@cobalt-github-releaser-bot
Copy link
Collaborator Author

Important

There were merge conflicts while cherry picking! Check out cherry-pick-24.lts.1+-3027 and fix the conflicts before proceeding. Check the log at https://github.com/youtube/cobalt/actions/runs/8789760282 for details.

@jellefoks jellefoks marked this pull request as ready for review April 22, 2024 19:40
@gbournou gbournou merged commit b8d3a02 into 24.lts.1+ Apr 22, 2024
433 checks passed
@gbournou gbournou deleted the cherry-pick-24.lts.1+-3027 branch April 22, 2024 23:12
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.

3 participants