Ozone is a platform abstraction layer beneath the Aura window system that is used for low level input and graphics. Once complete, the abstraction will support underlying systems ranging from embedded SoC targets to new X11-alternative window systems on Linux such as Wayland or Mir to bring up Aura Chromium by providing an implementation of the platform interface.
Our goal is to enable chromium to be used in a wide variety of projects by making porting to new platforms easy. To support this goal, ozone follows the following principles:
--ozone-platform) if multiple are enabled. Each platform has a unique build define (e.g.
ozone_platform_foo) that can be turned on or off independently.
Ozone moves platform-specific code behind the following interfaces:
PlatformWindowrepresents a window in the windowing system underlying chrome. Interaction with the windowing system (resize, maximize, close, etc) as well as dispatch of input events happens via this interface. Under aura, a
PlatformWindowcorresponds to a
WindowTreeHost. Under mojo, it corresponds to a
NativeViewport. On bare hardware, the underlying windowing system is very simple and a platform window corresponds to a physical display.
SurfaceFactoryOzoneis used to create surfaces for the Chrome compositor to paint on using EGL/GLES2 or Skia.
GpuPlatformSupportHostprovides the platform code access to IPC between the browser & GPU processes. Some platforms need this to provide additional services in the GPU process such as display configuration.
CursorFactoryOzoneis used to load & set platform cursors.
OverlayManagerOzoneis used to manage overlays.
InputControllerallows to control input devices such as keyboard, mouse or touchpad.
SystemInputInjectorconverts input into events and injects them to the Ozone platform.
NativeDisplayDelegateis used to support display configuration & hotplug.
PlatformScreenis used to fetch screen configuration.
ClipboardDelegateprovides an interface to exchange data with other applications on the host system using a system clipboard mechanism.
Our implementation of Ozone required changes concentrated in these areas:
USE_X11ifdef, and adding a new
USE_OZONEpath that works in a relatively platform-neutral way by delegating to the interfaces described above.
WindowTreeHostOzoneto send events into Aura and participate in display management on the host system, and
GLSurfaceEGLwhich delegates allocation of accelerated surfaces and refresh syncing to the provided implementation of
Users of the Ozone abstraction need to do the following, at minimum:
PlatformWindow. This class (I'll call it
PlatformWindowImpl) is responsible for window system integration. It can use
MessagePumpLibeventto poll for events from file descriptors and then invoke
PlatformWindowDelegate::DispatchEventto dispatch each event.
SurfaceFactoryOzonethat handles allocating accelerated surfaces. I'll call this
CursorFactoryOzoneto manage cursors, or use the
BitmapCursorFactoryOzoneimplementation if only bitmap cursors need to be supported.
OverlayManagerOzoneor just use
StubOverlayManagerif your platform does not support overlays.
NativeDisplayDelegateif necessary or just use
FakeDisplayDelegate, and write a subclass of
PlatformScreen, which is used by aura::ScreenOzone then.
GpuPlatformSupportHostor just use
InputControlleror just use
OzonePlatformthat owns instances of the above subclasses and provide a static constructor function for these objects. This constructor will be called when your platform is selected and the returned objects will be used to provide implementations of all the ozone platform interfaces. If your platform does not need some of the interfaces then you can just return a
Stub*instance or a
The recommended way to add your platform to the build is as follows. This walks through creating a new ozone platform called
ui/ozone/platform/alongside internal platforms.
ui/ozone/ozone_extra.gnito add your
chrome, do this from the
gn args out/OzoneChromeOS --args="use_ozone=true target_os=\"chromeos\"" ninja -C out/OzoneChromeOS chrome
Then to run for example the X11 platform:
Warning: Only some targets such as
content_shell or unit tests are currently working for embedded builds.
content_shell, do this from the
gn args out/OzoneEmbedded --args="use_ozone=true toolkit_views=false" ninja -C out/OzoneEmbedded content_shell
Then to run for example the headless platform:
./out/OzoneEmbedded/content_shell --ozone-platform=headless \ --ozone-dump-file=/tmp/
Warning: Experimental support for Linux Desktop is available since m57 and still under development. The work is purely done in the upstream, but you can still find some Ozone/X11 patches in the the old ozone-wayland-dev branch.
chrome, do this from the
gn args out/OzoneLinuxDesktop --args="use_ozone=true use_system_minigbm=true use_system_libdrm=true" ninja -C out/OzoneLinuxDesktop chrome
Then to run for example the X11 platform:
Or run for example the Wayland platform:
You can turn properly implemented ozone platforms on and off by setting the corresponding flags in your GN configuration. For example
ozone_platform_headless=false ozone_platform_gbm=false will turn off the headless and DRM/GBM platforms. This will result in a smaller binary and faster builds. To turn ALL platforms off by default, set
You can also specify a default platform to run by setting the
ozone_platform build parameter. For example
ozone_platform="x11" will make X11 the default platform when
--ozone-platform is not passed to the program. If
ozone_auto_platforms is true then
ozone_platform is set to
headless by default.
Specify the platform you want to use at runtime using the
--ozone-platform flag. For example, to run
content_shell with the GBM platform:
content_shellalways runs at 800x600 resolution.
This platform draws graphical output to a PNG image (no GPU support; software rendering only) and will not output to the screen. You can set the path of the directory where to output the images by specifying
--ozone-dump-file=/path/to/output-directory on the command line:
content_shell --ozone-platform=headless \ --ozone-dump-file=/tmp/
This is Linux direct rending with acceleration via mesa GBM & linux DRM/KMS (EGL/GLES2 accelerated rendering & modesetting in GPU process) and is in production use on Chrome OS.
Note that all Chrome OS builds of Chrome will compile and attempt to use this. See Building Chromium for Chromium OS for build instructions.
This platform is used for Chromecast.
This platform provides support for the X window system.
This platform provides support for the Wayland display protocol. It was initially developed by Intel as a fork of chromium and then partially upstreamed. It is still actively being developed by Igalia both on the ozone-wayland-dev branch and the Chromium mainline repository, feel free to discuss with us on freenode.net,
#ozone-wayland channel or on
Below are some quick build & run instructions. It is assumed that you are launching
chrome from a Wayland environment such as
weston. Execute the following commands (make sure a system version of gbm and drm is used, which are required by Ozone/Wayland by design, when running on Linux platforms.):
gn args out/OzoneWayland --args="use_ozone=true use_system_minigbm=true use_system_libdrm=true" ninja -C out/OzoneWayland chrome ./out/OzoneWayland/chrome --ozone-platform=wayland
This platform draws graphical output to text using libcaca (no GPU support; software rendering only). In case you ever wanted to test embedded content shell on tty. It has been removed from the tree and is no longer maintained but you can build it as an out-of-tree port.
Alternatively, you can try the latest revision known to work. First, install libcaca shared library and development files. Next, move to the git revision
0e64be9cf335ee3bea7c989702c5a9a0934af037 (you will probably need to synchronize the build dependencies with
gclient sync --with_branch_heads). Finally, build and run the caca platform with the following commands:
gn args out/OzoneCaca \ --args="use_ozone=true ozone_platform_caca=true use_sysroot=false ozone_auto_platforms=false toolkit_views=false" ninja -C out/OzoneCaca content_shell ./out/OzoneCaca/content_shell
Note: traditional TTYs are not the ideal browsing experience.
There is a public mailing list: email@example.com