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