You can learn the native resolution of your LCD display by using the edid-decode
utility to decode the monitor's EDID data.
sudo apt install edid-decode
The native resolution (i.e. exactly how many pixels the display actually has) is important because, first, it is not possible to select a higher resolution, and second, if you select a lower resolution the display will either place black bars around the displayed image (which looks bad) or try to interpolate pixels to stretch the image (which looks even worse).
To use it, you will need to get the paths for your display's EDID, which are exposed in sysfs. You can use find
to find them. For example:
$ find /sys/devices -name edid
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1/edid
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/edid
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-2/edid
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-2/edid
/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-1/edid
One will be listed for every display port the system thinks it has (even some that don't physically exist). For your laptop, the built in display will usually be eDP-1
. An external monitor may be connected to an HDMI
port or a DP
port, depending on what your laptop's ports actually are.
Run edid-decode
on each of these to decode their data, and look in the Block 0, Base EDID:
section under the Basic Display Parameters & Features:
subsection for a message about the First detailed timing
. For example, from my laptop's screen:
$ edid-decode /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/edid
....
First detailed timing includes the native pixel format and preferred refresh rate
Or, from my external monitor:
$ edid-decode /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1/edid
....
First detailed timing is preferred timing
You can then look at the Detailed Timing Descriptors:
in the same Block
to see the native resolution. For example, my laptop's screen shows:
Detailed Timing Descriptors:
DTD 1: 1920x1080 60.056 Hz 16:9 67.143 kHz 141.000 MHz (344 mm x 193 mm)
My external monitor shows:
Detailed Timing Descriptors:
DTD 1: 1920x1080 60.000 Hz 16:9 67.500 kHz 148.500 MHz (476 mm x 268 mm)
My external monitor also has a Block 1, CTA-861 Extension Block:
with additional Detailed Timing Descriptors listed. You can ignore such a block for this purpose.
If there is nothing connected to the port, you will just get an error. For example:
$ edid-decode /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-1/edid
EDID extract of '/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-1/edid' failed