Skip to content
Carlos Alberto Lopez Perez edited this page May 14, 2018 · 17 revisions

WPE

WPE WebKit (former WebKitForWayland) is a WebKit port intended to allow embedders to create simple and performant systems based on Web platform technologies. It is designed with hardware acceleration in mind, leveraging common 3D graphics APIs for best performance.

You can find more information about WPE at:

Building an image with WPE

The usual way to create an image with WPE is:

  • Add this layer to bblayers.conf

  • Add the following to local.conf:

    IMAGE_INSTALL_append = " wpewebkit cog"
    PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"
    

    IMPORTANT: With the lines above we are making a selection of the wpebackend that will be used (wpebackend-fdo) as well of the launcher (cog). Read below to have a better understanding of the backends and launchers available.

  • Then build the target image, for example:

    bitbake core-image-weston
    
  • Run cog from a weston terminal.

NOTE: If your target hardware is a Raspberry Pi or a board based on i.MX6 then check the extended documentation about WPE on this platforms on the links below:

  • Documentation about the RPi
  • Documentation about i.MX6

Selecting a WPE launcher.

Currently this layer includes recipes for two launchers:

  1. Cog: Cog is a small launcher designed for the WebKit WPE port. But it also allows to use the WebKit GTK port instead. Cog is small: provides no user interface, and is suitable to be used as a Web application container. Cog may be presented fullscreen depending on the WPE backend being used.

  2. dyz: dyz is a simple launcher for WPE port of WebKit. dyz is written in Lua and depends on LuaJIT. dyz depends on wpebackend-fdo (see below).

Selecting a WPE backend.

The WPE Backend is what integrates wpewebkit with the platform (provides a way to render to the screen and to receive input events).

Currently this layer includes recipes for 3 wpebackend implementations. In order to select which backend we want to use in the image we select one of this 3 as the PREFERRED_PROVIDER_virtual/wpebackend in conf/local.conf and then we enable any non-default packageconfig option for it (if required).

For example, for using the backend that displays WPE full-screen on the RPi framebuffer we will add to conf/local.conf

PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-rdk"
PACKAGECONFIG_pn-wpebackend-rdk = "rpi"
IMAGE_INSTALL_append = " wpewebkit cog"

The selection of one backend or other depends on two things:

  1. The launcher that will be used (for example, with dyz its currently only possible to use wpebackend-fdo)
  2. The target hardware: On some hardware only a specific backend will work. On other hardware there are different backends that will work, but it can happen that a specific backend perform better than others.

This is a summary of the current available options for the wpebackend selection.

  1. wpebackend-fdo: WPE's backend based on a freedesktop.org stack where the view backend is implemented on the launcher. It is the backend that is receiving more attention from the WPE project upstream. But depending on your hardware it may still not perform as good as the other backends. It runs inside a wayland session (e.g.: run it from a weston terminal).

    • Usage: select it by setting in conf/local.conf the line PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"
  2. wpebackend-rdk: Collection of backends for WPE with specific support for embedded devices used on the RDK. To select which one of the backends its enabled, there are different PACKAGECONFIG options inside the recipe.

    • Usage: select it by setting in conf/local.conf the line PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-rdk" and then select a sub-backend by enabling the packageconfig option. The following 3 ones are relevant backends inside:
      • PACKAGECONFIG_pn-wpebackend-rdk = "wayland" : Renders directly to a wayland surface (e.g: runs inside weston). It doesn't enable proper buffer sharing buffers between the UIProcess and the Webprocess. To select the window size export this environment variables before executing the launcher.
        export WPE_INIT_VIEW_WIDTH=1280
        export WPE_INIT_VIEW_HEIGHT=720
        
      • PACKAGECONFIG_pn-wpebackend-rdk = "rpi" : Renders full-screen directly to the RPi framebuffer with the propietary drivers (Broadcom userland). To enable mouse or touch support export this environment variable before executing the launcher
        export WPE_BCMRPI_TOUCH=1
        export WPE_BCMRPI_CURSOR=1
        
      • PACKAGECONFIG_pn-wpebackend-rdk = "imx6" : Renders full-screen directly to the i.MX6 framebuffer with the propietary drivers (Vivante). To select the window size export this environment variables before executing the launcher:
        export WPE_INIT_VIEW_WIDTH=1280
        export WPE_INIT_VIEW_HEIGHT=720
        
  3. wpebackend-mesa: Backend for WPE for GPUs that work with Mesa drivers and GBM. It is useful for Intel or AMD GPUs that can leverage libgbm support.

    • Usage: select it by setting in conf/local.conf the line PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-mesa"
    • It also allows to run full-screen directly over the framebuffer via the DRM API. To do that simply stop weston ( /etc/init.d/weston stop ) and run the launcher directly from the text terminal or from ssh session.
Clone this wiki locally