Appendix W. Dots Per Inch

DPI (Dots Per Inch), also known as PPI (Pixels Per Inch), is a property of an X screen that describes the physical size of pixels. Some X applications, such as xterm, can use the DPI of an X screen to determine how large (in pixels) to draw an object in order for that object to be displayed at the desired physical size on the display device.

The DPI of an X screen is computed by dividing the size of the X screen in pixels by the size of the X screen in inches:

    DPI = SizeInPixels / SizeInInches

Since the X screen stores its physical size in millimeters rather than inches (1 inch = 25.4 millimeters):

    DPI = (SizeInPixels * 25.4) / SizeInMillimeters

The NVIDIA X driver reports the size of the X screen in pixels and in millimeters. On X.Org 6.9 or newer, when the XRandR extension resizes the X screen in pixels, the NVIDIA X driver computes a new size in millimeters for the X screen, to maintain a constant DPI (see the "Physical Size" column of the `xrandr -q` output as an example). This is done because a changing DPI can cause interaction problems for some applications. To disable this behavior, and instead keep the same millimeter size for the X screen (and therefore have a changing DPI), set the ConstantDPI option to FALSE (see Appendix D, X Config Options for details).

You can query the DPI of your X screen by running:

    % xdpyinfo | grep -B1 dot

which should generate output like this:

    dimensions:    1280x1024 pixels (382x302 millimeters)
    resolution:    85x86 dots per inch

The NVIDIA X driver performs several steps during X screen initialization to determine the DPI of each X screen:

You can find how the NVIDIA X driver determined the DPI by looking in your X log file. There will be a line that looks something like the following:

    (--) NVIDIA(0): DPI set to (101, 101); computed from "UseEdidDpi" X config option

Note that the physical size of the X screen, as reported through `xdpyinfo` is computed based on the DPI and the size of the X screen in pixels.

The DPI of an X screen can be confusing when TwinView is enabled: with TwinView, multiple display devices (possibly with different DPIs) display portions of the same X screen, yet DPI can only be advertised from the X server to the X application with X screen granularity. Solutions for this include: