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

Webrender as native toolkit for wayland #3891

Open
coderkalyan opened this issue Mar 23, 2020 · 8 comments
Open

Webrender as native toolkit for wayland #3891

coderkalyan opened this issue Mar 23, 2020 · 8 comments

Comments

@coderkalyan
Copy link

Hey guys, since webrender is efficient, GPU accelerated, and flexible, I was wondering if it would be possible for me to use it as a native toolkit for wayland? 1) I'm thinking something like electron, except only as a UI toolkit, no JS - just native application code. 2) I would like to be able to use it natively with wayland if possible, instead of resorting to an xwayland layer. For wayland, basically webrender needs to be able to connect to an EGL layer and render to that.

Is using it as a native toolkit and/or with wayland possible? Advice is appreciated!

@jrmuizel
Copy link
Collaborator

It's definitely possible to WebRender on Wayland as WebRender will just use any GL context that you give. (Firefox happily uses WebRender on Wayland)

However, WebRender alone is insufficient to act as toolkit. It basically just does drawing. If you want a toolkit based on WebRender I'd recommend looking at https://github.com/maps4print/azul/ or https://github.com/tiffany352/moxie-native

@coderkalyan
Copy link
Author

Thanks @jrmuizel I'll take a look into those toolkits as a reference! How do I initialize/connect webrender on wayland? Any specific code/environment/boilerplate?

@coderkalyan
Copy link
Author

Also, what would be the memory footprint of using webrender as a toolkit, as compared to something like GTK? One issue I had with electron is its memory consumption, but i assumed that was mostly due to the V8 JS runtime.

@jrmuizel
Copy link
Collaborator

Like I said earlier, there's no windowing system specific code in WebRender. You can take a look at https://github.com/servo/webrender/blob/master/examples/basic.rs for a simple example.

It doesn't really make sense to compare memory consumption of WebRender to GTK as GTK is a full toolkit and memory usage will depend heavily on the particular usage.

@coderkalyan
Copy link
Author

@jrmuizel Oh, okay! Sorry, got a bit confused. What I'm actually looking for is some way to write a UI toolkit which can be expressed in terms of an HTML DOM and CSS stylesheet(s), like electron does. I would like to use servo's webrender, pathfinder, html5ever, and css engine to do so... any suggestions? Does servo abstract a module where I could tap into the entire rendering pipeline without touching the javascript stuff or browser-specific stuff?

@jdm
Copy link
Member

jdm commented Mar 23, 2020

Servo does not expose that. It's an idea that has been discussed before in issues like servo/servo#3646 and servo/servo#7379 but it is not a focus of the Servo project for the foreseeable future.

@coderkalyan
Copy link
Author

@jdm thanks for the clarification! How much work do you think it would be for me to implement my own "glue" code using the individual rendering crates under servo?

@jdm
Copy link
Member

jdm commented Mar 24, 2020

Lots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants