Wayland Weston overview

来自百问网嵌入式Linux wiki
Zhouyuebiao讨论 | 贡献2020年5月8日 (五) 23:01的版本 (创建页面,内容为“This article gives information about the Linux<sup>®</sup> Wayland/Weston framework. It explains how to configure it and, based on examples, how to use it. == F…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

This article gives information about the Linux® Wayland/Weston framework. It explains how to configure it and, based on examples, how to use it.

Framework purpose

The Wayland/Weston[1] framework is dedicated to the management of the displays, including the composition[2] of their contents, the support of their related input device events (touchscreen, mouse, keyboard...) and their settings (background wallpapers, resolutions, multi-screens...):

  • Wayland[3] is a protocol that specifies the communication between a display server and its clients. Wayland is intended as a simpler replacement for the X Window system[4], easier to develop and maintain.
  • Weston is the reference implementation of a Wayland compositor that is a display server using the Wayland protocol. Weston is a minimal and fast compositor and is suitable for many embedded and mobile use cases.

The purpose of this article is to provide a quick overview of the Wayland/Weston framework, giving some hints on how to use and configure Weston and some external references to better understand the Wayland/Weston structure.

System overview

Component description

From Application/Middleware to Hardware

  • Application/Middleware (User space): The Wayland client application or middleware relying on the Wayland protocol. This client can be traditional applications or middleware, X servers (rootless or fullscreen) or other display servers.
  • Wayland/Weston (User space): The Wayland libraries implementing the Wayland display server protocol and the Weston libraries using this Wayland protocol for implementing the display server running on the Linux Kernel Mode Setting (KMS), the composition based on OpenGLES and Direct Rendering Manager (DRM) and the management of Linux input devices.
  • OpenGLES (User space): The OpenGLES libraries used by Weston for the GPU-based composition.
  • libdrm/libkms (User space): The libdrm and libkms libraries are used by the Weston compositor to configure the display path and refresh the display content.
  • GPU driver (Kernel space): The Linux kernel driver used to transfer OpenGLES commands to the GPU hardware block.
  • DRM/KMS driver (Kernel Space): The DRM/KMS Linux kernel driver to access the display hardware block.
  • GPU (Hardware): The GPU hardware block.
  • Display (Hardware): The display hardware block.
  • LCD device (Hardware): The physical LCD device to display contents.

API description

The Wayland protocol API is described in the official Wayland documentation https://wayland.freedesktop.org/docs/html .

Configuration

The /etc/xdg/weston/weston.ini file allows the user to set its Weston shell look and behaviour preferences.

In this file you will be able to configure:

  • the shell appearance:
    • deactivation of the panel bar using panel-location variable
    • color of the panel bar using panel-color variable
    • background color using background-color variable
    • background image using background-image variable
    • keyboard layout (qwerty, azerty...) using keymap_layout variable (us, fr...)
    • ...
  • the animation during transition (to enable if GPU is supported)
  • the launcher bar by adding some icons and associated script
  • the display output (HDMI, DSI, DVO, LVDS, ...)


Please refer to the Ubuntu weston.ini manpage[5] to know how to configure it.

You may want also to configure:

How to use the framework

Start Weston

Weston is automatically started at boot by systemd using /lib/systemd/system/weston.service.

You can plug a keyboard and a mouse on the board and enjoy the Weston desktop mode.

To start/stop or enable/disable the Weston service, please refer to How to stop and start Weston article.

Weston utilities

Once Weston is started you can launch simple Wayland client examples.

Here below some interesting utilities...

Display some images

Info.png Don't have an image ? Download one here

weston-image utility decodes and displays in Wayland window image contents:

Board $> weston-image <file(s)>

Variety of image types are supported such as jpeg, png or webp. If the image is bigger than display, the image is resized transparently. Several files can be given in argument, one window being opened per file:

Board $> weston-image 模板:Image ref file 模板:Image ref file

Embedded terminal

weston-terminal opens a new Wayland window with a terminal session. Connect a keyboard and a mouse and you can use your board as an autonomous personal computer.

Start first a Weston terminal session using your PC console:

Board $> weston-terminal

Then switch to keyboard connected to board and type:

Wayland Terminal$> weston-image 模板:Image ref file

OpenGLES application

weston-simple-egl aims to check that GPU is up & running and well integrated within the Wayland/Weston system. It opens a new alpha transparent Wayland window with a rotating colorized triangle.

Board $> weston-simple-egl
has EGL_EXT_buffer_age and EGL_EXT_swap_buffers_with_damage
244 frames in 5 seconds: 48.799999 fps
242 frames in 5 seconds: 48.400002 fps

Other options are available, check usage below:

Board $> weston-simple-egl -h
Usage: simple-egl [OPTIONS]

  -f    Run in fullscreen mode
  -o    Create an opaque surface
  -s    Use a 16 bpp EGL config
  -b    Don't sync to compositor redraw (eglSwapInterval 0)
  -h    This help text

Make screen or video capture

Please refer to the following articles:

List of Weston utilities

Client example binaries location:

Board $> ls -1 /usr/bin/weston*
/usr/bin/weston
/usr/bin/weston-calibrator
/usr/bin/weston-clickdot
/usr/bin/weston-cliptest
/usr/bin/weston-confine
/usr/bin/weston-dnd
/usr/bin/weston-editor
/usr/bin/weston-eventdemo
/usr/bin/weston-flower
/usr/bin/weston-fullscreen
/usr/bin/weston-image
/usr/bin/weston-info
/usr/bin/weston-launch
/usr/bin/weston-multi-resource
/usr/bin/weston-presentation-shm
/usr/bin/weston-resizor
/usr/bin/weston-scaler
/usr/bin/weston-simple-damage
/usr/bin/weston-simple-dmabuf-v4l
/usr/bin/weston-simple-egl
/usr/bin/weston-simple-shm
/usr/bin/weston-simple-touch
/usr/bin/weston-smoke
/usr/bin/weston-stacking
/usr/bin/weston-start
/usr/bin/weston-subsurfaces
/usr/bin/weston-terminal
/usr/bin/weston-transformed

Wayland "Hello World"

You can find various Wayland "Hello World" applications on internet. We suggest to browse:


You can refer to the official Wayland documentation: https://wayland.freedesktop.org/docs/html/index.html

How to trace and debug the framework

To debug weston and enable log traces, please refer to How to debug Weston article.

To go further

You can find a good overview of the Wayland/Weston implementation in the Wayland/Weston overview chapter of the presentation held at the 2015 Automotive Linux Summit: Using Linux Media Controller for Wayland/Weston Renderer

You can refer to the official Wayland documentation: https://wayland.freedesktop.org/docs/html/index.html

References


<securetransclude src="ProtectedTemplate:ArticleBasedOnModel" params="Framework overview article model"></securetransclude> <securetransclude src="ProtectedTemplate:PublicationRequestId" params="10153 | 2019-01-03 | AlainF"></securetransclude>