-
Notifications
You must be signed in to change notification settings - Fork 61
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
core, wl, headless: New virtual functions in CogPlatform to track live viewport instances #683
Conversation
6af7c01
to
908740f
Compare
Add a pair of new CogPlatform::viewport-{created,disposed} signals, available also as virtual functions. The main intended usage is tracking live CogViewport instances inside platform plug-in implementations.
Support more than one view. This is achieved by opting-in to use the new CogView.create_backend vfunc, which makes each web view responsible for creating its own WPE view backend. The platform keeps track of viewports using CogPlatform.viewport_{created,disposed}, and on each frame timer tick all views in from all viewports are checked for dispatching frame acknowledgements.
Use the new CogPlatform.viewport_{created,disposed} vfuncs to track live CogViewport instances, instead of relying on CogShell. This removes all the usage of the shell instance in the Wayland platform, paving the way to uncouple CogShell from CogPlatform.
908740f
to
209676e
Compare
wpe_fdo_initialize_for_egl_display(display->egl_display); | ||
|
||
/* get a reference to the hashmap with viewports added to the shell */ | ||
self->viewports = cog_shell_get_viewports(shell); |
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.
The platform will use the new signals to track the Viewports by its own in the Platform::viewports. That is good.
What happens with the CogShell? it is still having its own list of Viewports accesible through cog_shell_get_viewports()
?. Isn't redundant?
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.
Yes, it is redundant to have cog_shell_get_viewports()
and I plan to revamp CogShell
in follow-up PRs. I focused in this one to only avoid using the shell to track viewports inside platform plug-ins.
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.
Actually, scratch that, I will be adding one more commit here removing all the viewport handling from CogShell
.
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.
OK. good. Go ahead. Nice if we have all this done in the same PR.
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 spent a bit of time removing from CogShell
all the code related to view and viewport handling, and it's bigger than expected. For my current WIP patch I have:
5 files changed, 129 insertions(+), 413 deletions(-)
Now that is a nice amount of code removed, and there are opportunities to clean up things even more. Therefore I have changed my opinion again: let's merge this PR as-is, and leave the cleanups for follow-up PRs, to make them easier to review. WDYT @psaavedra?
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.
Yes. My feeling was the change was not so big so it makes sense to do it in 2 steps.
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.
R+
Remove handling of viewports and vies from CogShell. Tracking live viewports can be done using CogPlatform since #683 and platform plug-ins no longer depend on CogShell for that. The following are no longer needed in CogShell: - The :web-view and :viewport properties, and their accessors. - The ::create-view and ::create-viewport signals. - The .create_view() virtual function and its default implementation. - The cog_shell_add_viewport(), cog_shell_remove_viewport(), cog_shell_get_n_viewports(), and cog_shell_get_nth_viewport() methods. As a side effect of the above removals, the examples have been changed to have them create their views using cog_view_new() instead of relying on the default implementation of the CogShell.create_view() virtual function. The launcher also needed a number of changes, which now manages itself a viewport as it cannot rely on the shell for that. Some code was moved around to accommodate creation of the view in cog_launcher_startup() without relying on the CogShell::create-view signal, and similarly for web view creation when running in automation mode. There are more opportunities for further simplifications that would be better done in separate patches: this one focuses on the minimum amount of changes needed to get view and viewport handling out of CogShell.
Remove handling of viewports and views from CogShell. Tracking live viewports can be done using CogPlatform since #683 and platform plug-ins no longer depend on CogShell for that. The following are no longer needed in CogShell: - The :web-view and :viewport properties, and their accessors. - The ::create-view and ::create-viewport signals. - The .create_view() virtual function and its default implementation. - The cog_shell_add_viewport(), cog_shell_remove_viewport(), cog_shell_get_n_viewports(), and cog_shell_get_nth_viewport() methods. As a side effect of the above removals, the examples have been changed to have them create their views using cog_view_new() instead of relying on the default implementation of the CogShell.create_view() virtual function. The launcher also needed a number of changes, which now manages itself a viewport as it cannot rely on the shell for that. Some code was moved around to accommodate creation of the view in cog_launcher_startup() without relying on the CogShell::create-view signal, and similarly for web view creation when running in automation mode. There are more opportunities for further simplifications that would be better done in separate patches: this one focuses on the minimum amount of changes needed to get view and viewport handling out of CogShell.
Remove handling of viewports and views from CogShell. Tracking live viewports can be done using CogPlatform since #683 and platform plug-ins no longer depend on CogShell for that. The following are no longer needed in CogShell: - The :web-view and :viewport properties, and their accessors. - The ::create-view and ::create-viewport signals. - The .create_view() virtual function and its default implementation. - The cog_shell_add_viewport(), cog_shell_remove_viewport(), cog_shell_get_n_viewports(), and cog_shell_get_nth_viewport() methods. As a side effect of the above removals, the examples have been changed to have them create their views using cog_view_new() instead of relying on the default implementation of the CogShell.create_view() virtual function. The launcher also needed a number of changes, which now manages itself a viewport as it cannot rely on the shell for that. Some code was moved around to accommodate creation of the view in cog_launcher_startup() without relying on the CogShell::create-view signal, and similarly for web view creation when running in automation mode. There are more opportunities for further simplifications that would be better done in separate patches: this one focuses on the minimum amount of changes needed to get view and viewport handling out of CogShell.
Remove handling of viewports and views from CogShell. Tracking live viewports can be done using CogPlatform since #683 and platform plug-ins no longer depend on CogShell for that. The following are no longer needed in CogShell: - The :web-view and :viewport properties, and their accessors. - The ::create-view and ::create-viewport signals. - The .create_view() virtual function and its default implementation. - The cog_shell_add_viewport(), cog_shell_remove_viewport(), cog_shell_get_n_viewports(), and cog_shell_get_nth_viewport() methods. As a side effect of the above removals, the examples have been changed to have them create their views using cog_view_new() instead of relying on the default implementation of the CogShell.create_view() virtual function. The launcher also needed a number of changes, which now manages itself a viewport as it cannot rely on the shell for that. Some code was moved around to accommodate creation of the view in cog_launcher_startup() without relying on the CogShell::create-view signal, and similarly for web view creation when running in automation mode. There are more opportunities for further simplifications that would be better done in separate patches: this one focuses on the minimum amount of changes needed to get view and viewport handling out of CogShell.
Remove handling of viewports and views from CogShell. Tracking live viewports can be done using CogPlatform since #683 and platform plug-ins no longer depend on CogShell for that. The following are no longer needed in CogShell: - The :web-view and :viewport properties, and their accessors. - The ::create-view and ::create-viewport signals. - The .create_view() virtual function and its default implementation. - The cog_shell_add_viewport(), cog_shell_remove_viewport(), cog_shell_get_n_viewports(), and cog_shell_get_nth_viewport() methods. As a side effect of the above removals, the examples have been changed to have them create their views using cog_view_new() instead of relying on the default implementation of the CogShell.create_view() virtual function. The launcher also needed a number of changes, which now manages itself a viewport as it cannot rely on the shell for that. Some code was moved around to accommodate creation of the view in cog_launcher_startup() without relying on the CogShell::create-view signal, and similarly for web view creation when running in automation mode. There are more opportunities for further simplifications that would be better done in separate patches: this one focuses on the minimum amount of changes needed to get view and viewport handling out of CogShell.
Remove handling of viewports and views from CogShell. Tracking live viewports can be done using CogPlatform since Igalia#683 and platform plug-ins no longer depend on CogShell for that. The following are no longer needed in CogShell: - The :web-view and :viewport properties, and their accessors. - The ::create-view and ::create-viewport signals. - The .create_view() virtual function and its default implementation. - The cog_shell_add_viewport(), cog_shell_remove_viewport(), cog_shell_get_n_viewports(), and cog_shell_get_nth_viewport() methods. As a side effect of the above removals, the examples have been changed to have them create their views using cog_view_new() instead of relying on the default implementation of the CogShell.create_view() virtual function. The launcher also needed a number of changes, which now manages itself a viewport as it cannot rely on the shell for that. Some code was moved around to accommodate creation of the view in cog_launcher_startup() without relying on the CogShell::create-view signal, and similarly for web view creation when running in automation mode. There are more opportunities for further simplifications that would be better done in separate patches: this one focuses on the minimum amount of changes needed to get view and viewport handling out of CogShell.
Platform implementations may need (or want) to track all the
CogViewport
instances in use. Until now this was done by fetching the list of viewports fromCogShell
, but that assumed that a.) there is always a shell instantiated, and b.) there will ever be only one viewport. It is already possible today to use multiple viewports (seeexamples/viewports.c
) so the latter does not hold true. We want to also avoid using the shell from platform implementations so what this PR does is:CogPlatform.viewport_created
andCogPlatform.viewport_disposed
, and corresponding signalsCogPlatform::viewport-created
andCogPlatform::viewport-disposed
. These are triggered fromCogViewport
during creation and disposal using private functions.CogShell
.After this, the uses that remain of the shell in platform implementations are related to their configuration. Those uses will be addressed in a separa patch set.
This is part of the work towards decoupling
CogShell
fromCogPlatform
, as per #634.