Rowanto Luo


Just another blog. or log.


Monitor resolution not properly detected in Linux (Debian 7 or Wheezy)

So I have an ATI HD5xxx graphic card in my desktop personal computer. It's a nice and quite fast card. It also has three display adapters: HDMI, DVI, DisplayPort. On my desk, there are two monitors. One of them have a DVI and a VGA adapter. The other however, only have VGA adapter. Do you see the problem here?

My graphic card has no VGA adapter, because of this, I need to use some adapter, and because I used an adapter, the resolution of the monitor is not detected properly. The native resolution of that monitor is 1920x1080 pixels, but I can only set it to 1440x900 when I use the adapter (which looks quite ugly). This problem is easily solveable in Windows 8. The windows' ATI Cataylst has an option to force a resolution on the monitor. So I can just force 1920x1080 and it works perfectly. Debian (or other distribution like Fedora) however, does not have this option..

Well I was a Fedora user before, and I somehow fixed this problem wayy long ago by playing with the "xrandr" command. Now I've forgotten all about it. I've done it multiple times, and everytime I did it, I wasted quite a few hours because somehow it doesn't always want to work.

So here's a post which logs what I did now with Debian.

# Get the modeline for your computer
# Get the modeline for your computer
# cvt <width> <height> <refresh-rate>
cvt 1920 1080 60

# You will get an output like this, which is a modeline for your computer
# 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

# You need to add the modeline to xrandr with the command : xrand --newmode 
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

# Add the modeline to your monitor
# xrandr --addmode <monitor-code> <modeline-name>
# The monitor code you can get from running "xrandr", in my case it's CRT1 (dunno why CRT1)
xrandr --addmode CRT1 1920x1080_60.00

# Try the use the new modeline
# xrandr --output <monitor-code> --mode <modeline-name>
xrandr --output CRT1 --mode 1920x1080_60.00

If it works, you can now either edit xorg config directly or put the whole command in your start-up script. I prefer the first one, but I'm not going to edit it directly. I'm just going to add the modeline in the xorg config, restart, then use Catalyst or the display settings to set and save the new resolution.You need to be careful when editing xorg config or your computer will crash on restart. Please make a backup of the xorg.conf file before you edit it so that you can restore it in safemode if your computer crashes.

Just edit your xorg.conf file, and look for your monitor identifier (in my case, it's CRT-1). After that, you can just add the modeline you've got from cvt after the identifier like the example below.

sudo gedit /etc/X11/xorg.conf

# This is how the section of your monitor should roughly look like, notice the new added modeline. Everything else is left unchanged.
# The PreferredMode of this monitor is already 1920x1080 because I've already set it from the display setting
# You should not change it manually. Just add the modeline.
# Once again, please be EXTRA careful in editing xorg.conf since I don't take responsibility if you crash anything.
Section "Monitor"
    Identifier   "0-CRT1"
    ModeLine     "1920x1080_60.00" 173.0 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
    Option      "VendorName" "ATI Proprietary Driver"
    Option      "ModelName" "Generic Autodetecting Monitor"
    Option      "DPMS" "true"
    Option      "PreferredMode" "1920x1080"
    Option      "TargetRefresh" "60"
    Option      "Position" "0 0"
    Option      "Rotate" "normal"
    Option      "Disable" "false"
EndSection

After editing the xorg.conf file and restarting, you should be able to select the resolution in display setting or Catalyst. Either open the display setting or run Catalyst in sudo mode using

gksudo amdcccle

In my case, after adding the new modeline, Catalyst can detect the 1920x1080 resolution resulting me to have two 1920x1080 resolution modes (there's only one 1920x1080 option, but it has two refresh rate options which are both 60Hz). Just select any of them and your monitor should display the 1920x1080 resolution.