1. Skip to Menu
  2. Skip to Content
  3. Skip to Footer>
Monday Dec 9th     3:15 AM PST                                  

Adjust Screen Resolution with XRANDR and xorg.conf

PDF Print E-mail

Written by Greg King Last Updated on Thursday, 11 August 2016 17:18

DISCLAIMER! This document is nothing more than the musings of the author as he attempts to perform the stated tasks.  Conclusions and approaches
may very well be incorrect, inefficient, or otherwise outside of professionally accepted best practices. Use this document at your own risk! In this
document, screen outputs will be presented in green. Where keyboard input is required, the prompt will be in bolded red. # means you should be at the
super user prompt, $ means you should be at an
unprivileged
user prompt. Do not include these prompts in your input! The command to be typed will be
shown in blue.
# ls -al
means you type ls -al at the super user prompt.
An out of the box Debian Jessie (8.5) installation has a very generic 800x600 or 1024x768 video resolution.  I want to set it for 1600x1200 and have it survive a reboot.

The first thing to do is to create an /etc/x11/xorg.conf file.  To do this, hit ctrl-alt-f4 to switch to another virtual terminal and log in as root.  At the root prompt, shutdown the Xserver by issuing an init 3

# init 3

now create the xorg.conf file by telling the X server to configure.

# X -configure

(note the X command is upper case).  It will generate some output and will hopefully be successful.  Now back up your existing xorg.conf and copy the new one over and reboot.

# mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old
# mv /root/xorg.conf.new /etc/X11/xorg.conf
# init 6



First, I use xrandr -q to find out what the resolution is set for and the output device it is using.


# xrandr -q

Screen 0: minimum 320 x 200, current 1024x768, maximum 8192 x 8192
VGA1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768      60.00 *
800x600       60.32    56.25
848x480       60.00
640x480       59.94
HDMI1 disconnected (normal left inverted right x axis y axis)

The output being used is VGA1.  I now need to know what modeline to set for the resolution I want to use.  Run cvt with the output resolution you want to use, in this case 1600 x 1200 at 60hz refresh.

# cvt 1600 1200 60

# 1600x1200 59.87 Hz (CVT 1.92M3) hsync: 74.54 kHz; pclk: 161.00 MHz
Modeline "1600x1200_60.00"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsync



Now using the text after the MODELINE above, create a new mode in xrandr.

# xrandr --newmode "1600x1200_60.00"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsync

The new mode is called 1600x1200_60.00 because it was the name we gave it above.

Now we will add the mode to our VGA1 output

# xrandr --addmode VGA1 "1600x1200_60.00"

now will will direct the output to that mode...

# xrandr --output VGA1 --mode 1600x1200_60.00

Your screen resolution should change. 

Check the xrandr output again

# xrandr -q


Screen 0: minimum 320 x 200, current 1600 x 1200, maximum 8192 x 8192
VGA1 connected primary 1600x1200+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1600x1200_60.00  59.87*+
1024x768      60.00  
800x600       60.32    56.25  
848x480       60.00  
640x480       59.94  
HDMI1 disconnected (normal left inverted right x axis y axis)


Now to make the change survive a reboot.


edit your /etc/X11/xorg.conf file and put the modeline, from our cvt output above, in the data between
Section "Monitor"
...
...
EndSection

that section should now look something like this:


Section "Monitor"
Identifier   "Monitor0"
VendorName   "Monitor Vendor"
ModelName    "Monitor Model"
Modeline "1600x1200_60.00"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsync
EndSection


now, scroll down to the Section "Screen"

and then scroll to the SubSection "DISPLAY" and look for the entry with a Depth = 24 (denoting 24 color).
put the mode in that section before the EndSubSection.

This section should look like the following:


SubSection "Display"
Viewport   0 0
Depth     24
Modes "1600x1200_60.00"
EndSubSection
EndSection


you can comma separate modes in the SubSection DISPLAY above, just add new modes on the MODES line separated by commas.

save the file and reboot.  Upon rebooting, your monitor should come up with the 1600x1200x60 resolution.




  Debian Lab
eXTReMe Tracker
Content View Hits : 436713