How to support mixed DPI in Xwayland?

Olivier Fourdan ofourdan at redhat.com
Thu Sep 7 16:17:27 UTC 2017


Hi all,

For quite some time now [1] we've been trying to figure out a way to have
mixed DPI, both non-HiDPI capable X11 clients (e.g. xterm) and HiDPI aware
X11 clients coexists on Xwayland.

Typically, the compositor would scale the surface for xterm when on a HiDPI
monitor, but would leave another HiDPI aware client's surface unscaled to
achieve best results (as the client is HiDPI aware).

Problem, when scaling up the client buffer, the Xwayland screen size needs
to be scaled down accordingly, so that a client wishing to size or locate
its toplevel window based on the output size gets the correct size and
location once the surface is mapped on screen by the compositor.

So, we need to advertise different screen sizes (via Width//HeightOfScreen(),
Xrandr, Xvidmode, whatever) to different clients, depending on whether or
not those clients are HiDPI capable.

During GUADEC, we had some discussions with Jonas and Carlos, involving
Peter as well trying to evaluate the level of insanity of the various
solutions being considered.

One solution was to have two different "Screens" (in X11 terms) coexisting,
with a new X11 extension in place so that HiDPI aware clients would connect
to a screen that advertise the HiDPI "version" of the screen whereas the
no-HiDPI aware would connect to a different screen of the same display.

But we dismissed that solution, having different X11 screens is not very
practical, mutter does not support multiple screens for a start, and 
things like drag'n drop, copy/paste, root properties, etc. all would
become quite complicated very quickly when dealing with multiple screens...

The other solution would be to have the same screen, but have Xwayland to
give different scaling conversions for root window size, screen size, events
coordinates, etc. depending on the client, if it's HiDPI aware or not,
some sort of a "hidden" screen.

Ajax, Keith, what's your take on such an approach, is that even doable based
on your knowledge of the Xserver internals? Or do you see any better/simpler
idea?

Cheers,
Olivier

[1] https://bugs.freedesktop.org/show_bug.cgi?id=93315


More information about the wayland-devel mailing list