Over the past 2 months my fellow Igalian Frédéric Wang and I have been working on improving the Wayland support in Chromium. I will be detailing on this post some of the progresses we’ve made and what our next steps are.
The more Wayland evolved as a mature alternative to the traditional X11-based environments, the more the Chromium community realized efforts were needed to run Chrome natively and flawlessly on such environments. On that context, the Ozone project began back in 2013 with the main goal of making porting Chrome to different graphics systems easier.
Ozone consists in a set of C++ classes for abstracting different window systems on Linux. It provides abstraction for the construction of accelerated surfaces underlying Aura UI framework, input devices assignment and event handling.
Yet in 2013, Intel presented an Ozone/Wayland backend to the Chromium community. Although project progressed really well, after some time of active development, it got stalled: its most recent update is compatible with Chromium m49, from December/2015.
Leaping forward to 2016, a Wayland backend was added to Chromium upstream by Michael Forney. The implementation is not as feature complete as Intel’s (for example, drag n’ drop support is not implemented, and it only works with specific build configurations of Chrome), but it is definitively a good starting point.
In July, I experimented a bit this existing Wayland backend in Chromium. In summary, I took the existing wayland support upstream, and “ported” the minimal patches from Intel’s 01.org repository, being able to get ContentShell running with Wayland. However, given how the Wayland backend in Chromium upstream is designed and implemented, the GPU process failed to start, and HW rendering path was not functional.
Communication with Google
Our main goal was to make Chrome capable of running natively on a Wayland-based environment, with hardware accelerated rendering enabled through the GPU process. After the investigation phase, the natural follow up step for us at Igalia was to contact Chrome hackers at Google, share our plans to Chromium/Wayland, and gather feedback. We reached out to @forney and @rjkroege, and once we heard back, we could understand why “porting” the missing bits from Intel’s original Ozone/Wayland implementation could not be the best choice on the long run.
Basically, the Ozone/Wayland backend present in Chromium upstream is designed in accordance to the original Mus+Ash Project’s architecture: the UI and GPU components would live in the same process. This way, the Wayland connection and other objects, that belong to the UI component, would be accessible to the GPU component and accelerated HW rendering could be implemented without any IPC.
This differs from Intel’s original implementation, where the GPU process owns the Wayland connections and objects, and the legacy Chromium IPC system is used to pass Wayland data from the GPU process to the Browser process.
It was also pointed to us that eventually the UI and GPU components will be split into different processes. At that point, the same approach as the one done for the DRM/GBM Ozone backend was advised in order to implement communication between UI and GPU components.
Given that “ash” is a ChromeOS-oriented UI component, it seems logical to say that “mus+ash” project’s primarily focus is on the ChromeOS platform. Well, with that in mind, we thought we just needed to: (1) make a ChromeOS/Ozone/Wayland build of Chrome; (2) run ‘chrome –mash –ozone-platform=wayland’; (c) voilà, all should work.
When Fred and I started on this project two months ago, the situation was:
- Chrome/Ozone/Wayland configuration was only build-able on ChromeOS and failed to run by default.
- The Ozone project documentation was out of date (e.g. it referred to GYP and the obsolete Intel Ozone/Wayland code)
- The Wayland code path was not tested by any buildbots, and could break without being noticed at this time.
After various code clean-ups and build fixes, we could finally launch Chrome off of a ChromeOS/Mash/Ozone/X11 build.
With further investigation, we verified that ChromeOS/Mash/Ozone/Wayland worked in m52 (when hardware accelerated rendering support was added to the Wayland backend), m53 and m54 checkouts, but not in m55. We bisected commits between m54 and m55, identified the regressions, and fixed them in issues 2387063002 and 2389053003. Finally, chrome –mash –ozone-platform=wayland was running with hardware accelerated rendering enabled on “off-device” ChromeOS builds.
Linux desktop builds
Our next goal at this point of the collaboration was to make it possible to build and run chrome –mash off of a regular Linux desktop build, through Ozone/Wayland backend.
After discussing about it on the ozone-dev mailing, we submitted and upstreamed various patches, converging to a point where a preliminary version of Chrome/mash/Ozone/Wayland was functional on a non-chromeos build, as shown below.
Note that this version of Chrome is stated above as “preliminary” because although it launches off of a regular desktop Linux build, it still runs with UI components from the ChromeOS UI environment, including a yellow bottom tray, and other items part of the so called “ash” Desktop environment.
Improving developers’ ecosystem
As mentioned, when we started on this collaboration, the Ozone project featured an out of date documentation, compilation and execution failures, and was mostly not integrated to Chromium’s continuous testing system (buildbots, etc). However, given that Ozone is the abstraction layer we would work on in order to get a Wayland backend up and running for Chrome, we found it sensible to improve this scenario.
By making use of Igalia’s community work excellence, many accomplishments were made
on this front, and now Ozone documentation is up-to-date.
Also, after having fixed Ozone/Wayland recurring build and execution failures, Fred and I realized the Ozone/Wayland codepath in Chromium needed to be exercised by a buildbot, so that its maintenance burden is reduced. Fred emailed ozone-dev about it and we started contributing to it, together with the Googler thomasanderson@. As a result, Ozone/Wayland backend was made part of Chromium’s continuous integration testing system.
Also, Fred made a great post about the current Ozone/Wayland code in Chromium, its main classes and some experimentation done about adding Mojo capability to it. I consider it is a must-read follow on on this post.
Today chrome —mash launches within an “ash” window, where the “ash” environment works as a shell for child internal windows, being Chrome one of them.
Being “mash” a shortener for “mus+ash”, our next step is to “eliminate”
the “ash” aspects from the execution path, resulting on a “Chrome Mus” launch.
This project is sponsored by Renesas Electronics …
… and has been performed by the great Igalian hacker Frédéric Wang and I on behalf of Igalia.
17 thoughts on “Chromium, ozone, wayland and beyond”
Need more and new articles !!
They are coming..!
What is the state of Wayland support in Chromium when it comes to “desktop features” like DND, touch gestures like pinch etc?
How long do you think it will be until Linux distributions can start shipping with Wayland support by default?
I believe we are not yet too close to the point where distros can start to ship chromium/wayland.
For Q1 we (Igalia) are planning to have the bases working, following up with Q2 to get it in feature parity with chromoum/x11 (dnd, et al). There will is lots of work ongoing about performance, etc.
Martin, Igalia will be working at making Chrome/Wayland paired up in terms of functionality to stock Chrome/x11 over H2, as planed. We have the basis working, an good overall understanding of the missing bits: https://github.com/Igalia/chromium/tree/ozone-wayland-dev
OK, thank you for answering. Was mainly wondering since work seemed to have stalled in Chromium’s git repo. Searched a bit and found this post.
Keep up the great work! 🙂
Hi Martin. Actually, the work is really at full speed. I posted an status update in https://blogs.igalia.com/tonikitoo/2017/05/17/chromium-musozone-update-h12017-wayland-x11/.
Hi, first of all thank you very much for your work. I believe that having another commonly used browser(Firefox already has GTK3 port) will be a major step forward for Wayland. Do you plan to offer some nightly builds of Chrome/Chromium compiled for wayland? I want to test it but I don’t want to compile it from source.
Have nightly builds would definitively be great! I will put it in our backlog.
We plan to fix some more stuff in order to offer users a real desktop experience with Chromium/Wayland, and see how to offer pre-built Linux x86-64 binaries. Stay tuned.
What’s the best place to get a good high-level view of the progress. It’s now end part of Q2 and the above comment ends there. Is there any milestone map with missing features listed?
Good question, Seppo. I hope https://blogs.igalia.com/tonikitoo/2017/05/17/chromium-musozone-update-h12017-wayland-x11/ answers it :).
How to get the latest chromium-wayland source for yocto where GPU hardware rendering is working.
Hi karthik. I have posted an status update on https://blogs.igalia.com/tonikitoo/2017/05/17/chromium-musozone-update-h12017-wayland-x11/ , which brings in lots of good news, including a Chromium baseline as of May/15.
As for the yocto recipe, our next step will be to update our https://github.com/Igalia/meta-browser fork with the latest Chromium source. I will blog about it in the coming days.