-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the Wayland display server #990
Comments
Relevant PRs with initial Wayland implementation but that pre-dated the OS/DisplayServer split and thus couldn't be merged: godotengine/godot#23426 (@toger5) |
Most notably for me, denying Wayland applications un-privileged access to the "confuse the window manager about whether this resolution change is permanent enough that windows should be repositioned to keep them within the bounds of the desktop" API. (i.e. X11's decision that games and control panels use the same resolution-changing API that's not tied to the lifetime of a window.) |
@ssokolow Godot never attempts to change the screen resolution, so this shouldn't be an issue in the current state of things. Still, Wayland has many other benefits. |
Oh, certainly. It's more that so many other games screw that up, or misbehave when they discover that I've removed standard resolutions like (eg. The game Dungeons of Dredmor will refuse to accept any windowed resolution that's not a valid fullscreen resolution. I've been meaning to write an SDL |
Earlier this week I read the updates in the X11 display server progress report article which does mention Wayland being "still not widely used". Meanwhile today in this article: It's Time To Admit It: The X.Org Server Is Abandonware there are various snippets that give an idea of current state of play for Wayland and X11. Notably they mention that Ubuntu 21.04 may well be the version that defaults back to Wayland. Currently Fedora, RHEL since version 8 and Debian since version 10 I believe all default to Wayland over X11. With Ubuntu possibly joining them next year I'm not sure that "still not widely used" is entirely accurate :) Posting to provide the second article above (which has links to relevant conversations) as evidence really. |
Keep in mind that on NVIDIA graphics cards, those distributions' installers or session managers will often fall back to X11 by default. Also, with WINE still not having official native Wayland support, Linux gamers are likely to keep using X11 for a while. (WINE gaming makes for a large share of popular games currently playable on Linux after all.) |
Just adding actual data to the conversation. It's great that things are progressing, but the current state seems to be that most gamers are on X11: So I don't think it's exaggerated to state that Wayland is not widely used at the moment. That said, now that the X11 display server is in a better shape, contributions for Wayland support are welcome :) |
The distribution statistics in there are worth looking at too with most being Ubuntu based. If Ubuntu does indeed jump with 21.04 then there would be a fairly big swing fairly quickly potentially. Either way, more than happy to help test/debug Wayland support :) |
Most Ubuntu users stick to LTS versions nowadays. Non-LTS Ubuntu versions are becoming increasingly less popular over time, especially since getting recent applications working on LTS distributions is now easier than it has ever been. Therefore, we'd have to wait until Ubuntu 22.04 is released1 to see any substantial difference. Footnotes
|
Quiet funny, 2 users reported they use Cinnamon as their Wayland Desktop although Cinnamon doesn't support Wayland (see here and here). I would love to see native Wayland support but I have to admit nVidia recently submitted patches to support hardware accelerated rendering under XWayland, with performances "roughly on-par with native X11". Yet another argument to say that Wayland support is not that critical by now 🤷. Probably at least not before godotengine/godot#37734 . |
Ubuntu 21.04 will indeed default to Wayland, paving the way for 22.04 LTS. Nvidia users will still default to Xorg for now ("but hopefully that situation will be resolved before the LTS") 😃. |
https://www.gamingonlinux.com/2021/04/xwayland-work-for-hardware-accelerated-nvidia-support-has-been-merged-in - sounds like it'll be ready for Nvidia users on Ubuntu by 21.10 (assuming they don't release a point update for 21.04 with it), so high probability for 22.04. |
I’m currently running ubuntu 21.04 and it defaults to Wayland. |
how? WE NEED WAYLAND SUPPORT |
Godot 3.x and If you run into issues on XWayland but not native X11, please report them to the XWayland developers first. If (and only if) it turns out to be something that can't be fixed at a XWayland level, please report them on the main Godot repository. |
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
Hi! I'd be glad to implement this. I already got a very basic working prototype. EDIT: Just to be clear, by very basic I mean that it can resize itself properly in single-window mode and that it can (as of very, very recently) handle just pointer motions and its left click. I started it just a few days ago. Sorry for any misunderstanding that I might have caused. |
Would you mind sharing a link? 🙏 |
Will work on this also implement HiDPI awareness on Linux? |
@snoopdouglas this is definitely planned, but Wayland has a really weird approach with scaling that will probably require some core changes (not sure, I'm not a rendering person). Basically you get a window which is, for example assuming scale 2, half the resolution but twice the size. How do you get crisp graphics then, you might ask? Through some sort of "supersampling", by sending a buffer that's twice the resolution (but with the same half-sized coordinate system). I don't know if I've been clear enough, but this requires something very similar (AFAIK) to the text supersampling option in Godot, and doesn't sound very trivial to implement properly. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@HalanoSiblee Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
@HalanoSiblee Wayland still very problematic in general, even XFCE lacks wayland support until now. |
Supposedly KDE Plasma Wayland works for Nvidia users (with a handful of remaining limitations, see the Nvidia section of the Plasma Wayland showstoppes), but AMD and Intel GPUs work fine for gaming on Wayland. I have been using Plasma Wayland for gaming for well over a year on my 5700XT, and on a couple of Intel laptops, specifically for a mixed-scaling and mixed-refresh-rate setup. Some desktop environments, such as KDE, are moving to Wayland as the default. Of course, distributions can still override this like Ubuntu do/did with GNOME. Native Wayland support may gain more interest as a result of this though, mainly for mixed-scale users where KDE's X11 scaling option doesn't help, and XWayland apps are blurry. Other DEs may suffer similar issues as well. |
Note that native Wayland support doesn't automatically mean good scaling. As far as I know proper Wayland scaling implies some deeper changes in the renderer which I haven't really investigated yet. |
Indeed, usually the desktop toolkit takes care of this (GTK, Qt) and/or the underlying tech stack (Chromium for Electron apps) but in Godot's case that won't apply. I believe Wine's Wayland support is also in the same boat as requiring additional work in this regard. Wayland support is a step in the right direction for scaling support, though, as afaik this kind of mixed-scale stuff can't really be done cleanly on the application side under X11. |
Yup, having a Wayland backend will already improve the situation considerably for users in general. |
Possible idea for a slightly more out-there feature that I wish that at least one game engine supported: being able to have Wayland windows float inside a Godot game, essentially using Godot as a window manager. This is primarily useful for VR productivity applications. VR headsets have the very real potential to be the form factor of the future, combining portability with theoretical maximum screen real estate. The issue has been on the software side, with all headsets so far being completely consumer focused, and my ideal would be to just have a linux distro that uses a game engine acting as the WM. |
Godot is cross-platform. If it was going to work as a Wayland compositor, I would think that it would have to have similar functionality for Windows, Mac, and others. That seems quite infeasible. That being said, Wayland is not a particularly complicated protocol. I don't know what kind of FFI Godot has, but I suppose that it might be possible to implement some kind of plugin for Godot that uses wlroots or something to enable running a compositor in a game. |
This comment was marked as off-topic.
This comment was marked as off-topic.
https://www.gamingonlinux.com/index.php?module=statistics&view=trends#SessionType-top EDIT: wow I didn't see how far along the PR is, that's awesome :) |
Silly question. Why not just add SDL to Godot? It can help with running on Wayland natively. Many game engines (Unreal, Unity, Source, It Tech) use it, so it's defacto a standard. |
There has been some discussion in godotengine/godot#16470 quite some time ago for SDL (platform middle layer) and a similar discussion related to bgfx (rendering middle layer) over at godotengine/godot#19602 In short, from what I can tell, it looks like it's not worth it due the fact that platform-specific workarounds will be needed anyways due to how much we integrate with each one. AFAIK, the game engines you've listed have a way simpler integration and probably have way less resources in their platform team than us, so in that case it's not a bad idea over there, but here we already have lots of working backends and a very big API of our own. |
That's a shame. The number-one thing I value SDL for is something Godot fundamentally cannot replicate... the adoption by people like Valve as a means to inject updated platform support (Wayland, PipeWire, GNOME windeco, etc.) into statically linked games which have been abandoned by their developers via the (That feature Ryan Gordon implemented where SDL's |
@ssokolow Yeah, that's a really nice feature. I was able to run old game (DEFCON) on wayland natively by just using sdl12-compat layer. SDL really did a great job with the backward compatibility. |
Considering there's talk of xorg being deprecated in the next few years, I think that having good Wayland support is becoming more and more urgent. Especially considering how many DEs are taking a wayland-first approach now or coming up. |
Yes that is true, notable plans are
Some stuff related to gaming
|
Wayland support is becoming more important as X11 is effectively a dead project. Godot is suffering from critical issues like godotengine/godot#75308 because of this. At this point it might be worth considering having Godot a not fully featured Wayland implementation available, so that X11 bugs, that nobody is likely to touch, don't prevent people from working and having their projects running. |
@Leshy-YA we already have a WIP backend over at pr godotengine/godot#57025. It's planned to be merged in 4.3, so it's only a matter of time, don't worry! |
Describe the project you are working on:
Godot's platform ports.
Describe the problem or limitation you are having in your project:
None directly as X11 still works decently on recent Linux distros, but we need to add support for the more modern Wayland display server eventually.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Wayland is a newer, more modern display server that can be used on Linux and likely some BSD-derived OSes too (now or in the future).
Many Linux distros / DEs now run on Wayland by default, and Godot only works thanks to the
xwayland
compatibility layer.Having builtin Wayland support will give us access to a much cleaner API as well as more advanced features for window management, etc.
Supersedes godotengine/godot#576 - see discussion there for relevant technical details.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
I'm not an expert on Wayland so I'll let others fill in and explain what are the gains we can expect from having built-in Wayland support.
From a technical implementation point of view, the following points are important:
master
branch, and thus Wayland support can be implemented for Godot 4.0. There's no intention to backport it to earlier releases.dlopen
-ed so that the same binary can be used on systems with only X11, only Wayland, or both installed.If this enhancement will not be used often, can it be worked around with a few lines of script?:
No.
Is there a reason why this should be core and not an add-on in the asset library?:
This can only be done in core.
The text was updated successfully, but these errors were encountered: