1*517393d9SAndrew Geissler.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2*517393d9SAndrew Geissler
3*517393d9SAndrew GeisslerUsing Wayland and Weston
4*517393d9SAndrew Geissler************************
5*517393d9SAndrew Geissler
6*517393d9SAndrew Geissler:wikipedia:`Wayland <Wayland_(display_server_protocol)>`
7*517393d9SAndrew Geissleris a computer display server protocol that provides a method for
8*517393d9SAndrew Geisslercompositing window managers to communicate directly with applications
9*517393d9SAndrew Geisslerand video hardware and expects them to communicate with input hardware
10*517393d9SAndrew Geisslerusing other libraries. Using Wayland with supporting targets can result
11*517393d9SAndrew Geisslerin better control over graphics frame rendering than an application
12*517393d9SAndrew Geisslermight otherwise achieve.
13*517393d9SAndrew Geissler
14*517393d9SAndrew GeisslerThe Yocto Project provides the Wayland protocol libraries and the
15*517393d9SAndrew Geisslerreference :wikipedia:`Weston <Wayland_(display_server_protocol)#Weston>`
16*517393d9SAndrew Geisslercompositor as part of its release. You can find the integrated packages
17*517393d9SAndrew Geisslerin the ``meta`` layer of the :term:`Source Directory`.
18*517393d9SAndrew GeisslerSpecifically, you
19*517393d9SAndrew Geisslercan find the recipes that build both Wayland and Weston at
20*517393d9SAndrew Geissler``meta/recipes-graphics/wayland``.
21*517393d9SAndrew Geissler
22*517393d9SAndrew GeisslerYou can build both the Wayland and Weston packages for use only with targets
23*517393d9SAndrew Geisslerthat accept the :wikipedia:`Mesa 3D and Direct Rendering Infrastructure
24*517393d9SAndrew Geissler<Mesa_(computer_graphics)>`, which is also known as Mesa DRI. This implies that
25*517393d9SAndrew Geissleryou cannot build and use the packages if your target uses, for example, the
26*517393d9SAndrew GeisslerIntel Embedded Media and Graphics Driver (Intel EMGD) that overrides Mesa DRI.
27*517393d9SAndrew Geissler
28*517393d9SAndrew Geissler.. note::
29*517393d9SAndrew Geissler
30*517393d9SAndrew Geissler   Due to lack of EGL support, Weston 1.0.3 will not run directly on the
31*517393d9SAndrew Geissler   emulated QEMU hardware. However, this version of Weston will run
32*517393d9SAndrew Geissler   under X emulation without issues.
33*517393d9SAndrew Geissler
34*517393d9SAndrew GeisslerThis section describes what you need to do to implement Wayland and use
35*517393d9SAndrew Geisslerthe Weston compositor when building an image for a supporting target.
36*517393d9SAndrew Geissler
37*517393d9SAndrew GeisslerEnabling Wayland in an Image
38*517393d9SAndrew Geissler============================
39*517393d9SAndrew Geissler
40*517393d9SAndrew GeisslerTo enable Wayland, you need to enable it to be built and enable it to be
41*517393d9SAndrew Geisslerincluded (installed) in the image.
42*517393d9SAndrew Geissler
43*517393d9SAndrew GeisslerBuilding Wayland
44*517393d9SAndrew Geissler----------------
45*517393d9SAndrew Geissler
46*517393d9SAndrew GeisslerTo cause Mesa to build the ``wayland-egl`` platform and Weston to build
47*517393d9SAndrew GeisslerWayland with Kernel Mode Setting
48*517393d9SAndrew Geissler(`KMS <https://wiki.archlinux.org/index.php/Kernel_Mode_Setting>`__)
49*517393d9SAndrew Geisslersupport, include the "wayland" flag in the
50*517393d9SAndrew Geissler:term:`DISTRO_FEATURES`
51*517393d9SAndrew Geisslerstatement in your ``local.conf`` file::
52*517393d9SAndrew Geissler
53*517393d9SAndrew Geissler   DISTRO_FEATURES:append = " wayland"
54*517393d9SAndrew Geissler
55*517393d9SAndrew Geissler.. note::
56*517393d9SAndrew Geissler
57*517393d9SAndrew Geissler   If X11 has been enabled elsewhere, Weston will build Wayland with X11
58*517393d9SAndrew Geissler   support
59*517393d9SAndrew Geissler
60*517393d9SAndrew GeisslerInstalling Wayland and Weston
61*517393d9SAndrew Geissler-----------------------------
62*517393d9SAndrew Geissler
63*517393d9SAndrew GeisslerTo install the Wayland feature into an image, you must include the
64*517393d9SAndrew Geisslerfollowing
65*517393d9SAndrew Geissler:term:`CORE_IMAGE_EXTRA_INSTALL`
66*517393d9SAndrew Geisslerstatement in your ``local.conf`` file::
67*517393d9SAndrew Geissler
68*517393d9SAndrew Geissler   CORE_IMAGE_EXTRA_INSTALL += "wayland weston"
69*517393d9SAndrew Geissler
70*517393d9SAndrew GeisslerRunning Weston
71*517393d9SAndrew Geissler==============
72*517393d9SAndrew Geissler
73*517393d9SAndrew GeisslerTo run Weston inside X11, enabling it as described earlier and building
74*517393d9SAndrew Geisslera Sato image is sufficient. If you are running your image under Sato, a
75*517393d9SAndrew GeisslerWeston Launcher appears in the "Utility" category.
76*517393d9SAndrew Geissler
77*517393d9SAndrew GeisslerAlternatively, you can run Weston through the command-line interpretor
78*517393d9SAndrew Geissler(CLI), which is better suited for development work. To run Weston under
79*517393d9SAndrew Geisslerthe CLI, you need to do the following after your image is built:
80*517393d9SAndrew Geissler
81*517393d9SAndrew Geissler#. Run these commands to export ``XDG_RUNTIME_DIR``::
82*517393d9SAndrew Geissler
83*517393d9SAndrew Geissler      mkdir -p /tmp/$USER-weston
84*517393d9SAndrew Geissler      chmod 0700 /tmp/$USER-weston
85*517393d9SAndrew Geissler      export XDG_RUNTIME_DIR=/tmp/$USER-weston
86*517393d9SAndrew Geissler
87*517393d9SAndrew Geissler#. Launch Weston in the shell::
88*517393d9SAndrew Geissler
89*517393d9SAndrew Geissler      weston
90*517393d9SAndrew Geissler
91