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

Vsync support for Wayland #68

Closed
jwinarske opened this issue Apr 13, 2021 · 11 comments · Fixed by #140
Closed

Vsync support for Wayland #68

jwinarske opened this issue Apr 13, 2021 · 11 comments · Fixed by #140
Assignees
Labels
wayland Topics of Wayland

Comments

@jwinarske
Copy link

vsync is missing

@HidenoriMatsubayashi
Copy link
Contributor

Thank you. Actually, I don't understand what to use FlutterEngineOnVsync for. Could you tell me the purpose of it?

@guangoon
Copy link

VSync can be understood as a timed interrupt. The system will send a VSync signal every time it can proceed, and the CPU/GPU will immediately process the rendering after receiving the signal. Therefore, in Flutter, when rendering is needed, we need to monitor the VSync signal, and when a VSync signal is generated, we can start GPU rendering. and if we don't set VsyncCallback in embedder, engine will set a default VsyncCallback which is 60 fps.

@HidenoriMatsubayashi
Copy link
Contributor

HidenoriMatsubayashi commented Apr 14, 2021

Thank you. That's quite understandable. What should this embedder do is to prepare the API so that the user program or plugins can receive Vsync, right?

@guangoon
Copy link

FlutterProjectArgs args = {};
args.vsync_callback =
you should implement this callback,
When this callback is triggered, you need request vsync signal,
when receive vsync signal callback, you need call FlutterEngineOnVsync.

@HidenoriMatsubayashi
Copy link
Contributor

Thanks. I'll implement vsync.

@HidenoriMatsubayashi HidenoriMatsubayashi self-assigned this Apr 14, 2021
@HidenoriMatsubayashi
Copy link
Contributor

By the way, is there any good way to detect Vsync on Linux platforms? I couldn't find it.

@jwinarske
Copy link
Author

jwinarske commented Apr 14, 2021 via email

@HidenoriMatsubayashi
Copy link
Contributor

Thanks!

@HidenoriMatsubayashi HidenoriMatsubayashi added drm Topics of DRM backend wayland Topics of Wayland x11 Topics of X11 backend labels Apr 14, 2021
@jwinarske
Copy link
Author

For DRM this is a good reference:
https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset-vsync.c

@HidenoriMatsubayashi
Copy link
Contributor

HidenoriMatsubayashi commented Apr 16, 2021

In terms of Wayland backend, I think wp_presentation is better than wl_callback_listener. We can also get a refresh rate by using it. However, we don't call wl_surface_commit because of using eglSwapBuffers which is called from Flutter Engine. So, wp_presentation events don't happen continuously every frame.

@HidenoriMatsubayashi HidenoriMatsubayashi added this to To do in Wayland support via automation May 24, 2021
@HidenoriMatsubayashi HidenoriMatsubayashi changed the title vsync Vsync support for Wayland May 24, 2021
@HidenoriMatsubayashi HidenoriMatsubayashi removed drm Topics of DRM backend x11 Topics of X11 backend labels May 24, 2021
This was referenced May 24, 2021
@HidenoriMatsubayashi
Copy link
Contributor

I'm implementing to add vsync support for Wayland, but I separed this issue into x11, drm, and wayland respectively.

@HidenoriMatsubayashi HidenoriMatsubayashi moved this from To do to In progress in Wayland support May 24, 2021
Wayland support automation moved this from In progress to Done May 26, 2021
HidenoriMatsubayashi pushed a commit that referenced this issue May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wayland Topics of Wayland
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants