Friday, 20 December 2019

Using Linux With Wayland? What You Need to Know

linux-wayland

Aspects of the Linux desktop change all the time, but some components have been around for decades. Take the X Window System (known primarily as X). Work is underway to create a replacement that’s faster and more secure. That replacement is Wayland.

Unlock the "Essential Linux Commands Cheat Sheet" now!

This will sign you up to our newsletter

Enter your Email

Wayland has been a long time coming, and several Linux-based operating systems have embraced it as the default display server protocol. If yours hasn’t yet, there’s a chance it will soon. Here’s what it means to use Linux with Wayland.

What Is Wayland?

How Wayland functions
Image Credit: Freedesktop.org

Wayland is a protocol that tells programs how they should appear on your screen, based on your actions (such as moving a window around or clicking a button). Technically, Wayland is not a replacement for the X server by itself—Wayland only defines the way in which such a display server should talk to those applications.

Wayland relies on a third party, known as a Wayland compositor, to serve as the display server. Examples include Mutter and KWin (of the GNOME and KDE Plasma desktops respectively). Wayland attempts to simplify display server communications, making future development easier and faster.

Like many future technologies, Wayland has some teething to work through. X has been around for a long time and has been steadily built on. That means that Wayland has plenty of catching up to do (along with the display servers which implement it). But for now, there are a few things to know to make testing it out much smoother.

Avoid GTK+ 2 or Qt 4 Apps on Wayland

Most of the Linux apps you you interact with day to day are written for one of two graphical toolkits: GTK+ and Qt. These frameworks act as clients to the display server, asking for things to be drawn onto your screen. However, these requests need to be understood first, and that’s up to the toolkit to do.

As a result, only some types of programs can actually run on Wayland desktops. For example, GTK+ 3 programs also can run properly. So can those written in Qt 5 (the toolkit the Plasma desktop is based on).

That being said, if you do try to open, say, a Qt 4 application, you’ll have a fair chance of it running. Wayland does this by running the X server behind the scenes, to listen to the apps which it can’t understand. However, this can lead to higher memory usage, and slightly lower speeds. Plus, there are some things that this approach just can’t do at the moment.

Some Apps Are Incompatible With Wayland

GNOME Night Light feature in System Settings

Wayland and X are designed in different ways, so some apps that work with X simply won’t be able to work on Wayland.

Consider screen color-shifting apps like Redshift and f.lux. These apps filter blue light from your display based on the time of day. They operate using X extensions, such as RandR, which provides programs with an easy way of asking X to change your screen’s display.

While Wayland provides the means to recreate this ability somewhat, it’s reliant on each Wayland compositor to actually implement it. This means that while one desktop environment might support something like Redshift (such as the GNOME Night Light feature pictured above), that functionality isn’t necessarily available elsewhere.

You can expect to run into similar issues with screen recording software. As a security feature, a Wayland display server blocks apps from recording the screen. That’s not to say that screen recording is fundamentally impossible on Wayland. Developers are working to implement the feature in a different way.

Compositing Is a Must

Compositing is a technique which helps to prevent screen tearing and artifacts. This is done by keeping copies of your display in memory, usually with the help of your graphics card. This way, even if apps stop responding, your display server will still have something to work with. Compositing also provides window animations and shadows.

Wayland is designed to make this process much more efficient than X by making it compulsory. X has compositing as an optional feature, through an extension called Xcomposite. But because of how it’s implemented, it takes a little more time compared to Wayland.

That being said, compositing can lead to some problems. Compositing results in slightly lower performance of programs such as games. In X, most desktops turn compositing off when an app goes full-screen. But many Wayland compositors still need to implement this. If you’re interested in using graphics intensive programs on a Wayland desktop, this is quite important to keep in mind.

Nvidia Graphics May Not Work With Wayland

More specifically, if you’re using Nvidia’s proprietary graphics driver, Wayland probably won’t work for you. This is related to the compositing problem above. To make the process work, your graphics driver must talk to Wayland compositors in a certain way.

Intel and AMD graphics cards don’t have this problem, since they use the expected standard, called GBM (Generic Buffer Management). Nvidia believes that their way of speaking to Wayland, called EGL, is better, and as such sticks to that instead.

This problem can be solved in two ways: Nvidia drivers implement GBM, or Wayland compositors implement EGLStreams. Currently, Nvidia seems uninterested in pursuing the former solution.

How to Use Wayland

At this point, most Linux distros give you the option to install Wayland, but most still run X by default. You can search for Wayland in your distro’s repositories, log out from the desktop, and select Wayland when logging back in.

Fedora was one of the earliest distros to buck this trend and has run Wayland by default for a few years now. Fedora is known for using the latest technologies the Linux desktop has to offer, while also being quite usable. But Fedora isn’t alone.

Some Distros That Provide Wayland By Default

  • Fedora
  • Debian
  • openSUSE Tumbleweed
  • PureOS
  • Red Hat Enterprise Linux
  • SUSE Enterprise Linux

Why haven’t more distros made the switch? Many are waiting for a few more issues to clear up. A lot of people expect to use Nvidia’s proprietary graphics driver to get the most optimal gaming experience. Some want to record their screen to create podcasts or stream video online.

Given that the display server is not something that most of us notice, distros are not eager to introduce such noticeable problems in exchange for benefits that, while real, exist largely behind the scenes. And if you try to fix things using a remote desktop, well, that’s just the sort of thing that may or may not work under Wayland.

Read the full article: Using Linux With Wayland? What You Need to Know



from MakeUseOf https://ift.tt/2sOXQLA
via IFTTT

No comments:

Post a Comment