Feedback

type to search

How to set the DPI of the display?

Asked by [ Editor ] , Edited by Helmut Grohne [ Editor ]

How are DPI settings managed by Xorg?


There are at least two tools to retrieve the DPI value for the screen. One is xrandr and the other is xdpyinfo. While randr only displays the physical screen dimension xdpyinfo displays both DPI and physical screen dimension. The interesting thing is: These utilities do not necessarily print the same values! Why?

How to set the DPI value?


My monitor seems to be too old for providing a usable EDID, so I have to set the physical screen dimension myself. I thought that this was to be done using DisplaySize in xorg.conf, but this is not the case. During startup Xorg later decided to choose a different value overriding my configured value.

Further observations

that the DPI setting can be changed during runtime using xrandr --dpi. It gets a bit confused if you set the DPI to the current DPI (in belief of xrandr) and does not update the DPI setting (for xdpyinfo). If you however change the DPI setting it updates both settings (xrandr and xdpyinfo).

Also note that applications use the setting xdpyinfo displays. For instance evince adjusts "100%" to this setting.

Also note that this does not depend on the video driver. This behavior can be reproduced with nouveau and intel.
NN comments
or Cancel

2 answers

0

hadret [ Moderator ]

I'll start from the end of your question:

Also note that this does not depend on the video driver.

It partially does. For example, when using NVIDIAs proprietary driver, you can set DPI in /etc/X11/xorg.conf (in "Monitor" section) -- using this option, you don't have to set dpi in xrandr and xdpyinfo should show you correct value. I don't know whether different drivers allow you to do the same, as I'm not using them, but it's worth looking for it.

The interesting thing is: These utilities do not necessarily print the same values! Why?

I don't know "why", however I know one thing: xdpyinfo is the most important as it's real DPI setting. I'm not perfectly sure, but, as far as I remember, nvidia-settings (again: proprietary driver) display values from xdpyinfo. So the rule is simple: if you've got correct DPI displayed in xdpyinfo, you should set the same one in your desktop environment. That's all.

Recapitulate: check in xdpyinfo DPI settings. If it has correct value, set correct one in your DE. If it has incorrect value, try to set it in /etc/X11/xorg.conf. If that doesn't work, try to force DPI when Xserver is starting, for example: startx -- -dpi 96. Setting this might be different depending on using or not any login manager (GDM, KDM, SLiM etc.) -- but in all of them it's possible to add flag with DPI setting.

I hope this at least partially answered your question (:

NN comments
helmut
-

Thanks for your effort.

On nvidia: The proprietary driver does not work like X11 is intended to work in quite some areas. Afaik it still works around xrandr and don’t even try to think about KMS. So it is a particularly bad example for a video driver.

On xdpyinfo showing the useful value: This was my second last comment in my question.

On setting in the DE: fluxbox? How does your DE communicate that value to X11? Using xrandr? I already pointed out the problems with that method.

On setting in xorg.conf: Doesn’t work, see question.

On startx — -dpi: Will try.

or Cancel

Your answer

You need to join Debian to complete this action, click here to do so.