天天看点

Wayland Install

The instructions below assume some familiarity with git and building and running experimental software. And be prepared that this project isn't at all useful right now, it's still very much a prototype. When the instructions suggest to clone a git repo, you can of course just add a remote and fetch instead, if you have a clone of that repo around already. By default the software is installed in $HOME/install but you can change it by altering $WLD (explained later). You can also install everything system wide by setting WLD to /usr and passing --sysconfdir=/etc to autogen.sh.

Hardware / Drivers

X output requires DRI2. DRM output (without X) requires Kernel Mode Setting (KMS) and the page flip ioctl. These are supported by:

Intel: i915 (June 2004) or newer cards. DRM support has been in the kernel since around 2.6.29. Sandy Bridge chips require kernel 2.6.37.

AMD/ATI: Requires open source driver (radeon/ati, not fglrx/catalyst). DRM output requires kernel version 2.6.38. Cards probably work back to Radeon 7200 (2000).

nVidia: Requires Nouveau (open source driver). DRM output requires a kernel built from the Nouveau git repository, details below. Cards probably work back to Riva TNT (1998). The latest series of chips, NVC0 / Fermi, released March 2010, requires loading external firmware for Nouveau, which is not documented.

Setting up the environment

If you want to install in a custom location (not system wide), you'll need to set the following environment variables to get various libraries to link appropriately:

WLD=$HOME/install   # change this to another location if you prefer
LD_LIBRARY_PATH=$WLD/lib
PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
ACLOCAL="aclocal -I $WLD/share/aclocal"
C_INCLUDE_PATH=$WLD/include
LIBRARY_PATH=$WLD/lib
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1

export WLD LD_LIBRARY_PATH PKG_CONFIG_PATH ACLOCAL C_INCLUDE_PATH /
       LIBRARY_PATH PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
      

Do not set LD_LIBRARY_PATH as your default, it will break things.

You may put the above in a script and source it in the terminal you wish to build the packages.

Wayland libraries

Required to build Mesa with --with-egl-platforms=x11,wayland,drm.

$ git clone git://anongit.freedesktop.org/wayland/wayland
    $ cd wayland
    $ ./autogen.sh --prefix=$WLD
    $ make
    $ make install
      

Mesa

Wayland uses the mesa EGL stack, and all extensions required to run EGL on KMS are now upstream on the master branch. You'll need to pull it from git, because 7.10 does not include required commits related to BGRA8888 and wayland-egl. For this you'll also need a development package for libdrm. Other dependencies are development packages of xcb-dri2 and xcb-xfixes.

$ git clone git://anongit.freedesktop.org/git/mesa/drm
    $ cd drm
    $ ./autogen.sh --prefix=$WLD --enable-nouveau-experimental-api
    $ make && make install

    $ git clone git://anongit.freedesktop.org/mesa/mesa
    $ cd mesa
    $ ./autogen.sh --prefix=$WLD --enable-gles2                   /
      --disable-gallium-egl --enable-gallium-nouveau --enable-gallium-r600 /
      --with-egl-platforms=x11,wayland,drm
    $ make && make install
      

We disable Gallium for Intel 915 and 965, which just means that libEGL won't try to load the Gallium drivers directly. The Gallium drivers will be built as DRI drivers, which the EGL loader will load just fine.

libxkbcommon

Wayland needs libxkbcommon for translating evdev keycodes to keysyms. For this you'll need development packages for xproto, kbproto, macros and libX11.

$ git clone git://anongit.freedesktop.org/xorg/util/macros
    $ cd macros
    $ ./autogen.sh --prefix=$WLD
    $ make && make install

    $ git clone git://anongit.freedesktop.org/xorg/proto/xproto
    $ cd xproto
    $ ./autogen.sh --prefix=$WLD
    $ make && make install

    $ git clone git://anongit.freedesktop.org/xorg/proto/kbproto
    $ cd kbproto
    $ ./autogen.sh --prefix=$WLD
    $ make && make install

    $ git clone git://anongit.freedesktop.org/xorg/lib/libX11
    $ cd libX11
    $ ./autogen.sh --prefix=$WLD
    $ make && make install

    $ git clone git://people.freedesktop.org/xorg/lib/libxkbcommon.git
    $ cd libxkbcommon/
    $ ./autogen.sh --prefix=$WLD --with-xkb-config-root=/usr/share/X11/xkb
    $ make && make install
      

cairo-gl

The Wayland clients can render using cairo-gl, but fall back to software when cairo-gl is not available. cairo-gl is an experimental cairo backend and has been available since cairo 1.10, but recent bugfixes (available in non-released 1.11.3) are needed. Thus cairo from git is required. For this you'll need a development package for pixman.

$ git clone git://anongit.freedesktop.org/pixman
    $ cd pixman
    $ ./autogen.sh --prefix=$WLD
    $ make && make install

    $ git clone git://anongit.freedesktop.org/cairo
    $ cd cairo
    $ ./autogen.sh --prefix=$WLD --enable-gl --enable-xcb
    $ make && make install
      

Wayland applications

Aside from mesa and libxkbcommon, the Wayland demos' dependencies can be satisfied with released versions of: gdk-pixbuf-2.0, libudev 136, libdrm 2.4.23, pixman-1, cairo-gl 1.11.3, glib-2.0, and gobject-2.0. And optionally, for the pdf viewer: poppler-glib and gio-2.0.

$ git clone git://anongit.freedesktop.org/wayland/wayland-demos
    $ cd wayland-demos
    $ ./autogen.sh --prefix=$WLD
    $ make
    $ make install
      

Installing into a non-/usr prefix is fine, but the 70-wayland.rules udev rule file has to be copied to /etc/udev/rules.d.

$ sudo cp compositor/70-wayland.rules /etc/udev/rules.d/
      

Once installed, either reboot or run the following to make udev label the devices wayland will use.

$ sudo udevadm trigger --subsystem-match=drm --subsystem-match=input
      

If DISPLAY is set, the wayland compositor will run under X in a window and take input from X. Otherwise it will run on the KMS framebuffer and take input from evdev devices. Pick a background image that you like and copy it to the Wayland source directory as background.jpg or use the -b command line option:

$ ./compositor -b my-image.jpg
      

To run clients, switch to a different VT and run the client from there. Or run it under X and start up the clients from a terminal window. There are a few demo clients available, but they are all pretty simple and mostly for testing specific features in the wayland protocol:

  • 'terminal' is a simple terminal emulator, not very compliant at all, but works well enough for bash
  • 'flower' draws a flower on the screen, testing the frame protocol
  • 'gears' glxgears, but for wayland
  • 'smoke' tests SHM buffer sharing
  • 'image' loads the image files passed on the command line and shows them
  • 'view' does the same for pdf files
  • 'resizor' demonstrates smooth window resizing (use up and down keys)
  • 'eventdemo' reports libtoytoolkit's events to console (see eventdemo --help)

Notes

Environment variables which will get you more debugging output:

MESA_DEBUG=1
EGL_LOG_LEVEL=debug
LIBGL_DEBUG=verbose
WAYLAND_DEBUG=1
      

Nouveau Kernel

To use DRM output with nVidia, you need to build a kernel from the Nouveau kernel git repository:

(required commit)

$ git clone --depth 1 git://anongit.freedesktop.org/nouveau/linux-2.6
    $ cd linux-2.6
    $ cp /boot/config-`uname -r` .config # use .config of currently running kernel
    $ yes "" | make oldconfig            # use defaults for new options
    $ make clean && make && make modules && sudo make modules_install && sudo make install
      

Ubuntu Maverick's /sbin/installkernel is broken, requring these additional commands:

$ mkinitramfs -o initrd.img `make kernelversion`+
    $ sudo mv initrd.img /boot/initrd.img-`make kernelversion`+
    $ sudo update-grub
      

To uninstall a kernel installed this way:

$ sudo rm /boot/initrd.img-`make kernelversion`+ /lib/modules/`make kernelversion`+
    $ sudo update-grub
      
原文地址:http://wayland.freedesktop.org/building.html