Change display resolution - xrandr BadMatch support

Motivation

Immediately after installing Ubuntu, the display resolution was set to 1368x768. The screen was inconveniently small when working with multiple terminals open, and since I had connected to a display (JAPANNEXT JN-MD-IPS1562FHDR) that can display 1920x1080, I wanted to display it in that resolution.

I tried to change the resolution, but got into a bit of trouble, so here is a summary of the process.

Sources

  1. Ubuntuディスプレイ解像度の変更|1920x1080 Reading this information, it seems that it is easy to change the resolution using the xrandr command, and it only takes a few minutes of work. I thought it would only take a few minutes to change the display resolution, so I started to work on it.
  2. 4.3 Permanently adding undetected resolutions This is the page I referred to when editing xorg.conf.
  3. External Monitor, can’t set desired resolution *This page solved the problem. I tried many things without success, and after searching the net further, I finally found an article about the same phenomenon I was experiencing.
  4. edid-generator Github page referenced from the above page.
  5. 19 xrandr BadMatch Why xrandr is a BadMatch.
  6. 4.2.1 EDID checksum is invalid An article about EDID related to the above.
  7. Archive:Creating and using edid.bin via xorg.conf An article about edid.bin from xorg. conf to use edid.bin via xorg.conf.

Setup

Normal way

To change the resolution of the display, go to “Settings” -> “Display” and specify the resolution, but in my environment, there is no 1920x1080 entry in this list!

“Sources 1." I understood that what this article says is how to add 1920x1080 in the list of resolutions. I will set it up according to the article.

$ cvt 1920 1080
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
$ xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
$ xrandr
Screen 0: minimum 8 x 8, current 1368 x 768, maximum 16384 x 16384
DVI-I-0 connected primary 1368x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      60.00 +
   1600x900      59.82  
   1400x900      59.88  
   1368x768      59.88    59.85* 
   1360x768      59.96    59.80  
   1280x800      59.91    59.81  
   1280x720      59.86    59.74  
   1152x864      60.00  
   1024x576      59.90    59.82  
   960x540       59.82    59.63  
   864x486       59.92    59.57  
   800x600       72.19    60.32    56.25  
   800x450       59.82  
   700x450       59.88  
   684x384       59.88    59.85  
   680x384       59.96    59.80  
   640x480       59.94  
   640x400       59.98    59.88  
   640x360       59.86    59.83  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.82    59.63  
   432x243       59.92    59.57  
   400x300       72.19  
   320x240       60.05  
DVI-I-1 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
  1920x1080_60.00 (0x26f) 173.000MHz -HSync +VSync
        h: width  1920 start 2048 end 2248 total 2576 skew    0 clock  67.16KHz
        v: height 1080 start 1083 end 1088 total 1120           clock  59.96Hz

I thought I was ready to go with two more commands, but the next operation resulted in an error.

$ xrandr --addmode DVI-I-0 1920x1080_60.00
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  18 (RRAddOutputMode)
  Serial number of failed request:  35
  Current serial number in output stream:  36

Trial and error

Here, I searched the net and tried the following two things, but nothing worked.

  • add GRUB_GFXMODE=1920x1080 in /etc/default/grub
  • edit /etc/X11/xorg.conf
    • initially, /etc/X11/xorg.conf did not exist, so open the “X Server Display Configuration” tab of “NVIDIA X Server Settings”, click the “Save to X Configuration File” button and edit xorg.conf was generated.
    • referring to “Source 2.", made the following modifications/additions to xorg.conf:
      • added “1920x1080_60.00” to the modeline line in the Monitor section
      • added Modes to the Display subsection of the Screen section
      • added “UseEDID” “false” in Option in Divice section

Further, I searched the net and found “Sources 3.

Response to xrandr BadMatch

The phenomenon in this article (source .3) was similar to what was happening in my environment. So I read it with high expectations and applied it to my environment.

About EDID

The solution this time is to create EDID by yourself and use the binary you created. The reason why this is necessary is explained in Sources 5." and [Sources 6."](https://wiki. archlinux.org/title/xrandr#EDID_checksum_is_invalid). For myself, I understood that it forces the NVIDIA driver to set the EDID of the monitor (display) because it does not recognize it correctly.

Download sources from Github

Download from github at “Sources .4”. I downloaded the ZIP file and extracted it to my local environment.

Install necessary packages

I installed zsh, edid-decode, automake, dos2unix packages as described in README.md on github, as well as development packages such as make since there were no such packages on this workstation.

$ sudo apt install zsh edid-decode automake dos2unix
$ sudo apt install build-essential

Implementation steps

$ ./modeline2edid /etc/X11/xorg.conf
Searching for modelines in '/etc/X11/xorg.conf'.
$ make

No new .s was created because there is no “modeline” in my xorg.conf.

The above created 1920x1080.bin, but there was no description on github on how to incorporate it. Is this common sense? But I didn’t know, so I checked the net and found “Sources 7.".

Incorporating edid.bin into xorg.conf

First, copy the “1920x1080.bin” created in the above “implementation steps” to /etc/X11.

Next, edit /etc/X11/xorg.conf with reference to “Sources 7.".

The difference between my edited xorg.conf and the one I created in “Trial and Error” 2.-1. (NVIDIA X Server Settings) is as follows: I just added 4 lines to the Device section.

54,57d53
< Option "ConnectedMonitor" "DVI-I-0"
< Option "CustomEDID" "DVI-I-0:/etc/X11/1920x1080.bin"
< Option "IgnoreEDID" "false"
< Option "UseEDID" "ture"

Here, when I logged off/logged in, I suddenly had a 1920x1080 desktop view.

Summary

After all this action, to change the resolution of the display, I went to Settings -> Display and looked at the resolution, and the list shows only 1920x1080.

I don’t think I will ever use a lower resolution, so this is fine.

Translated with www.DeepL.com/Translator (free version)