Red Hat Bugzilla – Bug 1289714
find a solution for XWayland games trying to set display resolution
Last modified: 2017-07-01 18:21:45 EDT
This is the year or Linux gaming. We now have thousands of games available for Linux thanks to Steam, and Steam machines running SteamOS (Linux) are sold worldwide. All of those games out there are X11-based. Some of them will get updated for Wayland, but most never will. If we want to push Wayland as the default display technology, we need to make sure those games work.
One of the core issues is display resolution. Game developers and players are used to games changing their display resolution (especially 3D games) in order to achieve satisfactory performance. That is no longer possible in Wayland, and there are good reasons for that, and solutions (scaling the ouput). However, we also need a solution for XWayland games, which is the majority.
Under XWayland, there seems to be only a single resolution available when querying display through xrandr - the current resolution - and no custom resolution can be set.
According to my short testing, there are several ways how games currently cope with that (all of this covers fullscreen behavior only, I haven't seen any issues when running in a windowed mode):
A) Run in a letterbox fixed to a single resolution - the game in enclosed in black bars around the screen (corresponding to the game's default resolution), no change can be made
B) Run in a letterbox, but allow different resolutions to be set, adjusting letterbox - different resolutions change the rendering size and the size of the black bars around it
Examples: Extreme Tux Racer, Battle for Wesnoth
C) Run in a desktop resolution - you can either see desktop resolution as the only available resolution, or you can see other resolutions available, but nothing happens when you try to set it, you stay fixed to the current one. This is basically the same case as A), only the game default resolution seems to be your desktop resolution. Internal game logic probably differentiates A) and C).
Examples: 0 A.D., Xonotic, Supertuxkart, Neverball
D) Run scaled in a desktop resolution - only single resolution is available, but the game output is scaled as opposed to letterboxing
E) Use internal scaling instead of relying on system resolutions - this is what some modern games do. Instead of changing the monitor resolution, keep it intact, just adjust the internal rendering resolution and then either scale up the output or display a smaller game area.
Examples: Pillars of Eternity, Gnomoria
F) Crash - when configuring the game in the better case, on startup in the worst case
Examples: Minecraft (according to bug 1287864, not tested)
Only E) is the ideal solution for users of Wayland desktop. A) and B) make the game screen small or tiny, C) and D) don't allow to tune the game performance to available hardware.
There is a simple yet tiresome workaround for B) and C) - switch desktop resolution manually to a desired size, run the game, switch resolution manually back afterwards. I don't know about any workarounds for A), D) and F).
Please try to find a solution for this. If we can't make the crushing majority of games work, Wayland will not convert a large portion of our user base (anyone who sometimes plays a game), they will stay with X11.
For example, could we fake the resolution list for XWayland apps and if they try to set a custom fullscreen resolution, could we tell them it succeeded, but scale their output instead? (similarly to what we intend to do with Wayland-based games)
*** Bug 1286217 has been marked as a duplicate of this bug. ***
(In reply to Kamil Páral from comment #0)
> F) Crash - when configuring the game in the better case, on startup in the
> worst case
> Examples: Minecraft (according to bug 1287864, not tested)
Bug 1287864 is a bug in Minecraft itself, not something we can fix.
(In reply to Olivier Fourdan from comment #2)
> Bug 1287864 is a bug in Minecraft itself, not something we can fix.
Actually, a workarround for this was just added to Xwayland, included in xserver 1.18.3 so Minecraft should start in Wayland now (upstream).
This is still an issue in F25 (e.g. with openarena I can't change its resolution at all).
Well, for games using Xwayland this feature was denied:
That comment said it should be implemented in mutter, not Xwayland.
(In reply to Olivier Fourdan from comment #5)
> Well, for games using Xwayland this feature was denied:
Yes, and I understand why. However, the purpose of this ticket was whether we can find a different solution to this (because X11-based games will be with us for a long time still). For example:
(In reply to Kamil Páral from comment #0)
> For example, could we fake the resolution list for XWayland apps and if they
> try to set a custom fullscreen resolution, could we tell them it succeeded,
> but scale their output instead? (similarly to what we intend to do with
> Wayland-based games)
Is that doable (or something similar)? Is there a will and time to implement it?