rotating screen 90 degrees clockwise

Just got a new computer loaded with NVidia GForce N430, and installed a fresh new Ubuntu 11.10 amd64.

I also enabled nvidia drivers using "additional drivers" apt, and all is working fine in "normal" mode, however, I want to rotate my screens, and failed getting through.

IIRC, in previous installations, there used to be an entry for rotation within nvidia-settings UI, but not in this version.

I am using two screens, and willing to use them rotated 90 degrees clockwise (portrait vs. landscape).

I am dumping my X11/xorg.cong file and will appreciate if one can tell where to add the Option "RandRRotation" "True" line.

By the way,

$ xrandr -o right

prints out

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  153 (RANDR)
  Minor opcode of failed request:  2 (RRSetScreenConfig)
  Serial number of failed request:  14
  Current serial number in output stream:  14

Content of /etc/X11/xorg.conf

$ cat /etc/X11/xorg.conf

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 280.13  (buildd@allspice)  Thu Aug 11 20:54:45 UTC 2011


Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"

    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "Philips 225P"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Monitor"

    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Philips 225P"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 430"
    BusID          "PCI:4:0:0"
    Screen          1
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 430"
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "DFP-1: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"

# Removed Option "TwinView" "0"
# Removed Option "metamodes" "DFP-0: nvidia-auto-select +0+0"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "metamodes" "DFP-0: nvidia-auto-select +1680+0, DFP-1: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

You need to add the following line after the Device section where the driver is listed as "nvidia" in your xorg.conf file

Option "RandRRotation" "on"

Example:

Section "Device"
    Identifier  "Default Device"
    Driver  "nvidia"
    Option  "RandRRotation" "on"
EndSection

Save the file then log out and log back in to restart the Xserver.

Use the following xrandr commands to rotate the screen;

xrandr -o left to rotate to the left, xrandr -o right to rotate to the right, xrandr -o normal to go back to a normal screen, xrandr -o inverted to flip the screen upside down.

Reference