Skip to content

Instantly share code, notes, and snippets.

@amr3k
Forked from hinell/Fix Broken EDID Guide.md
Last active October 29, 2024 17:43
Show Gist options
  • Save amr3k/94bbd4546a2efa9bdfaae5476b999330 to your computer and use it in GitHub Desktop.
Save amr3k/94bbd4546a2efa9bdfaae5476b999330 to your computer and use it in GitHub Desktop.
Guide how to achieve better resolution with broken EDID. Two methods are used: xorg.conf config and kernel params.

Fix Broken EDID Guide

This guide outlines replacement of the broken EDID metadata file for the device in Linux Operating Systems.

Last-Modified: Sunday, April 11, 2021

• • • • • •

Intro

If your Linux Operating System can't configure expected display resolution one of the issues is probably corrupted EDID metadata file that your system fetch from display controller board every time it's connected.

Diagnostics may show EDID doesn't match specs of the display devices specified by the manufacturer. That's exactly the issue we are going to solve here.

In this guide we will take as an example the following old dispaly with broken EDID: BenQ G2000W - LCD monitor - 20.1"(mfr. 2008).

Prerequisites

This guide assumes you are working under Linux Operating System. The chances are that there is a editor for your EDID metadata so you can try to find one and edit your EDID file. (note that the EDID file format is a crossplatform one).

Install package read-edid:

$ sudo apt-get install read-edid

Use the get-edid command to get actual information about EDID monitor output:

$ sudo get-edid -b XYZ | edid-decode

Where XYZ is digit specifying bus name e.g. 0,1....

BenQ G2000W case

In this case we have the BenQ G2000W monitor with broken EDID metadata. Step by step we will fix its display resolution modes.

EDID Troubleshooting

In order to spot wrong EDID you have to match original specs of your display with get-edid command output. If your resolution listings don't match, then probably you have incorrect EDID.

Example of the corrupted BenQ G2000W EDID output:

$ edid-decode < /sys/class/drm/card0-DVI-D-1/edid`

    ...
    720x400    70.082 Hz   9:5    31.467 kHz  28.320 MHz (IBM)
    640x480    59.940 Hz   4:3    31.469 kHz  25.175 MHz (DMT)
    640x480    75.000 Hz   4:3    37.500 kHz  31.500 MHz (DMT)
    ..
    1280x1024   60.020 Hz   5:4    63.981 kHz 108.000 MHz (DMT)
    1280x960    60.000 Hz   4:3    60.000 kHz 108.000 MHz (DMT)
    ...

As you can see, the max resolution is capped at 1280x1024 value meanwhile according to the BenQ G2000W specs it can up to 1680x1050:

Feature Value
... ...
Native Resolution 1680 x 1050
Aspect Ratio 16:10
Horizontal Refresh Rate 76 kHz
Video Bandwidth 135 MHz
Vertical Refresh Rate 83 Hz
... ...
Max V-Sync Rate 83 Hz
Max H-Sync Rate 76 KHz

That's where we have problem.

You can also checkout your own EDID files outputs by the following command (star char is a wildcard):

$ edid-decode < /sys/class/drm/*/edid

So what we do now? We need a Correct EDID binary file. We have options how to get it:

  1. Find Correct EDID binary - Reuse existing ones
  2. Generate new EDID binary - Generate from scratch

Find Correct EDID binary

  1. Follow to to the github repo: https://github.com/linuxhw/EDID
  2. Find an appropriate monitor by using model name by checking out AnalogDisplay.md or DigitalDisplay.md files
  3. Once found, take an ID field value (the last one to the right) and copy it
  4. Find respective EDID file by matching the ID against file name (ctrl + f) in the analog/ or digital/ sub-folders of the repo above
  5. Once found generate binary file from the hexadecimal strings which may look like the following (excerpt):
00 ff ff ff ff ff ff 00 09 d1 07 78 45 54 00 00\
....

HEX string to EDID binary

The following bash script demonstrates how to produce binary file (you can replace HEXSTR= value with your own hex string for instance):

# Don't forget to place `\` after EOLs
HEXSTR="\
00 ff ff ff ff ff ff 00 09 d1 07 78 45 54 00 00\
03 12 01 03 a0 2b 1b 78 22 c4 f6 a3 57 4a 9c 23\
11 4f 54 a5 6b 80 71 00 81 00 00 00 00 00 81 80\
81 40 00 00 01 01 02 3a 80 18 71 38 2d 40 58 2c\
45 00 a0 5a 00 00 00 1e 00 00 00 ff 00 52 31 38\
31 32 34 34 31 53 4c 30 0a 20 00 00 00 fd 00 37\
4c 1f 53 0f 00 0a 20 20 20 20 20 20 00 00 00 fc\
00 42 65 6e 51 20 47 32 30 30 30 57 0a 0a 00 89";
echo -en $(echo "$HEXSTR" | sed -E 's/([0-9abcdef][0-9abcdef])[[:space:]]?/\\x\1/g') > BENQ-GW2000-BNQ7807-09AFF.edid.bin

Now you can check the output:

$ edid-decode BENQ-GW2000-BNQ7807-09AFF.edid.bin

Force EDID for display device

Create /lib/firmware/edid folder and copy the working EDID:

$ sudo mkdir /lib/firmware/edid
$ sudo cp ./BENQ-GW2000-BNQ7807-09AFF.edid.bin

Now we have to find at which port our display gets output from the Vidoe Card:

$  xrandr | grep connected

VGA-0 connected 1920+1080+0 ...
DVI-D-0 connected 1280x1024+0+0 ...
HDMI-0 connected primary 1920x1080+1280+0 ...

First words on every line is the Output ID.

In order to force Operating System X-systme display manager (like SDDM) system and Video Card Drivers to use our newly obtained edid file we can use the following features:

  1. X System Xorg.conf - The preffered way.
  2. GNU Linux Kernel Parameters - The hard way. Cnfiguration is dependent on kind of bootloader (GRUB, system-boot, Syslinux, LILO etc) you use.

Via Xorg.conf

This is simple way. It can be easily reused. We will follow the same steps as in the xorg.conf guide. Add the following options to the "Device" section of the /etc/X11/xorg.conf.d/20-vendor.conf file, so it looks like this (ensure right Output ID and vendor name):

Section "Device"
    Identifier     "Device0"
    # Your vendor may be different!
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "ConnectedMonitor" "DVI-D-0"
    Option         "CustomEDID" "DVI-D-0:/lib/firmware/edid/BENQ-GW2000-BNQ7807-09AFF.edid.bin"
    Option         "IgnoreEDID" "false"
    Option         "UseEDID" "true"
EndSection

Take a note that these options are vendor-dependent (see Nvidia X.org Multiple Monitors , and Nvidia X.org options):

For multiple displays you may want to specify a comma-separated list of connected monitors in the "ConnectedMonitor" option, like so:

    Option         "ConnectedMonitor" "DVI-D-0, HDMI-0, VGA-0"

NOTE: If you don't have /etc/X11/xorg.conf file, you can generate it by using tools such as nvidia-xconfig

Via Kernel Parameters

This is hard way. It would be hard to reuse from system to system. Just set up the following kernel parameters in your favorite boot-loader:

drm.edid_firmware=DVI-D-0:edid/BENQ-GW2000-BNQ7807-09AFF.edid.bin

Follow kernel mode setting to learn more about kernel parameter settings.

EDID from scratch

EDID Editing

As of 2021 you can use EDID-spefic editors.

Useful Links

See also

---

Copyright (C) 2021- Alex A. Davronov [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment