Skip to content

Instantly share code, notes, and snippets.

@CounterPillow
Created December 12, 2017 21:04
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save CounterPillow/a4f8abea6570db11b73f42667f78801c to your computer and use it in GitHub Desktop.

Modding your EDID for Fun and Profit

The EDID is a small binary blob your display sends to your system that describes the capabilities of the display, for example, what physical dimensions it is, or what resolution is supports at what clockrates.

I recently had to modify my EDID to fix a DTD (Detailed Timing Descriptor), which caused the display to report a 59.93 Hz refresh rate mode that actually could only do about 48 Hz. Nudging around the pixel clock and V-Blank "fixed" this by changing it to a 60.10 Hz mode that could only do 59.93 Hz.

This guide is specific to Intel GPUs. On nvidia, you'll have to use a different approach.

Finding the Display

First, find out which display you want to mod the EDID of. The output of xrandr should give you a good idea.

$ xrandr | grep primary
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 294mm x 165mm

As you can see, eDP-1 is my monitor.

Finding the EDID

The EDID of your display should be in /sys/class/drm/card0-$MONITOR/edid. For example, this translates to /sys/class/drm/card0-eDP-1/edid for me.

If you have more than one GPU and the monitor is connected to the second GPU, it won't be card0 but card1 of course.

Modifying the EDID

Download wxEDID and compile it, then run it and load the EDID binary from the previous location.

If you want to modify the DTD like me, select the DTD that you want to edit, and head to the "DTD Constructor" tab.

In the DTD Constructor tab, you get to play around with various things such as the pixel clock. As you can see, it spits out a X11 Mode line at the bottom. This is useful; with that, we can test a new mode without rebooting.

Testing a Modeline

Testing a modeline is as simple as adding it through xrandr

xrandr --newmode "1920x1080x60.10" 138.76 1920 1968 2000 2080 1080 1083 1088 1110
xrandr --addmode eDP-1 1920x1080x60.10
xrandr --output eDP-1 --mode 1920x1080x60.10
# test stuff now, e.g. by running glxgears with vsync and looking at the output fps
# after you're done, you can switch back and remove the temporary mode again
xrandr --output eDP-1 --mode 1920x1080  # switch back the mode
xrandr --delmode eDP-1 1920x1080x60.10  # remove our test mode from the output
xrandr --rmmode 1920x1080x60.10         # delete our test mode

Loading the Modified EDID

If you've found a DTD that works for you, save your modded EDID binary to /usr/lib/firmware/edid/. If that directory doesn't exist, create it.

Last but not least, add the kernel option drm_kms_helper.edid_firmware=$YOURMONITOR:edid/$YOUREDIDFILENAME replacing $YOURMONITOR and $YOUREDIDFILENNAME according to your specific setup.

Once you reboot, the modified DTD should result in different auto-detected modes in xrandr's output.

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