OsDictator
Posts: 19
Joined: Mon Feb 05, 2018 9:57 am

Force resolutions and refresh rates on HDMI

Mon Feb 12, 2018 6:55 pm

WARNING!!!

DO NOT use resolutions and refresh rates outside your monitors range!!! If you don't use a resolution AND its matching refresh rate or lower, you might damage your monitor or hardware.

Problem

When using an external monitor via HDMI you might be limited to use what resolution your computer and monitor agrees on, but this agreement doesn't always match what your system is actually capable of. I cannot go into this detail, since I would probably write some nonsense because I am to lazy to do the research, and this post isn't an in depth article on the HDMI standard.
But you need to know your monitors resolution and refresh rate specs, both the versions of HDMI output of your computer and the HDMI input of your monitor, and last the capabilities of the HDMI cable you are using. All these can individually limit the maximum resolution of your whole system.

Ex.:

My laptop has a HDMI 1.4 if I remember correctly, and it is capable of outputting 2K(2560x1440) at 60Hz (on paper), but if I go to 4K(3840 × 2160) my HDMI 1.4 would only be able to push 30Hz at that resolution. So I chose the 2K monitor, which also is better suited for my old graphics card. But opening my display manger, I only get resolution up to 1920x1080 60Hz.
Read more about the various standards and there capabilities on the internet, I might have got some of thees figures wrong.

HowTo

Setting MY computer to output WQHD/2K(2560x1440) at 55Hz, your computer is most likely different.
This is all done through the command-line, so fire up your favorite console.

1. List output names and associated resolutions

When you type in xrandr in your console, you will get a list of all your computers outputs, and what resolutions they seemingly are able to run:

Code: Select all

user@solus ~ $ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
LVDS-1-1 connected (normal left inverted right x axis y axis)
   1920x1080     59.91 +  39.94  
   1400x1050     59.98  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   800x600       60.00    60.32    56.25  
   700x525       59.98  
   640x512       60.02  
   640x480       60.00    59.94  
   512x384       60.00  
   400x300       60.32    56.34  
   320x240       60.05  
VGA-1-1 disconnected (normal left inverted right x axis y axis)
HDMI-1-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 708mm x 398mm
   1920x1080     60.00*   50.00    50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      74.98    59.90  
   1280x960      60.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x576i      50.00  
   720x480       60.00    59.94  
   720x480i      60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  
DP-1-1 disconnected (normal left inverted right x axis y axis)

Looking at this output, I get names like VGA-1-1, but I am interested in using the HDMI output so in my case I use the output name HDMI-1-1. These names vary from computer to computer, and on my Optimus laptop, the HDMI-name changes to HDMI-1, when i am running the integrated Intel-graphics instead of the dedicated Nvidia-graphics that is the case in this example. ie. it has a 1 less in the name, when running on the Intel GPU.

2. Get the modeline for the desired resolution

But as seen in the previous step, doing the xrandr-command did not give me the desired resolutions, it only gave me 1920x1080 at 60.00Hz. To force your computer to run a resolution outside this list you need to type in the gft-command followed by the desired resolution and refresh rate. The resolution and refresh rate 2560x1440 55Hz, is typed in as three parameters after the gft-command:

Code: Select all

user@solus ~ $ gtf 2560 1440 55

  # 2560x1440 @ 55.00 Hz (GTF) hsync: 81.73 kHz; pclk: 283.77 MHz
  Modeline "2560x1440_55.00"  283.77  2560 2736 3016 3472  1440 1441 1444 1486  -HSync +Vsync
Now it yields the code that should be specific for your setup, but this is not always the case. I will return to this subject.

3. Finally switching to a higher resolution

When all that is done, you simply need to feed xrandr the new mode, add it and then initiate it. First you type xrandr --newmode into your console followed by the modeline you got in the previous step:

Code: Select all

user@solus ~ $ xrandr --newmode "2560x1440_55.00"  283.77  2560 2736 3016 3472  1440 1441 1444 1486  -HSync +Vsync
Next you add it to xrandr(sorry if I am a little to loose in my use of the terminology):

Code: Select all

user@solus ~ $ xrandr --addmode HDMI-1-1 2560x1440_55.00
And finally you initiate the new mode. This can also be done from your GUI in your display settings, here the new mode should now be visible. But if your system doesn't accept this configuration, I find it does not switch back, and I have to restart my computer, since I then would be blindfolded. When doing it through the console it usually switches back to the previous settings. In the console you now type in the output command for xrandr followed by the new mode:

Code: Select all

user@solus ~ $ xrandr --output HDMI-1-1 --mode 2560x1440_55
The screen should now flicker, and go to your desired resolution and refresh rate.

4. But it did not work!!!

As I mentioned earlier, at the end of step two, the modeline you get from gtf isn't always accurate. Using this approach only brings me to 2K at 40Hz, frequencies above 40Hz found with gtf, gives me the error:

Code: Select all

user@solus ~ $ xrandr --output HDMI-1-1 --mode 2560x1440_55
xrandr: Configure crtc 0 failed
Why this is, I havn't figured out yet, but I am the type of person that keeps randomly pocking until I get a desired result or just wares myself out. From this list I found in one of the resources at the end of this post, I was able to get my system to accept an output of 2K at 55Hz. Close enough although it annoys me a bit. These are the modelines I tested and their respective commands, but I was not able to use any above 55Hz:

Code: Select all

xrandr --newmode "2560x1440_30" 146.25 2560 2680 2944 3328 1440 1443 1448 1468 -hsync +vsync   # 29.94
xrandr --newmode "2560x1440_41" 162.00 2560 2608 2640 2720 1440 1443 1448 1468 +hsync +vsync   # 40.57
xrandr --newmode "2560x1440_55" 220.812 2560 2608 2640 2720 1440 1443 1448 1478 -hsync -vsync  # 54.93
xrandr --newmode "2560x1440_58" 231 2560 2608 2640 2720 1440 1443 1448 1468 -hsync -vsync      # 57.85
xrandr --newmode "2560x1440_60" 239.56 2560 2608 2640 2720 1440 1443 1448 1468 -hsync -vsync   # 60.00

xrandr --addmode HDMI-0 2560x1440_30  # 29.94
xrandr --addmode HDMI-0 2560x1440_41  # 40.57
xrandr --addmode HDMI-0 2560x1440_55  # 54.93
xrandr --addmode HDMI-0 2560x1440_58  # 57.85
xrandr --addmode HDMI-0 2560x1440_60  # 60.00

xrandr --output HDMI-0 --mode 2560x1440_60
Notice how this user uses HDMI-0, and not HDMI-1-1 as in my case.

5. Make the new resolution available after reboot

Running these three commands does not save the modelines to your system. A simple way of making modelines available across reboots, is to load then through a bash file at startup. When doing this most or some DE's will be able to use the last resolution set by you at next login. I have tested this with KDE and Mate.
Create at file called lets say MyResolutions.sh and equivalent to my example put in your tested resolution:

Code: Select all

#!/bin/sh

xrandr --newmode "2560x1440_55.00" 220.812 2560 2608 2640 2720 1440 1443 1448 1478 -hsync -vsync
xrandr --addmode HDMI-1-1 2560x1440_55.00
Go into your systems Startup Applications manager, and add a new program for the manager to launch at start up. You run the bash file by pointing to the file and its location like this:

Code: Select all

bash /home/user/MyResolutions.sh
And you should have the desired resolution available on every reboot.

Comments are most welcome

Any insight on how to accurately get the various resolutions for a given system are appreciated, as well as other useful knowledge.
Since English is not my native language, I apologies for any unfortunate misspellings or word constellations. If so, kindly point me in the right direction.

Resources
https://superuser.com/questions/119755/ ... 0-possible
https://wiki.archlinux.org/index.php/Xrandr
https://www.notebookcheck.net/2560x1440 ... 840.0.html
https://plus.google.com/+LinusTorvalds/ ... QsCY7ErAL4
https://wiki.ubuntu.com/X/Config/Resolu ... esolutions
Last edited by OsDictator on Tue Feb 13, 2018 5:28 pm, edited 2 times in total.

User avatar
Craig-toyoracer
Posts: 227
Joined: Sun Apr 16, 2017 2:29 am

Re: Force resolutions and refresh rates on HDMI

Mon Feb 12, 2018 11:20 pm

Hello OsDictator, for being a "lazy" person that was a very informative and well written tutorial. :)


one typo :
Comments are most welcome

Any insight on how to accurately get the various resolutions for a given system are appreciated, ass as well as other useful knowledge.

OsDictator
Posts: 19
Joined: Mon Feb 05, 2018 9:57 am

Re: Force resolutions and refresh rates on HDMI

Tue Feb 13, 2018 8:23 am

Craig-toyoracer wrote:
Mon Feb 12, 2018 11:20 pm
Hello OsDictator...
Thx., as I was not talking about my ... :lol:

Return to “Tutorials”