STUTS Tech Blog


Custom Resolution on Linux with Nvidia Graphics Cards


Originally Published: 2015-05-14

Background

When tasked with utilising the 4k (4096x2160) capabilities of the Nvidia GTX 780 graphics card on a Linux system I believed this would be a walk in the park. Contrary to my beliefs, Xorg can be a pain when it comes to setting up a custom resolution (especially if you want to boot without a screen!).

From my digging online it seemed like this was a common problem among users however there never was a clear solution. From gathering the info from various forum posts I managed to find a working solution... And it was far simpler than I would have imagined.

Solution

First of all, in a terminal, create a modeline for your desired resolution:

[stuart@asuka ~]$ cvt 4096 2160
# 4096x2160 59.98 Hz (CVT) hsync: 134.18 kHz; pclk: 760.00 MHz
Modeline "4096x2160_60.00"  760.00  4096 4432 4880 5664  2160 2163 2173 2237 -hsync +vsync

Open up /etc/X11/xorg.conf with your favourite text editor (my preference being vim) and do the following

  • In Section "Monitor" add the Modeline generated above
  • Modeline "4096x2160_60.00"  760.00  4096 4432 4880 5664  2160 2163 2173 2237 -hsync +vsync
  • In Section "Screen" add
  • Option        "UseDisplayDevice" "none"
  • In Subsection "Display" add the
  • Virtual        4096 2160

Restart the X window system

[stuart@asuka ~]$ /sbin/init 3
[stuart@asuka ~]$ /sbin/init 5

The above solution has been tested on Centos6.3 running the Nvidia 331.10 graphics driver. You can do any custom resolution you want, just replace 4096 with your desired width and 2160 with your desired height but make sure it's a resolution supported by your graphics card!


If you have any feedback or issues regarding this then please do contact me