Making Wayland Game-friendly

Luke Benstead kazade at
Tue Nov 9 01:54:24 PST 2010

> > Basically, xrandr is designed under the assumption that a resolution
> change
> > is permanent, or at least semi-permanent (e.g. until reboot or manual
> switch
> > back) and system wide. The problem is that games (as an example) require
> a
> > temporary resolution change that is associated with a single window. What
> I
> > mean by this is that when a game initializes it sets the resolution
> (through
> > SDL, X, Win32 on Wine etc.) and this is frequently a resolution below
> native
> > normally for performance reasons (e.g. your PC may not like running Alien
> > Arena at full HD, but it will run perfectly well at 1024x768).
> >
> > Ideally, if that game then crashed, or someone ALT+TAB'd to a different
> > window, the native resolution would be restored. If the user then
> switched
> > back to the window, then the game's resolution would be restored. On
> > Windows, it's possible to pass a temporary flag to the Win32
> > ChangeDisplaySettings()* function for this behaviour.
> Could you elaborate on how Windows handles this?

I don't know much about what it does under the hood, but there is a little
more information here:

The general idea is that it:

1. Restores the native resolution when the application exits
2. Restores the native resolution when the application window loses focus
3. Goes back to the non-native resolution when the window gains focus
4. Doesn't reorganize the desktop etc. (e.g other applications don't get a
5. If the window loses focus, it is minimized automatically.

> > At the moment, if a game crashes (either native, or run via Wine) on X
> you
> > are left with a low resolution and have to find your way to the Monitor
> > control panel to set it back. Which is obviously not ideal.
> >
> > So, basically I'm hoping that Wayland can fix this issue by allowing a
> > resolution change to be associated with a single window.
> Could you expound on how you think Wayland should behave in this
> situation?
> Bryce

I think basically, similar to windows. So, in the API call that sets the
resolution, allow an optional parameter which takes the ID of the window. If
the window does not have focus (or ceases to exist), restore the previous
resolution. I don't really know how Wayland works so I can't really suggest
much more than that.

I do have another idea, but whether it would work in practice I'm not sure,
so I'll just throw this out there. What if, instead of changing the native
resolution, Wayland allocated an off-screen buffer of the requested
resolution. As far as the app is concerned it's rendering to a fullscreen
window at the requested res, but then Wayland scales the offscreen buffer
and blits it to the screen. If the window loses focus then it's minimized.
(I know we are sort of stumbling onto WM territory here, I'm not really sure
how to handle that. Perhaps it doesn't need to be minimized just displayed

Sorry if I'm talking rubbish, I only have basically knowledge of how this
stuff works.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the wayland-devel mailing list