Skip to content
Pablo Saavedra edited this page Nov 9, 2021 · 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 also a recipe for Cog. Cog (previously known as dinghy) 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 full screen depending on the WPE backend being used.

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 trought the DRM Linux interface we will add to conf/local.conf

PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"
IMAGE_INSTALL:append = " wpewebkit cog"

The selection of one backend or other depends on 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. Currently the launchers supporting it (cog and dyz) do that requiring a Wayland session with an EGL driver implementing the extension EGL_WL_bind_wayland_display, but support for running directly from a frame-buffer (DRM/KMS) or from X11 may get implemented on the future. Contrary to other wpebackends, the support for how the image is presented on the screen (e.g.: wayland) is implemented on the launcher itself (e.g.: on cog or dyz) rather than on the backend.

    • Usage: select it by setting in conf/local.conf the line PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"
  2. wpebackend-rdk (deprecated): 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
        

Performance Tips

Check PerformanceTips for some tips regarding how to improve performance