Linux Video Part 3: The X Window System

459

THE X WINDOW SYSTEM

 

 

Preamble

This is the third article in the “Linux Display Anatomy”. Here we are covering the the general X server system and how to configure it. The X server system is very interesting since it allows applications to have a graphical interface. Not just visual quantities, the X system allows a wealth of window managers that serve a purpose for low-end and high-end computer systems. X can be the friend factor for a revived machine.

 

 

 

Why You Need to Know This

X is extremely reliable and most of the time it just does its job automatically and requires no adjustment. But Linux distributions differ from one another sometimes in terms of what graphics hardware they support. Some Linux systems on certain hardware may need to be configured manually, and troubleshooted when the X system crashes. Or, in the case of older computers with very limited resources, configuring X and other video settings can make even an ancient machine run quickly and efficiently.

 

 

 

Explanation of X

The X Server system/X Window system – or commonly X11 – is a computer software system that provides a graphical user interface for applications and for network computers. Rather than operating your system from a command line, with X you can interact with programs using a mouse, keyboard and graphical buttons. The programs are displayed in a window-like form structure display and makes interacting with programs much easier than remembering complex commands.
 
X uses the resources from your GPU (Graphical Processing Unit) either from your video card or proprietary video controller. Taking the geometry of the monitor, screen resolutions and pixels it creates a simple graphic-like frames, no more then a white square with a mouse icon indicator. You can view programs like gedit, network monitoring tools, and remote desktop programs. This “window frame” is light weight, meaning it requires few resources, which allows it to work well on enterprise networks and older, low resource hardware.
 
Do not confuse the X system with window managers or the famous desktop environments. The X Server provides the low-level functions for interacting with your video hardware. IT gives the protocols that window managers and desktop environments use to decide graphically how programs will be displayed. Thus, X is system specific. Window managers and desktop environments handle the cool stylish displays. X is the window frame, windows managers and desktop environments are “window dressing.”

 

 

 

History

The X project originated from MIT in 1984 and was used on many UNIX and UNIX-like systems or 386-compatible PCs as a network protocol to access programs from other computers on a network. It was primarily designed to implement on thin clients, where many people shared the processing power of a time-sharing computer and each user uses a network terminal with limited capabilities to draw a visual screen and accept user input from mouse and keyboard.
 
X was then renamed X11 in 1987 and Xfree86 managed the development of X11 up to 2004. Now X.org handles the development project.
 
X started the revolution of computers using graphic windows to let users interact easily with their systems. Most of all the popular OSs use some version of the X protocols and structure, or took a page from X to implement their own graphical system. UNIX and Linux systems however, still use X and it’s one if the reasons opensource systems are becoming very popular. So you see, Microsoft didn’t “invent” graphical windows after all! They just very wisely chose to name their operating system in a way that “suggests” that X was a Microsoft idea.
 
Before the present day, system administrators had to manually configure the X system. Today, X handles its own configuration, and the only time you would have to configure X is if you want to set specific attributes or if the X system crashes. This article will you a brief introduction of inner workings of the X system using Slackware 13.1 for examples. Hopefully, with this knowledge, you will have an understanding of how the X system works and how it is configured on various Unix/Linux distros.
http://en.wikipedia.org/wiki/X_Window_System

 

 

 

As a Reminder:

Configuring X will be a complex task. The reason for this is the vast numbers of video cards available for the PC architecture, most of which use different programming interfaces. Luckily, most cards today support basic video standards known as VESA(Video Electronics Standards Association), and if your card is among them, you’ll be able to start X using the “startx” command right out of the box.

 

 

Remember, to configure X, you must have it installed. Usually, your system does this by default during installation. If your system does not have X installed you can build it from source. View this url: http://www.Linuxfromscatch.org/blfs/view/stable/x/xorg.html

 

To configure X manually, you will need to make an /etc/X11/xorg.conf file.This file contains details about your video hardware, mouse, and monitor. It it a complex configuration file, but fortunately, there are several programs to help create one for you. For this tutorial, we will use a simple X configuration program: xorgsetup.

 

 

Xorgsetup:

This is a simple ncurses menu driven front-end that’s similar in feel to Slackware’s menu installer. For those who have installed Slackware, xorgsetup uses the same menu format. Xorgsetup tells the X server to take a look at the card and setup up the best initial configuration file it can make based on the information it gathers.

 

 

Xorgsetup can not be used if you are already running the X server.

  • To exit out of the X system by pressing ctrl + alt + f1
  • login to the root account once the virtual terminal is open
  • If these key-combination don’t work, logout out of the current account, and within the CLI, login to the root account.
  • While in the CLI, type this command: # xorgsetup

 

 

When xorgsetup is executed, it will bring you to a menu window. In this window, xorg will ask you if you want to probe your video hardware and mouse, and write an initial configuration file to /etc/X11/xorg.conf. After you select “yes”, you will be asked to choose the color scheme.

There are several such as:

  • 24bit true color
  • 16bit Pseude Color
  • 8bit 256 color
  • 4bit 16 color
  • 1bit mono B/W
  • none go with driver default (usually 8-bit)

 

 

Normally you would choose 24bit true color, which is the default settings if your video card supports it. Afterwards, you will be asked to select additional keyboard options if you want your keyboard to have customs settings to perform in a certain way. Choose none as default.

 

Once you’ve made your selections, xorg then adds all the settings to the xorg.conf file in /etc/X11/xorg.conf and the X system is restarted. Type “startx” in the CLI and your X system is executed using the newly created xorg.conf file. Xorgsetup is easy to use when you want to apply some graphics/GUI to your system and don’t want to be burdened by manually configuration.
http://www.slackware.com/config/x.php

 

There are more advanced ways to configure the X system if you want to try utilize all of your video card attributes. One of such programs designed for this purpose is “X -configure”.

 

 

X -configure:

The “X -configure”, similar to xorgconfig, is a text-based X configuration program that collects various geometry values from your video controller, mouse, keyboard and monitor which X uses to draw window frames for programs to be displayed in. X uses this file to set graphical protocols for window managers to follow.

 

 

“X -configure” is mainly used by advanced system administrators that want to take full control of their video cards features, like 3D acceleration and shading. “X -configure” creates a xorg.config file collectiing various information from the monitor, mouse, video card, and keyboard, and allows admins to manaully customize it to their likings. We are going to use “X -configure” to create a xorg.config file and take a closer look at what exactly is contained.

 

To start “X -configure”, you will have to be in the command prompt as before using xorgsetup. While in the CLI, type the command:

$ X -configure

A series of texts scrolls across the screen, and the system announces that it has create a file called, “xorg.conf.new” and placed it in the root folder. We will open the file for viewing using “nano”.
$ nano xorg.conf.new

 

The file is organized into sections with names identifying the devices, variable and their values. My Slackware system is using an ATI-radeon video card, a P/2 keyboard, an ACER X163w monitor, and a microsoft 3 button usb mouse. Here is a view of the attributes contained in the file.

 
Section “ServerLayout”
    identifier;         “X.org Configured”
    Screen;            0  “Screen0” 0 0
    InputDevice;    “Mouse0” “CorePointer”
    InputDevice;    “Keyboard0” “CoreKeyboard”
EndSection
 
Section “Files”
  ModulePath   “/usr/lib/xorg/modules”
  FontPath     “/usr/share/fonts/local”
  FontPath     “/usr/share/fonts/TTF”
  FontPath     “/usr/share/fonts/OTF”
  FontPath     “/usr/share/fonts/Type1”
  FontPath     “/usr/share/fonts/misc”
  FontPath     “/usr/share/fonts/CID”
  FontPath     “/usr/share/fonts/75dpi/:unscaled”
  FontPath     “/usr/share/fonts/100dpi/:unscaled”
  FontPath     “/usr/share/fonts/75dpi”
  FontPath     “/usr/share/fonts/100dpi”
  FontPath     “/usr/share/fonts/cyrillic”
EndSection

Section “Module”
  Load  “dri2”
  Load  “dri”
  Load  “extmod”
  Load  “glx”
  Load  “dbe”
EndSection

Section “InputDevice”
  Identifier   “Keyboard0”
  Driver       “kbd”
EndSection

Section “InputDevice”,
  Identifier   “Mouse0”
  Driver       “mouse”
  Option       “Protocol” “auto”
  Option       “Device” “/dev/input/mice”
  Option       “ZAxisMapping” “4 5 6 7”
EndSection

Section “Monitor”
  #DisplaySize      340   190    # mm
  Identifier   “Monitor0”
  VendorName   “ACR”
  ModelName    “Acer X163W”
  HorizSync    30.0 – 80.0
  VertRefresh  50.0 – 75.0
  Option        “DPMS”
EndSection

Section “Device”
  ### Available Driver options are:-
  ### Values: : integer, : float, : “True”/”False”,
  ### : “String”, : ” Hz/kHz/MHz”
  ### [arg]: arg optional
  #Option     “NoAccel”                # []
  #Option     “SWcursor”               # []
  #Option     “Dac6Bit”                # []
  #Option     “Dac8Bit”                # []
  #Option     “BusType”                # []
  #Option     “CPPIOMode”              # []
  #Option     “CPusecTimeout”          #
  #Option     “AGPMode”                #
  #Option     “AGPFastWrite”           # []
  #Option     “AGPSize”                #
  #Option     “GARTSize”               #
  #Option     “RingSize”               #
  #Option     “BufferSize”             #
  #Option     “EnableDepthMoves”       # []
  #Option     “EnablePageFlip”         # []
  #Option     “NoBackBuffer”           # []
  #Option     “DMAForXv”               # []
  #Option     “FBTexPercent”           #
  #Option     “DepthBits”              #
  #Option     “PCIAPERSize”            #
  #Option     “AccelDFS”               # []
  #Option     “IgnoreEDID”             # []
  #Option     “CustomEDID”             # []
  #Option     “DisplayPriority”        # []
  #Option     “PanelSize”              # []
  #Option     “ForceMinDotClock”       #
  #Option     “ColorTiling”            # []
  #Option     “VideoKey”               #
  #Option     “RageTheatreCrystal”     #
  #Option     “RageTheatreTunerPort”     #
  #Option     “RageTheatreCompositePort”     #
  #Option     “RageTheatreSVideoPort”     #
  #Option     “TunerType”              #
  #Option     “RageTheatreMicrocPath”     #
  #Option     “RageTheatreMicrocType”     #
  #Option     “ScalerWidth”            #
  #Option     “RenderAccel”            # []
  #Option     “SubPixelOrder”          # []
  #Option     “ShowCache”              # []
  #Option     “ClockGating”            # []
  #Option     “VGAAccess”              # []
  #Option     “ReverseDDC”             # []
  #Option     “LVDSProbePLL”           # []
  #Option     “AccelMethod”            #
  #Option     “DRI”                    # []
  #Option     “ConnectorTable”         #
  #Option     “DefaultConnectorTable”     # []
  #Option     “DefaultTMDSPLL”         # []
  #Option     “TVDACLoadDetect”        # []
  #Option     “ForceTVOut”             # []
  #Option     “TVStandard”             #
  #Option     “IgnoreLidStatus”        # []
  #Option     “DefaultTVDACAdj”        # []
  #Option     “Int10”                  # []
  #Option     “EXAVSync”               # []
  #Option     “ATOMTVOut”              # []
  #Option     “R4xxATOM”               # []
  #Option     “ForceLowPowerMode”      # []
  #Option     “DynamicPM”              # []
  #Option     “NewPLL”                 # []
  #Option     “ZaphodHeads”            #
 Identifier  “Card0”
 Driver      “radeon”
 VendorName  “Unknown Vendor”
 BoardName   “Unknown Board”
 BusID       “PCI:2:0:0”
EndSection

Section “Screen”
    Identifier “Screen0”
    Device     “Card0”
    Monitor    “Monitor0”
    SubSection “Display”
        Viewport   0 0
        Depth     1
    EndSubSection

    SubSection “Display”
        Viewport   0 0
        Depth     4
    EndSubSection

    SubSection “Display”
        Viewport   0 0
        Depth     8
    EndSubSection

    SubSection “Display”
        Viewport   0 0
        Depth     15
    EndSubSection

    SubSection “Display”
        Viewport   0 0
        Depth     16
    EndSubSection

    SubSection “Display”
        Viewport   0 0
        Depth     24
    EndSubSection

EndSection

 

As you can see, “X -configure” collected quite a bit of information for the X system. The X system will now use these settings for the window framing. This file will automatically be used to start X. You can test this file by typing this in the CLI:

$ X -configure /root/xorg.conf.new

If this works you should see the GUI desktop. If not, the file may have some settings the X system cannot use. If you noticed in the file, under Section “device”:

Identifier   “Card0”
  Driver   “radeon”
  VendorName   “Unknown Vendor”
  BoardName   “Unknown Board”

There are two variables with values, “Unknown”. The Vendor name is not important, so this is fine. The “BoardName” variable tells what device the graphic card is. Unfortunately, X could not determine the board type. Also notice, the driver for the card is “radeon”. Normally, Linux prefers to use Nvidia drivers. I tested out the file using the above command, and not surprising, the X system did not execute.

If I had to guess, X tried to use the attributes recommended by the video card. X system worked fine with the file created by “xorgsetup”. This is because, xorgsetup used the VESA settings instead of what the video card wanted to use. I have mentioned before, if X can’t used the settings recommended by the video card, it will used the VESA settings. It appears, ATI cards are not welll supported by Linux, or in this case, Slackware.

Be that as it may, X was still able to use the radeon video card applying the VESA settings. However, “X -configure” should work on any normal Nvidia compatible video card. This is how the X system works and the ways you can configure it.

If you have any questions or having issues setting up your X system, please post a comment I will be glad to assist.