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

Discussion: lifetime of compositor vs. constellation, and potential compositor refactoring #23179

Open
paulrouget opened this issue Apr 8, 2019 · 4 comments
Labels
A-constellation Involves the constellation A-gfx/compositing B-meta This issue tracks the status of multiple, related pieces of work

Comments

@paulrouget
Copy link
Contributor

A compositor is a lot of things at once:

  • it holds the embedder's window object which provides all the info about graphical information (gl methods, window size, etc)
  • it runs (in) the "main" thread
  • it holds one instance of WebRender
  • it holds one WR document and "root" pipeline
  • it composites WR output into the gl window (or images)
  • it dispatches touch/mouse/scroll/zoom events to the right pipeline
  • it handles animation states
  • it is created at the same time as the constellation, and it shuts down after the constellation.

This set of responsibilities and behavior are not compatible with 3 features we need:

  • support for 0 windows

On Mac, Android and Firefox Reality, we can end up in situations where the native window doesn't exist anymore.
We want to be able to close a window and keep Servo alive (the constellation, probably not the pipelines for now).

  • support for multi windows

We want to be able to have more that one window. As of now, one compositor = one window.
#13993

  • support for multiple root pipeline per window

We want to be able to draw multiple top level document on window without having to use an iframe.
Think "chrome document" vs. "content document" for example. As of now, a compositor only has one
top level root pipeline.
#20335 (comment)

Proposed changes:

We should start by making the compositor optional, be able to shut it down, and create a new one. The constellation should be able to outlive the compositor.
Then we need to make it possible to hold multiple compositors.
And finally introduce a sub structure inside a compositor that I call "Area" which basically holds a WR document. A compositor could have multiple areas.

  • The constellation will have 0 or multiple compositors.
  • The constellation will outlive compositors.
  • A compositor will have multiple areas, one renderer, do the composition and handle animation states.
  • An area will have its own zoom/scroll/touch states and its own top level pipeline.

I'm starting by making the compositor optional. This involves quite a lot of refactoring and also changes the lifetime of the compositor and the constellation.
So before jumping too deep, I'd like to get some feedback on this proposal.

@paulrouget
Copy link
Contributor Author

/cc @asajeffrey

@asajeffrey
Copy link
Member

So the idea is that on devices which support multiple windows, there'd be one compositor per window? If we have tabs, there'll be multiple top-level browsing contexts per compositor?

@paulrouget
Copy link
Contributor Author

So the idea is that on devices which support multiple windows, there'd be one compositor per window?

Yes.

If we have tabs, there'll be multiple top-level browsing contexts per compositor?

That's already the case, but only one visible at a time.

But what we can't do as of now is having multiple visible top-level browsing contexts . For example, the HTML content and a HTML sidebar, or HTML content and a chrome UI in HTML.

@jdm
Copy link
Member

jdm commented Apr 10, 2019

This design sounds reasonable to me. It may even make it easier to experiment with some kind of remote compositing for low-powered VR devices where we run the rest of Servo in the cloud.

@jdm jdm added B-meta This issue tracks the status of multiple, related pieces of work A-constellation Involves the constellation A-gfx/compositing labels Apr 10, 2019
@delan delan mentioned this issue Oct 26, 2023
39 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-constellation Involves the constellation A-gfx/compositing B-meta This issue tracks the status of multiple, related pieces of work
Projects
None yet
Development

No branches or pull requests

3 participants