Twinview Example
From Gentoo Linux Wiki
Contents |
[edit] Introduction
This article is about how to configure X with one AGP Geforce 6600GT with one DVI and one VGA adapter. A TFT is connected to the DVI adapter and a CRT is connected to the VGA adapter. The following combinations are described:
- (1) TFT only (called single)
- (2) TFT and CRT using nvidia's twinview without xinerama (called twinview)
- (3) TFT and CRT using two screen sections with xinerama (called xinerama)
The following combinations are not described:
- (4) TFT and CRT using nvidia'a twinview with xinerama
- (5) TFT and CRT using two screen sections without xinerama
The difference between (2) and (4) is the fullscreen behaviour. (2) shows a fullscreen window on one screen. (4) shows a fullscreen window over both screens.
The difference between (3) and (5) is that (3) allows to move a window from one screen to the other and (5) disallows it. For looking videos in fullscreen mode on one screen, (1), (2), (3) and (5) are possible configurations.
I always use the nvidia driver from nvidia. The configurations (2) and (4) will only work with this nvidia driver. (1), (3) and (5) will also work with the open source nv driver.
I prefer (3).
[edit] Versions used
Important packages:
- Linux Kernel 2.6.15
- x11-base/xorg-x11-6.8.2-r6
- media-video/nvidia-kernel-1.0.8174-r1
- media-video/nvidia-glx-1.0.8174-r1
Not important, but useful:
[edit] X Setup
This shows the X config file /etc/X11/xorg.conf. All three ServerLayouts can be used without changing the file.
| File: /etc/X11/xorg.conf |
Section "Files"
RgbPath "/usr/lib/X11/rgb"
FontPath "/usr/share/fonts/local/"
FontPath "/usr/share/fonts/misc/"
FontPath "/usr/share/fonts/75dpi/:unscaled"
FontPath "/usr/share/fonts/100dpi/:unscaled"
FontPath "/usr/share/fonts/Type1/"
FontPath "/usr/share/fonts/TTF/"
FontPath "/usr/share/fonts/CID/"
FontPath "/usr/share/fonts/75dpi/"
FontPath "/usr/share/fonts/100dpi/"
EndSection
Section "Module"
Load "dbe"
Load "v4l"
Load "extmod"
SubSection "extmod"
Option "omit xfree86-dga"
EndSubSection
Load "type1"
Load "freetype"
Load "glx"
EndSection
Section "Extensions"
Option "Composite" "Enable"
EndSection
Section "ServerFlags"
Option "blank time" "1"
Option "standby time" "2"
Option "suspend time" "3"
Option "off time" "4"
# SELECT YOUR PREFERRED LAYOUT HERE
Option "DefaultServerLayout" "twinview"
EndSection
Section "InputDevice"
Identifier "Keyboard_Labtec"
Driver "keyboard"
Option "XkbModel" "pc105"
Option "XkbLayout" "de"
Option "XkbVariant" "deadkeys"
EndSection
Section "InputDevice"
Identifier "Mouse_Logitech"
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "/dev/input/mice"
Option "Resolution" "800"
Option "Buttons" "7"
Option "ZAxisMapping" "6 7"
EndSection
Section "Monitor"
Identifier "SamsungTFT"
Option "dpms"
HorizSync 30.0-81.0
VertRefresh 56-75
DisplaySize 376 301
EndSection
Section "Monitor"
Identifier "ProviewCRT"
Option "dpms"
HorizSync 30.0-98.0
VertRefresh 50-160
DisplaySize 360 270
EndSection
Section "Monitor"
Identifier "TwinMoni"
Option "dpms"
HorizSync 30.0-81.0
VertRefresh 56-60
DisplaySize 752 301 #SamsungTFT horizontal size *2 to get 86*86 dpi
EndSection
#----- Single BEGIN ------------------------------------------------------------------------------
Section "ServerLayout"
Identifier "single"
Screen 0 "Screen0"
InputDevice "Mouse_Logitech" "CorePointer"
InputDevice "Keyboard_Labtec" "CoreKeyboard"
EndSection
#----- Single END --------------------------------------------------------------------------------
#----- Twinview BEGIN ----------------------------------------------------------------------------
Section "Device"
Identifier "NvidiaTwin"
VendorName "Gainward"
BoardName "Ultra/1960 Golden Sample"
Driver "nvidia"
BusID "PCI:1:0:0"
Option "NoLogo" "0"
Option "TwinView"
Option "MetaModes" "1280x1024,1280x1024; 1280x1024; 1024x768,1024x768; 1024x768; 800x600,800x600; 800x600"
Option "TwinViewOrientation" "CRT-0 RightOf DFP-0"
Option "HorizSync" "DFP-0: 30-81; CRT-0: 30-98"
Option "VertRefresh" "DFP-0: 56-75; CRT-0: 50-160"
Option "ConnectedMonitor" "DFP-0,CRT-0"
Option "RenderAccel" "true"
Option "AllowGLXWithComposite" "true"
Option "UseEdidDpi" "FALSE"
EndSection
Section "Screen"
Identifier "ScreenTwin"
Device "NvidiaTwin"
Monitor "TwinMoni"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600"
EndSubsection
EndSection
Section "ServerLayout"
Identifier "twinview"
Screen 0 "ScreenTwin"
InputDevice "Mouse_Logitech" "CorePointer"
InputDevice "Keyboard_Labtec" "CoreKeyboard"
Option "Xinerama" "0"
EndSection
#----- Twinview END ------------------------------------------------------------------------------
#----- Xinerama BEGIN ----------------------------------------------------------------------------
Section "Device"
Identifier "Nvidia0"
VendorName "Gainward"
BoardName "Ultra/1960 Golden Sample"
Driver "nvidia"
BusID "PCI:1:0:0"
Screen 0
#SINCE NVIDIA VERSION 1.0-8756 YOU MUST USE UseDisplayDevice INSTEAD OF ConnectedMonitor TO GET XINERAMA WORK:
#Option "ConnectedMonitor" "DFP"
Option "UseDisplayDevice" "DFP"
Option "NoLogo" "1"
Option "RenderAccel" "true"
Option "AllowGLXWithComposite" "true"
Option "UseEdidDpi" "FALSE"
EndSection
Section "Device"
Identifier "Nvidia1"
VendorName "Gainward"
BoardName "Ultra/1960 Golden Sample"
Driver "nvidia"
BusID "PCI:1:0:0"
Screen 1
#SINCE NVIDIA VERSION 1.0-8756 YOU MUST USE UseDisplayDevice INSTEAD OF ConnectedMonitor TO GET XINERAMA WORK:
#Option "ConnectedMonitor" "CRT"
Option "UseDisplayDevice" "CRT"
Option "NoLogo" "1"
Option "RenderAccel" "true"
Option "AllowGLXWithComposite" "true"
Option "UseEdidDpi" "FALSE"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Nvidia0"
Monitor "SamsungTFT"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600"
EndSubsection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Nvidia1"
Monitor "ProviewCRT"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600"
EndSubsection
EndSection
Section "ServerLayout"
Identifier "xinerama"
Screen 0 "Screen0"
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse_Logitech" "CorePointer"
InputDevice "Keyboard_Labtec" "CoreKeyboard"
Option "Xinerama" "1"
EndSection
#----- Xinerama END ------------------------------------------------------------------------------
|
[edit] Important Update in the Device Sections for Xinerama since Nvidia 1.0-8756
When using the old Parameter ConnectedMonitor I get the following message in the /var/log/Xorg.0.log:
(EE) NVIDIA(1): Unable to find available Display Devices for screen 1
Update: With version 1.0-9755 of the nvidia driver, there are some changes/improvments in the /etc/X11/xorg.conf . Some Options are necessary for getting up Beryl (see Link below in the references).
Only the important section used with (1) and (3) (called single and xinearama). Use the same options in the device sections Nvidia0 and Nvidia1.
| File: /etc/X11/xorg.conf |
Section "Device"
Identifier "Nvidia0"
VendorName "Gainward"
BoardName "Ultra/1960 GOLDEN SAMPLE"
Driver "nvidia"
BusID "PCI:1:0:0"
Screen 0
Option "UseDisplayDevice" "DFP"
Option "NoLogo" "0"
Option "RenderAccel" "true"
Option "AllowGLXWithComposite" "true"
#Option "backingstore" "true"
Option "UseEdidDpi" "FALSE"
Option "DPI" "86 x 86"
Option "UseEdidFreqs" "FALSE"
Option "XvmcUsesTextures" "true"
Option "NvAgp" "1"
Option "AddARGBGLXVisuals" "true"
# If you are using an older version of compiz that
# does not support rendering into the Composite
# Overlay Window, you will need to disable clipping
# of GLX rendering to the X Root window with this
# option, or you will get a blank screen after
# starting compiz:
#Option "DisableGLXRootClipping" "True"
Option "DynamicTwinView" "0"
EndSection
|
[edit] Starting X
The layout in use is selected in the Section ServerFlags with the option
Option "DefaultServerLayout" "twinview"
When using startx command, you can use parameters to start the right ServerLayout:
startx -- -layout twinview startx -- -layout xinerama startx -- -layout single
[edit] Additional Informations
[edit] Twinview device order
Due to a bug in the nvidia driver prior to 9361, the device connected via VGA was always the primary device. Nvidia has fixed this issue, introducing a new option. You can now use
Section "Device" Identifier "Nvidia" ... Option "TwinViewXineramaInfoOrder" "DFP-0" ...
to set the primary display.
[edit] Xinerama device order
When using xinerama and not twinview, the declarations of the first and second devices are made by the following Options in the Device sections (search for it in the /etc/X11/xorg.conf above).
Section "Device" Identifier "Nvidia0" ... Option "ConnectedMonitor" "DFP" ...
Section "Device" Identifier "Nvidia1" ... Option "ConnectedMonitor" "CRT" ...
If you use two DFP's (or CRT's) you should identify them as "DFP-0" and "DFP-1".
Both sections are used by the two Screen sections.
Section "Screen" Identifier "Screen0" Device "Nvidia0" ...
Section "Screen" Identifier "Screen1" Device "Nvidia1" ...
After all, the Screen sections are used by the ServerLayout section. Here the right order is declared.
Section "ServerLayout" Identifier "xinerama" Screen 0 "Screen0" Screen 1 "Screen1" RightOf "Screen0" ...
With this configuration using xinerama, DVI is first and VGA is second.
[edit] USE flag
There is a USE="xinerama" flag, which enables further Xinerama capabilities in an application.
[edit] Overclocking
I use
nvclock --speeds nvclock -m 950 -n 525
to set up the correct MHz values (memory at 950 MHz, GPU at 525 MHz) to my Geforce Extreme Edition (Gainward Ultra 1960 Golden Sample).
Similar graphical programs for X are
nvclock_gtk nvclock_qt
But remember: The graphic board uses two speed modes. Only when using an OpenGL application, it will turn to the fast mode automatically. So some seconds after setting the MHz values with nvclock, nvclock --speeds will show the slow mode again!
Update: Overclocking is possible with nvidia-settings too. When starting X, start the following in ~/kde/Autostart/overclock_nvidia_card (in case of using KDE):
nvidia-settings --load-config-only nvidia-settings -a GPUOverclockingState=1 -a GPU2DClockFreqs=300,950 -a GPU3DClockFreqs=525,950
[edit] External power connector
Without a connected power cable to my Geforce, X will not start. To start it without power cable, the option 'Option "NoPowerConnectorCheck" "1"' can used in the device section for the graphic board (sections meant: Nvidia0 / Nvidia1 / NvidiaTwin).
[edit] Nvidia Settings
The media-video/nvidia-settings package provides tools to easily configure your nVidia-specific settings, and requires an X server to run on.
[edit] DPI
The right DPI value should be configured for a better look. Please keep in mind to configure every Device and Monitor section.
When using two displays (xinerama or twinview), there is no way to use different DPI settings for different displays.
There are two ways to configure the dots per inch (DPI):
[edit] Using the display size
To disallow the nvidia driver to set the DPI value by itself, the option UseEdidDpi is required in the device sections:
Section "Device" Identifier "NvidiaTwin" ... Option "UseEdidDpi" "FALSE" ...
The option DisplaySize in the monitor section sets the size of the display in milimeters (1 inch is 25.4 mm):
Section "Monitor" Identifier "SamsungTFT" ... DisplaySize 376 301 ...
[edit] using nvidia's DPI option
Another way to configure the right dpi uses nvidia's DPI option in the device sections:
Section "Device" Identifier "NvidiaTwin" ... Option "UseEdidDpi" "FALSE" Option "DPI" "86 x 86" ...
With this configuration you do not need the option DisplaySize in the monitor section, but setting it although is not a problem.
[edit] proof the result
To proof if everything went correct, use the following command while running X:
xdpyinfo | grep -C 1 resolution
The output on my system:
dimensions: 1280x1024 pixels (378x302 millimeters) resolution: 86x86 dots per inch depths (7): 24, 1, 4, 8, 15, 16, 32
Here you see the right dpi value for my Display: 86x86
The reason for all this is that the dpi autosetting by the nvidia driver leads to 85x86 dpi which is not correct.
[edit] XVMC
To get xvmc work you need the right entry in the file /etc/X11/XvMCConfig.
First find the right name (combined with version): ls -l /usr/lib/libXvMC*
Put the found filename in the config file (for example):
nano -w /etc/X11/XvMCConfig /usr/lib/libXvMCNVIDIA.so.1.0.9746
Update: Do not use comment-lines in the /etc/X11/XvMCConfig! For example, mplayer do not like it.
[edit] Nvidia and console resolution
WARNING: Only try the following things when you know how to compile a kernel and how to use lilo.
Because I am using a TFT as primary display, i like to set my console to the native-TFT video mode 1280x1024. So I get smaller fonts and working in the console is more efficient, especially when emerging in the console.
Configure the kernel. Be sure that the symbolic link /usr/src/linux points to the right directory:
ls -lah /usr/src
and check the output! After being sure, continue:
cd /usr/src/linux make menuconfig
Do the following settings (not more or less in these submenus):
device drivers -> graphics support -> support for frame buffer device ON
device drivers -> graphics support -> vesa vga graphics support ON
device drivers -> graphics support -> console display driver support -> video mode selection ON
device drivers -> graphics support -> console display driver support -> framebuffer console support ON
Now compile the kernel with the new settings (same directory as above):
make
Than (if you use an extra boot partition)
mount /boot
and (same directory as above):
cp arch/i386/boot/bzImage /boot/kernelNEW
I use lilo - so when using grub translate it to "grub language". It is good to have an other boot disk availabe. I have different working lilos on different harddisks which i can choice out of the BIOS. A simple disk with the old working lilo is an other possibility. Just be sure you can boot your system later when something went wrong!
Configure the lilo:
nano -w /etc/lilo.conf
vga=0x307 default="Gentoo_NEW" image=/boot/kernelNEW label="Gentoo_NEW" root=/dev/hdXY read-only append="video=vesafb:ywrap,mtrr"
0x307 means 1280x1024 with 256 colors.
Now remove destructing scripts:
rc-update del consolefont boot rc-update del consolefont default
No CONSOLEFONT entry in the /etc/rc.conf required!
Now restart your system.
