-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Cleanup Android input on render thread settings #94052
Cleanup Android input on render thread settings #94052
Conversation
Looks great. I also totally agree with merging the concepts of input buffering and agile flushing since they always work in tandem and that makes things simpler. My only remaining concern is regarding accumulated input. I think whether it's enabled or nor shouldn't contribute to deciding which thread to send events through. Accumulation works regardless agile flushing is enabled or not since it will use the input buffer regardless. In case agile flushing is enabled, well, it will have fewer chances of merging events, but between flushes it will still accumulate as events come. |
@RandomShaper I am not sure I understand the concern, can you clarify. |
18ea76e
to
0d36a4f
Compare
My point is that sending via the render thread should happen if, and only if, agile input is disabled. Whether accumulation is enabled or not is unrelated. Accumulation just means that events are not parsed directly but added to a buffer and new events can be merged with the last one in the buffer. That works the same regardless which thread sends the events. The only difference is that if agile flushing is enabled (events sent from UI thread), there will be multiple flush points per frame, and if agile is disabled (events from render thread) there will be a single flush. |
0d36a4f
to
c8c6d84
Compare
Make sense! I've updated the criteria for dispatching on the render thread to only depend on the state of agile input. |
Thinking about it some more, I want to make sure we're all aligned on the new proposed behavior as it'll change the default input dispatch thread.. The previous criteria for dispatching input events from the UI thread was:
This meant that both The new criteria for dispatching input events from the UI thread is:
If true, we dispatch from the UI thread, otherwise we dispatch from the render thread. The change in behavior is that previously, the default configuration ( The concern here being that I'm leery of changing the default behavior, especially for users that are not seeing an issue with the default configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me, but I'll wait for RandomShaper to give it a second look too.
My notion is that before #93933 input events on Android were delivered via the UI thread uncontionally (moreover, regardless accumulation being enabled or not). Input buffering was enabled at startup regardless any setting:
And then, for instance, when user triggered an input event, this code path woud be followed:
All that happens within the UI thread. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you've changed the condition to use the render thread already. That matches my current best judgement of the situation. I hope my analysis helps bringing us to the same page.
Follow up to godotengine#93933 Clean up the set of settings use to control whether Android input should be dispatched on the render thread. Addresses comments in godotengine#93933 (comment)
c8c6d84
to
5e59819
Compare
Yeah I agree, my comment was that now the default will be to use the render thread. If we are okay with that then I'm good to go. Also should we have agile input flushing enabled by default? |
That's a good question. I don't have a strong opinion. If anything, given that it's only implemented on Android, it may be better to have it as opt-in per the least astonishment principle. In the future we should have the same thread split and so agile flushing will be available everywhere. If we ever reach that point, having it as a default would make more sense. But, again, I'm not a big proponent of either way. |
Working on one additional set of changes to help limit the creation of |
On second thought, I'll do the memory optimizations in a separate PR, so this PR is good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm this fixes #94132.
Thanks! |
Follow up to #93933
Clean up the set of settings used to control whether Android input should be dispatched on the render thread.
Addresses comments in #93933 (comment) and #93933 (comment)
Fixes #94132
Fixes #94202