Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@luckysmg
Copy link
Contributor

@luckysmg luckysmg commented Apr 17, 2023

In Triage

Will add test and modify comments and code if this patch looks reasonable.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@luckysmg
Copy link
Contributor Author

luckysmg commented Apr 17, 2023

@cyanglaz Re: #41201 (comment)

From the debugging this change does help with reducing jitter in keyboard animation. But I m not very sure current patch is correct and match the thought you mentioned in comment. Would you mind giving me some advice? ^_^


flutter::Shell& shell = [_engine.get() shell];
fml::closure onFrameRasterizedCallback = [&shell, platformTask] {
shell.GetTaskRunners().GetPlatformTaskRunner()->PostTask(platformTask);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this also needs to be synchronized. The rasterizer needs to wait until the platform task to finish before starting next frame.

fml::closure onFrameRasterizedCallback = [&shell, platformTask] {
shell.GetTaskRunners().GetPlatformTaskRunner()->PostTask(platformTask);
};
shell.AddOnFrameRasterizedCallback(onFrameRasterizedCallback);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think add the callback here might be a frame late?
What I was thinking was the callback will be some sort of delegate method and runs every frame. The delegate then decide if the method body is a no-op (when there is no keyboard animation), or synchronously runs the keyboard animation on platform thread.

@luckysmg
Copy link
Contributor Author

I made a patch to add callback in Shell (Still have some issues but can test at least)

RPReplay_Final1681806613.MP4

Seems has some delay with system's keyboard. Maybe we should still use vsync to track value so that we can get the correct presentation time by adding one frame interval time.

As for #41201
I think it is safe just keep the delay less than one vsync time. Maybe Just < 8ms on 120HZ devices is ok.... Just keep the task run after the vsync process callback and before the next vsync callback...

@delfme
Copy link

delfme commented May 6, 2023

Was the master updated meantime the fix is landed? Asking coz I updated to latest master and now keyboard has a bit different behaviour. I now see a delay (instead of the previous instant bump to end of run). Random jitters issue remained the same. Tested on iphone 13 pro ios 16.3.1

IMG_8947.MOV

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants