Don't want to see articles from a certain category? When logged in, go to your User Settings and adjust your feed in the Content Preferences section where you can block tags!
We do often include affiliate links to earn us some pennies. See more here.

The ongoing work bit by bit to get Wine and Wayland to fully work together on Linux has taken another step, with a third big merge request accepted. Wine 8.4 from mid-March was the first development release to actually have some of the initial Wayland work in it.

From the merge request that's now accepted:

This MR introduces the driver mechanisms to handle dynamic events from the Wayland compositor, using wl_output events as the guiding use case (i.e., we want to update the win32u display settings when the host settings change).

In this design we create a dedicated thread to read and dispatch Wayland events received from the compositor. If a Wayland event handler wants some code to be run in the context of a particular HWND's thread, it can add an internal event to a custom queue we have for each (GUI enabled) thread. The ProcessEvents driver callback processes internal events from that queue. In order to wake up waiting threads we use a pipe to notify about new internal events, with the read end acting as the thread's host queue fd. This is similar to how winemac.drv works.

We use the aforementioned mechanisms to queue win32u display device updates to the desktop window thread. Since there are many pieces that need to fall into place, this MR gradually reaches the final design:

  1. We first introduce the dedicated read/dispatch thread and handle events (and also display device updates if in the desktop process) in that thread.
  2. We ensure access to Wayland output information is thread-safe and consistent (since in step 3 we will need to access it from a different thread).
  3. We finally introduce per-thread internal event queues and, if we are in the desktop process, queue the display device update to the desktop window thread internal event queue. Note that the main portion of the wl_output event code is still handled in the dedicated read/dispatch thread.

Why is this actually needed? Well currently Wine uses X11, and so for anyone running Wayland it will then be run through XWayland, which is basically X running under Wayland like a compatibility layer. As Collabora said in their original announcement back in 2020 talking about it they said it's "a source of complexity and possible inefficiencies" and so it would "be ideal if Wine could talk directly to Wayland to enable a leaner and more efficient stack on modern systems"

So the end result should be for users on Wayland, which will eventually be everyone, to have Wine work without the XWayland layer and have it all work nicely far into the future.

Article taken from GamingOnLinux.com.
18 Likes
About the author -
author picture
I am the owner of GamingOnLinux. After discovering Linux back in the days of Mandrake in 2003, I constantly checked on the progress of Linux until Ubuntu appeared on the scene and it helped me to really love it. You can reach me easily by emailing GamingOnLinux directly.
See more from me
The comments on this article are closed.
14 comments
Page: 1/2»
  Go to:

drjoms May 25, 2023
So in a nutshell, direct or indirect consequence of this - we shall have wine/proton working natively with Wayland?
Jarmer May 25, 2023
Quoting: drjomsSo in a nutshell, direct or indirect consequence of this - we shall have wine/proton working natively with Wayland?

yes exactly. The big question is "when" - I think I've been hearing some version of this exact same statement for years now. It's always "coming soon" so we shall see. For now I'm still on x11 just because it irks me to switch to wayland and then for all my games it's just running x on top of wayland. Why not just run x natively. I'll be very glad when it runs natively on wayland! But the when ...
drjoms May 25, 2023
Quoting: Jarmer
Quoting: drjomsSo in a nutshell, direct or indirect consequence of this - we shall have wine/proton working natively with Wayland?

yes exactly. The big question is "when" - I think I've been hearing some version of this exact same statement for years now. It's always "coming soon" so we shall see. For now I'm still on x11 just because it irks me to switch to wayland and then for all my games it's just running x on top of wayland. Why not just run x natively. I'll be very glad when it runs natively on wayland! But the when ...

I have been using Xfce4 for many years now. Switched over to Gnome with wayland. I am not picky about my GUI.
As long as i can run browser, terminal and switch easily between windows - I am good.

Albeit gnome is a bit more technically problematic than xfce, but its "more feature rich" too.

Did not notice any performance issues and what not.
Xwayland has almost no overhead, less than 1% I understand.

So i tried gnome+wayland and stayed with it.
Desum May 25, 2023
I thought Wayland's security made running Wine without xWayland a technical nightmare because of all the unsafe things Windows allows programs to do?
sonic2kk May 25, 2023
Been using KDE Plasma Wayland for gaming for well over a year now to use my mixed-scale + mixed-refresh-rate setup. Wayland support won't immediately fix it, but I'm looking forward to hopefully eventual scaling support on Wine. Most applications that I use apart from Steam run Wayland native and look nice and crisp at my 150% scaling, looking forward to the same being true for Wine applications, and being able to run games at native resolution as well - though I remember an Xwayland MR that implemented this for fullscreen Xwayland windows.
fedecv May 25, 2023
Im staying with X11 at this time, Wayland is not bad but i cant get gsync working with nvidia cards also get less fps even in native games. Anyone got adaptive sync working on Nvidia cards with wayland?
TheRiddick May 25, 2023
Quoting: fedecvAnyone got adaptive sync working on Nvidia cards with wayland?

No because I can't be bothered testing wayland when it still has the RTX Primary display 75hz+ login crash entire system dead bug. (you can bypass it, but cbf)


Last edited by TheRiddick on 25 May 2023 at 10:07 pm UTC
Shmerl May 25, 2023
Quoting: Jarmeryes exactly. The big question is "when" - I think I've been hearing some version of this exact same statement for years now.

If you mean when for Wine itself - hopefully later this year. Once they merge all major pieces it will be possible to test and they'll probably focus on bugs that will be reported once more people will start using it.

If you mean when Wayland itself will be used more widely - you can check the trend in GOL stats for example.

https://www.gamingonlinux.com/index.php?module=statistics&view=trends#SessionType-top

You can probably correlate that trend with the growing trend of AMD GPUs usage, since experience with Nvidia on Wayland is worse.

Personally I've been using KDE Wayland session for a while already and it works well including for gaming.


Last edited by Shmerl on 25 May 2023 at 11:24 pm UTC
Purple Library Guy May 25, 2023
Quoting: Shmerl
Quoting: Jarmeryes exactly. The big question is "when" - I think I've been hearing some version of this exact same statement for years now.

If you mean when for Wine itself - hopefully later this year. Once they merge all major pieces it will be possible to test and they'll probably focus on bugs that will be reported once more people will start using it.

If you mean when Wayland itself will be used more widely - you can check the trend in GOL stats for example.

https://www.gamingonlinux.com/index.php?module=statistics&view=trends#SessionType-top

Personally I've been using KDE Wayland session for a while already and it works well including for gaming.
Hmmm . . . that looks like a 15% increase in about a year and a half. So say 10%/year. At that rate it would get to almost half in two more years, over half in 3 years. But I suspect that although the progression is pretty even in the graph, the line is really quite straight, it will probably start curving up at some point as various distros decide Wayland is good enough.
Shmerl May 25, 2023
Quoting: Purple Library GuyHmmm . . . that looks like a 15% increase in about a year and a half. So say 10%/year. At that rate it would get to almost half in two more years, over half in 3 years. But I suspect that although the progression is pretty even in the graph, the line is really quite straight, it will probably start curving up at some point as various distros decide Wayland is good enough.

Sounds right. It probably would accelerate once some major pieces will be improved and there would be less reasons to use X11.

And as I also added above, one of the factors is the GPU. Nvidia blob is the drag on Wayland usage due to it causing poor experience on it. But the trend for Nvidia is negative as you can see on the same page, so that will speed things up for Wayland adoption.


Last edited by Shmerl on 25 May 2023 at 11:34 pm UTC
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.
Buy Games
Buy games with our affiliate / partner links: