Xserver Issues

From Blue-IT.org Wiki

Revision as of 18:22, 28 July 2010 by Apos (talk | contribs) (Nvidia Card and Xrandr)

Ubuntu

The ubuntu(debian)-way of configuring the xserver is to open a terminal and do

dpkg-reconfigure xserver-xorg

This gives you a runnable but not anyway optimal configuration.

Other useful information

Usefull informations you'll find in the (german) wiki pages here.

xorg-edit

But fortunately we are living in open source land and there is now a nice program to configure the xserver. It's called xorg-edit and can be visited here or direct downloaded at at sourceforge.

It automatically checks the syntax and gives the abitlity to write xml files for special configurations.

This program however is only intended to be an editor for the xorg.conf file. IT WON'T HELP YOU if you don't exactly know what to do and have profound knowledge about the xservers configuration file.

SuSE

YaST and SaX2 are your best friends!

For older versions of SuSE it might be necessary to install manually the nvidia/ati driver and start sax2 with the following (for nvidia):

init 3
sax2 -m 0=nvidia

Start a program in fullscreen X session

If you like to start a single program, e.g. mythfrontend on another screen - e.g. a TV or a second monitor, simple use the next line:

xinit /bin/sh -c "DISPLAY=:1 mythfrontend" -- /usr/bin/X :1 -ac

And from HowTo Setup MythTV

[...] I have this first script run at boot up time:

#!/bin/bash
cd /root
HOME='/root'
export HOME
xinit /root/xinitmyth -- :0 &

and the startup file /root/xinitmyth

xsetroot -solid gray &
mythfrontend

[...]

Modline generator

GTF is a modline generator.

linux: > gtf
usage: gtf x y refresh [-v|--verbose] [-f|--fbmode] [-x|--xorgmode]

           x : the desired horizontal resolution (required)
           y : the desired vertical resolution (required)
     refresh : the desired refresh rate (required)
-v|--verbose : enable verbose printouts (traces each step of the computation)
 -f|--fbmode : output an fbset(8)-style mode description
-x|--xorgmode : output an Xorg-style mode description (this is the default
               if no mode description is requested)

This gives me e.g.

linux: > gtf 768 576 50 -x

 # 768x576 @ 50.00 Hz (GTF) hsync: 29.65 kHz; pclk: 28.46 MHz
 Modeline "768x576_50.00"  28.46  768 784 864 960  576 577 580 593  -HSync +Vsync

for a modline used with a HTPC (Home theatre PC) for a PAL-M TV out resolution.

Remember to use it you have to add the following in the Monitor' section of yur xorg.conf:

Section "Monitor"
  UseModes     "MyModes"
  [...]
End Section

If not already there you have to create a Modes section:

Section "Modes"
 Identifier   "MyModes"
 Modeline      "768x576_50.00"  28.46  768 784 864 960  576 577 580 593  -HSync +Vsync
 [...]
End Section

And according to the fact, that the default depth will be 16 in our example here you schould add the new created mode in front of the other modes.

Section "Screen"
   Identifier      "Default Screen"
   [...]
   DefaultDepth    16
   SubSection "Display"
        Depth           16
        Modes           "768x576_50.00" "1024x768" "800x600" "640x480"
   EndSubSection
EndSection:


Xrandr

Nvidia Card and Xrandr

For getting an nvidia setting with twinview working we have to change the xorg.conf like this:

Section "Screen"
   Identifier     "Screen0"
   Device         "Device0"
   Monitor        "Monitor0"
   DefaultDepth    24
   Option         "TwinViewXineramaInfoOrder" "DFP-0"
   Option         "TwinView" "1"
   Option         "metamodes" "DFP: nvidia-auto-select +0+0; DFP: 1680x1050 +0+0, CRT: nvidia-auto-select +1680+0;"
   SubSection     "Display"
       Depth       24
   EndSubSection
EndSection

With:

xrandr -s 0

we activate the first setting:

DFP: nvidia-auto-select +0+0;

With

xrandr -s 1

we activate the second (multimonitor) setting:

DFP: 1680x1050 +0+0, CRT: nvidia-auto-select +1680+0;

In the second example, an LCD Display with 1680x1050 on the left side (first entry) is attached to an CRT on the right side. The display of the CRT therefore has to be moved to the left (+1680+0) so that it fits next to the LCD. The settings of the CRT (width and height) is set via nvidia-auto-select.

The whole xorg.conf is here:

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

Section "Module"
    Load           "glx"
EndSection

Section "ServerFlags"
    Option         "Xinerama" "1"
EndSection

Section "InputDevice"
    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"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "VSN V7 P17S"
    HorizSync       31.0 - 80.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "CRT-0"
    HorizSync       29.0 - 121.0
    VertRefresh     43.0 - 160.0
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro NVS 140M"
    Option         "NvAgp" "1"
    Option         "NoLogo" "True"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro NVS 140M"
    Option         "NvAgp" "1"
    Option         "NoLogo" "True"
    BusID          "PCI:1:0:0"
    Screen          1
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinViewXineramaInfoOrder" "DFP-0"
    Option         "TwinView" "1"
    Option         "metamodes" "DFP: nvidia-auto-select +0+0; DFP: 1680x1050 +0+0, CRT: nvidia-auto-select +1680+0;"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "CRT: 1280x1024 +0+0;"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "On"
EndSection

Source: [1]

Autoconfiguration

Xrandr gives the following info for single LCD on my laptop:

> xrandr
Screen 0: minimum 1680 x 1050, current 1680 x 1050, maximum 2960 x 1050 
default connected 1680x1050+0+0 0mm x 0mm
  1680x1050      50.0* 
  2960x1050      51.0     50.0 

and for dual screen:

Screen 0: minimum 1680 x 1050, current 2960 x 1050, maximum 2960 x 1050 
default connected 2960x1050+0+0 0mm x 0mm
  1680x1050      50.0  
  2960x1050      51.0*    50.0 

The skript toggle_xrandr has to be changed the line "current 1680 x 1050" to your specific single LCD configuration.

#!/bin/bash
xrandr | grep "Screen 0" | grep "current 1680 x 1050"; 

if [ $? -eq 1 ]; then 
	xrandr -s 0; 
else 
	xrandr -s 1; 
fi;

If you have real xrand informations you can use the following script:

EXTERNAL_OUTPUT=”Screen 1″
INTERNAL_OUTPUT=”Screen 0″

xrandr |grep $EXTERNAL_OUTPUT | grep ” connected ”

if [ $? -eq 0 ]; then
    xrandr -s 0
else
    xrandr -s 1
fi