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 |
|
---|
7 | <sect1 id="xorg-config">
|
---|
8 | <?dbhtml filename="xorg-config.html"?>
|
---|
9 |
|
---|
10 | <sect1info>
|
---|
11 | <date>$Date$</date>
|
---|
12 | </sect1info>
|
---|
13 |
|
---|
14 | <title>Xorg-&xorg-version; Testing and Configuration</title>
|
---|
15 |
|
---|
16 | <indexterm zone="xorg-config">
|
---|
17 | <primary sortas="g-configuring-xorg">Configuring Xorg</primary>
|
---|
18 | </indexterm>
|
---|
19 |
|
---|
20 | <sect2 id='X11-testing' xreflabel="Testing Xorg">
|
---|
21 | <title>Testing Xorg</title>
|
---|
22 |
|
---|
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 |
|
---|
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
|
---|
35 | and appropriate security issues are properly set.
|
---|
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 |
|
---|
41 | <warning>
|
---|
42 | <para>
|
---|
43 | If Xorg hangs for some reason (for example, lacking a proper
|
---|
44 | input driver), the system may stop responding to any user input.
|
---|
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 |
|
---|
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
|
---|
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
|
---|
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">
|
---|
104 | <title>Checking the Direct Rendering Infrastructure (DRI)
|
---|
105 | Installation</title>
|
---|
106 |
|
---|
107 | <para>
|
---|
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.
|
---|
112 | </para>
|
---|
113 |
|
---|
114 | <para>
|
---|
115 | To check if DRI drivers are installed properly, check the log file
|
---|
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
|
---|
119 | statements such as:
|
---|
120 | </para>
|
---|
121 |
|
---|
122 | <screen><literal>(II) intel(0): direct rendering: DRI2 Enabled</literal></screen>
|
---|
123 |
|
---|
124 | <para>or</para>
|
---|
125 |
|
---|
126 | <screen><literal>(II) NOUVEAU(0): Loaded DRI module</literal></screen>
|
---|
127 |
|
---|
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
|
---|
133 | <ulink url="http://www.amd.com/">AMD</ulink>.
|
---|
134 | </para>
|
---|
135 | </note>
|
---|
136 |
|
---|
137 | <!-- With elogind, this is not needed anymore
|
---|
138 | <para>
|
---|
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>
|
---|
149 | </para>
|
---|
150 |
|
---|
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:
|
---|
155 | </para>
|
---|
156 |
|
---|
157 | <screen role="root" revision="sysv"><userinput>usermod -a -G video <replaceable><username></replaceable></userinput></screen>
|
---|
158 | -->
|
---|
159 | <para>
|
---|
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
|
---|
162 | linkend="mesa"/>. From an X terminal, run <command>glxinfo</command>
|
---|
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
|
---|
172 | <command>LIBGL_DEBUG=verbose glxinfo</command>. This will show the
|
---|
173 | drivers, device nodes and files used by the DRI system.
|
---|
174 | </para>
|
---|
175 |
|
---|
176 | <para>
|
---|
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.
|
---|
183 | </para>
|
---|
184 |
|
---|
185 | <para>
|
---|
186 | If your hardware does not have any DRI2 driver available, it will use a
|
---|
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:
|
---|
195 | </para>
|
---|
196 |
|
---|
197 | <screen><computeroutput>OpenGL vendor string: VMware, Inc.
|
---|
198 | OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.5, 256 bits)
|
---|
199 | OpenGL version string: 3.0 Mesa 10.4.5</computeroutput></screen>
|
---|
200 |
|
---|
201 | <para>
|
---|
202 | You can also force LLVMPipe by exporting the
|
---|
203 | <envar>LIBGL_ALWAYS_SOFTWARE=1</envar> environment variable when
|
---|
204 | starting Xorg.
|
---|
205 | </para>
|
---|
206 |
|
---|
207 | <para>
|
---|
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.
|
---|
216 | </para>
|
---|
217 |
|
---|
218 | </sect2>
|
---|
219 |
|
---|
220 | <sect2 role="configuration" id="hybrid-graphics" xreflabel="Hybrid Graphics">
|
---|
221 | <title>Hybrid Graphics</title>
|
---|
222 |
|
---|
223 | <para>
|
---|
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.
|
---|
228 | </para>
|
---|
229 |
|
---|
230 | <para>
|
---|
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>
|
---|
234 | 1.13 or later.
|
---|
235 | </para>
|
---|
236 |
|
---|
237 | <para>
|
---|
238 | <application>Xorg Server</application> should load both GPU drivers
|
---|
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,
|
---|
272 |
|
---|
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>
|
---|
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.
|
---|
281 | </para>
|
---|
282 |
|
---|
283 | </sect2>
|
---|
284 |
|
---|
285 | <sect2 role="configuration" id='xconfig'>
|
---|
286 | <title>Setting up Xorg Devices</title>
|
---|
287 |
|
---|
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>
|
---|
295 |
|
---|
296 | <sect3 id="xinput">
|
---|
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>
|
---|
302 |
|
---|
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>
|
---|
307 |
|
---|
308 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/xkb-defaults.conf << "EOF"
|
---|
309 | <literal>Section "InputClass"
|
---|
310 | Identifier "XKB Defaults"
|
---|
311 | MatchIsKeyboard "yes"
|
---|
312 | Option "XkbLayout" "fr"
|
---|
313 | Option "XkbOptions" "terminate:ctrl_alt_bksp"
|
---|
314 | EndSection</literal>
|
---|
315 | EOF</userinput></screen>
|
---|
316 |
|
---|
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>
|
---|
323 |
|
---|
324 | <sect3 id="xdisplay">
|
---|
325 | <title>Fine Tuning Display Settings</title>
|
---|
326 |
|
---|
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>
|
---|
333 |
|
---|
334 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/videocard-0.conf << "EOF"
|
---|
335 | <literal>Section "Device"
|
---|
336 | Identifier "Videocard0"
|
---|
337 | Driver "radeon"
|
---|
338 | VendorName "Videocard vendor"
|
---|
339 | BoardName "ATI Radeon 7500"
|
---|
340 | Option "NoAccel" "true"
|
---|
341 | EndSection</literal>
|
---|
342 | EOF</userinput></screen>
|
---|
343 |
|
---|
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>
|
---|
349 |
|
---|
350 | <screen role="root"><userinput>cat > /etc/X11/xorg.conf.d/server-layout.conf << "EOF"
|
---|
351 | <literal>Section "ServerLayout"
|
---|
352 | Identifier "DefaultLayout"
|
---|
353 | Screen 0 "Screen0" 0 0
|
---|
354 | Screen 1 "Screen1" LeftOf "Screen0"
|
---|
355 | Option "Xinerama"
|
---|
356 | EndSection</literal>
|
---|
357 | EOF</userinput></screen>
|
---|
358 |
|
---|
359 | </sect3>
|
---|
360 | </sect2>
|
---|
361 | </sect1>
|
---|