Display Size

From MythTV Official Wiki
Jump to: navigation, search

DisplaySize tells X11 and X11 widgets and applications how large your screen is physically, in millimeters. You can simply measure your monitor/TV with a ruler (but make sure that it's exactly 16:9 or 4:3, depending on your monitor), or calculate it.

Together with the pixel size (e.g. 1280x1024 or 1920x1080), this allows to calculate the "dpi" (dots per inch) value, i.e. how many pixels there are on a physical screen area, which is important to know how large something will physically appear on the screen. Different values will cause text fonts in some programs (not MythTV) to be rendered at different sizes, as X will typically calculate the display pitch/dpi based on the video output resolution and the DisplaySize. Generally, configuring your display such that X thinks it's 100x100DPI will cause other applications to render at a size that's readable from your viewing position (i.e. for xterm's, browsers, ...).

MythTV requires that you configure X to report a DisplaySize whose aspect is the same as your TV or monitor's physical aspect ratio. Therefore, if you have a 16:9 widescreen TV, you should configure the DisplaySize such that the ratio of the first number to the second is 16 to 9 (i.e. "DisplaySize 16 9", "DisplaySize 32 18", "DisplaySize 160 90", "DisplaySize 320 180", "DisplaySize 1280 720", or whatever). For a "normal" standard-definition display, specify a 4:3 ratio. For a widescreen computer monitor, the ratio could be either 16:9 or 16:10. You may find the ratio by simply measuring the width and height of the physical display. Note that this ratio is not necessarily related to the ratio of your X and Y resolutions (it will be only if your display has square pixels).

Note that some video drivers provide other means to specify the DPI that may override the settings you configure with DisplaySize (i.e. as do the NVIDIA drivers--see Specifying_DPI_for_NVIDIA_Cards for more information). Note, however, that if you do specify your display pitch using something other than DisplaySize, you'll have to ensure that the calculated DisplaySize has the appropriate aspect. Therefore, it makes the most sense to specify DisplaySize directly (and leave out other options, such as NVIDIA's DPI option).

Checking your Configuration

You may find your current X configuration using:

xdpyinfo | grep -B2 resolution

which will give output such as:

screen #0:
  dimensions:    1920x1080 pixels (488x274 millimeters)
  resolution:    100x100 dots per inch

Note that the dimensions in millimeters are "488x274 millimeters". The ratio of these dimensions (488 / 274 = 1.781) is approximately equal to the proper ratio for a 16:9 physical display (16 / 9 = 1.778). Note that the value is unlikely to ever match, exactly, as rounding errors will prevent it from ever being exact. However, as long as it is very close to the physical aspect of the TV/monitor, MythTV and X will do the right thing. If the ratio is not very close to the physical aspect, you must configure X properly or your video will not display properly in MythTV (or any other application).


X will normally attempt to probe the monitor during initialization in an attempt to find out its actual size using EDID, but some monitors respond with incorrect information, and most televisions don't respond to EDID queries at all, making it sometimes necessary to manually set this information in your X config file using the DisplaySize directive. If xdpyinfo reports that your display is using something other than 100x100 DPI, you can use the DisplaySize directive to fix it.

Each Monitor section in your X configuration file (/etc/X11/XF86Config or /etc/X11/xorg.conf) should contain a DisplaySize entry like below:

Script.png /etc/X11/xorg.conf

Section "Monitor"
    Identifier  "Television"
    VendorName  "Wombatronic Industries"
    ModelName   "Colormeister 5000"
    HorizSync   30 - 50
    VertRefresh 60

# For 2560x1600 at 100dpi  (16:10)
#    DisplaySize  650 406
# For 1920x1200 at 100dpi  (16:10)
#    DisplaySize  487 304
# For 1680x1050 at 100dpi  (16:10)
#    DisplaySize  426 266
# For 1440x900 at 100dpi  (16:10)
#    DisplaySize  365 228
# For 1280x768 at 100dpi  (16:10)
#    DisplaySize  325 195
# For 1920x1080 at 100dpi  (16:9)
#    DisplaySize  487 274
# For 1920x1080 - 1080p 46" TV ~ 1030mm x 580mm
#    DisplaySize  1024 576
# For 1360x768 at 100dpi  (16:9)
#    DisplaySize  345 195
# For 1280x720 at 100dpi  (16:9)
#    DisplaySize  325 182
# For 1600x1200 at 100dpi (4:3)
#    DisplaySize  406 304
# For 1400x1050 at 100dpi (4:3)
#    DisplaySize  355 266
# For 1280x960  at 100dpi (4:3)
#    DisplaySize  325 243
# For 1024x768 at 100dpi  (4:3)
#    DisplaySize  260 195
# For 800x600 at 100dpi  (4:3)
#    DisplaySize  203 153
# For 640x480 at 100dpi  (4:3)
#    DisplaySize  162 121


Uncomment (remove the pound symbol/hash at the beginning of the line) the DisplaySize line matching the resolution you're going to be using on that display. It is important that you choose a DisplaySize whose aspect matches that of your physical Display; otherwise, Myth will be unable to display video using the proper aspect ratio. The aspect ratio must be correct--regardless of the resolution you're using. Verify your configuration, again, after restarting X if you made any changes.

Calculating your own values

If you have non-square pixels on your device (i.e. if the ratio of your physical display's dimensions is different from the ratio of your X and Y resolution), and you would like to run X at about 100DPI (to size fonts appropriately in programs other than MythTV), you will need to set either vertical or horizontal pitch to 100DPI and calculate the other based on your physical display's dimensions. Generally, you should choose to use 100DPI vertical pitch.

So, for example, if you're using a 16:9 CRT TV using TV out at 800x600, to choose to use 100DPI vertical pitch, you should start with the size specified above ("DisplaySize 203 153"), but calculate the first value based on the TV's aspect ratio. To do so, divide 153 by 9 and multiply by 16 to get 272. Therefore, you would use the line

  1. For 800x600 at 100dpi (16:9)
   DisplaySize  272 153

Note, also, that a 4:3 monitor using 1280x1024 pixels (5:4) is using non-square pixels.

See also the FAQ for more details and for information about setting DPI when using NVIDIA drivers.

If your display is using a resolution not listed above, it's very easy to compute the values you need for DisplaySize. Use "DisplaySize x y" where

x = (horizontal resolution)*0.254


y = (vertical resolution)*0.254

both rounded to the nearest integer. Again, the physical display's aspect ratio should be considered for non-square pixels.

For 1024x768, this would be

x=1024*0.254, or x=260


y=768*0.254, or y=195

so you would use "DisplaySize 260 195".


The Mythbuntu distribution erroneously forces DPI to 100x100 in their gdm configuration. This causes all your hard work above to be ignored, so fix it by removing the "-dpi 100" argument from this file.



Newer X servers using XRandR (starting with xorg 1.7) override the DPI reported in xorg.conf with the above settings for many aspects of the system, including the value that MythTV is given. If you have this then

 xdpyinfo | grep -B2 resolution

Will give 96x96 dots per inch no matter what you set in the xorg.conf. This affects NVidia cards as well, even if you use the NVidia settings detailed elsewhere. This decision was made to benefit those using projectors and monitors where the true DPI figure takes no account of the expected viewing distance, and would lead to unexpected (to most users) scaling of the screen. This is generally works OK for MythTV except where there are non-square pixels. In that case the command

 xrandr --fbmm (horizontal mm)x(vertical mm)

Will set the correct aspect ratio and DPI.

The command for the for 800x600 at 100dpi(16:9) example worked above would be

 xrandr --fbmm 272x153

This command needs to be set to execute either on session startup, or before starting the MythTV Frontend

See also