Resolution

Resetting an out-of-range resolution

If you set a resolution inappropriate for your monitor in the Screen Resolution GUI tool, you can reset it from a terminal by running

  • $ rm ~/.config/monitors.xml

Dynamically testing different resolutions

You can either use the Screen Resolution GUI tool to experiment with different resolutions, or the more powerful xrandr command-line tool. Without parameters, xrandr shows you the names of different outputs available on your system (LVDS, VGA-0, etc.) and resolutions available on each:

  • $ xrandr
    Screen 0: minimum 320 x 200, current 1400 x 1050, maximum 1400 x 1400
    VGA disconnected (normal left inverted right x axis y axis)
    LVDS connected 1400x1050+0+0 (normal left inverted right x axis y axis) 286mm x 214mm
       1400x1050      60.0*+   50.0  
    [...]

You can direct xrandr to set a different resolution like this:

  • $ xrandr --output LVDS --mode 1024x768
    $ xrandr --output VGA1 --mode 1024x768

The refresh rate may also be changed, either at the same time or independently:

  • $ xrandr --output LVDS --mode 1024x768 --rate 75
    $ xrandr --output VGA1 --mode 1024x768 --rate 60

Note that changes you make using xrandr only last through the current session. xrandr has a lot more capabilities - see man xrandr for details.

Panning viewport

If you want to have a panning viewport, i.e., a virtual screen that's bigger than your physical screen that moves when you move the mouse to the edge ("zoomed in" view) specify the desired physical resolution with --mode and the virtual screen size with --fb and panning area (typically same as virtual screen size) with --panning.

For example,

  • $ xrandr --output VGA1 --rate 60 --mode 800x600 --fb 1280x1024 --panning 1280x1024

How to setup a dual monitor

Introduction

This article above will give you some important background information. I will summarize the points that I think are important and add a few points. It makes life easier if you pop open a terminal and type to open your gui monitor program:

  • $ gnome-display-properties

Next uncheck same image in all Monitors. If your watch a lot of movies it is important to set your Monitors to your lower resolution. For example, if they are both 1440 x 900 monitors, make sure it is set to that resolution. If the monitors are different resolutions, you will need it to the resolution of the smaller monitor. So, for example, if one monitor is 1440 x 900 and the other is full HD resolution, you will have to set it at 1440×900. The reason for this is your video will be a black screen when trying to watch a movie so this is very important. Click APPLY. Then you will get a warning and you need to keep your new configuration. You will need to restart your session for this to take effect sometimes. There are 2 simple ways to do this. The first is to log out then log back in, and the second is to hit ctrl+alt+backspace. The second method restarts your x session so make you save your work.

This guide is targeted for people who want to use extended desktop mode on two outputs. Clone mode should work out-of-box with a normal configuration.

With RandR 1.2, you can setup dual head and add/remove monitor dynamically (i.e. on-the-fly, without restarting X).

Output port names

Intel driver - UMS

  • VGA - Analog VGA output

  • LVDS - Laptop panel

  • DP1 - DisplayPort output

  • TV - Integrated TV output

  • TMDS-1 - First DVI SDVO output

  • TMDS-2 - Second DVI SDVO output

The SDVO and DVO TV outputs are not supported by the driver at this time.

Intel driver - KMS

  • LVDS1 - Laptop panel

  • VGA1 - Analog VGA output

  • DVI1 - Digital video output

radeon driver

  • VGA-0 - Analog VGA output

  • LVDS - Laptop panel

  • S-video - Integrated TV output

  • DVI-0 - DVI output

http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

Four methods to setup

  1. By session with .xprofile.
  2. Dynamically by using xrandr tool
  3. Statically by setting in xorg.conf.
  4. Xrandr Graphical Front End GUI.

xrandr tool (an app component in Xorg) is a command line interface to RandR extension, and can be used to set outputs for a screen dynamically, without any specific setting in xorg.conf. You can refer the xrandr manual for details.

By Session with .xprofile

Use your favorite editor to create ~/.xprofile containing something like:

  • xrandr --output VGA1 --mode 1024x768 --rate 60

Now that command will be run every time your start your Xsession. You can force it to run by logging out and logging back in or by executing ~/.xprofile from your terminal.

Here is an example of my ~/.xprofile. The # are for comments just like you do with shell scripts. The purpose of my setup is sometime have laptop on the left and other times I have my laptop on the right. This makes very simple and easy to change which side you want each monitor to be on. I just added the information on how to set your primary monitor.

  • xrandr --output VGA1 --mode 1024x768 --rate 60
    
    #Laptop right extra Monitor Left
    #xrandr --output VGA1 --left-of LVDS1
    
    #Laptop left extra Monitor right
    xrandr --output LVDS1 --left-of VGA1
    
    #This is to set your primary monitor.
    
    #This sets your laptop monitor as your primary monitor. 
    xrandr --output LVDS1 --primary
    
    #This sets your VGA monitor as your primary monitor. 
    #xrandr --output VGA1 --primary

Some people think it is a disadvantage that this only works for one user, other people think this is an advantage. If you want to be able to use this just copy it over to your profile folder.

Important Note: If you just blindly copy some commands from a website, you may see an error message:

  • xrandr: cannot find mode 1024×768

This may be due to some CMS' way of modifying content: xrandr expects the letter x and not the multiplication cross × between horizontal and vertical resolution.

Incorrect example:

  • $ xrandr --output VGA1 --mode 1024×768 --rate 60

Corrected example

  • $ xrandr --output VGA1 --mode 1024x768 --rate 60

Dynamic setup with xrandr

Xrandr can be used to change outputs' mode, rotation direction, position, etc. In this guide, we only introduce options related with dual head setting.

You can see the outputs' status with option '-q'. Below is an example:

  • $ xrandr -q
    Screen 0: minimum 320 x 200, current 2048 x 768, maximum 4096 x 4096
    VGA1 connected 1024x768+1024+0 (normal left inverted right x axis y axis) 338mm x 270mm
     1280x1024      60.0 +   75.0  
     1280x960       75.0     70.0     60.0  
     1152x864       75.0     70.0     60.0  
     1024x768       75.1     70.1     66.0     60.0* 
     832x624        74.6  
     800x600        72.2     75.0     60.3     56.2  
     640x480        72.8     75.0     66.7     60.0  
     720x400        70.1  
    LVDS1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 304mm x 228mm
     1024x768       60.0*+
     800x600        60.3  
     640x480        59.9  
    DVI1 disconnected (normal left inverted right x axis y axis)
    TV1 disconnected (normal left inverted right x axis y axis)

In the above example, two outputs (VGA1 and LVDS1) are connected, the resolution of both is 1024x768@60, output VGA's viewport is at (1024, 0) and output LVDS's viewport is at (0, 0), i.e. LVDS1 is located at left of VGA. The size of occupied area by both outputs is 2048x768. The virtual screen size (maximum framebuffer) is 4096 x 4096 which is statically set in xorg.conf (see next section). You can decrease the maximum with '--fb' option but can not increase it. You need make sure your screen size fall into the maximum framebuffer, otherwise you should increase the value in xorg.conf.

There are five xrandr options that can be used to set Dual Monitor:

  • $ xrandr --pos <x>x<y>
    $ xrandr --left-of <output>
    $ xrandr --right-of <output>
    $ xrandr --above <output>
    $ xrandr --below <output>

The last four will set the output's relative position to another output, for example:

  • $ xrandr --output VGA1 --left-of LVDS1

Option '-pos' is more flexible which can place output to anywhere, for example:

  • $ xrandr --output VGA1 --pos 200x200
    $ xrandr --output LVDS1 --pos 400x500

statically setup in xorg.conf

RandR1.2 configuration in xorg.conf is based on per monitor. So you need write a 'Monitor' section for each output and specify these monitors in 'Device' section.

Below is a example snippet in xorg.conf.

  • Section "Device"
            Identifier      "Intel 945G "
            Driver         "intel"
    
            # Using the name of the output defined by the video driver plus the identifier of a
            #     monitor section, one associates a monitor section with an output by adding an
            #     option to the Device section in the following format:
            #     Option "Monitor-outputname" "monitor ID"
    
            Option          "monitor-VGA" "foo"
            Option          "monitor-LVDS" "bar"
            #Option         "monitor-TMDS-1" "dvi"
    EndSection
    
    Section "Monitor"
            Identifier      "foo"
    
            # specifies a mode to be marked as the preferred initial mode of the monitor
            # Option "PreferredMode"  "800x600"
            # This optional entry specifies the position of the monitor within the X screen.
            #Option        "Position" "1024 0"
            #This optional entry specifies that the monitor should be ignored
            #     entirely, and not reported through RandR.  This is useful if the
            #     hardware reports  the  presence  of  outputs  that do not exist.
            #Option "Ignore"  "true"
    EndSection
    
    Section "Monitor"
            Identifier      "bar"
    
            #Options LeftOf, RightOf, Above, Below specify monitors' relative position
    
            Option "LeftOf"  "foo"
    
            # This optional entry specifies  whether  the  monitor  should  be
            #     turned  on  at  startup.  By default, the server will attempt to
            #     enable all connected monitors.
            #Option "Enable"  "true"       
    
            #This optional entry specifies the initial rotation of the given monitor.
            #     Valid values for rotation are "normal", "left", "right", and "inverted".
            # Option "Rotate"  "left"
    EndSection
    
    Section "Screen"
            Identifier      "Default Screen"
            Device        "Intel Corporation 945G Integrated Graphics Controller"
            Monitor       "foo"
            DefaultDepth  24
            SubSection "Display"
                    Depth          24
                    Modes         "1280x1024"  "1024x768"   "640x480"
            EndSubSection
    EndSection

Xrandr Graphical Front End GUI

Not recognised video cards

It is possible, that resolutions higher than 1024x768 (or 800x600.. 640x480) are not avalaible by default, because the videocard isn't recognised propely. If you can add and apply the desired undetected resolution(s) dinamically with cvt and xrandr, but you get an error after applying static changes to xorg.conf, etc/gdm/init/default, or .xprofile etc. & reboot, something like 'Stored settings can't be applied to monitors, any of the selected modes are not compatible with avalaible modes.. trying modes to 79.CRTC..', than You could try forcing X to recognize the video RAM.

Use your favorite text editor as root: (open a terminal)

  •  $ sudo nano /usr/share/X11/xorg.conf.d/99-vesahack

or

  •  $ gksudo gedit /usr/share/X11/xorg.conf.d/99-vesahack 

and put this in the newly created file:

  • Section "Device"
        Identifier "Screen0"
        VideoRam 10000
    EndSection

This tells X that there is 10000 kB (~10 MB) of video RAM, enough for 1920x1200 at 4 bytes per pixel. You can replace '10000' above with the amount of avalaible video ram. Save and reboot. (Remove the 99-vesahack file if it doesn't help.)

Adding undetected resolutions

Due to buggy hardware or drivers, your monitor's correct resolutions may not always be detected. For example, the EDID data block queried from your monitor may be incorrect.

If the mode already exists, but just isn't associated for the particular output, you can add it like this:

  • $ xrandr --addmode S-video 800x600

If the mode doesn't yet exist, you'll need to create it first by specifying a modeline:

  • $ xrandr --newmode <Mode``Line>

You may create a modeline using the gtf or cvt utility. For example, if you want to add a mode with resolution 800x600 at 60 Hz, you can enter the following command: (The output is shown following.)

  • $ cvt 800 600 60
    # 800x600 59.86 Hz (CVT 0.48M3) hsync: 37.35 kHz; pclk: 38.25 MHz
    Modeline "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync

Then copy the information after the word "Modeline" into the xrandr command:

  • $ xrandr --newmode "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync

After the mode is entered, it needs to be added to the output using the --addmode command as explained above.

Setting xrandr changes persistently

There are several ways to make xrandr customizations permanent from session to session: a) .xprofile, b) kdm/gdm, c) xorg.conf. Each of these mechanisms will be discussed in turn.

Setting xrandr commands in .xprofile

A user's ~/.xprofile file is executed on Xorg startup if it exists and is executable. You can copy and paste xrandr command line strings into this file so they're executed when you log in. For example:

  • $ xrandr --output VGA-0 --mode 800x600

There are two disadvantages to using .xprofile for xrandr settings. First, it occurs fairly late in the startup process, so you'll see some resolution resizing during the initial screen draw; in some cases panel windows may resize improperly as a result. Second, as this is a per-user setting, it won't affect the resolutions of other users, nor will it alter the resolution on the login screen.

Setting xrandr commands in kdm/gdm startup scripts

Both KDM and GDM have startup scripts that are executed when X is initiated. For GDM, these are in /etc/gdm/ , while for KDM this is done at /etc/kde4/kdm/Xsetup. In either case, you can paste in an xrandr command line string into one of these scripts. For GDM, try putting them right before

  • initctl -q emit login-session-start DISPLAY_MANAGER=gdm

in /etc/gdm/Init/Default.

This process requires root access and mucking around in system config files, but will take effect earlier in the startup process than using .xprofile, and will apply to all users including the login screen.

Setting resolution changes in xorg.conf

While xorg.conf is largely empty these days, it can still be used for setting up resolutions. For example:

  • Section "Monitor"
        Identifier      "External DVI"
        Modeline        "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync
        Option          "PreferredMode" "1280x1024_60.00"
    EndSection
    Section "Device"
        Identifier      "ATI Technologies, Inc. M22 [Radeon Mobility M300]"
        Driver          "ati"
        Option          "Monitor-DVI-0" "External DVI"
    EndSection
    Section "Screen"
        Identifier      "Primary Screen"
        Device          "ATI Technologies, Inc. M22 [Radeon Mobility M300]"
        DefaultDepth    24
        SubSection "Display"
            Depth           24
            Modes   "1280x1024" "1024x768" "640x480"
        EndSubSection
    EndSection
    
    Section "ServerLayout"
            Identifier      "Default Layout"
            Screen          "Primary Screen"
    EndSection

See man xorg.conf for full details on how to craft an xorg.conf file.

Setting resolution changes in xorg.conf -- resolution lower than expected

Try this first

If you video card is recognized but the resolution is lower than you expect, you may try this.

Background: I use Ubuntu 9.0.4 x86, ATI X1550 based video card and two LCD monitors DELL 2408(up to 1920x1200) and Samsung 206BW(up to 1680x1050). Upon first login after installation, the resolution default to 1152x864. xrandr does not list any resolution higher than 1152x864. You may want to try editing /etc/X11/xorg.conf, add a section about virtual screen, logout, login and see if this helps. If not then read on.

Change the default xorg.conf

  • Section "Device"
            Identifier      "Configured Video Device"
    EndSection
    
    Section "Monitor"
            Identifier      "Configured Monitor"
    EndSection
    
    Section "Screen"
            Identifier      "Default Screen"
            Monitor         "Configured Monitor"
            Device          "Configured Video Device"
    EndSection

To:

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
->        SubSection "Display"
->                Virtual 3600 1200
->        EndSubSection
EndSection

Section "Device"
        Identifier      "Configured Video Device"
EndSection

About the numbers: I put DELL on the left and Samsung on the right. So the virtual width is of sum of both LCD width 3600=1920+1680; Height then is figured as the max of them, which is max(1200,1050)=1200. If you put one LCD above the other, use this calculation instead: (max(width1, width2), height1+height2).

If that does not help, here's what I did:

Use cvt/xrandr tool to add the highest mode the LCD can do

The actual order was different, as I tried to add new mode to one LCD at a time. Below is the combined/all-in-one quote

  • aa@aa-desktop:/$ cvt 1920 1200 60
    # 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz
    Modeline "1920x1200_60.00"  193.25  1920 2056 2256 2592  1200 1203 1209 1245 -hsync +vsync
    aa@aa-desktop:/$ cvt 1680 1050 60
    # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
    Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
    aa@aa-desktop:/$ xrandr --newmode "1920x1200_60.00"  193.25  1920 2056 2256 2592  1200 1203 1209 1245 -hsync +vsync
    aa@aa-desktop:/$ xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
    aa@aa-desktop:/$ xrandr --addmode DVI-1 "1920x1200_60.00"
    aa@aa-desktop:/$ xrandr --addmode DVI-0 "1680x1050_60.00"

Goto Ubuntu Menu: System -> Preference -> Display

Change one of the LCD's resolution to a lower one, e.g. 800x600. Apply change, then (I don't remember the exact order/wording here:) hopefully the GUI will give you a prompt saying something like "the resolution can be improved but virtual screen has to be enabled, you need to however logout and log back in". I did it and on 2nd login, I am able to find the higher resolution listed for that LCD. After that I follow suite and make similar change to 2nd LCD and am able to get both of them working.

Obtaining modelines from Windows program PowerStrip

X.Org Wiki has an article about this.

X/Config/Resolution (last edited 2013-02-01 14:19:52 by 91-157-220-54)