Once there was Xfree86 the X server. But Xfree86 wasn't GPL, so a fork of it, Xorg got created. Lightweight alternative X servers are:
XVesa
TinyX
The X server turns the text based Linux into a graphic computer. In simple words X does all the graphical things except, the ones that you see on the screen. For the things on the screen a Desktop-System as Kde, Gnome, Xfce, LXDE and many others has to be used, that run on top of the X server. More precisely window manager as matacity for gnome, xfwm4 for Xfce4 have to be used. There are also window mangers that do not come with a Desktop-system as compiz. The X server can therefore be understood as the infrastructure that allows a graphical user interface.
Since the system gets a lot of plug and play information modern X server do not any manual configuration to run with basic functionality. Fine tuning might be just necessary to let the X server know what keyboard layout is used.
The X server relies on a kernel having the graphic cards correctly supported. A good sign for such a kernel is if at boot the penguin icons appear. If not the a kernel should be created that does this. Setting up modern radon cards is a bit tricky since they require firmware to be loaded. But when done, they work well.
X servers make use of evdev, so make sure your kernel has it enabled. Additionally dbus should run verify it by rc-update show.
The X server is quite heavy, therefore alternatives have been developed. Android does not use the X server at all.
Programs using the X server can obviously access the graphic card, however there is a need to do it more direct:
XV (Xvideo) extension allows to direct access to the graphic card via the X-server
DGA (Direct Graphic Access) accesses the graphic card bypassing the X-server
To install X the VIDEO_CARDS and INPUT_DEVICES variables have to be set in
/etc/portage/make.conf
.
VIDEO_CARDS="radeon"
for backup drivers, you may also want to add vesa and fbdev
INPUT_DEVICES="keyboard mouse synaptics evdev"
In the sample above a radeon video card is used and synaptics is the driver for most laptops touch panels and evdev for some mice.
emerge xorg-x11 then does the job.
After the installation
/usr/lib/xorg/modules
holds the drivers. The directory
/usr/X11R6/lib/X11/doc
should be present and hold the documentation.
X -showconfig, X -version or xdpyinfo shows what you have.
To start the xserver with startx some window managers need to be installed in the past x came with some, but not anymore, therefore emerge -1 twm and emerge -1 xterm or go directly to your desired window manager as lxde.
Major updates of the xserver might bring incompatibilities with the x drivers. Therefore recompile the drivers as follows:
emerge -av1 `qlist -I -C x11-drivers/` or (in case of qlist makes a segment failure) emerge -vuDN --with-bdeps=y xorg-drivers
The key to have a running X server was the
/etc/X11/xorg.conf
configuration file, now the xserver can even
run without it since it can get most device information from the system. A closer look shows that the idea of the xorg.conf
file did not disappear. Furthermore it got quite expanded. There is the directory/usr/share/X11/xorg.conf.d/
that holds the configuration files. Those files are basically an xorg.config
file that got split into different files and luckily follows the same syntax. There is nothing wrong if the /usr/share/X11/xorg.conf.d/
directory is empty and the X server runs. In this case the X server has found all the necessary configuration using plug an play data. However certain things the X server can not detect as keyboard layouts. So some help by adding config files is recommended.
To tune the X severs configuration delete temporarily xdm service rc-update del xdm and if done re-added rc-update add xdm default. Be aware that /etc/init.d/xdm stop terminates immediately the X server
If the system administrator wants to change something he should do it in the/etc/X11/xorg.conf.d/
, those settings will overwrite the default settings where the sequence of processing is defined by alphabetical order, therefore the file have a preceding number in their file names. A practical way is to copy and rename the files from the default settings in /usr/share/X11/xorg.conf.d/
to /etc/X11/xorg.conf.d/
, and do the modification there. See
https://wiki.gentoo.org/wiki/X_server/upgrade
To see the appropriate xserver version type X -version.
The/etc/X11/xorg.conf
, /usr/share/X11/xorg.conf.d/
and /etc/X11/xorg.conf.d/
,files have
sections, starting with :
Section "<section identifier>
"
" " "
EndSection
In the past xorgcfg and xorgconfig where programs that created the/etc/X11/xorg.conf
file. X -configure should still work
See man xorg.conf to get the actual information about the config file.
The sequence in the /etc/X11/xorg.conf
file can be structured bottom up or top down. It is explained here in a top down approach.
The sections of the same type can be more than once present in the file, since the can be distinguished by
their identifiers.
In the newer Xorg's how it is dealt with the keyboard and mouse have changed The mouse and keyboard drivers are obsolete and have been replaced by evdev. Therefore create a kernel with evdev before installing xorg to have the keyboard and mouse running in xorg. evdev might end up to have a laptops touchpad working as absolute coordinates (thinking it is a touch screen). In this case the synaptics driver can be installed in parallel. On a long term both evdev and synaptics will be replaced by libinput.
See man evdev
Create a kernel with:
Device Drivers --->
Input device support --->
<*> Event interface
If you have an AT (all laptops) or PS/2 keyboard
-*- Keyboards --->
<*> AT keyboard
If you have an USB keyboard
[*] HID Devices --->
-*- Generic HID support
<*> USB Human Interface Device (full HID) support
Add to/etc/make.conf
:
INPUT_DEVICES="... evdev ...."
To see your ev devices:
cat /proc/bus/input/devices
the line
H: Handlers=mouse1 event8 kbd
shows the link to the device file
/dev/input/event8
The test cat /dev/input/mouse1 should now show that this mouse is active and the appropriate kernel driver is loaded (if it is a laptop touch-pad, check also that is enabled by keys as Fn + F7 or BIOS).
Touch pads of laptops might operate in two modes. Relative as mice do and absolute. If touching in the middle or corners of the touch pads and the cursor jumps thee then absolute mode is used. Obviously in absolute mode positioning the cursor is difficult, since some mm on the touch pads result in some cm on the screen. If the touch-pad is very sensitive and jumps then absolute mode might be enabled.
Install the package evemu from https://www.freedesktop.org/wiki/Evemu/ to get the tools
evemu-describe to describe the devices
evemu-record > <filename>
to record events and write it to a file Ctrl+C
exits
evemu-play <filename>
to play the recorded events
See http://who-t.blogspot.com/2016/09/understanding-evdev.html
or install the package xev, start xev in a x terminal, and type multimedia keys to see their key code. Example for E-Mail button:
KeyPress event, serial 34, synthetic NO, window 0x2c00001,
root 0x13b, subw 0x0, time 3132075, (765,504), root:(793,581),
state 0x0, keycode 163 (keysym 0x1008ff19, XF86Mail), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 34, synthetic NO, window 0x2c00001
,
root 0x13b, subw 0x0, time 3132287, (765,504), root:(793,581),
state 0x0, keycode 163 (keysym 0x1008ff19, XF86Mail), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
There is also emerge input-utils that prints out what events a device can produce and the monitors it. lsinput shows what you have got.
For the mouse: http://www.gentoo-wiki.info/HOWTO_Advanced_Mouse
Originally each input device as mouse and keyboard had an individual InputDevice section. This caused a problem when multiple mice and keyboard (like) devices got plugged in. New Xservers solve this issue by using InputClass sections instead of InputDevice sections. The main difference between InputClass and InputDevice sections is that a InputClass section can match different input devices and therefore support multiple devices as multiple mice and keyboards. See https://wiki.gentoo.org/wiki/X_server/upgrade
All the mice that live around and in your computer and their wheels
Section "InputDevice"
Identifier "<Name of the Mouse>
"
Driver "mouse"
Option "Protocol" "Auto" # Auto detect
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
For the wheel mouse add at least
Option "ZaxisMapping" "4 5"
to enable the wheel. A program to detect the mouse wheels is xev.
See also: Keyboard
This section contains everything about the Keyboard and its layout (Swiss-Layout => ch).
For evdev the section would look as follows:
Section "InputClass" Identifier "keyboard-all" Driver "evdev" Option "XkbLayout" "ch" Option "XkbVariant" ",qwerty" MatchIsKeyboard "on" EndSection
When not using evdev then the kbd driver has been used
Section "InputDevice"
Identifier "<Name of the Keyboard>
"
Driver "kbd"
Option "AutoRepeat" "500 30"
Option "XkbRules" "xorg"
Option "XkbModel" "logiaccess"
Option "XkbLayout" "ch"
EndSection
/usr/share/X11/xkb/rules/base.lst holds the possible values
Alternatively the layout could also be set in the desktop environment as gnome, but this is not recommended since it is not active on the login screen and when having a password deviating from the default keyboard layout will create big confusion since just * appears during typing in the password.
This Section puts everything together and defines the Layout. The Screen is the combination of Monitor and Graphic card, CorePointer and Keyboard are the input devices.
Section "ServerLayout" Identifier "<Identifier of this Layout>
" Screen "<Identifies the Screen used>
" InputDevice "<Identifier of the mouse>
" "CorePointer" InputDevice "<Identifier of the keyboard>
" "CoreKeyboard" EndSection
This section does not have to be present, if there is just one section of every device.
The section screen links the monitor to the graphic card (Device) and lists all Video modes supported:
Section "Screen" Identifier "<Identifier for the Screen>
" Device "<Identifier of the Graphic Card>
" Monitor "<Identifier of the Monitor>
" DefaultDepth 24 Subsection "Display" Depth 8 Modes "1280x1024" "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection Subsection "Display" Depth 16 Modes "1280x1024" "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection Subsection "Display" Depth 24 Modes "1280x1024" "1024x768" "800x600" "640x480" ViewPort 0 0 EndSubsection EndSection
Shows what your monitor is able to do:
Section "Monitor"
Identifier "<Identifier of the Monitor>
"
HorizSync 22-82
VertRefresh 56-76
EndSection
The horizontal synchronization frequency range values are in kHz and the vertical synchronization frequency range in Hz. Usually this section looks simple, but it can be highly customized to create various timings. It is also a place where you can adjust horizontal and vertical position of the picture on the monitor, to remove annoying jumps when video modes change. See: Timing for a TV
If i2c is enabled (see i2c section in this book) then the graphic controller can read the edid data from the monitor. The program get-edid can create the content of the Monitor section and can be stored into a file as /etc/X11/xorg-conf.d/22-monitor.conf
The Section for the graphic card is called Device. It helps the X server to take directly the correct driver and not try to guess generic drivers first producing errors and maybe end up loading a wrong driver.
Section "Device" Identifier "<Identifier of the Graphic Card>
" Driver "<Name of the driver for the Graphic Card>
"<Graphic Card specific options>
EndSection
For binary device drivers of ATI and Nvidia drivers this section becomes complex, drivers delivered with the kernel source have just the basic settings.
Holds the paths that differ from the defaults paths plus many paths to fonts
Section "Files" RgbPath "<here when differ from default>
" ModulePath "<addtitionl paths to modules can be added>
" FontPath "<path to fonts>
" EndSection
Checkout for what modules are available
/usr/lib/modules/fonts
/usr/lib/modules/extensions
Section "Module" Load "dbe" # Double buffer extension SubSection "extmod" Option "omit xfree86-dga" # don't initialise the DGA EndSubSection Load "<Font module>
" Load "<An other font module>
" Load "extmod" # for some commonly used extensions Load "glx" # This loads the OpenGL for X module Load "drm" Load "v4l" #Video for Linux EndSection
This is the configuration for the Direct Rendering Infrastructure for OpenGL and sets the permission rights
Section "dri" Mode 0666 EndSection