HowTo: Set Linux video modes

InfoDabble > Tech Notes > Linux > HowTo: Set Linux video modes
Jump to: navigation, search

[edit] VESA modes

The video mode can be specified in the kernel boot configuration file. For example,

label slax
kernel boot/vmlinuz
append vga=769 changes=slaxsave.dat max_loop=255 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=4444 root=/dev/ram0 rw gui autoexec=xconf;startx

The "vga=" is an important parameter. This parameter allows you to specify which graphical mode you want to use. Read the Documentation/fb/vesafb.txt file in the kernel source directory for more information and a summary of the VESA modes. The relevant kernel mode numbers are:

640x480 800x600 1024x768 1280x1024
256 0x301 0x303 0x305 0x307
32k 0x310 0x313 0x316 0x319
64k 0x311 0x314 0x317 0x31A
16M 0x312 0x315 0x318 0x31B
  • 640x480x256 = 0x301 = 769 decimal
  • 800x600x16M = 0x315 = 789 decimal
  • 1024x768x16M = 0x318 = 792 decimal

[edit] xrandr

http://www.perpetualpc.net/srtd_resolution.html page last modified 2004-08-13

To change the resolution (monitor display) from the command line ( using a terminal window ) do this: ( when x is running -- don't exit Xwindows just use a terminal window. This is done from the command line. )

xrandr

this command will bring up information like this:

SZ:    Pixels          Physical       Refresh
 0   1024 x 768    ( 271mm x 201mm )   75   70   60  
 1    800 x 600    ( 271mm x 201mm )   85   75   72   60   56  
 2    640 x 480    ( 271mm x 201mm )   85   75   72   60  
*3    832 x 624    ( 271mm x 201mm )  *74  
 4    720 x 400    ( 271mm x 201mm )   85  
 5    640 x 400    ( 271mm x 201mm )   85  
 6    640 x 350    ( 271mm x 201mm )   85  
Current rotation - normal
Current reflection - none
Rotations possible - normal 
Reflections possible - none

This will show the resolutions possible on your monitor. The star indicates what is currently being used. To change resolution use a command like this:

xrandr -s 1024x760

This will immediately change the resolution; in this case to 1024x760. ( it takes about .5 seconds on my system which uses a "Super View 1280" monitor which is actually an Hitachi cm500 as far as specifications go -- I am using RedHat with kernel 2.4.20-6 and Xfree86 version 4.3.0) To check for xrandr on your system type [ xdpyinfo ] (If you see RANDR listed under number of extensions then it should work.) Also typing [ xrandr -s ] will give this information:

usage: xrandr [options]
  where options are:
  -display <display> or -d <display>
  -help
  -o <normal,inverted,left,right,0,1,2,3>
            or --orientation <normal,inverted,left,right,0,1,2,3>
  -q        or --query
  -s <size>/<width>x<height> or --size <size>/<width>x<height>
  -r <rate> or --rate <rate>
  -v        or --version
  -x        (reflect in x)
  -y        (reflect in y)
  --screen <screen>
  --verbose

This assumes your (crt) monitor is set up with vertical and horizontal specifications that it can handle. Be aware that you can inadvertently destroy your monitor with the wrong settings.