How to fix screen-resolution detection?

Alan Stern stern at
Sun Jan 9 02:51:19 UTC 2022

On Sat, Jan 08, 2022 at 11:38:47PM +0100, Jan Engelhardt wrote:
> On Saturday 2022-01-08 20:57, Alan Stern wrote:
> >The screen resolution on my laptop is not reported accurately.  Here's 
> >an extract from the output of xdpyinfo (under Xwayland):
> >
> >screen #0:
> >  dimensions:    3200x1800 pixels (847x476 millimeters)
> >  resolution:    96x96 dots per inch
> >
> >The number of pixels is correct, but the size and resolution values 
> >smack of a bogus default.
> The way I remember it:
>  1. Xorg(!) would read EDID once on startup, and set the DPI value
>     based on it. // Or you have your environment set to a fixated
>     DPI value, then that is used.
>  2. millimeter numbers reported afterwards through X are not
>     EDID-based, but simply area size divided by DPI.
> As such, I have, for example:
>   dimensions:    1920x1080 pixels (508x286 millimeters)
>   resolution:    96x96 dots per inch
> on both a 12" and a 13" laptop.
> Now, the DPI value has been fixated at 96 recently again -
> because, in summary, you cannot determine a sensible global DPI
> value if a system has two or more monitors of different pixel
> density. Either the font is too small or too big for either screen.
> (And the only way to truly have separate DPI values per monitor
> might be a Xinerama-style setup where each monitor is its own
> independent X (sub)screen object, hence DISPLAY=":0.0".)
> And Wayland probably just behaves the same as Xorg, for the same
> reasons.

Thanks for your help.

I wonder if that is really the whole story, though.  On systems with a 
single monitor, why not determine an accurate DPI value?

For that matter, on systems with multiple monitors, why not use the DPI 
value of the first as a global value?  It can't be any worse than using 
96 DPI for everything.

Alan Stern

More information about the wayland-devel mailing list