xrandr - How to set a custom resolution?

18
2014-04
  • user216356

    I tried to use xrandr to set 1680x1050 as a new mode to VGA output, but it says:

     sudo xrandr --addmode VGA-0 1680
    X Error of failed request:  BadMatch (invalid parameter attributes)
      Major opcode of failed request:  140 (RANDR)
      Minor opcode of failed request:  18 (RRAddOutputMode)
      Serial number of failed request:  35
      Current serial number in output stream:  36
    
  • Answers
  • thom

    First generate a "modeline" by using cvt
    Syntax is: cvt width height refreshrate

    cvt 1680 1050 60
    

    this gives you:

    # 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
    

    Now tell this to xrandr:

    sudo xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
    

    Then you can now add it to the table of possible resolutions of an output of your choice:

    sudo xrandr --addmode VGA-0 "1680x1050_60.00"
    

  • Related Question

    10.04 - Problem changing resolution using xrandr: BadMatch
  • Toto

    I tried to change the resolution using the following commands (found here):

    Use xrandr to check the current configuration and available modes:

    $ xrandr
    Screen 0: minimum 64 x 64, current 800 x 600, maximum 32000 x 32000
    VBOX1 connected 800x600+0+0 0mm x 0mm
       800x600        60.0*+
       640x480        59.9  
    

    Use cvt to get the proper modeline for 1280x800:

    $ cvt 1280 800
    # 1280x800 59.81 Hz (CVT 1.02MA) hsync: 49.70 kHz; pclk: 83.50 MHz
    Modeline "1280x800_60.00"   83.50  1280 1352 1480 1680  800 803 809 831 -hsync +vsync
    

    Create the new mode using xrandr --newmode:

    $ xrandr --newmode "1280x800_60.00"   83.50  1280 1352 1480 1680  800 803 809 831 -hsync +vsync
    

    Use xrandr again to check that the mode was created successfully:

    $ xrandr
    Screen 0: minimum 64 x 64, current 800 x 600, maximum 32000 x 32000
    VBOX1 connected 800x600+0+0 0mm x 0mm
       800x600        60.0*+
       640x480        59.9  
      1280x800_60.00 (0x11a)   83.0MHz
            h: width  1280 start 1352 end 1480 total 1680 skew    0 clock   49.4KHz
            v: height  800 start  803 end  809 total  831           clock   59.5Hz
    

    However, when I try to add the new mode to the display with xrandr --addmode I get the following error:

    $ xrandr --addmode VBOX1 1280x800_60.00
    X Error of failed request:  BadMatch (invalid parameter attributes)
      Major opcode of failed request:  150 (RANDR)
      Minor opcode of failed request:  18 (RRAddOutputMode)
      Serial number of failed request:  18
      Current serial number in output stream:  19
    

    Of course, if I try to set the new resolution for my current display it fails (the mode isn't associated to te display):

    $ xrandr --output VBOX1 --mode 1280x800_60.00
    xrandr: cannot find mode 1280x800_60.00
    

  • Related Answers
  • Olver

    Seems that you're trying within VirtualBox. If it's the case, just install VirtualBox Guest Addition, you can get any resolution (by resizing the VirtualBox window)