Xwayland and weston’s scale=2 (hi-dpi display)

Jonas Ådahl jadahl at gmail.com
Sun Nov 8 18:10:41 PST 2015


On Sat, Nov 07, 2015 at 09:48:59PM +0100, Michael Stapelberg wrote:
> Hey,
> 
> I just got around to trying Wayland on my ThinkPad X1 Carbon 2015.
> 
> The machine has a 2560x1440px display with 220 DPI, hence I’m using it as a
> “retina display”, i.e. with a scale factor of 2. On Xorg, I achieve this by
> setting “Xft.dpi: 192” in my ~/.Xresources. All the applications then come
> up with crystal-clear text, in comparison to a regular 96 dpi screen at
> least… :)
> 
> When running weston without a ~/.config/weston.ini, everything is rendered
> with the native resolution of 2560x1440px, meaning the text is unreadably
> small (see the left weston-terminal window in
> http://t.zekjur.net/xwayland-scale-1-x.png).
> 
> Therefore, I’ve set the following in my ~/.config/weston.ini:
> 
>   [output]
>   name=eDP-1
>   scale=2
> 
> This is recommended on
> https://wiki.archlinux.org/index.php/Wayland#High_DPI_displays, but I’m not
> sure if it’s actually the best method or the desired end state of hi-dpi
> support in wayland/weston. My uncertainty stems from the fact that while
> text in weston-terminal is rendered clearly, all assets (icons, mouse
> cursors) are low-resolution, even though higher-resolution versions are
> available.
> 
> For the actual issue I’m trying to describe, my test procedure is to use
> “xrdb ~/.Xresources && urxvt”, then place the urxvt window such that it
> occupies about half of the screen.
> 
> With scale=2 (see http://t.zekjur.net/xwayland-scale-2-x.png), I get a
> window with about 640px width in xwininfo and an extremely big font. I
> suppose this is because the Xwayland window (is that how it works?) is
> scaled to 2x.
> 
> With scale=1 (see http://t.zekjur.net/xwayland-scale-1-x.png), I get a
> window with about 1280px width in xwininfo and the font I expect.
> 
> So, it seems to me that I have to use scale=2 to get wayland apps to render
> correctly on a hi-dpi screen, and scale=1 to get xwayland apps to render
> correctly on a hi-dpi screen, and I obviously can’t do both at the same
> time.

Pretty much. weston pretty much assumes that X11 clients are simply just
not HiDPI capable, and will just scale up as if it was a Wayland client,
and this produces this result.

As a side note, in mutter we currently don't scale up Xwayland client
surfaces because of this reason; in GNOME, clients tend to be rendered
with respect to the DPI (i.e. at double the scale if the DPI is high
enough), and since the X server has no clue about the scale in use, it
will always set the buffer scale to 1. Pointer cursors has the same
issue; the X side of things might be aware of it (but without the actual
X server having any idea of what's going on).

An issue with this is that non-DPI-aware X clients will look very tiny;
but this since that wasn't really a regression from before, we are
currently living with it. Another issue is that even though the display
server is aware of each monitor's individual DPI, X11 windows will not
adapt their size to the monitor.

A possible way to deal with this in the future is to add per window
properties specifying the scale the client actually drew its content
with, an X11 equivalent of wl_surface.set_buffer_scale more or less.
This might be problematic though because of race conditions and what
not, and I'm not aware of it being tried out anywhere.

> 
> Shall I file a bug about this, or am I misunderstanding something?

Feel free to report one. I took a quick look, but couldn't see any
existing bug in the fdo bug tracker which covers this.


Jonas

> 
> Thanks,
> Best regards,
> Michael

> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel



More information about the wayland-devel mailing list