[d28b5ef] | 1 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 2 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 |
|
---|
[7c472863] | 7 | <sect1 id="xorg-config">
|
---|
| 8 | <?dbhtml filename="xorg-config.html"?>
|
---|
[d28b5ef] | 9 |
|
---|
| 10 | <sect1info>
|
---|
[8020e8b] | 11 | <date>$Date$</date>
|
---|
[d28b5ef] | 12 | </sect1info>
|
---|
| 13 |
|
---|
[5287b7c] | 14 | <title>Xorg-&xorg-version; Testing and Configuration</title>
|
---|
[d28b5ef] | 15 |
|
---|
[b960e3ec] | 16 | <indexterm zone="xorg-config">
|
---|
| 17 | <primary sortas="g-configuring-xorg">Configuring Xorg</primary>
|
---|
| 18 | </indexterm>
|
---|
| 19 |
|
---|
[da4b5e0] | 20 | <sect2 id='X11-testing' xreflabel="Testing Xorg">
|
---|
[5930509] | 21 | <title>Testing Xorg</title>
|
---|
[0d7900a] | 22 |
|
---|
[da4b5e0] | 23 | <note>
|
---|
| 24 | <para>
|
---|
| 25 | Before starting Xorg for the first time, is is useful to
|
---|
| 26 | rebuild the library cache by running <userinput>ldconfig</userinput>
|
---|
| 27 | as the <systemitem class="username">root</systemitem> user.
|
---|
| 28 | </para>
|
---|
| 29 | </note>
|
---|
| 30 |
|
---|
[d43c7a12] | 31 | <note>
|
---|
| 32 | <para>
|
---|
| 33 | Before starting Xorg for the first time, is is often needed to
|
---|
| 34 | reboot the system to ensure all appropriate daemons are started
|
---|
[b9c353b] | 35 | and appropriate security issues are properly set.
|
---|
[d43c7a12] | 36 | As an alternative, logging out and logging back in may work, but as
|
---|
| 37 | of this writing has not been tested.
|
---|
| 38 | </para>
|
---|
| 39 | </note>
|
---|
| 40 |
|
---|
[df5c5e0] | 41 | <warning>
|
---|
| 42 | <para>
|
---|
| 43 | If Xorg hangs for some reason (for example, lacking a proper
|
---|
[2c87187] | 44 | input driver), the system may stop responding to any user input.
|
---|
[df5c5e0] | 45 | As a precaution, you can enable a magic <keycap>SysRq</keycap> key
|
---|
| 46 | before testing Xorg. As the
|
---|
| 47 | <systemitem class="username">root</systemitem> user, issue:
|
---|
| 48 | </para>
|
---|
| 49 |
|
---|
| 50 | <screen><userinput>echo 4 > /proc/sys/kernel/sysrq</userinput></screen>
|
---|
| 51 |
|
---|
| 52 | <para>
|
---|
| 53 | Then if Xorg hangs, it's possible to use
|
---|
| 54 | <keycombo>
|
---|
| 55 | <keycap>Alt</keycap>
|
---|
| 56 | <keycap>SysRq</keycap>
|
---|
| 57 | <keycap>R</keycap>
|
---|
| 58 | </keycombo>
|
---|
| 59 | to reset the keyboard mode. Now it should be able to use
|
---|
| 60 | <keycombo>
|
---|
| 61 | <keycap>Ctrl</keycap>
|
---|
| 62 | <keycap>Alt</keycap>
|
---|
| 63 | <keycap>Fx</keycap>
|
---|
| 64 | </keycombo>
|
---|
| 65 | (replace x with a VT number) to switch to another VT.
|
---|
| 66 | If it works, login and kill Xorg using command line in the new VT.
|
---|
| 67 | </para>
|
---|
| 68 | </warning>
|
---|
| 69 |
|
---|
[da4b5e0] | 70 | <para>
|
---|
| 71 | To test the <application>Xorg</application> installation, issue
|
---|
| 72 | <command>startx</command>. This command brings up a rudimentary window
|
---|
| 73 | manager called <emphasis>twm</emphasis> with three xterm windows and one
|
---|
| 74 | xclock window. The xterm window in the upper left is a login terminal and
|
---|
| 75 | running <emphasis>exit</emphasis> from this terminal will exit the
|
---|
| 76 | <application>X Window</application> session. The third xterm window may
|
---|
| 77 | be obscured on your system by the other two xterms.
|
---|
| 78 | </para>
|
---|
| 79 |
|
---|
| 80 | <note>
|
---|
| 81 | <para>
|
---|
| 82 | When testing <application>Xorg</application> with the
|
---|
| 83 | <application>twm</application> window manager, there will be several
|
---|
[82bdecf] | 84 | warnings in the Xorg log file, <!--<filename revision="sysv">
|
---|
| 85 | /var/log/Xorg.0.log</filename><filename revision="systemd">-->
|
---|
| 86 | $HOME/.local/share/xorg/Xorg.0.log<!--</filename>-->, about missing font
|
---|
[da4b5e0] | 87 | files. In addition, there will be several warnings on the text mode
|
---|
| 88 | terminal (usually tty1) about missing fonts. These warnings do not
|
---|
| 89 | affect functionality, but can be removed if desired by installing
|
---|
| 90 | the <xref linkend="xorg7-legacy"/>.
|
---|
| 91 | </para>
|
---|
| 92 | </note>
|
---|
| 93 |
|
---|
| 94 | <para>
|
---|
| 95 | Generally, there is no specific configuration required for
|
---|
| 96 | <application>Xorg</application>, but customization is possible. For
|
---|
| 97 | details, see <xref linkend='xconfig'/> below.
|
---|
| 98 | </para>
|
---|
| 99 |
|
---|
| 100 | </sect2>
|
---|
| 101 |
|
---|
| 102 | <sect2 role="configuration" id="checking-dri" xreflabel="Checking the DRI
|
---|
| 103 | installation">
|
---|
[7612749] | 104 | <title>Checking the Direct Rendering Infrastructure (DRI)
|
---|
| 105 | Installation</title>
|
---|
[2001b3e] | 106 |
|
---|
[f38727d] | 107 | <para>
|
---|
[7612749] | 108 | DRI is a framework for allowing software to access graphics hardware in
|
---|
| 109 | a safe and efficient manner. It is installed in
|
---|
| 110 | <application>X</application> by default (using
|
---|
| 111 | <application>Mesa</application>) if you have a supported video card.
|
---|
[f38727d] | 112 | </para>
|
---|
| 113 |
|
---|
| 114 | <para>
|
---|
| 115 | To check if DRI drivers are installed properly, check the log file
|
---|
[97ee53d] | 116 | <filename>$HOME/.local/share/xorg/Xorg.0.log</filename> (or
|
---|
| 117 | <filename>/var/log/Xorg.0.log</filename> if you have
|
---|
| 118 | built <xref linkend="xorg-server"/> with the suid bit) for
|
---|
[7612749] | 119 | statements such as:
|
---|
[f38727d] | 120 | </para>
|
---|
| 121 |
|
---|
| 122 | <screen><literal>(II) intel(0): direct rendering: DRI2 Enabled</literal></screen>
|
---|
| 123 |
|
---|
[c96921c] | 124 | <para>or</para>
|
---|
| 125 |
|
---|
| 126 | <screen><literal>(II) NOUVEAU(0): Loaded DRI module</literal></screen>
|
---|
| 127 |
|
---|
[f38727d] | 128 | <note>
|
---|
| 129 | <para>
|
---|
| 130 | DRI configuration may differ if you are using alternate drivers, such
|
---|
| 131 | as those from
|
---|
| 132 | <ulink url="http://www.nvidia.com/page/home.html">NVIDIA</ulink> or
|
---|
[fce3067] | 133 | <ulink url="http://www.amd.com/">AMD</ulink>.
|
---|
[f38727d] | 134 | </para>
|
---|
[2001b3e] | 135 | </note>
|
---|
| 136 |
|
---|
[cc405844] | 137 | <!-- With elogind, this is not needed anymore
|
---|
[f38727d] | 138 | <para>
|
---|
[7612749] | 139 | Although all users can use software acceleration, any hardware
|
---|
| 140 | acceleration (DRI2) is only available to <systemitem
|
---|
| 141 | class="username">root</systemitem> and members of the <systemitem
|
---|
| 142 | class="groupname">video</systemitem> group, but
|
---|
| 143 | <phrase revision="sysv"><emphasis>ConsoleKit2</emphasis></phrase>
|
---|
| 144 | <phrase revision="systemd"><emphasis>systemd-logind</emphasis></phrase>
|
---|
| 145 | takes care of adding any logged in user to the user ACL's of
|
---|
| 146 | <filename>/dev/dri/card*</filename>, the special file(s) allowing access
|
---|
| 147 | to hardware acceleration.<phrase revision="systemd"> So, no further
|
---|
| 148 | configuration is needed.</phrase>
|
---|
[f38727d] | 149 | </para>
|
---|
[2001b3e] | 150 |
|
---|
[7612749] | 151 | <para revision="sysv">
|
---|
| 152 | If your driver is supported and <emphasis>ConsoleKit2</emphasis> is not
|
---|
| 153 | installed, add any users that might use X to the <systemitem
|
---|
| 154 | class="groupname">video</systemitem> group:
|
---|
[f38727d] | 155 | </para>
|
---|
[2001b3e] | 156 |
|
---|
[7612749] | 157 | <screen role="root" revision="sysv"><userinput>usermod -a -G video <replaceable><username></replaceable></userinput></screen>
|
---|
[cc405844] | 158 | -->
|
---|
[f38727d] | 159 | <para>
|
---|
[c96921c] | 160 | Another way to determine if DRI is working properly is to use one of the
|
---|
| 161 | two optionally installed OpenGL demo programs in <xref
|
---|
[7a395d1] | 162 | linkend="mesa"/>. From an X terminal, run <command>glxinfo</command>
|
---|
[f38727d] | 163 | and look for the phrase:
|
---|
| 164 | </para>
|
---|
| 165 |
|
---|
| 166 | <screen><computeroutput>name of display: :0
|
---|
| 167 | display: :0 screen: 0
|
---|
| 168 | direct rendering: Yes</computeroutput></screen>
|
---|
| 169 |
|
---|
| 170 | <para>
|
---|
| 171 | If direct rendering is enabled, you can add verbosity by running
|
---|
[7612749] | 172 | <command>LIBGL_DEBUG=verbose glxinfo</command>. This will show the
|
---|
| 173 | drivers, device nodes and files used by the DRI system.
|
---|
[f38727d] | 174 | </para>
|
---|
| 175 |
|
---|
| 176 | <para>
|
---|
[c96921c] | 177 | To confirm that DRI2 hardware acceleration is working, you can (still in
|
---|
| 178 | the X terminal) run the command <command>glxinfo | egrep "(OpenGL
|
---|
| 179 | vendor|OpenGL renderer|OpenGL version)"</command>.
|
---|
| 180 | If that reports something <emphasis>other than</emphasis>
|
---|
| 181 | <literal>Software Rasterizer</literal> then you have working
|
---|
| 182 | acceleration for the user who ran the command.
|
---|
[f38727d] | 183 | </para>
|
---|
| 184 |
|
---|
| 185 | <para>
|
---|
[c96921c] | 186 | If your hardware does not have any DRI2 driver available, it will use a
|
---|
[7612749] | 187 | Software Rasterizer for Direct Rendering. In such cases, you can use a
|
---|
| 188 | new, LLVM-accelerated, Software Rasterizer called LLVMPipe. In order to
|
---|
| 189 | build LLVMPipe just make sure that <xref linkend="llvm"/> is present at
|
---|
| 190 | Mesa build time. Note that all decoding is done on the CPU instead of
|
---|
| 191 | the GPU, so the display will run slower than with hardware acceleration.
|
---|
| 192 | To check if you are using LLVMpipe, review the output of the glxinfo
|
---|
| 193 | command above. An example of the output using the Software Rasterizer
|
---|
| 194 | is shown below:
|
---|
[f38727d] | 195 | </para>
|
---|
| 196 |
|
---|
[c8a70a5] | 197 | <screen><computeroutput>OpenGL vendor string: VMware, Inc.
|
---|
| 198 | OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits)
|
---|
[9b175e27] | 199 | OpenGL version string: 3.0 Mesa 10.4.5</computeroutput></screen>
|
---|
[f38727d] | 200 |
|
---|
| 201 | <para>
|
---|
[7612749] | 202 | You can also force LLVMPipe by exporting the
|
---|
| 203 | <envar>LIBGL_ALWAYS_SOFTWARE=1</envar> environment variable when
|
---|
| 204 | starting Xorg.
|
---|
[f38727d] | 205 | </para>
|
---|
| 206 |
|
---|
| 207 | <para>
|
---|
[c96921c] | 208 | Again, if you have built the Mesa OpenGL demos, you can also run the test
|
---|
| 209 | program <command>glxgears</command>. This program brings up a window with
|
---|
| 210 | three gears turning. The X terminal will display how many frames were
|
---|
| 211 | drawn every five seconds, so this will give a rough benchmark. The window
|
---|
| 212 | is scalable, and the frames drawn per second is highly dependent on the
|
---|
| 213 | size of the window. On some hardware, <command>glxgears</command> will
|
---|
| 214 | run synchronized with the vertical refresh signal and the frame rate will
|
---|
| 215 | be approximately the same as the monitor refresh rate.
|
---|
[f38727d] | 216 | </para>
|
---|
[2001b3e] | 217 |
|
---|
[da4b5e0] | 218 | </sect2>
|
---|
[2001b3e] | 219 |
|
---|
[da4b5e0] | 220 | <sect2 role="configuration" id="hybrid-graphics" xreflabel="Hybrid Graphics">
|
---|
[f38727d] | 221 | <title>Hybrid Graphics</title>
|
---|
| 222 |
|
---|
| 223 | <para>
|
---|
[7612749] | 224 | Hybrid Graphics is still in experimental state for Linux. Xorg Developers
|
---|
| 225 | have developed a technology called PRIME that can be used for switching
|
---|
| 226 | between integrated and muxless discrete GPU at will. Automatic switching
|
---|
| 227 | is not possible at the moment.
|
---|
[f38727d] | 228 | </para>
|
---|
| 229 |
|
---|
| 230 | <para>
|
---|
[7612749] | 231 | In order to use PRIME for GPU switching, make sure that you are using
|
---|
| 232 | Linux Kernel 3.4 or later (recommended). You will need latest DRI and
|
---|
| 233 | DDX drivers for your hardware and <application>Xorg Server</application>
|
---|
[6039a39] | 234 | 1.13 or later.
|
---|
[f38727d] | 235 | </para>
|
---|
| 236 |
|
---|
| 237 | <para>
|
---|
[7612749] | 238 | <application>Xorg Server</application> should load both GPU drivers
|
---|
[6039a39] | 239 | automaticaly. You can check that by running:
|
---|
| 240 | </para>
|
---|
| 241 |
|
---|
| 242 | <screen><userinput>xrandr --listproviders</userinput></screen>
|
---|
| 243 |
|
---|
| 244 | <para>
|
---|
| 245 | There should be two (or more) providers listed, for example:
|
---|
| 246 | </para>
|
---|
| 247 |
|
---|
| 248 | <screen><computeroutput>Providers: number : 2
|
---|
| 249 | Provider 0: id: 0x7d cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 4 associated providers: 1 name:Intel
|
---|
| 250 | Provider 1: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 1 associated providers: 1 name:radeon</computeroutput></screen>
|
---|
| 251 |
|
---|
| 252 | <para>
|
---|
| 253 | In order to be able to run a GLX application on a discrete GPU, you will
|
---|
| 254 | need to run the following command, where <provider> is the more
|
---|
| 255 | powerful discrete card, and <sink> is the card which has a display
|
---|
| 256 | connected:
|
---|
| 257 | </para>
|
---|
| 258 |
|
---|
| 259 | <screen><userinput>xrandr --setprovideroffloadsink <replaceable><provider> <sink></replaceable></userinput></screen>
|
---|
| 260 |
|
---|
| 261 | <note>
|
---|
| 262 | <para>
|
---|
| 263 | With newer <application>Xorg</application> drivers, such as modesetting
|
---|
| 264 | or intel, which are DRI3 capable, the above command is no longer
|
---|
| 265 | necessary. It does no harm however.
|
---|
| 266 | </para>
|
---|
| 267 | </note>
|
---|
| 268 |
|
---|
| 269 | <para>
|
---|
| 270 | Then, you will need to export the <envar>DRI_PRIME=1</envar> environment
|
---|
| 271 | variable each time you want the powerful GPU to be used. For example,
|
---|
[0d7900a] | 272 |
|
---|
[f38727d] | 273 | <screen><userinput>DRI_PRIME=1 glxinfo | egrep "(OpenGL vendor|OpenGL renderer|OpenGL version)"</userinput></screen>
|
---|
| 274 |
|
---|
| 275 | will show OpenGL vendor, renderer and version for the discrete GPU.
|
---|
| 276 | </para>
|
---|
| 277 |
|
---|
| 278 | <para>
|
---|
[c96921c] | 279 | If the last command reports same OpenGL renderer with and without
|
---|
| 280 | <envar>DRI_PRIME=1</envar>, you will need to check your installation.
|
---|
[f38727d] | 281 | </para>
|
---|
[2001b3e] | 282 |
|
---|
[da4b5e0] | 283 | </sect2>
|
---|
[2001b3e] | 284 |
|
---|
[d28b5ef] | 285 | <sect2 role="configuration" id='xconfig'>
|
---|
| 286 | <title>Setting up Xorg Devices</title>
|
---|
[c96921c] | 287 |
|
---|
[da4b5e0] | 288 | <para>
|
---|
| 289 | For most hardware configurations, modern Xorg will automatically
|
---|
| 290 | get the server configuration correct without any user intervention. There
|
---|
| 291 | are, however, some cases where auto-configuration will be incorrect.
|
---|
| 292 | Following are some example manual configuration items that may be of use
|
---|
| 293 | in these instances.
|
---|
| 294 | </para>
|
---|
[d28b5ef] | 295 |
|
---|
| 296 | <sect3 id="xinput">
|
---|
[da4b5e0] | 297 | <title>Setting up X Input Devices</title>
|
---|
| 298 | <para>
|
---|
| 299 | For most input devices, no additional configuration will be
|
---|
| 300 | necessary. This section is provided for informational purposes only.
|
---|
| 301 | </para>
|
---|
[0d7900a] | 302 |
|
---|
[da4b5e0] | 303 | <para>
|
---|
| 304 | A sample default XKB setup could look like the following (executed as
|
---|
| 305 | the <systemitem class="username">root</systemitem> user):
|
---|
| 306 | </para>
|
---|
[c96921c] | 307 |
|
---|
[7612749] | 308 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/xkb-defaults.conf << "EOF"
|
---|
[51dfb3e] | 309 | <literal>Section "InputClass"
|
---|
[d28b5ef] | 310 | Identifier "XKB Defaults"
|
---|
| 311 | MatchIsKeyboard "yes"
|
---|
[7612749] | 312 | Option "XkbLayout" "fr"
|
---|
[d28b5ef] | 313 | Option "XkbOptions" "terminate:ctrl_alt_bksp"
|
---|
[51dfb3e] | 314 | EndSection</literal>
|
---|
[d28b5ef] | 315 | EOF</userinput></screen>
|
---|
| 316 |
|
---|
[da4b5e0] | 317 | <para>
|
---|
| 318 | The <quote>XkbLayout</quote> line is an example for a French (AZERTY)
|
---|
| 319 | keyboard. Change it to your keyboard model. That line is not needed for
|
---|
| 320 | a QWERTY (US) keyboard.
|
---|
| 321 | </para>
|
---|
| 322 | </sect3>
|
---|
[d28b5ef] | 323 |
|
---|
[da4b5e0] | 324 | <sect3 id="xdisplay">
|
---|
| 325 | <title>Fine Tuning Display Settings</title>
|
---|
[f3429309] | 326 |
|
---|
[da4b5e0] | 327 | <para>
|
---|
| 328 | Again, with modern Xorg, little or no additional configuration is
|
---|
| 329 | necessary. If you should need extra options passed to your video driver,
|
---|
| 330 | for instance, you could use something like the following (again,
|
---|
| 331 | executed as the <systemitem class="username">root</systemitem> user):
|
---|
| 332 | </para>
|
---|
[d28b5ef] | 333 |
|
---|
[da4b5e0] | 334 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/videocard-0.conf << "EOF"
|
---|
[51dfb3e] | 335 | <literal>Section "Device"
|
---|
[d28b5ef] | 336 | Identifier "Videocard0"
|
---|
| 337 | Driver "radeon"
|
---|
| 338 | VendorName "Videocard vendor"
|
---|
| 339 | BoardName "ATI Radeon 7500"
|
---|
| 340 | Option "NoAccel" "true"
|
---|
[51dfb3e] | 341 | EndSection</literal>
|
---|
[d28b5ef] | 342 | EOF</userinput></screen>
|
---|
| 343 |
|
---|
[da4b5e0] | 344 | <para>
|
---|
| 345 | Another common setup is having multiple server layouts for use in
|
---|
| 346 | different environments. Though the server will automatically detect the
|
---|
| 347 | presence of another monitor, it may get the order incorrect:
|
---|
| 348 | </para>
|
---|
[d28b5ef] | 349 |
|
---|
[da4b5e0] | 350 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/server-layout.conf << "EOF"
|
---|
[51dfb3e] | 351 | <literal>Section "ServerLayout"
|
---|
[d28b5ef] | 352 | Identifier "DefaultLayout"
|
---|
| 353 | Screen 0 "Screen0" 0 0
|
---|
| 354 | Screen 1 "Screen1" LeftOf "Screen0"
|
---|
| 355 | Option "Xinerama"
|
---|
[51dfb3e] | 356 | EndSection</literal>
|
---|
[d28b5ef] | 357 | EOF</userinput></screen>
|
---|
| 358 |
|
---|
[da4b5e0] | 359 | </sect3>
|
---|
[d28b5ef] | 360 | </sect2>
|
---|
| 361 | </sect1>
|
---|