3

I have a HP laptop with an nVidia card, and I'm using Ubuntu 11.04 (stable). I have set up TwinView using the nVidia X Server Settings application. If I boot up without my secondary monitor plugged in, the desktop is stretched and out of resolution. Unity and the main panel work and look normal, but any applications I run are also stretched and the resolution is wrong, making them virtually unusable. When I boot with my secondary monitor plugged in (via HDMI) everything is working fine.

I've drilled this down to my xorg.conf file. If I delete the file and restart, the primary monitor works fine but I need to configure nVidia to use TwinView again. For a laptop where I'm constantly switching between single and multiple monitors, this gets annoying...

So basically my question is: can I set up Ubuntu in a way where the dual monitor settings are ignored when only 1 monitor is plugged in? This worked fine in 10.10 (btw I still have that xorg.conf file, and it causes the same issue).

Here is my current xorg.conf file:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 270.29  (buildd@allspice)  Fri Feb 25 14:42:07 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     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Seiko/Epson"
    HorizSync       30.0 - 75.0
    VertRefresh     60.0
    Option         "DPMS"
EndSection

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

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "metamodes" "DFP-0: nvidia-auto-select +1920+0, DFP-1: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Cas
  • 8,557
Michael
  • 31

3 Answers3

2

If this is a hybrid graphics laptop, try to install bumblebee to have both the Intel and Nvidia cards working simultaneously, and use gnome-display-properties for multi-screen configurations, which is better than nvidia twinview these days: https://launchpad.net/~hybrid-graphics-linux

sudo apt-get install git
# type password
git clone http://github.com/MrMEEE/bumblebee.git
cd bumblebee/
sudo ./install.sh
optirun glxgears
# check the speed and compare to running:
glxgears
# If you have google-chrome installed, you can try it with/without optirun and report the FPS values on the mailing list:
optirun google-chrome http://webglsamples.googlecode.com/hg/aquarium/aquarium.html
719016
  • 6,217
1

My first suggestion is to not use the xorg.conf as it tends to cause more problems than it solves.

What I suggest instead is disper which can be run on startup and if the monitor is not detected it will not switch the resolution. If you have a more complicated setup you can create a script with different disper setups as I did in this answer - How to automatically switch monitors with my laptop dock

Cas
  • 8,557
0

I've tackled this one too. The current file that works for me is at the end.

The main settings that keeps things in spec are:

Option "TwinViewXineramaInfoOrder" "CRT-0"
Option "metamodes" "CRT: nvidia-auto-select, DFP: nvidia-auto-select"
Option "TwinViewOrientation" "RightOf"

This also allows me to use a range of different monitors (connected at boot time) without having to worry about their resolution.

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "DELL SE198WFP"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8400M GS"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "TwinViewXineramaInfoOrder" "CRT-0"
    Option         "metamodes" "CRT: nvidia-auto-select, DFP: nvidia-auto-select"
    Option          "TwinViewOrientation" "RightOf"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
AgentK
  • 1,080