Xorg-7 のテストと設定

Xorg のテスト



Before starting Xorg for the first time, is is useful to rebuild the library cache by running ldconfig as the root user.

インストールした Xorg をテストするために startx を実行します。 この実行によって最も単純なウィンドウマネージャー twm が立ち上がり、X ターミナルウィンドウ3つと xclock ウィンドウ1つが表示されます。 左上に位置する xterm ウィンドウはログインターミナルです。 このターミナルにて exit を入力すると X Window セッションが終了します。 3つめの xterm ウィンドウは不要なものかもしれません。



When testing Xorg with the twm window manager, there will be several warnings in the Xorg log file, /var/log/Xorg.0.log, about missing font files. In addition, there will be several warnings on the text mode terminal (usually tty1) about missing fonts. These warnings do not affect functionality, but can be removed if desired by installing the Xorg Legacy Fonts.

基本的には Xorg に対しての特別な設定は必要ありません。 ただしカスタマイズは可能です。 詳しくは後述する Setting up Xorg Devices項 を参照してください。

Checking the Direct Rendering Infrastructure (DRI) Installation

DRI is a framework for allowing software to access graphics hardware in a safe and efficient manner. It is installed in X by default (using Mesa) if you have a supported video card.

To check if DRI drivers are installed properly, check the log file /var/log/Xorg.0.log for statements such as:

(II) intel(0): direct rendering: DRI2 Enabled


(II) NOUVEAU(0): Loaded DRI module


DRI configuration may differ if you are using alternate drivers, such as those from NVIDIA or AMD.

Although all users can use software acceleration, any hardware acceleration (DRI2) is only available to root and members of the video group, but ConsoleKit2 takes care of adding any logged in user to the user ACL's of /dev/dri/card*, the special file(s) allowing access to hardware acceleration.

If your driver is supported and ConsoleKit2 is not installed, add any users that might use X to the video group:

usermod -a -G video <username>

Another way to determine if DRI is working properly is to use one of the two optionally installed OpenGL demo programs in Mesa-17.1.6. From an X terminal, run glxinfo and look for the phrase:

name of display: :0
display: :0  screen: 0
direct rendering: Yes

If direct rendering is enabled, you can add verbosity by running LIBGL_DEBUG=verbose glxinfo. This will show the drivers, device nodes and files used by the DRI system.

To confirm that DRI2 hardware acceleration is working, you can (still in the X terminal) run the command glxinfo | egrep "(OpenGL vendor|OpenGL renderer|OpenGL version)". If that reports something other than Software Rasterizer then you have working acceleration for the user who ran the command.

If your hardware does not have any DRI2 driver available, it will use a Software Rasterizer for Direct Rendering. In such cases, you can use a new, LLVM-accelerated, Software Rasterizer called LLVMPipe. In order to build LLVMPipe just make sure that LLVM-4.0.1 is present at Mesa build time. Note that all decoding is done on the CPU instead of the GPU, so the display will run slower than with hardware acceleration. To check if you are using LLVMpipe, review the output of the glxinfo command above. An example of the output using the Software Rasterizer is shown below:

OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits)
OpenGL version string: 3.0 Mesa 10.4.5

You can also force LLVMPipe by exporting the LIBGL_ALWAYS_SOFTWARE=1 environment variable when starting Xorg.

Again, if you have built the Mesa OpenGL demos, you can also run the test program glxgears. This program brings up a window with three gears turning. The X terminal will display how many frames were drawn every five seconds, so this will give a rough benchmark. The window is scalable, and the frames drawn per second is highly dependent on the size of the window. On some hardware, glxgears will run synchronized with the vertical refresh signal and the frame rate will be approximately the same as the monitor refresh rate.

Hybrid Graphics

Hybrid Graphics is still in experimental state for Linux. Xorg Developers have developed a technology called PRIME that can be used for switching between integrated and muxless discrete GPU at will. Automatic switching is not possible at the moment.

In order to use PRIME for GPU switching, make sure that you are using Linux Kernel 3.4 or later (recommended). You will need latest DRI and DDX drivers for your hardware and Xorg Server 1.13 or later with an optional patch applied.

Xorg Server should load both GPU drivers automaticaly. In order to run a GLX application on a discrete GPU, you will need to export the DRI_PRIME=1 environment variable. For example,

DRI_PRIME=1 glxinfo | egrep "(OpenGL vendor|OpenGL renderer|OpenGL version)"

will show OpenGL vendor, renderer and version for the discrete GPU.

If the last command reports same OpenGL renderer with and without DRI_PRIME=1, you will need to check your installation.

Setting up Xorg Devices

For most hardware configurations, modern Xorg will automatically get the server configuration correct without any user intervention. There are, however, some cases where auto-configuration will be incorrect. Following are some example manual configuration items that may be of use in these instances.

Setting up X Input Devices

For most input devices, no additional configuration will be necessary. This section is provided for informational purposes only.

A sample default XKB setup could look like the following (executed as the root user):

cat > /etc/X11/xorg.conf.d/xkb-defaults.conf << "EOF"
Section "InputClass"
    Identifier "XKB Defaults"
    MatchIsKeyboard "yes"
    Option "XkbLayout" "fr"
    Option "XkbOptions" "terminate:ctrl_alt_bksp"

The 「XkbLayout」 line is an example for a French (AZERTY) keyboard. Change it to your keyboard model. That line is not needed for a QWERTY (US) keyboard.


再度述べますが、最近の Xorg では追加の設定を行う必要はほとんどありません。 例えばお手元のビデオドライバーに特別なオプションを与えなければならないのであれば、以下のような設定とすることも考えられます。 (再度 root になって実行します。)

cat > /etc/X11/xorg.conf.d/videocard-0.conf << "EOF"
Section "Device"
    Identifier  "Videocard0"
    Driver      "radeon"
    VendorName  "Videocard vendor"
    BoardName   "ATI Radeon 7500"
    Option      "NoAccel" "true"

Another common setup is having multiple server layouts for use in different environments. Though the server will automatically detect the presence of another monitor, it may get the order incorrect:

cat > /etc/X11/xorg.conf.d/server-layout.conf << "EOF"
Section "ServerLayout"
    Identifier     "DefaultLayout"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" LeftOf "Screen0"
    Option         "Xinerama"

最終更新日: 2017-05-09 17:59:52 +0900