View previous topic :: View next topic |
Author |
Message |
optiluca Guru
Joined: 16 Jan 2006 Posts: 545 Location: Rivergaro, Italy
|
Posted: Wed Jul 20, 2011 9:24 pm Post subject: Setting up for dual screens |
|
|
Hi all. Firstly, apologies if this has already been covered before, but the topic is proving quite hard to search around for, given the rapidly evolving nature of Xorg which renders half the info out there wrong/obsolete..
I am trying to set up dual monitors on my laptop, running an nvidia card with proprietary drivers. Twinview works just fine, but it has a few perks that I find quite annoying, so I wanted to give a "true" dual monitor setup a try. As the second monitor will only be rarely plugged in, I would like to be able to hotplug it with the X server already started. This is done using xrandr I believe. However, from what I understand Xorg.conf needs to have a few sections added for everything to function correctly. Namely, a "Virtual" line needs to be added, in order to tell Xorg how big the "Virtual screen" which contains the 2 physical displays should be.
With this modification, my Xorg.conf reads as follows
Code: |
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "NvAGP" "1"
Option "UseEdidDpi" "FALSE"
Option "DPI" "96 x 96"
Screen 0
EndSection
Section "Screen"
Identifier "Default Screen Section"
Subsection "Display"
Virtual 3840 2160
EndSubSection
EndSection
Section "InputClass"
Identifier "Keyboard Defaults"
MatchIsKeyboard "yes"
Option "XkbLayout" "ch"
Option "XkbVariant" "de"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
Section "InputClass"
Identifier "Touchpad Defaults"
MatchIsTouchpad "yes"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
Option "SHMConfig" "on"
Option "RightEdge" "5500"
Option "VertEdgeScroll" "1"
Option "VertTwoFingerScroll" "true"
Option "EmulateTwoFingerMinZ" "95"
EndSection
Section "InputClass"
Identifier "Trackpoint"
MatchProduct "TPPS/2 IBM TrackPoint"
Option "SHMConfig" "true"
Option "Sensitivity" "171"
Option "Speed" "150"
EndSection |
However, when I boot up with no external display attached, Xorg starts centred on the "Virtual" screen, so I get http://imagebin.org/164061
Also, if I place my cursor on any side, the "Virtual screen" will pan over in that direction! Looking at this http://lynnlinse.wikispaces.com/Ubuntu+panning+virtual+xorg+desktop , this is apparently a desired feature by some. It most definitely is not by me Also, some windows now open in the centre of this virtual screen, and not in the centre of the true screen! What's going on? I fail to see a significant difference between what I have set up, and what is stated here http://en.gentoo-wiki.com/wiki/X.Org/Dual_Monitors#Intermittent_Dual-Monitors
Any ideas??
Thanks in advance _________________ # "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"
http://www.rinkworks.com/stupid/cs_mincing.shtml |
|
Back to top |
|
|
BradN Advocate
Joined: 19 Apr 2002 Posts: 2391 Location: Wisconsin (USA)
|
Posted: Sat Jul 23, 2011 7:35 pm Post subject: |
|
|
First idea, make sure everything's compiled with the xinerama use flag, it might help. I think what's happening on your setup is that this section...
Section "Screen"
Identifier "Default Screen Section"
Subsection "Display"
Virtual 3840 2160
EndSubSection
EndSection
is making it want to do a larger virtual screen. Unfortunately I haven't set up multiple monitors in a long time so I haven't kept up with what needs to be done in xorg.conf for that type of stuff. I thought this stuff has become a lot more automated and might not even need xorg.conf settings if your desktop environment has good monitor configuration capability.
Be careful to check the dates on howtos and forum posts with regard to this stuff because I think a lot of it's changed lately. |
|
Back to top |
|
|
geki Advocate
Joined: 13 May 2004 Posts: 2387 Location: Germania
|
Posted: Sun Jul 24, 2011 9:13 am Post subject: |
|
|
I switched from nvidia propietary to intel i915 these days with monitor and TV setup.
I guess this will work for any good gfx card and monitor/TV these days?!
well, maybe the device with nvidia driver needs to be set. does not need to be for intel here.
this is my xorg.conf:
http://geki.ath.cx/hacks/xorg.conf
my xrandr line to setup: ( i.e. put in ~/.xinitrc or ~/.xsession )
Quote: | xrandr --output VGA1 --mode 1920x1080 --output HDMI1 --mode 1920x1080 --right-of VGA1 |
enabled USE="xinerama" globally for i.e.:
Quote: | mplayer -xineramascreen X <movie> |
I did not expect it to be that simple.
looks like the devs did well last years. _________________ hear hear |
|
Back to top |
|
|
Gusar Advocate
Joined: 09 Apr 2005 Posts: 2665 Location: Slovenia
|
Posted: Sun Jul 24, 2011 12:29 pm Post subject: |
|
|
Look into Twinview, in particular TwinviewXineramaInfoOrder. And as has been said, compile everything with the xinerama USE flag, if it isn't already. |
|
Back to top |
|
|
optiluca Guru
Joined: 16 Jan 2006 Posts: 545 Location: Rivergaro, Italy
|
Posted: Sun Jul 24, 2011 10:24 pm Post subject: |
|
|
As I said in my original post, twinview does work, but it has a few weird perks that I don't particularly like.
Also, xinerama is indeed enabled globally. I don't have my secondary screen to try at the moment, but when I last tried connecting it and running xrandr -q, nothing was found other than my laptop screen. Also, the xorg.conf you posted only contains unrelated information as far as I can make out, eg paths/modules/inputs, nothing related to displays. I'll try the xrandr command you posted, but considering xrandr -q finds nothing I am not too confident...
BTW, the external monitor is attached via an HDMI cable, thru a Displayport/HDMI adaptor. As I said, it works just fine using twinview, via the nvidia-settings program, but I'd like to use xrandr instead _________________ # "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"
http://www.rinkworks.com/stupid/cs_mincing.shtml |
|
Back to top |
|
|
Gusar Advocate
Joined: 09 Apr 2005 Posts: 2665 Location: Slovenia
|
Posted: Sun Jul 24, 2011 10:46 pm Post subject: |
|
|
optiluca wrote: | As I said, it works just fine using twinview, via the nvidia-settings program, but I'd like to use xrandr instead |
You can't. While xrandr and twinview are very similar actually in the way they work (merged framebuffer, xineramainfo to inform clients of screen sizes and positions), they're not the same. Nvidia won't switch to xrandr because it's missing something they want/need. I don't know any details though. Except that xrandr 1.4 will possibly provide it, but who knows when xrandr 1.4 will be released and when/if will nvidia then update their driver to use it. |
|
Back to top |
|
|
BradN Advocate
Joined: 19 Apr 2002 Posts: 2391 Location: Wisconsin (USA)
|
Posted: Mon Jul 25, 2011 2:01 am Post subject: |
|
|
It could be related to 3d acceleration spanning the displays or even more exotic stuff like stereo displays - nvidia actually supports some unusual stuff in their linux drivers. |
|
Back to top |
|
|
lyallp Veteran
Joined: 15 Jul 2004 Posts: 1579 Location: Adelaide/Australia
|
Posted: Mon Jul 25, 2011 6:20 am Post subject: |
|
|
Before I start, if there is a better way to do this, I am all ears.
I guess I could merge both xorg config files into one and have the xdm-setup simply set the X startup parameter, indicating which serverLayout to use, however, this works for me and if it isn't broken, I probably won't get around to fixing it.
Anyway, on to what I have....
I have a HP EliteBook 8540w working with two different sized monitors, with the large, external, monitor plugged into the docking bay in addition to the built in panel.
I use nvidia proprietary drivers.
So, my screen real estate varies depending upon if I am docked or undocked.
I assume that docking state will only change whilst powered down and not under hibernation.
A hot dock/undock will result in the no change in my monitor configuration, possibly causing issues if I undock and being unable to access windows. I am ok with this.
Given all this, I have approached it in such a way that X will setup, depending upon what it's configuration is at X startup time.
A little extra effort, I guess I could make it 'switch' as I hot dock/undock.
I use Fluxbox, so a lot of the 'KDE/Gnome' functionality is not available to me.
I use an init script /etc/init.d/xdm-setup, on which my /etc/init.d/xdm depends.
I have tweaked this script to check to see if I am docked or not, on the assumption that the second monitor is available whilst docked.
My external monitor is a 24" widescreen which is positioned on the LEFT of the laptop.
Additionally, the bottom of the two screens line up physically, so I wanted the bottom of the 'screens' to line up.
The /etc/init.d/xdm-setup script
Code: | #!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm-setup.initd-1,v 1.1 2010/04/13 10:07:39 scarabeus Exp $
depend() {
need localmount
}
start() {
if get_bootparam "nox" ; then
touch /etc/.noxdm
else
# check to see if we are docked, if we are, we assume an external monitor.
# maybe later figure out how to tell if the external monitor is there at all.
if [ -r /sys/devices/platform/hp-wmi/dock -a -r /etc/X11/xorg.docked.conf -a -r /etc/X11/xorg.undocked.conf ]
then
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
if [ "$(</sys/devices/platform/hp-wmi/dock)" = "1" ]
then
cp /etc/X11/xorg.docked.conf /etc/X11/xorg.conf && logger "Configured for Docked operation."
else
cp /etc/X11/xorg.undocked.conf /etc/X11/xorg.conf && logger "Configured for Undocked operation."
fi
fi
fi
}
|
Given this, I have two xorg.conf files, one configured for my docked situation and one configured for my undocked situation.
See the two xorg.conf files, below.
Undocked - only laptop panel used.
Code: | # nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 260.19.29 (buildmeister@swio-display-x86-rhel47-04.nvidia.com) Wed Dec 8 12:27:27 PST 2010
#Section "Files"
# FontPath "/usr/share/fonts/Windows"
#EndSection
# Section "ServerFlags"
# Option "blank time" "5" # Blank the screen after 5 minutes (Fake)
# Option "standby time" "10" # Turn off screen after 10 minutes (DPMS)
# Option "suspend time" "20" # Full suspend after 20 minutes
# Option "off time" "30" # Turn off after half an hour
# EndSection
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
# InputDevice "Joystick0" "SendCoreEvents"
Option "Xinerama" "0"
EndSection
Section "ServerFlags"
# Option "DefaultServerLayout" "DualSingleDesktop"
Option "AutoAddDevices" "false"
Option "AutoEnableDevices" "true"
Option "AllowEmptyInput" "true"
# Screen blanking, 1 hour - primarily so I don't have it blank during movie playback.
Option "BlankTime" "60"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "60"
# Option "Xinerama" "true"
Option "TwinView" "true"
Option "TwinViewOrientation" "RightOf"
Option "IgnoreDisplayDevices" "TV"
Option "UseEvents" "true"
Option "BackingStore" "1"
EndSection
Section "InputDevice"
Identifier "Joystick0"
Option "Path" "/dev/input/js0"
Driver "joystick"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
# generated from data in "/etc/conf.d/gpm"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "LGD"
DisplaySize 344 194
HorizSync 30.0 - 75.0
VertRefresh 60.0
Option "DPMS"
# Option "PreferredMode" "1920x1080"
# 13.54 x 7.59 inches
# 34.4 x 19.4 cm
# 142 Pixels per inch
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "SWcursor" # [<bool>]
#Option "HWcursor" # [<bool>]
#Option "NoAccel" # [<bool>]
#Option "ShadowFB" # [<bool>]
#Option "VideoKey" # <i>
#Option "WrappedFB" # [<bool>]
# BusID "PCI:1:0:0"
Identifier "Card0"
Driver "nvidia"
Option "BackingStore" "1"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro FX 880M"
Option "BackingStore" "1"
EndSection
Section "Screen"
# Removed Option "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-3: NULL"
# Removed Option "TwinView" "1"
# Removed Option "metamodes" "DFP-0: nvidia-auto-select +1920+120, DFP-3: nvidia-auto-select +0+0"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "NoPowerConnectorCheck" "false"
Option "NoLogo" "true"
Option "AddARGBGLXVisuals" "true"
Option "UseEvents" "false"
Option "RenderAccel" "true"
Option "HWcursor"
Option "TwinView" "0"
Option "TwinViewXineramaInfoOrder" "DFP-0"
Option "metamodes" "nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection |
Docked - laptop panel is primary, external 24" widescreen, to the LEFT, is secondary.
Code: | # nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 260.19.29 (buildmeister@swio-display-x86-rhel47-04.nvidia.com) Wed Dec 8 12:27:27 PST 2010
#Section "Files"
# FontPath "/usr/share/fonts/Windows"
#EndSection
# Section "ServerFlags"
# Option "blank time" "5" # Blank the screen after 5 minutes (Fake)
# Option "standby time" "10" # Turn off screen after 10 minutes (DPMS)
# Option "suspend time" "20" # Full suspend after 20 minutes
# Option "off time" "30" # Turn off after half an hour
# EndSection
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
# InputDevice "Joystick0" "SendCoreEvents"
Option "Xinerama" "0"
EndSection
Section "ServerFlags"
# Option "DefaultServerLayout" "DualSingleDesktop"
Option "AutoAddDevices" "false"
Option "AutoEnableDevices" "true"
Option "AllowEmptyInput" "true"
# Screen blanking, 1 hour - primarily so I don't have it blank during movie playback.
Option "BlankTime" "60"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "60"
# Option "Xinerama" "true"
Option "TwinView" "true"
Option "TwinViewOrientation" "RightOf"
Option "IgnoreDisplayDevices" "TV"
Option "UseEvents" "true"
Option "BackingStore" "1"
EndSection
Section "InputDevice"
Identifier "Joystick0"
Option "Path" "/dev/input/js0"
Driver "joystick"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
# generated from data in "/etc/conf.d/gpm"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "LGD"
DisplaySize 344 194
HorizSync 30.0 - 75.0
VertRefresh 60.0
Option "DPMS"
# Option "PreferredMode" "1920x1080"
# 13.54 x 7.59 inches
# 34.4 x 19.4 cm
# 142 Pixels per inch
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "SWcursor" # [<bool>]
#Option "HWcursor" # [<bool>]
#Option "NoAccel" # [<bool>]
#Option "ShadowFB" # [<bool>]
#Option "VideoKey" # <i>
#Option "WrappedFB" # [<bool>]
# BusID "PCI:1:0:0"
Identifier "Card0"
Driver "nvidia"
Option "BackingStore" "1"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro FX 880M"
Option "BackingStore" "1"
EndSection
Section "Screen"
# Removed Option "metamodes" "DFP-0: nvidia-auto-select +0+0, DFP-3: NULL"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "NoPowerConnectorCheck" "false"
Option "NoLogo" "true"
Option "AddARGBGLXVisuals" "true"
Option "UseEvents" "false"
Option "RenderAccel" "true"
Option "HWcursor"
Option "TwinView" "1"
Option "TwinViewXineramaInfoOrder" "DFP-0"
Option "metamodes" "DFP-0: nvidia-auto-select +1920+120, DFP-3: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
|
I hope this helps.
Oh, and if you get the hot plugging working, post a message here - I am very interested. _________________ ...Lyall |
|
Back to top |
|
|
optiluca Guru
Joined: 16 Jan 2006 Posts: 545 Location: Rivergaro, Italy
|
Posted: Mon Aug 01, 2011 10:21 pm Post subject: |
|
|
lyallp wrote: | Oh, and if you get the hot plugging working, post a message here - I am very interested. |
During my searches, I have come across a nifty utility called disper, which is in portage. Specifically, I believe there is a script bundled with it that does hot plugging and other fancy stuff, but have not looked into it yet. Have you tried it before? _________________ # "Hmm, sounds like your system froze up."
# "I don't know why. It's about 80 degrees in here!"
http://www.rinkworks.com/stupid/cs_mincing.shtml |
|
Back to top |
|
|
lyallp Veteran
Joined: 15 Jul 2004 Posts: 1579 Location: Adelaide/Australia
|
Posted: Tue Aug 02, 2011 3:41 am Post subject: |
|
|
In my attempts to have acpi events cause the display readjustment, I have come up with a script that uses disper.
My acpi events invoke it but it doesn't affect my logged in session.
As a workaround, I have assigned the script to a key, which I can press when I dock/undock.
I also set this to run in my .Xsession
This works with my HP EliteBook 8540w with the hp_wmi module configured.
Code: | #!/bin/sh
# Interlocking to prevent paralell runs.
LOCKDIR="/tmp/docking_lock"
if mkdir "${LOCKDIR}"; then
:
else
# already running
exit 0
fi
# cleanup on exit.
trap "/bin/rm -fr ${LOCKDIR}" EXIT
# just so we know who created it and can clean up if necessary
echo "$$:$(date):$(logname)" > "${LOCKDIR}/pid"
DOCKING_STATE="/sys/devices/platform/hp-wmi/dock"
PREVIOUS_DOCKING_STATE="/var/run/dock_state"
if [ ! -r "${DOCKING_STATE}" ]
then
# No docking detection
logger "ACPI $0 : No Docking detection found."
exit 0
fi
dockingState="$(<${DOCKING_STATE})"
if [ "${1}" != "" ]
then
# testing, allow docking state to be nominated on the command line.
dockingState="${1}"
shift
fi
if [ ! -r "${PREVIOUS_DOCKING_STATE}" ]
then
# create previous file if not there, exit if can't create it - first run probably needs to be as root
echo "0" > "${PREVIOUS_DOCKING_STATE}" ||
if [ ! -r "${PREVIOUS_DOCKING_STATE}" ]
then
logger "ACPI $0 : Failed to create ${PREVIOUS_DOCKING_STATE} : Please recitfy - aborted."
exit 1
fi
# need global write if currently logged in user is to be able to alter it.
chmod u=rw,g=rw,o=wr "${PREVIOUS_DOCKING_STATE}"
fi
previousDockingState="$(<${PREVIOUS_DOCKING_STATE})"
if [ "${dockingState}" != "${previousDockingState}" ]
then
logger "ACPI $0 : Docking state changed."
# update previous state
echo $dockingState > "${PREVIOUS_DOCKING_STATE}"
set -x
#
# do stuff here.
#
# re-enable disconnected displays
#[ "${DISPLAY}" != "" ] && oldDISPLAY="${DISPLAY}" && export DISPLAY=:0
#[ "${XAUTHORITY}" != "" ] && oldXAUTHORITY="${XAUTHORITY}" && export XAUTHORITY="$(ls /var/run/xauth/*)"
if [ "${dockingState}" -eq "1" ]
then
/usr/bin/xrandr --auto && /usr/bin/disper --displays=0 -i < /etc/disper/docked_external_LA2405wg.conf
logger "ACPI $0 : Docking state changed from undocked to docked."
else
/usr/bin/disper --displays=0 -i < /etc/disper/undocked_internal_only.conf
logger "ACPI $0 : Docking state changed from docked to undocked."
fi
#[ "${oldDISPLAY}" != "" ] && export DISPLAY="${oldDISPLAY}" || unset DISPLAY
#[ "${oldXAUTHORITY}" != "" ] && export XAUTHORITY="${oldXAUTHORITY}" || unset XAUTHORITY
#unset oldDISPLAY
#unset oldXAUTHORITY
echo $dockingState > "${PREVIOUS_DOCKING_STATE}" || exit 0
fi
|
The contents of the two conf files are as follows
docked_external_LA2405wg.conf Code: | backend: nvidia
associated displays: DFP-0, DFP-3
metamode: DFP-0: 1920x1080 @1920x1080 +1920+120, DFP-3: 1920x1200 @1920x1200 +0+0
scaling: stretched, stretched
|
undocked_internal_only.conf Code: | backend: nvidia
associated displays: DFP-0
metamode: DFP-0: 1920x1080 @1920x1080 +0+0
scaling: stretched
|
_________________ ...Lyall |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|