Post Reply
Guide to (Nvidia) monitor overclocking on Linux
11-14-2014, 02:01 PM (Last edited: 11-14-2014, 06:17 PM by kablammo)
Post: #1
Guide to (Nvidia) monitor overclocking on Linux
Hey there,

Since I was a bit bored, I looked into overclocking my Monitors with the Proprietary Linux drivers on Linux.

First things first
For pretty much all of the config file modifying you need to be root (you can get root rights with sudo or by logging into root with su) .
It's good to have full debugging output for X.org, it tells you a lot and you can easily see if you made an error. To do so, start X with -logverbose 6. This can be done by editing you desktop managers config file.
for KDM it's /etc/kde4/kdm/kdmrc where you add it to ServerArgsLocal=. For lightdm (ubuntu default) you can find this at /etc/lightdm/lightdm.conf where under [SeatDefaults] you need to add xserver-command=X -logverbose 6.
Restart your computer (or only your DM).
Now if something does not work, you can check /var/log/Xorg.0.log, it will give you a very detailed output of what happens.
After all is done and works the way you want it , you can disable all the extra logging.

Tell the Nvidia driver to ignore every precaution
Go to your /etc/X11/xorg.conf (it it's not yet generated, you can create it with the nvidia gui)
and add Option "ModeValidation" "AllowNonEdidModes,NoEdidMaxPClkCheck,NoMaxPClkCheck" to
Code:
Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
...
    Option        "ModeValidation"   "AllowNonEdidModes,NoEdidMaxPClkCheck,NoMaxPClkCheck"
...
EndSection
Option "UseEDIDFreqs" "false"
Code:
Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
...
    Option         "UseEDIDFreqs" "false"
EndSection

and finally
modify your VertRefresh to fit your needs
Code:
Section "Monitor"
    Identifier     "Monitor0"
...
    HorizSync       30.0 - 94.0
    VertRefresh     48.0 - 120.0
...
EndSection

Now you told the nvidia driver to ignore any refresh rates that the monitor tells it and to ignore Bandwidths too.
For more info about all these settings look here:
http://ftp.download.nvidia.com/XFree86/L...tions.html

I am not certain how far NoMaxPClkCheck goes, if it can get past the 330 Mhz Pixel Fequency. I can't test it since I got ancient Screens and only did this to have a bit of fun. But fear not, there is a patch for the nvidia driver.

You get it here : https://github.com/CFSworks/nvlinpatch

download it, unpack, grab your nvidia kernel module from /lib/modules/<your kernel> put it where you unpacked nvlinpatch and run python2 nvlinpatch.py <name of the kernel module>. Then copy it back. If you use ubuntu, the Kernel module will be in /lib/modules/<kernel>/updates/dkms/nvidia_331.ko. Keep a backup of the original module just in case. Unfortunately because the kernel module gets built after every kernel update, you need to keep patching it.

Now reboot your computer and you should already see a bunch more modes for you to choose from. Maybe already the one you want.

Fine grained Modesetting

Now that we have everything unlocked, you can start messing around with modelines if you want very precise control over your refresh rate.

There are several ways to generate modelines. an easy one is to use cvt. it will spit out a line like

Code:
$ cvt 1920 1080 120
# 1920x1080 119.93 Hz (CVT) hsync: 139.12 kHz; pclk: 369.50 MHz
Modeline "1920x1080_120.00"  369.50  1920 2080 2288 2656  1080 1083 1088 1160 -hsync +vsync

the first number after Modeline "1920x1080_120.00" is the Pixel Frequency, then the horizontal screen size then the 3 sizes needed to sync the screen lines. After that the vertical screen size and again 3 sizes to sync the screen. Now to test if your screen works with this, run as normal user xrandr -q to find your screen name and then copy the modeline and use it with xrandr like so:
Code:
xrandr --newmode "1920x1080_120.00"  369.50  1920 2080 2288 2656  1080 1083 1088 1160 -hsync +vsync
xrandr --addmode <your screen> 1920x1080_120.00
xrandr --output <you screen> --mode 1920x1080_120.00

if everything works great for you, you can copy the output from cvt to
/etc/X11/xorg.conf
Code:
Section "Monitor"
    Identifier     "Monitor0"
...
# 1920x1080 119.93 Hz (CVT) hsync: 139.12 kHz; pclk: 369.50 MHz
Modeline "1920x1080_120.00"  369.50  1920 2080 2288 2656  1080 1083 1088 1160 -hsync +vsync
EndSection

and the next time you reboot, you'll find it in your nvidia settings.

Now if you happen to only have crummy cables and be really tight on bandwidth, you can check your monitors current modeline with
Code:
xvidtune -show
"1920x1200"   154.00   1920 1968 2000 2080   1200 1203 1209 1235 +hsync -vsync
If you have more than 1 screen plugged in, just unplug all but 1 and read the modeline.
You can also grab Modlines from your edid by reading your Xorg.0.log, it needs logverbose 6 , but it seems to be the most reliable way to get information from your edid.
Code:
[   672.112] (--) NVIDIA(0): Detailed Timings:
[   672.112] (--) NVIDIA(0):   1920 x 1200 @ 60 Hz
[   672.112] (--) NVIDIA(0):     Pixel Clock      : 154.00 MHz
[   672.112] (--) NVIDIA(0):     HRes, HSyncStart : 1920, 1968
[   672.112] (--) NVIDIA(0):     HSyncEnd, HTotal : 2000, 2080
[   672.112] (--) NVIDIA(0):     VRes, VSyncStart : 1200, 1203
[   672.112] (--) NVIDIA(0):     VSyncEnd, VTotal : 1209, 1235
[   672.112] (--) NVIDIA(0):     H/V Polarity     : +/-
[   672.112] (--) NVIDIA(0):     Image Size       : 546 mm x 352 mm

To use this as a start for your Modeline:
Code:
Modeline "<name>" <Pixel Clock> <HRes> <HSyncStart> <HSyncEnd> <HTotal> <VRes> <VSyncStart> <VSyncEnd> <VTotal> <H Polarity>hsync <V Polarity>vsync
and replace the values with what you can see up there

My screen for example has much smaller numbers for the synching parameters than the autogenerated line and thus needs less bandwidth per screen draw. You can take that line and slowly increase the Pixel Frequency ( in this case 154.00 ) and watch how your Screen reacts. Increasing the Frequency will increase your Vertical refresh rate, as the bandwith is the multiplication of the 2 largest numbers (HTotal and VTotal) on each group with the vertical refresh rate. X is a bit picky about how you name your modelines, the easiest is just to increase the number at the end 1920x1080_120.00 1920x1080_120.01 ....

And again once you found a modeline you like, just copy it over to your xorg.conf and be done.

And that's it. Sadly there are not many pretty guis to click stuff, but everything you need is pretty easy to get.

Addendum

I am not sure if the Patch is still actively maintained, however it seems that it only consists of replacing a few small numbers

Code:
uncap_pclk_dvi_64 = Patch('uncap_pclk_dvi_64',
                          sig_hex('C7 86 ?? ?? 00 00 80 1A 06 00'),
                          sig_hex('?? ?? ?? ?? ?? ?? FF FF FF 7F'), True)

uncap_pclk_dp_64 = Patch('uncap_pclk_dp_64',
                         sig_hex('C7 86 ?? ?? 00 00 60 3D 08 00'),
                         sig_hex('?? ?? ?? ?? ?? ?? FF FF FF 7F'), True)

uncap_pclk_fermi_64 = Patch('uncap_pclk_fermi_64',
                            sig_hex('25 80 1A 06 00'),
                            sig_hex('90 90 90 90 90'))

For drivers after 334, the display port patch is not applied anymore. I don't know if later nvidia drivers have changed a lot or if you could just reuse the same patches, After all it seems they have not changed since 310

edit: how to get a modeline from edid
Find all posts by this user
Quote this message in a reply
07-07-2015, 03:31 PM
Post: #2
RE: Guide to (Nvidia) monitor overclocking on Linux
Thanks for this guide. I can't seem to get past 2560x1440 @ 80Hz in Linux, but I can get to 105Hz in Windows. Must be the pixel clock limitation you mentioned. I need to look into that.
Find all posts by this user
Quote this message in a reply
02-15-2018, 04:18 PM
Post: #3
RE: Guide to (Nvidia) monitor overclocking on Linux
I registered on the forum just to thank you, kablammo. The tutorial worked perfectly for me. I use Ubuntu 18.04 + GTX 1080 + Dell P2416D. Its default refresh rate is 60Hz, but it works perfectly with 75Hz.

Thanks to your tutorial I managed to make it work at 75Hz on linux.
Find all posts by this user
Quote this message in a reply
 Post Reply


Forum Jump:


User(s) browsing this thread: 1 Guest(s)